File indexing completed on 2026-01-09 09:26:47
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "ActsExamples/DetectorCommons/Detector.hpp"
0010
0011 #include "Acts/Geometry/DetectorElementBase.hpp"
0012 #include "Acts/Geometry/TrackingGeometry.hpp"
0013 #include "Acts/Material/IMaterialDecorator.hpp"
0014 #include "Acts/Utilities/BinningType.hpp"
0015 #include "ActsExamples/DetectorCommons/StructureSelector.hpp"
0016 #include "ActsExamples/Framework/IContextDecorator.hpp"
0017 #include "ActsExamples/GenericDetector/AlignedGenericDetector.hpp"
0018 #include "ActsExamples/GenericDetector/GenericDetector.hpp"
0019 #include "ActsExamples/TelescopeDetector/TelescopeDetector.hpp"
0020 #include "ActsExamples/Utilities/Options.hpp"
0021 #include "ActsPython/Utilities/Helpers.hpp"
0022 #include "ActsPython/Utilities/Macros.hpp"
0023
0024 #include <memory>
0025 #include <optional>
0026 #include <string>
0027 #include <utility>
0028 #include <vector>
0029
0030 #include <pybind11/pybind11.h>
0031 #include <pybind11/stl.h>
0032 #include <pybind11/stl/filesystem.h>
0033
0034 namespace py = pybind11;
0035
0036 using namespace Acts;
0037 using namespace ActsExamples;
0038
0039 namespace ActsPython {
0040
0041 void addDetector(py::module& mex) {
0042 {
0043 py::class_<Detector, std::shared_ptr<Detector>>(mex, "DetectorBase")
0044 .def("nominalGeometryContext", &Detector::nominalGeometryContext)
0045 .def("trackingGeometry", &Detector::trackingGeometry)
0046 .def("contextDecorators", &Detector::contextDecorators)
0047 .def("__enter__",
0048 [](const std::shared_ptr<Detector>& self) { return self; })
0049 .def("__exit__",
0050 [](std::shared_ptr<Detector>& self,
0051 const std::optional<py::object>&,
0052 const std::optional<py::object>&,
0053 const std::optional<py::object>&) { self.reset(); });
0054 }
0055
0056 {
0057 py::class_<StructureSelector, std::shared_ptr<StructureSelector>>(
0058 mex, "StructureSelector")
0059 .def(py::init<std::shared_ptr<const TrackingGeometry>>())
0060 .def("selectSurfaces", &StructureSelector::selectSurfaces)
0061 .def("selectedTransforms", &StructureSelector::selectedTransforms);
0062 }
0063
0064 {
0065 auto d =
0066 py::class_<GenericDetector, Detector, std::shared_ptr<GenericDetector>>(
0067 mex, "GenericDetector")
0068 .def(py::init<const GenericDetector::Config&>());
0069
0070 auto c = py::class_<GenericDetector::Config>(d, "Config").def(py::init<>());
0071 ACTS_PYTHON_STRUCT(c, buildLevel, logLevel, surfaceLogLevel, layerLogLevel,
0072 volumeLogLevel, buildProto, materialDecorator, gen3,
0073 graphvizFile);
0074 }
0075
0076 {
0077 auto ad = py::class_<AlignedGenericDetector, GenericDetector,
0078 std::shared_ptr<AlignedGenericDetector>>(
0079 mex, "AlignedGenericDetector")
0080 .def(py::init<const GenericDetector::Config&>());
0081 }
0082
0083 {
0084 auto d =
0085 py::class_<TelescopeDetector, Detector,
0086 std::shared_ptr<TelescopeDetector>>(mex, "TelescopeDetector")
0087 .def(py::init<const TelescopeDetector::Config&>());
0088
0089 auto c =
0090 py::class_<TelescopeDetector::Config>(d, "Config").def(py::init<>());
0091 ACTS_PYTHON_STRUCT(c, positions, stereos, offsets, bounds, thickness,
0092 surfaceType, binValue, materialDecorator, logLevel);
0093 }
0094 }
0095
0096 }