File indexing completed on 2025-10-29 07:54:48
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "Acts/Definitions/Direction.hpp"
0010 #include "Acts/EventData/TrackParameters.hpp"
0011 #include "Acts/Navigation/DetectorNavigator.hpp"
0012 #include "Acts/Propagator/AtlasStepper.hpp"
0013 #include "Acts/Propagator/EigenStepper.hpp"
0014 #include "Acts/Propagator/Navigator.hpp"
0015 #include "Acts/Propagator/Propagator.hpp"
0016 #include "Acts/Propagator/StraightLineStepper.hpp"
0017 #include "Acts/Propagator/SympyStepper.hpp"
0018 #include "Acts/Utilities/Logger.hpp"
0019 #include "ActsExamples/Propagation/PropagationAlgorithm.hpp"
0020 #include "ActsExamples/Propagation/PropagatorInterface.hpp"
0021 #include "ActsPython/Utilities/Helpers.hpp"
0022 #include "ActsPython/Utilities/Macros.hpp"
0023
0024 #include <algorithm>
0025 #include <array>
0026 #include <map>
0027 #include <memory>
0028 #include <optional>
0029 #include <string>
0030 #include <tuple>
0031 #include <utility>
0032 #include <vector>
0033
0034 #include <pybind11/pybind11.h>
0035 #include <pybind11/stl.h>
0036
0037 namespace Acts {
0038 class MagneticFieldProvider;
0039 }
0040
0041 namespace py = pybind11;
0042 using namespace Acts;
0043 using namespace ActsExamples;
0044
0045 namespace {
0046
0047 template <typename stepper_t, typename navigator_t>
0048 void addPropagator(py::module_& m, const std::string& prefix) {
0049 using propagator_t = Propagator<stepper_t, navigator_t>;
0050 py::class_<propagator_t>(m, (prefix + "Propagator").c_str())
0051 .def(py::init<>([=](stepper_t stepper, navigator_t navigator,
0052 Logging::Level level = Logging::Level::INFO) {
0053 return propagator_t{
0054 std::move(stepper), std::move(navigator),
0055 getDefaultLogger(prefix + "Propagator", level)};
0056 }),
0057 py::arg("stepper"), py::arg("navigator"),
0058 py::arg("level") = Logging::INFO);
0059
0060 using prop_if_t = ConcretePropagator<propagator_t>;
0061 py::class_<prop_if_t, PropagatorInterface, std::shared_ptr<prop_if_t>>(
0062 m, (prefix + "ConcretePropagator").c_str())
0063 .def(py::init<propagator_t>());
0064 }
0065
0066 }
0067
0068 namespace ActsPython {
0069 void addPropagation(Context& ctx) {
0070 auto [prop, mex] = ctx.get("propagation", "examples");
0071
0072 ACTS_PYTHON_DECLARE_ALGORITHM(
0073 PropagationAlgorithm, mex, "PropagationAlgorithm", propagatorImpl,
0074 sterileLogger, debugOutput, energyLoss, multipleScattering,
0075 recordMaterialInteractions, ptLoopers, maxStepSize, covarianceTransport,
0076 inputTrackParameters, outputSummaryCollection, outputMaterialCollection);
0077
0078 py::class_<PropagatorInterface, std::shared_ptr<PropagatorInterface>>(
0079 mex, "PropagatorInterface");
0080
0081
0082 {
0083 addPropagator<EigenStepper<>, Navigator>(prop, "Eigen");
0084 addPropagator<EigenStepper<>, Experimental::DetectorNavigator>(
0085 prop, "EigenDetector");
0086 }
0087
0088
0089 {
0090 addPropagator<AtlasStepper, Navigator>(prop, "Atlas");
0091 addPropagator<AtlasStepper, Experimental::DetectorNavigator>(
0092 prop, "AtlasDetector");
0093 }
0094
0095
0096 {
0097 addPropagator<SympyStepper, Navigator>(prop, "Sympy");
0098 addPropagator<SympyStepper, Experimental::DetectorNavigator>(
0099 prop, "SympyDetector");
0100 }
0101
0102
0103 {
0104 addPropagator<StraightLineStepper, Navigator>(prop, "StraightLine");
0105 addPropagator<StraightLineStepper, Experimental::DetectorNavigator>(
0106 prop, "StraightLineDetector");
0107 }
0108 }
0109
0110 }