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