File indexing completed on 2025-07-11 07:50:44
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([](const Acts::LayerCreator::Config &cfg,
0040 Acts::Logging::Level level) {
0041 return Acts::LayerCreator(
0042 cfg, Acts::getDefaultLogger("LayerCreator", level));
0043 }))
0044 .def(
0045 "cylinderLayer",
0046 [](const Acts::LayerCreator &self, const GeometryContext &gctx,
0047 SurfacePtrVector surfaces, std::size_t binsPhi,
0048 std::size_t binsZ) {
0049 return self.cylinderLayer(gctx, std::move(surfaces), binsPhi,
0050 binsZ);
0051 },
0052 "gctx"_a, "surfaces"_a, "binsPhi"_a, "binsZ"_a)
0053 .def(
0054 "discLayer",
0055 [](const Acts::LayerCreator &self, const GeometryContext &gctx,
0056 SurfacePtrVector surfaces, std::size_t binsR,
0057 std::size_t binsPhi) {
0058 return self.discLayer(gctx, std::move(surfaces), binsR,
0059 binsPhi);
0060 },
0061 "gctx"_a, "surfaces"_a, "binsR"_a, "binsPhi"_a);
0062
0063 auto config =
0064 py::class_<LayerCreator::Config>(creator, "Config").def(py::init<>());
0065
0066 ACTS_PYTHON_STRUCT(config, surfaceArrayCreator, cylinderZtolerance,
0067 cylinderPhiTolerance, defaultEnvelopeR,
0068 defaultEnvelopeZ);
0069 }
0070
0071 {
0072 using Creator = Acts::SurfaceArrayCreator;
0073 using Config = typename Creator::Config;
0074
0075 auto creator =
0076 py::class_<Creator, std::shared_ptr<Creator>>(m, "SurfaceArrayCreator")
0077 .def(py::init<Config>());
0078
0079 py::class_<Config>(creator, "Config").def(py::init<>());
0080 }
0081
0082 {
0083 using Base = Acts::ILayerArrayCreator;
0084 using Creator = Acts::LayerArrayCreator;
0085 using Config = typename Creator::Config;
0086
0087 py::class_<Base, std::shared_ptr<Base>>(m, "ILayerArrayCreator");
0088
0089 auto creator = py::class_<Creator, std::shared_ptr<Creator>, Base>(
0090 m, "LayerArrayCreator")
0091 .def(py::init<Config>());
0092
0093 py::class_<Config>(creator, "Config").def(py::init<>());
0094 }
0095
0096 {
0097 using Base = Acts::ITrackingVolumeArrayCreator;
0098 using Creator = Acts::TrackingVolumeArrayCreator;
0099 using Config = typename Creator::Config;
0100
0101 py::class_<Base, std::shared_ptr<Base>>(m, "ITrackingVolumeArrayCreator");
0102
0103 auto creator = py::class_<Creator, std::shared_ptr<Creator>, Base>(
0104 m, "TrackingVolumeArrayCreator")
0105 .def(py::init<Config>());
0106
0107 py::class_<Config>(creator, "Config").def(py::init<>());
0108 }
0109
0110 {
0111 auto helper =
0112 py::class_<Acts::CylinderVolumeHelper>(m, "CylinderVolumeHelper")
0113 .def(py::init([](const Acts::CylinderVolumeHelper::Config &cfg,
0114 Acts::Logging::Level level) {
0115 return Acts::CylinderVolumeHelper(
0116 cfg, Acts::getDefaultLogger("CylinderVolumeHelper", level));
0117 }))
0118 .def("createTrackingVolume",
0119 [](const Acts::CylinderVolumeHelper &self,
0120 GeometryContext gctx, const LayerVector &layers,
0121 std::shared_ptr<VolumeBounds> volumeBounds,
0122 const Transform3 &trafo, const std::string &name) {
0123 return self.createTrackingVolume(gctx, layers, {},
0124 std::move(volumeBounds), {},
0125 trafo, name);
0126 })
0127 .def("createContainerTrackingVolume",
0128 &Acts::CylinderVolumeHelper::createContainerTrackingVolume);
0129
0130 auto config = py::class_<CylinderVolumeHelper::Config>(helper, "Config")
0131 .def(py::init<>());
0132
0133 ACTS_PYTHON_STRUCT(config, layerArrayCreator, trackingVolumeArrayCreator,
0134 passiveLayerThickness, passiveLayerPhiBins,
0135 passiveLayerRzBins);
0136 }
0137 }
0138
0139 }