8 #include "GaudiKernel/IInterface.h"
17 #include "Acts/Propagator/Navigator.hpp"
18 #include "Acts/Propagator/EigenStepper.hpp"
19 #include "Acts/Propagator/Propagator.hpp"
20 #include "Acts/Propagator/ActorList.hpp"
21 #include <Acts/Propagator/StraightLineStepper.hpp>
22 #include "Acts/Propagator/EigenStepperDefaultExtension.hpp"
24 #include "Acts/Utilities/Logger.hpp"
27 #include <boost/variant/variant.hpp>
28 #include <boost/variant/apply_visitor.hpp>
29 #include <boost/variant/static_visitor.hpp>
39 Acts::Propagator<Acts::EigenStepper<Acts::EigenStepperDefaultExtension>,
Acts::Navigator>>;
67 using namespace std::literals::string_literals;
75 std::shared_ptr<const Acts::TrackingGeometry> trackingGeometry
78 Acts::Navigator navigator( Acts::Navigator::Config{ trackingGeometry } );
82 using Stepper = Acts::EigenStepper<Acts::EigenStepperDefaultExtension>;
85 auto bField = std::make_shared<ATLASMagneticFieldWrapper>();
87 auto stepper =
Stepper(std::move(bField));
88 auto propagator = Acts::Propagator<Stepper, Acts::Navigator>(std::move(stepper),
90 logger().cloneWithSuffix(
"Prop"));
91 m_varProp = std::make_unique<VariantPropagator>(propagator);
96 ATH_MSG_ERROR(
"Incorrect field vector size. Using empty field.");
97 return StatusCode::FAILURE;
108 using Stepper = Acts::EigenStepper<Acts::EigenStepperDefaultExtension>;
110 auto bField = std::make_shared<Acts::ConstantBField>(constantFieldVector);
111 auto stepper =
Stepper(std::move(bField));
112 auto propagator = Acts::Propagator<Stepper, Acts::Navigator>(std::move(stepper),
113 std::move(navigator));
114 m_varProp = std::make_unique<VariantPropagator>(propagator);
117 ATH_MSG_INFO(
"ACTS extrapolation successfully initialized");
118 return StatusCode::SUCCESS;
124 const Acts::BoundTrackParameters& startParameters,
125 Acts::Direction navDir ,
126 double pathLimit )
const
134 auto anygctx = geo_ctx.
context();
138 auto res = boost::apply_visitor([&](
const auto& propagator) ->
ResultType {
139 using Propagator = std::decay_t<decltype(propagator)>;
143 Acts::ActorList<SteppingLogger, Acts::MaterialInteractor, EndOfWorld>;
146 Options options = prepareOptions<Options>(anygctx, mctx, startParameters, navDir, pathLimit);
148 auto result = propagator.propagate(startParameters,
options);
154 auto steppingResults = propRes.template get<SteppingLogger::result_type>();
155 auto materialResult = propRes.template get<Acts::MaterialInteractor::result_type>();
156 output.first = std::move(steppingResults.steps);
157 output.second = std::move(materialResult);
164 <<
res.error() <<
" " <<
res.error().message()
165 <<
". Returning empty step vector.");
171 if(
output.first.size() == 0) {
172 ATH_MSG_WARNING(
"ZERO steps returned by stepper, that is not typically a good sign");
182 std::optional<const Acts::CurvilinearTrackParameters>
184 const Acts::BoundTrackParameters& startParameters,
185 Acts::Direction navDir ,
186 double pathLimit )
const
193 auto anygctx = geo_ctx.
context();
195 auto parameters = boost::apply_visitor([&](
const auto& propagator) -> std::optional<const Acts::CurvilinearTrackParameters> {
196 using Propagator = std::decay_t<decltype(propagator)>;
200 Acts::ActorList<Acts::MaterialInteractor, EndOfWorld>;
203 Options options = prepareOptions<Options>(anygctx, mctx, startParameters, navDir, pathLimit);
206 auto result = propagator.propagate(startParameters,
options);
209 <<
". Returning empty parameters.");
212 return result.value().endParameters;
220 const Acts::BoundTrackParameters& startParameters,
221 const Acts::Surface&
target,
222 Acts::Direction navDir ,
223 double pathLimit )
const
232 auto anygctx = geo_ctx.
context();
234 auto res = boost::apply_visitor([&](
const auto& propagator) ->
ResultType {
235 using Propagator = std::decay_t<decltype(propagator)>;
239 Acts::ActorList<SteppingLogger, Acts::MaterialInteractor>;
242 Options options = prepareOptions<Options>(anygctx, mctx, startParameters, navDir, pathLimit);
245 Acts::ForcedSurfaceReached, Acts::PathLimitReached>(startParameters,
target,
options) :
247 Acts::SurfaceReached, Acts::PathLimitReached>(startParameters,
target,
options);
255 auto steppingResults = propRes.template get<SteppingLogger::result_type>();
256 auto materialResult = propRes.template get<Acts::MaterialInteractor::result_type>();
257 output.first = std::move(steppingResults.steps);
258 output.second = std::move(materialResult);
264 <<
". Returning empty step vector.");
275 std::optional<const Acts::BoundTrackParameters>
277 const Acts::BoundTrackParameters& startParameters,
278 const Acts::Surface&
target,
279 Acts::Direction navDir ,
280 double pathLimit )
const
288 auto anygctx = geo_ctx.
context();
290 auto parameters = boost::apply_visitor([&](
const auto& propagator) -> std::optional<const Acts::BoundTrackParameters> {
291 using Propagator = std::decay_t<decltype(propagator)>;
295 Acts::ActorList<Acts::MaterialInteractor>;
298 Options options = prepareOptions<Options>(anygctx, mctx, startParameters, navDir, pathLimit);
301 Acts::ForcedSurfaceReached, Acts::PathLimitReached>(startParameters,
target,
options) :
303 Acts::SurfaceReached, Acts::PathLimitReached>(startParameters,
target,
options);
306 <<
". Returning empty parameters.");
309 return result.value().endParameters;
317 if (!readHandle.isValid()) {
318 std::stringstream
msg;
320 throw std::runtime_error(
msg.str());
324 return Acts::MagneticFieldContext(fieldCondObj);
327 template<
typename OptionsType>
329 const Acts::MagneticFieldContext& mctx,
330 const Acts::BoundTrackParameters& startParameters,
331 Acts::Direction navDir,
332 double pathLimit)
const {
333 using namespace Acts::UnitLiterals;
334 OptionsType
options(gctx, mctx);
344 auto& mInteractor =
options.actorList.template get<Acts::MaterialInteractor>();