Skip to content

Commit

Permalink
feat: core add particle stopped aborter (#1453)
Browse files Browse the repository at this point in the history
simple aborter that checks if the particle is stopped and aborts propagation if so
  • Loading branch information
andiwand committed Aug 26, 2022
1 parent c1dda47 commit fc75a54
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Core/include/Acts/Propagator/StandardAborters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,4 +186,25 @@ struct EndOfWorldReached {
}
};

/// If the particle stopped (p=0) abort the propagation
struct ParticleStopped {
ParticleStopped() = default;

/// boolean operator for abort condition without using the result
///
/// @tparam propagator_state_t Type of the propagator state
/// @tparam stepper_t Type of the stepper
///
/// @param [in,out] state The propagation state object
/// @param [in] stepper The stepper object
template <typename propagator_state_t, typename stepper_t>
bool operator()(propagator_state_t& state, const stepper_t& stepper) const {
if (stepper.momentum(state.stepping) > 0) {
return false;
}
state.navigation.targetReached = true;
return true;
}
};

} // namespace Acts

0 comments on commit fc75a54

Please sign in to comment.