Warning, file /acts/Python/Plugins/src/GeoModel.cpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #include <GeoModelRead/ReadGeoModel.h>
0014
0015
0016 #include "Acts/Geometry/ITrackingGeometryBuilder.hpp"
0017 #include "Acts/Surfaces/AnnulusBounds.hpp"
0018 #include "Acts/Surfaces/DiscSurface.hpp"
0019 #include "Acts/Surfaces/PlaneSurface.hpp"
0020 #include "Acts/Surfaces/RectangleBounds.hpp"
0021 #include "ActsPlugins/GeoModel/GeoModelConverters.hpp"
0022 #include "ActsPlugins/GeoModel/GeoModelDetectorElement.hpp"
0023 #include "ActsPlugins/GeoModel/GeoModelDetectorElementITk.hpp"
0024 #include "ActsPlugins/GeoModel/GeoModelDetectorObjectFactory.hpp"
0025 #include "ActsPlugins/GeoModel/GeoModelReader.hpp"
0026 #include "ActsPlugins/GeoModel/GeoModelTree.hpp"
0027 #include "ActsPlugins/GeoModel/IGeoShapeConverter.hpp"
0028 #include "ActsPython/Utilities/Helpers.hpp"
0029 #include "ActsPython/Utilities/Macros.hpp"
0030
0031 #include <string>
0032
0033 #include <GeoModelKernel/GeoFullPhysVol.h>
0034 #include <GeoModelKernel/GeoVPhysVol.h>
0035 #include <pybind11/pybind11.h>
0036 #include <pybind11/stl.h>
0037
0038 namespace py = pybind11;
0039 using namespace pybind11::literals;
0040
0041 PYBIND11_MODULE(ActsPluginsPythonBindingsGeoModel, gm) {
0042 using namespace Acts;
0043 using namespace ActsPython;
0044 using namespace ActsPlugins;
0045
0046
0047 {
0048 py::class_<GeoModelTree::FpvConstLink>(gm, "GeoModelTree::FpvConstLink")
0049 .def(py::init<>())
0050 .def("get", &GeoModelTree::FpvConstLink::get,
0051 py::return_value_policy::reference);
0052
0053 py::class_<GeoModelTree>(gm, "GeoModelTree").def(py::init<>());
0054
0055 gm.def("readFromDb", &GeoModelReader::readFromDb);
0056
0057 py::class_<GeoModelDetectorElement,
0058 std::shared_ptr<GeoModelDetectorElement>>(
0059 gm, "GeoModelDetectorElement")
0060 .def("logVolName", &GeoModelDetectorElement::logVolName)
0061 .def("databaseEntryName", &GeoModelDetectorElement::databaseEntryName)
0062 .def("surface", [](GeoModelDetectorElement self) {
0063 return self.surface().getSharedPtr();
0064 });
0065
0066 py::class_<GeoModelDetectorElementITk,
0067 std::shared_ptr<GeoModelDetectorElementITk>>(
0068 gm, "GeoModelDetectorElementITk")
0069 .def("surface", [](GeoModelDetectorElementITk& self) {
0070 return self.surface().getSharedPtr();
0071 });
0072 gm.def("convertToItk", &GeoModelDetectorElementITk::convertFromGeomodel);
0073 }
0074
0075
0076 {
0077 py::class_<IGeoShapeConverter, std::shared_ptr<IGeoShapeConverter>>(
0078 gm, "IGeoShapeConverter");
0079
0080 py::class_<GeoBoxConverter, IGeoShapeConverter,
0081 std::shared_ptr<GeoBoxConverter>>(gm, "GeoBoxConverter")
0082 .def(py::init<>())
0083 .def("toSensitiveSurface", &GeoBoxConverter::toSensitiveSurface)
0084 .def("toPassiveSurface", &GeoBoxConverter::toPassiveSurface);
0085
0086 py::class_<GeoTrdConverter, IGeoShapeConverter,
0087 std::shared_ptr<GeoTrdConverter>>(gm, "GeoTrdConverter")
0088 .def(py::init<>())
0089 .def("toSensitiveSurface", &GeoTrdConverter::toSensitiveSurface)
0090 .def("toPassiveSurface", &GeoTrdConverter::toPassiveSurface);
0091
0092 py::class_<GeoTubeConverter, IGeoShapeConverter,
0093 std::shared_ptr<GeoTubeConverter>>(gm, "GeoTubeConverter")
0094 .def(py::init<>())
0095 .def("toSensitiveSurface", &GeoTubeConverter::toSensitiveSurface)
0096 .def("toPassiveSurface", &GeoTubeConverter::toPassiveSurface);
0097
0098 py::class_<GeoUnionDoubleTrdConverter, IGeoShapeConverter,
0099 std::shared_ptr<GeoUnionDoubleTrdConverter>>(
0100 gm, "GeoUnionDoubleTrdConverter")
0101 .def(py::init<>())
0102 .def("toSensitiveSurface",
0103 &GeoUnionDoubleTrdConverter::toSensitiveSurface)
0104 .def("toPassiveSurface", &GeoUnionDoubleTrdConverter::toPassiveSurface);
0105
0106 py::class_<GeoIntersectionAnnulusConverter, IGeoShapeConverter,
0107 std::shared_ptr<GeoIntersectionAnnulusConverter>>(
0108 gm, "GeoIntersectionAnnulusConverter")
0109 .def(py::init<>())
0110 .def("toSensitiveSurface",
0111 &GeoIntersectionAnnulusConverter::toSensitiveSurface)
0112 .def("toPassiveSurface",
0113 &GeoIntersectionAnnulusConverter::toPassiveSurface);
0114
0115 py::class_<GeoShiftConverter, IGeoShapeConverter,
0116 std::shared_ptr<GeoShiftConverter>>(gm, "GeoShiftConverter")
0117 .def(py::init<>())
0118 .def("toSensitiveSurface", &GeoShiftConverter::toSensitiveSurface)
0119 .def("toPassiveSurface", &GeoShiftConverter::toPassiveSurface);
0120 }
0121
0122
0123 {
0124 auto a =
0125 py::class_<GeoModelDetectorObjectFactory,
0126 std::shared_ptr<GeoModelDetectorObjectFactory>>(
0127 gm, "GeoModelDetectorObjectFactory")
0128 .def(py::init([](const GeoModelDetectorObjectFactory::Config& cfg,
0129 Logging::Level level) {
0130 return std::make_shared<GeoModelDetectorObjectFactory>(
0131 cfg,
0132 getDefaultLogger("GeoModelDetectorObjectFactory", level));
0133 }))
0134 .def("construct", &GeoModelDetectorObjectFactory::construct);
0135
0136 py::class_<GeoModelDetectorObjectFactory::Config>(a, "Config")
0137 .def(py::init<>())
0138 .def_readwrite(
0139 "convertSubVolumes",
0140 &GeoModelDetectorObjectFactory::Config::convertSubVolumes)
0141 .def_readwrite("nameList",
0142 &GeoModelDetectorObjectFactory::Config::nameList)
0143 .def_readwrite("convertBox",
0144 &GeoModelDetectorObjectFactory::Config::convertBox)
0145 .def_readwrite("materialList",
0146 &GeoModelDetectorObjectFactory::Config::materialList);
0147
0148 auto convVol = py::class_<GeoModelDetectorObjectFactory::ConvertedGeoVol>(
0149 a, "ConvertedGeoVol");
0150
0151 ACTS_PYTHON_STRUCT(convVol, volume, fullPhysVol, name, surfaces);
0152 py::class_<GeoModelDetectorObjectFactory::Cache>(a, "Cache")
0153 .def(py::init<>())
0154 .def_readwrite("sensitiveSurfaces",
0155 &GeoModelDetectorObjectFactory::Cache::sensitiveSurfaces)
0156 .def_readwrite("boundingBoxes",
0157 &GeoModelDetectorObjectFactory::Cache::volumeBoxFPVs);
0158
0159 py::class_<GeoModelDetectorObjectFactory::Options>(a, "Options")
0160 .def(py::init<>())
0161 .def_readwrite("queries",
0162 &GeoModelDetectorObjectFactory::Options::queries);
0163 }
0164 }