forked from acts-project/acts
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathGeant4.cpp
More file actions
52 lines (43 loc) · 1.88 KB
/
Geant4.cpp
File metadata and controls
52 lines (43 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// This file is part of the ACTS project.
//
// Copyright (C) 2016 CERN for the benefit of the ACTS project
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
#include "ActsPlugins/Geant4/Geant4DetectorElement.hpp"
#include "ActsPlugins/Geant4/Geant4DetectorSurfaceFactory.hpp"
#include "ActsPlugins/Geant4/Geant4PhysicalVolumeSelectors.hpp"
#include "ActsPython/Utilities/Helpers.hpp"
#include "ActsPython/Utilities/Macros.hpp"
#include <memory>
#include <string>
#include <pybind11/pybind11.h>
namespace py = pybind11;
using namespace pybind11::literals;
PYBIND11_MODULE(ActsPluginsPythonBindingsGeant4, geant4) {
using namespace Acts;
using namespace ActsPlugins;
// Detector Element
py::class_<Geant4DetectorElement, std::shared_ptr<Geant4DetectorElement>,
SurfacePlacementBase>(geant4, "Geant4DetectorElement")
.def("surface", [](const Geant4DetectorElement& self) {
return self.surface().getSharedPtr();
});
// Surface creation
{
using ISelector = IGeant4PhysicalVolumeSelector;
auto is = py::class_<ISelector, std::shared_ptr<ISelector>>(
geant4, "IVolumeSelector");
using NameSelector = Geant4PhysicalVolumeSelectors::NameSelector;
auto ns = py::class_<NameSelector, std::shared_ptr<NameSelector>>(
geant4, "VolumeNameSelector", is)
.def(py::init<const std::vector<std::string>&, bool>());
using Factory = Geant4DetectorSurfaceFactory;
auto o = py::class_<Factory::Options>(geant4, "SurfaceFactoryOptions")
.def(py::init<>());
ACTS_PYTHON_STRUCT(o, scaleConversion, convertMaterial,
convertedMaterialThickness, sensitiveSurfaceSelector,
passiveSurfaceSelector);
}
}