Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-13 08:18:27

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/Navigation/DetectorNavigator.hpp"
0010 #include "Acts/Propagator/AtlasStepper.hpp"
0011 #include "Acts/Propagator/EigenStepper.hpp"
0012 #include "Acts/Propagator/Navigator.hpp"
0013 #include "Acts/Propagator/StraightLineStepper.hpp"
0014 #include "Acts/Propagator/SympyStepper.hpp"
0015 #include "Acts/Utilities/Logger.hpp"
0016 #include "ActsPython/Utilities/Helpers.hpp"
0017 #include "ActsPython/Utilities/Macros.hpp"
0018 
0019 #include <memory>
0020 
0021 #include <pybind11/pybind11.h>
0022 #include <pybind11/stl.h>
0023 
0024 namespace py = pybind11;
0025 using namespace pybind11::literals;
0026 
0027 using namespace Acts;
0028 
0029 namespace ActsPython {
0030 
0031 /// @brief Bind propagation related functions to the Python module
0032 /// @param m The Python module to which the functions will be bound
0033 void addPropagation(py::module_& m) {
0034   {
0035     using Config = Navigator::Config;
0036     auto nav =
0037         py::class_<Navigator, std::shared_ptr<Navigator>>(m, "Navigator")
0038             .def(py::init<>([](Config cfg,
0039                                Logging::Level level = Logging::INFO) {
0040                    return Navigator{cfg, getDefaultLogger("Navigator", level)};
0041                  }),
0042                  py::arg("cfg"), py::arg("level") = Logging::INFO);
0043 
0044     auto c = py::class_<Config>(nav, "Config").def(py::init<>());
0045 
0046     ACTS_PYTHON_STRUCT(c, resolveMaterial, resolvePassive, resolveSensitive,
0047                        trackingGeometry);
0048   }
0049 
0050   {
0051     using Config = Experimental::DetectorNavigator::Config;
0052     auto nav =
0053         py::class_<Experimental::DetectorNavigator,
0054                    std::shared_ptr<Experimental::DetectorNavigator>>(
0055             m, "DetectorNavigator")
0056             .def(py::init<>(
0057                      [](Config cfg, Logging::Level level = Logging::INFO) {
0058                        return Experimental::DetectorNavigator{
0059                            cfg, getDefaultLogger("DetectorNavigator", level)};
0060                      }),
0061                  py::arg("cfg"), py::arg("level") = Logging::INFO);
0062 
0063     auto c = py::class_<Config>(nav, "Config").def(py::init<>());
0064 
0065     ACTS_PYTHON_STRUCT(c, resolveMaterial, resolvePassive, resolveSensitive,
0066                        detector);
0067   }
0068   {
0069     auto stepper = py::class_<AtlasStepper>(m, "AtlasStepper");
0070     stepper.def(py::init<std::shared_ptr<const MagneticFieldProvider>>());
0071   }
0072   {
0073     auto stepper = py::class_<EigenStepper<>>(m, "EigenStepper");
0074     stepper.def(py::init<std::shared_ptr<const MagneticFieldProvider>>());
0075   }
0076   {
0077     auto stepper = py::class_<StraightLineStepper>(m, "StraightLineStepper");
0078     stepper.def(py::init<>());
0079   }
0080   {
0081     auto stepper = py::class_<SympyStepper>(m, "SympyStepper");
0082     stepper.def(py::init<std::shared_ptr<const MagneticFieldProvider>>());
0083   }
0084 }
0085 
0086 }  // namespace ActsPython