12#include "detray/core/concepts.hpp"
13#include "detray/definitions/algebra.hpp"
14#include "detray/definitions/detail/qualifiers.hpp"
15#include "detray/definitions/pdg_particle.hpp"
16#include "detray/definitions/units.hpp"
17#include "detray/geometry/identifier.hpp"
18#include "detray/geometry/tracking_surface.hpp"
19#include "detray/propagator/constrained_step.hpp"
20#include "detray/propagator/detail/print_stepper_state.hpp"
21#include "detray/propagator/stepping_config.hpp"
22#include "detray/propagator/transport_jacobian.hpp"
23#include "detray/tracks/tracks.hpp"
24#include "detray/utils/curvilinear_frame.hpp"
25#include "detray/utils/logging.hpp"
37 template <
typename state_t>
38 DETRAY_HOST_DEVICE
constexpr void operator()(
const state_t & ,
39 const char * )
const {
47template <concepts::algebra algebra_t,
typename constraint_t,
typename policy_t,
48 typename inspector_t = stepping::void_inspector>
73 template <
typename internal_jacobian_t = free_matrix_type>
82 : m_track(free_params) {
83 assert(!m_track.is_invalid());
89 m_jac_transport = internal_jacobian_type::identity();
91 m_jac_transport = matrix::identity<internal_jacobian_type>();
100 template <concepts::detector detector_t>
102 const detector_t &det,
103 const typename detector_t::geometry_context &ctx) {
113 assert(!m_track.is_invalid());
119 m_jac_transport = internal_jacobian_type::identity();
121 m_jac_transport = matrix::identity<internal_jacobian_type>();
137 return m_step_size >= 0.f ? step::direction::e_forward
138 : step::direction::e_backward;
147 return m_n_total_trials;
173 m_path_length += seg;
174 m_abs_path_length += math::fabs(seg);
180 template <step::constra
int type = step::constra
int::e_actor>
182 m_constraint.template set<type>(
step_size);
187 inline const constraint_t &
constraints()
const {
return m_constraint; }
190 template <step::constra
int type = step::constra
int::e_actor>
192 m_constraint.template release<type>();
220 return m_jac_transport;
228 return m_jac_transport;
234 return m_jac_transport;
240 return m_jac_transport;
249 m_jac_transport = internal_jacobian_type::identity();
251 m_jac_transport = matrix::identity<internal_jacobian_type>();
257 inline typename policy_t::state &
policy_state() {
return m_policy_state; }
269 [[maybe_unused]]
const char *message,
271 if constexpr (!std::is_same_v<inspector_t, stepping::void_inspector>) {
272 m_inspector(*
this, cfg, message, dist);
275 DETRAY_DEBUG_HOST(
"" << message <<
"\n"
276 << detray::stepping::print_state(*
this, dist));
290 std::size_t m_n_total_trials{0u};
302 DETRAY_NO_UNIQUE_ADDRESS constraint_t m_constraint = {};
305 DETRAY_NO_UNIQUE_ADDRESS
typename policy_t::state m_policy_state = {};
Base stepper implementation.
Definition base_stepper.hpp:49
void magnetic_field_type
Magnetic-field type, absent for the base stepper.
Definition base_stepper.hpp:63
bound_track_parameters< algebra_t > bound_track_parameters_type
Bound track parameter representation.
Definition base_stepper.hpp:57
policy_t policy_type
Navigation and step-constraint policy type.
Definition base_stepper.hpp:68
free_matrix< algebra_t > free_matrix_type
Free-parameter covariance/Jacobian matrix type.
Definition base_stepper.hpp:59
bound_matrix< algebra_t > bound_matrix_type
Bound-parameter covariance/Jacobian matrix type.
Definition base_stepper.hpp:61
inspector_t inspector_type
Type of the configured step inspection callback.
Definition base_stepper.hpp:66
dscalar< algebra_t > scalar_type
Scalar type used by the stepper.
Definition base_stepper.hpp:52
free_track_parameters< algebra_t > free_track_parameters_type
Free track parameter representation.
Definition base_stepper.hpp:55
constexpr bool is_invalid() const noexcept
Check whether the identifier is valid to use.
Definition identifier.hpp:141
Facade for a detray detector surface with extra tracking capabilities.
Definition tracking_surface.hpp:25
constexpr auto bound_to_free_vector(const context &ctx, const bound_param_vector_type &bound_vec) const
Definition tracking_surface.hpp:90
Definition transport_jacobian.hpp:18
Detray include(s).
Definition array_operators.hpp:18
get_scalar_t< A, T > dscalar
Scalar type for algebra A and value type T.
Definition algebra.hpp:64
dmatrix< algebra_t, e_free_size, e_free_size > free_matrix
Covariance matrix type for free track parametrization.
Definition track_parametrization.hpp:73
dmatrix< algebra_t, e_bound_size, e_bound_size > bound_matrix
Covariance matrix type for bound track parametrization.
Definition track_parametrization.hpp:81
get_matrix_t< A, R, C, T > dmatrix
R by C matrix type for algebra A and value type T.
Definition algebra.hpp:88
free_parameters_vector< algebra_t > free_track_parameters
The free track parameters consist only of the parameter vector.
Definition free_track_parameters.hpp:249
free_matrix_type transport_jacobian() const
Definition base_stepper.hpp:209
std::size_t n_total_trials() const
Definition base_stepper.hpp:146
policy_t::state & policy_state()
Definition base_stepper.hpp:257
step::direction direction() const
Get stepping direction.
Definition base_stepper.hpp:136
void set_particle(const pdg_particle< scalar_type > &ptc)
Set new particle hypothesis.
Definition base_stepper.hpp:202
void set_step_size(const scalar_type step)
Set the current step size.
Definition base_stepper.hpp:153
void update_path_lengths(scalar_type seg)
Add a new segment to all path lengths (forward or backward).
Definition base_stepper.hpp:172
void release_step()
Remove [all] constraints.
Definition base_stepper.hpp:191
constexpr auto & inspector()
Definition base_stepper.hpp:261
const constraint_t & constraints() const
Definition base_stepper.hpp:187
free_track_parameters_type & operator()()
Definition base_stepper.hpp:127
const auto & particle_hypothesis() const
Definition base_stepper.hpp:197
scalar_type step_size() const
Definition base_stepper.hpp:160
state(const bound_track_parameters_type &bound_params, const detector_t &det, const typename detector_t::geometry_context &ctx)
Sets track parameters from bound track parameter.
Definition base_stepper.hpp:101
free_matrix_type & transport_jacobian()
Definition base_stepper.hpp:225
scalar_type path_length() const
Definition base_stepper.hpp:164
void reset_transport_jacobian()
Reset transport Jacbian.
Definition base_stepper.hpp:245
const free_matrix_type & transport_jacobian() const
Definition base_stepper.hpp:217
const internal_jacobian_type & internal_transport_jacobian() const
Definition base_stepper.hpp:239
internal_jacobian_t internal_jacobian_type
Internal representation used to accumulate the transport Jacobian.
Definition base_stepper.hpp:76
const free_track_parameters_type & operator()() const
Definition base_stepper.hpp:131
internal_jacobian_type & internal_transport_jacobian()
Definition base_stepper.hpp:233
state(const free_track_parameters_type &free_params)
Sets track parameters.
Definition base_stepper.hpp:81
scalar_type abs_path_length() const
Definition base_stepper.hpp:168
void run_inspector(const stepping::config &cfg, const char *message, const scalar_type dist)
Call the stepping inspector.
Definition base_stepper.hpp:268
void count_trials()
Updates the total number of step trials.
Definition base_stepper.hpp:142
void set_constraint(scalar_type step_size)
Set new step constraint.
Definition base_stepper.hpp:181
Combine the bound track parameter vector with the covariance and associated surface.
Definition bound_track_parameters.hpp:297
const geometry::identifier & surface_link() const
Definition bound_track_parameters.hpp:364
constexpr bool is_invalid(const bool do_check=true) const
Definition bound_track_parameters.hpp:397
Negative muon hypothesis.
Definition pdg_particle.hpp:111
Particle hypothesis identified by PDG number, mass, and electric charge.
Definition pdg_particle.hpp:24
Configuration flags and limits consumed by a stepper.
Definition stepping_config.hpp:29
A void inpector that does nothing.
Definition base_stepper.hpp:34
constexpr void operator()(const state_t &, const char *) const
No-op inspection callback used when inspection is disabled.
Definition base_stepper.hpp:38
static constexpr scalar_t mm
Native length unit, the millimetre.
Definition units.hpp:27