File indexing completed on 2025-01-18 09:12:03
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "Acts/Geometry/CylinderVolumeHelper.hpp"
0010 #include "Acts/Geometry/Layer.hpp"
0011 #include "Acts/Geometry/LayerArrayCreator.hpp"
0012 #include "Acts/Geometry/LayerCreator.hpp"
0013 #include "Acts/Geometry/SurfaceArrayCreator.hpp"
0014 #include "Acts/Geometry/TrackingVolume.hpp"
0015 #include "Acts/Geometry/TrackingVolumeArrayCreator.hpp"
0016 #include "Acts/Geometry/VolumeBounds.hpp"
0017 #include "Acts/Plugins/Python/Utilities.hpp"
0018
0019 #include <memory>
0020 #include <vector>
0021
0022 #include <pybind11/pybind11.h>
0023 #include <pybind11/stl.h>
0024
0025 namespace py = pybind11;
0026 using namespace pybind11::literals;
0027
0028 namespace Acts::Python {
0029 void addGeometryBuildingGen1(Context &ctx) {
0030 auto m = ctx.get("main");
0031
0032 using SurfacePtrVector = std::vector<std::shared_ptr<const Surface>>;
0033
0034 py::class_<Acts::Layer, std::shared_ptr<Acts::Layer>>(m, "Layer");
0035
0036 {
0037 auto creator =
0038 py::class_<Acts::LayerCreator>(m, "LayerCreator")
0039 .def(py::init<Acts::LayerCreator::Config>())
0040 .def("cylinderLayer",
0041 [](const Acts::LayerCreator &self, const GeometryContext &gctx,
0042 SurfacePtrVector surfaces, std::size_t binsPhi,
0043 std::size_t binsZ) {
0044 return self.cylinderLayer(gctx, std::move(surfaces), binsPhi,
0045 binsZ);
0046 })
0047 .def("discLayer", [](const Acts::LayerCreator &self,
0048 const GeometryContext &gctx,
0049 SurfacePtrVector surfaces, std::size_t binsR,
0050 std::size_t binsPhi) {
0051 return self.discLayer(gctx, std::move(surfaces), binsR, binsPhi);
0052 });
0053
0054 auto config =
0055 py::class_<LayerCreator::Config>(creator, "Config").def(py::init<>());
0056
0057 ACTS_PYTHON_STRUCT_BEGIN(config, LayerCreator::Config);
0058 ACTS_PYTHON_MEMBER(surfaceArrayCreator);
0059 ACTS_PYTHON_MEMBER(cylinderZtolerance);
0060 ACTS_PYTHON_MEMBER(cylinderPhiTolerance);
0061 ACTS_PYTHON_STRUCT_END();
0062 }
0063
0064 {
0065 using Creator = Acts::SurfaceArrayCreator;
0066 using Config = typename Creator::Config;
0067
0068 auto creator =
0069 py::class_<Creator, std::shared_ptr<Creator>>(m, "SurfaceArrayCreator")
0070 .def(py::init<Config>());
0071
0072 py::class_<Config>(creator, "Config").def(py::init<>());
0073 }
0074
0075 {
0076 using Base = Acts::ILayerArrayCreator;
0077 using Creator = Acts::LayerArrayCreator;
0078 using Config = typename Creator::Config;
0079
0080 py::class_<Base, std::shared_ptr<Base>>(m, "ILayerArrayCreator");
0081
0082 auto creator = py::class_<Creator, std::shared_ptr<Creator>, Base>(
0083 m, "LayerArrayCreator")
0084 .def(py::init<Config>());
0085
0086 py::class_<Config>(creator, "Config").def(py::init<>());
0087 }
0088
0089 {
0090 using Base = Acts::ITrackingVolumeArrayCreator;
0091 using Creator = Acts::TrackingVolumeArrayCreator;
0092 using Config = typename Creator::Config;
0093
0094 py::class_<Base, std::shared_ptr<Base>>(m, "ITrackingVolumeArrayCreator");
0095
0096 auto creator = py::class_<Creator, std::shared_ptr<Creator>, Base>(
0097 m, "TrackingVolumeArrayCreator")
0098 .def(py::init<Config>());
0099
0100 py::class_<Config>(creator, "Config").def(py::init<>());
0101 }
0102
0103 {
0104 auto helper =
0105 py::class_<Acts::CylinderVolumeHelper>(m, "CylinderVolumeHelper")
0106 .def(py::init([](const Acts::CylinderVolumeHelper::Config &cfg,
0107 Acts::Logging::Level level) {
0108 return Acts::CylinderVolumeHelper(
0109 cfg, Acts::getDefaultLogger("CylinderVolumeHelper", level));
0110 }))
0111 .def("createTrackingVolume",
0112 [](const Acts::CylinderVolumeHelper &self,
0113 GeometryContext gctx, const LayerVector &layers,
0114 std::shared_ptr<VolumeBounds> volumeBounds,
0115 const Transform3 &trafo, const std::string &name) {
0116 return self.createTrackingVolume(gctx, layers, {},
0117 std::move(volumeBounds), {},
0118 trafo, name);
0119 })
0120 .def("createContainerTrackingVolume",
0121 &Acts::CylinderVolumeHelper::createContainerTrackingVolume);
0122
0123 auto config = py::class_<CylinderVolumeHelper::Config>(helper, "Config")
0124 .def(py::init<>());
0125
0126 ACTS_PYTHON_STRUCT_BEGIN(config, CylinderVolumeHelper::Config);
0127 ACTS_PYTHON_MEMBER(layerArrayCreator);
0128 ACTS_PYTHON_MEMBER(trackingVolumeArrayCreator);
0129 ACTS_PYTHON_MEMBER(passiveLayerThickness);
0130 ACTS_PYTHON_MEMBER(passiveLayerPhiBins);
0131 ACTS_PYTHON_MEMBER(passiveLayerRzBins);
0132 ACTS_PYTHON_STRUCT_END();
0133 }
0134 }
0135
0136 }