Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /acts/Python/Examples/src/DD4hep.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #include "Acts/Utilities/Logger.hpp"
0010 #include "ActsExamples/DD4hepDetector/AlignedDD4hepDetectorElement.hpp"
0011 #include "ActsExamples/DD4hepDetector/DD4hepDetector.hpp"
0012 #include "ActsExamples/DD4hepDetector/OpenDataDetector.hpp"
0013 #include "ActsPlugins/DD4hep/DD4hepDetectorElement.hpp"
0014 #include "ActsPython/Utilities/Helpers.hpp"
0015 #include "ActsPython/Utilities/Macros.hpp"
0016 
0017 #include <memory>
0018 #include <utility>
0019 
0020 #include <pybind11/functional.h>
0021 #include <pybind11/pybind11.h>
0022 #include <pybind11/stl.h>
0023 
0024 namespace py = pybind11;
0025 using namespace Acts;
0026 using namespace ActsPlugins;
0027 using namespace pybind11::literals;
0028 using namespace ActsExamples;
0029 using namespace ActsPython;
0030 
0031 PYBIND11_MODULE(ActsExamplesPythonBindingsDD4hep, m) {
0032   {
0033     py::class_<AlignedDD4hepDetectorElement, DD4hepDetectorElement,
0034                std::shared_ptr<AlignedDD4hepDetectorElement>>(
0035         m, "AlignedDD4hepDetectorElement");
0036   }
0037 
0038   {
0039     auto base =
0040         py::class_<DD4hepDetectorBase, Detector,
0041                    std::shared_ptr<DD4hepDetectorBase>>(m, "DD4hepDetectorBase")
0042             .def_property_readonly("field", &DD4hepDetectorBase::field);
0043     auto c = py::class_<DD4hepDetectorBase::Config>(base, "Config")
0044                  .def(py::init<>());
0045     ACTS_PYTHON_STRUCT(c, logLevel, dd4hepLogLevel, xmlFileNames, name);
0046     patchKwargsConstructor(c);
0047   }
0048 
0049   {
0050     auto f = py::class_<DD4hepDetector, DD4hepDetectorBase,
0051                         std::shared_ptr<DD4hepDetector>>(m, "DD4hepDetector")
0052                  .def(py::init<const DD4hepDetector::Config&>());
0053 
0054     auto c = py::class_<DD4hepDetector::Config, DD4hepDetectorBase::Config>(
0055                  f, "Config")
0056                  .def(py::init<>());
0057     ACTS_PYTHON_STRUCT(c, bTypePhi, bTypeR, bTypeZ, envelopeR, envelopeZ,
0058                        defaultLayerThickness, materialDecorator,
0059                        geometryIdentifierHook, detectorElementFactory);
0060     patchKwargsConstructor(c);
0061 
0062     m.def("alignedDD4hepDetectorElementFactory",
0063           &alignedDD4hepDetectorElementFactory);
0064   }
0065 
0066   {
0067     auto odd =
0068         py::class_<OpenDataDetector, DD4hepDetectorBase,
0069                    std::shared_ptr<OpenDataDetector>>(m, "OpenDataDetector")
0070             .def(py::init<const OpenDataDetector::Config&,
0071                           const Acts::GeometryContext&>(),
0072                  "config"_a, "gctx"_a);
0073 
0074     auto c = py::class_<OpenDataDetector::Config, DD4hepDetectorBase::Config>(
0075                  odd, "Config")
0076                  .def(py::init<>());
0077     // ACTS_PYTHON_STRUCT(c, );
0078 
0079     patchKwargsConstructor(c);
0080   }
0081 }