12#include "detray/definitions/algebra.hpp"
13#include "detray/definitions/detail/qualifiers.hpp"
14#include "detray/propagator/base_actor.hpp"
15#include "detray/propagator/base_stepper.hpp"
16#include "detray/utils/logging.hpp"
21namespace detray::actor {
24template <concepts::scalar scalar_t>
44 template <
typename propagator_state_t>
46 propagator_state_t &prop_state)
const {
47 DETRAY_VERBOSE_HOST_DEVICE(
"Aborter: Check path limits");
49 auto &step_state = prop_state.stepping();
50 auto &nav_state = prop_state.navigation();
53 if (nav_state.finished()) {
57 const scalar_t step_limit =
59 math::fabs(prop_state.stepping().abs_path_length());
62 if (step_limit <= 0.f) {
63 DETRAY_VERBOSE_HOST_DEVICE(
64 "Path lengths: %f mm",
65 math::fabs(prop_state.stepping().abs_path_length()));
68 nav_state.abort(
"Aborter: Maximal path length reached");
69 prop_state.heartbeat(
false);
73 step_state.template set_constraint<step::constraint::e_aborter>(step_limit);
78template <concepts::scalar scalar_t>
84 constexpr scalar_t
p_limit()
const {
return m_min_p; }
88 constexpr scalar_t
pT_limit()
const {
return m_min_pT; }
93 constexpr void min_p(
const scalar_t p) { m_min_p = p; }
98 constexpr void min_pT(
const scalar_t pT) { m_min_pT = pT; }
110 template <
typename propagator_state_t>
112 propagator_state_t &prop_state)
const {
113 DETRAY_VERBOSE_HOST_DEVICE(
"Aborter: Check momentum");
115 auto &step_state = prop_state.stepping();
116 auto &nav_state = prop_state.navigation();
119 if (nav_state.finished()) {
123 const auto &track = step_state();
124 const scalar_t q{step_state.particle_hypothesis().charge()};
126 if (track.pT(q) <= abrt_state.
pT_limit()) {
127 DETRAY_VERBOSE_HOST_DEVICE(
"Track |pT| = %f MeV", track.pT(q));
130 nav_state.abort(
"Aborter: Minimum transverse momentum (pT) reached");
131 prop_state.heartbeat(
false);
135 if (track.p(q) <= abrt_state.
p_limit()) {
136 DETRAY_VERBOSE_HOST_DEVICE(
"Track |p| = %f MeV", track.p(q));
139 nav_state.abort(
"Aborter: Minimum momentum (p) reached");
140 prop_state.heartbeat(
false);
157 template <
typename propagator_state_t>
159 propagator_state_t &prop_state)
const {
160 DETRAY_VERBOSE_HOST_DEVICE(
"Aborter: Check target surface");
162 auto &navigation = prop_state.navigation();
163 const auto &stepping = prop_state.stepping();
167 if (navigation.is_on_surface() &&
169 (stepping.path_length() > 0.f)) {
170 navigation.abort(
"Aborter: Reached target surface");
171 prop_state.heartbeat(
false);
Unique identifier for geometry objects, based on the ACTS GeometryIdentifier.
Definition identifier.hpp:36
Per-propagation minimum momentum thresholds.
Definition aborters.hpp:81
constexpr scalar_t p_limit() const
Definition aborters.hpp:84
constexpr scalar_t pT_limit() const
Definition aborters.hpp:88
constexpr void min_p(const scalar_t p)
Set the momentum limit to p.
Definition aborters.hpp:93
constexpr void min_pT(const scalar_t pT)
Set the transverse momentum limit to pT.
Definition aborters.hpp:98
Aborter that checks whether the track fell below a minimum momentum.
Definition aborters.hpp:79
void operator()(state &abrt_state, propagator_state_t &prop_state) const
Actor interface: Enforces a minimum momentum magnitude.
Definition aborters.hpp:111
Pathlimit for a single propagation workflow.
Definition aborters.hpp:27
scalar_t path_limit() const
Definition aborters.hpp:37
scalar_t _path_limit
Absolute path limit.
Definition aborters.hpp:29
void set_path_limit(const scalar_t pl)
Set the path limit to a scalar.
Definition aborters.hpp:33
Aborter that checks whether the track has exceeded its pathlimit.
Definition aborters.hpp:25
void operator()(state &abrt_state, propagator_state_t &prop_state) const
Enforces the path limit on a stepper state.
Definition aborters.hpp:45
Keeps the index for the target surface.
Definition aborters.hpp:148
geometry::identifier _target_surface
Unique surface id of the target.
Definition aborters.hpp:150
Aborter checks whether a specific surface was reached.
Definition aborters.hpp:146
void operator()(const state &abrt_state, propagator_state_t &prop_state) const
Exits the navigation as soon as the target surface has been found.
Definition aborters.hpp:158
Base class actor implementation.
Definition base_actor.hpp:20
static constexpr scalar_t MeV
Megaelectronvolt expressed in GeV.
Definition units.hpp:79