File indexing completed on 2025-01-18 09:12:04
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "Acts/Plugins/Detray/DetrayConversionUtils.hpp"
0010 #include "Acts/Plugins/Detray/DetrayConverter.hpp"
0011 #include "Acts/Plugins/Python/Utilities.hpp"
0012 #include "ActsExamples/Propagation/PropagatorInterface.hpp"
0013 #include "ActsExamples/Traccc/DetrayPropagator.hpp"
0014 #include "ActsExamples/Traccc/DetrayStore.hpp"
0015
0016 #include <detray/propagator/line_stepper.hpp>
0017 #include <pybind11/pybind11.h>
0018 #include <vecmem/memory/host_memory_resource.hpp>
0019 #include <vecmem/memory/memory_resource.hpp>
0020
0021 namespace py = pybind11;
0022 using namespace pybind11::literals;
0023
0024 using namespace Acts;
0025 using namespace ActsExamples;
0026
0027 namespace Acts::Python {
0028
0029 void addTraccc(Context& ctx) {
0030 auto [m, mex] = ctx.get("main", "examples");
0031
0032 auto traccc = mex.def_submodule("traccc");
0033
0034
0035 {
0036 py::class_<DetrayHostStore, std::shared_ptr<DetrayHostStore>>(
0037 traccc, "DetrayHostStore");
0038
0039
0040
0041
0042
0043
0044 traccc.def("convertDetectorHost", [](const GeometryContext& gctx,
0045 const Experimental::Detector& detector,
0046 DetrayConverter::Options options) {
0047 return DetrayHostStore::create(gctx, detector, options);
0048 });
0049 }
0050
0051
0052 {
0053 traccc.def(
0054 "createSlPropagatorHost",
0055 [](std::shared_ptr<const DetrayHostStore> detrayStore,
0056 bool sterile = false) {
0057 std::shared_ptr<PropagatorInterface> detrayProagator = nullptr;
0058
0059 using DetrayLineStepper =
0060 detray::line_stepper<typename DetrayHostDetector::algebra_type>;
0061
0062 using DetrayPropagator =
0063 DetrayPropagator<DetrayLineStepper, DetrayHostStore>;
0064
0065 DetrayPropagator::Config cfg{detrayStore, sterile};
0066 detrayProagator = std::make_shared<DetrayPropagator>(cfg);
0067 return detrayProagator;
0068 });
0069 }
0070 }
0071 }