Skip to content

Commit

Permalink
feat: Introduce propagator stage (#2621)
Browse files Browse the repository at this point in the history
Currently it is not possible to discover in which stage of propagation we are in the actors and aborters. By introducing a propagator stage enum, adding it to the state and setting it in the proagator loop this can be used in the actors and aborters.

Pulled out of #2603
  • Loading branch information
andiwand authored Nov 7, 2023
1 parent bfaffe1 commit 7925974
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Core/include/Acts/Propagator/Propagator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@

namespace Acts {

/// @brief Different stages during propagation
enum class PropagatorStage {
invalid, ///< Invalid stage
prePropagation, ///< Before the propagation
postPropagation, ///< After the propagation
preStep, ///< Before a step
postStep, ///< After a step
};

/// @brief Simple class holding result of propagation call
///
/// @tparam parameters_t Type of final track parameters
Expand Down Expand Up @@ -270,6 +279,9 @@ class Propagator final {
navigation{std::move(navigationIn)},
geoContext(topts.geoContext) {}

/// Propagation stage
PropagatorStage stage = PropagatorStage::invalid;

/// These are the options - provided for each propagation step
propagator_options_t options;

Expand Down
6 changes: 6 additions & 0 deletions Core/include/Acts/Propagator/Propagator.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ auto Acts::Propagator<S, N>::propagate_impl(propagator_state_t& state,
// Pre-stepping call to the navigator and action list
ACTS_VERBOSE("Entering propagation.");

state.stage = PropagatorStage::prePropagation;

// Navigator initialize state call
m_navigator.initialize(state, m_stepper);
// Pre-Stepping call to the action list
Expand All @@ -41,6 +43,7 @@ auto Acts::Propagator<S, N>::propagate_impl(propagator_state_t& state,
// Propagation loop : stepping
for (; result.steps < state.options.maxSteps; ++result.steps) {
// Pre-Stepping: target setting
state.stage = PropagatorStage::preStep;
m_navigator.preStep(state, m_stepper);
// Perform a propagation step - it takes the propagation state
Result<double> res = m_stepper.step(state, m_navigator);
Expand All @@ -57,6 +60,7 @@ auto Acts::Propagator<S, N>::propagate_impl(propagator_state_t& state,
}
// Post-stepping:
// navigator post step call - action list - aborter list
state.stage = PropagatorStage::postStep;
m_navigator.postStep(state, m_stepper);
state.options.actionList(state, m_stepper, m_navigator, result, logger());
if (state.options.abortList(state, m_stepper, m_navigator, result,
Expand All @@ -69,6 +73,8 @@ auto Acts::Propagator<S, N>::propagate_impl(propagator_state_t& state,
ACTS_VERBOSE("Propagation terminated without going into stepping loop.");
}

state.stage = PropagatorStage::postPropagation;

// if we didn't terminate normally (via aborters) set navigation break.
// this will trigger error output in the lines below
if (!terminatedNormally) {
Expand Down

0 comments on commit 7925974

Please sign in to comment.