12#include "detray/core/concepts.hpp"
13#include "detray/definitions/algebra.hpp"
14#include "detray/definitions/detail/qualifiers.hpp"
15#include "detray/definitions/navigation.hpp"
16#include "detray/propagator/actors/parameter_updater.hpp"
17#include "detray/tracks/bound_track_parameters.hpp"
18#include "detray/tracks/free_track_parameters.hpp"
26template <concepts::detector detector_t>
27struct intersection_record {
42 typename detector_t::algebra_type,
43 intersection::contains_pos>;
45 constexpr intersection_record() =
default;
57 const typename detector_t::point3_type&
position,
58 const typename detector_t::vector3_type&
direction,
60 const double q = detray::detail::invalid_value<double>(),
61 const double p = detray::detail::invalid_value<double>(),
63 : m_pos{algebra::cast_to<double>(
position)},
64 m_dir{algebra::cast_to<double>(
direction)},
74 template <concepts::value V = value_t>
76 return algebra::cast_to<V>(m_pos);
80 template <concepts::value V = value_t>
82 return algebra::cast_to<V>(m_dir);
98 template <concepts::value V = value_t>
99 DETRAY_HOST_DEVICE
auto charge()
const {
100 return algebra::cast_to<V>(m_charge);
104 template <concepts::value V = value_t>
105 DETRAY_HOST_DEVICE
auto p()
const {
106 return algebra::cast_to<V>(m_p_mag);
112 assert(m_p_mag > 0.f);
113 return {algebra::cast_to<value_t>(m_pos),
114 detail::invalid_value<typename detector_t::scalar_type>(),
115 algebra::cast_to<value_t>(m_p_mag * m_dir),
116 algebra::cast_to<value_t>(m_charge)};
124 template <concepts::po
int3D po
int_t>
126 m_pos = algebra::cast_to<double>(
position);
130 template <concepts::vector3D vector_t>
131 DETRAY_HOST_DEVICE
void direction(
const vector_t& dir) {
132 m_dir = algebra::cast_to<double>(dir);
145 template <concepts::scalar scalar_t>
146 DETRAY_HOST_DEVICE
void charge(
const scalar_t q) {
147 m_charge = algebra::cast_to<double>(q);
151 template <concepts::scalar scalar_t>
152 DETRAY_HOST_DEVICE
void p(
const scalar_t
p) {
153 m_p_mag = algebra::cast_to<double>(
p);
167 scalar_type m_charge{detray::detail::invalid_value<scalar_type>()};
173template <concepts::algebra algebra_t>
197 navigation::direction
m_nav_dir = navigation::direction::e_forward;
211 template <concepts::value V = value_t>
217 template <concepts::value V = value_t>
236 template <concepts::value V = value_t>
242 template <concepts::value V = value_t>
248 template <concepts::value V = value_t>
268 DETRAY_HOST_DEVICE
void n_trials(
const std::size_t n_trial) {
273 DETRAY_HOST_DEVICE
void nav_direction(
const navigation::direction nav_dir) {
283 template <
typename free_param_t>
284 DETRAY_HOST_DEVICE
void free_param(
const free_param_t& param) {
289 template <
typename bound_param_t>
295 template <
typename jacobian_t>
296 DETRAY_HOST_DEVICE
void jacobian(
const jacobian_t& jac) {
307 double path{detail::invalid_value<double>()};
317template <concepts::detector detector_t>
373 return m_intersection_record.template p<value_type>();
383 m_step_record.bound_params.surface_link() ==
385 return m_step_record.bound_params.surface_link();
391 m_step_record.bound_param().surface_link() = geo_id;
397 return m_intersection_record.intersection();
402 return m_intersection_record.intersection();
409 m_intersection_record.intersection(intr);
415 return m_step_record.free_param();
420 m_step_record.free_param(free_param);
429 m_step_record.bound_param(bound_param);
434 return m_step_record.bound_params;
451 std::optional<intersection_record<detector_t>> m_intersection_record{};
453 std::optional<material_record> m_material_record{};
Unique identifier for geometry objects, based on the ACTS GeometryIdentifier.
Definition identifier.hpp:36
This class holds the intersection information.
Definition intersection.hpp:212
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
unsigned int dindex
Default index type.
Definition indexing.hpp:18
dmatrix< algebra_t, e_free_size, e_free_size > free_matrix
Covariance matrix type for free track parametrization.
Definition track_parametrization.hpp:73
constexpr dindex dindex_invalid
Global invalid index definition.
Definition indexing.hpp:21
get_algebra_t< A, T > dalgebra
Select the algebra backend with value type T.
Definition algebra.hpp:44
get_vector3D_t< A, T > dvector3D
Three-dimensional vector type for algebra A and value type T.
Definition algebra.hpp:80
get_value_t< A > dvalue
Value scalar type of the algebra backend.
Definition algebra.hpp:48
get_point3D_t< A, T > dpoint3D
Three-dimensional point type for algebra A and value type T.
Definition algebra.hpp:72
free_parameters_vector< algebra_t > free_track_parameters
The free track parameters consist only of the parameter vector.
Definition free_track_parameters.hpp:249
Combine the bound track parameter vector with the covariance and associated surface.
Definition bound_track_parameters.hpp:297
dscalar< algebra_type > scalar_type
Scalar type used by this record.
Definition data_record.hpp:35
auto p() const
Definition data_record.hpp:105
intersection2D< typename detector_t::surface_type, typename detector_t::algebra_type, intersection::contains_pos > intersection_type
Intersection result type stored by this record.
Definition data_record.hpp:41
free_track_parameters< typename detector_t::algebra_type > track_param() const
Definition data_record.hpp:111
auto charge() const
Get the particle charge.
Definition data_record.hpp:99
dpoint3D< algebra_type > point3_type
3D point type used to store positions.
Definition data_record.hpp:37
void intersection(const intersection_type &intr)
Set the intersection result.
Definition data_record.hpp:137
auto direction() const
Definition data_record.hpp:81
void p(const scalar_t p)
Set the momentum magnitude.
Definition data_record.hpp:152
void direction(const vector_t &dir)
Set the track direction.
Definition data_record.hpp:131
const intersection_type & intersection() const
Get the intersection result.
Definition data_record.hpp:87
void volume(dindex vol_idx)
Set the containing volume index.
Definition data_record.hpp:141
intersection_type & intersection()
Get the mutable intersection result.
Definition data_record.hpp:91
dvector3D< algebra_type > vector3_type
3D vector type used to store directions.
Definition data_record.hpp:39
void charge(const scalar_t q)
Set the particle charge.
Definition data_record.hpp:146
constexpr intersection_record(const typename detector_t::point3_type &position, const typename detector_t::vector3_type &direction, const intersection_type &intr, const double q=detray::detail::invalid_value< double >(), const double p=detray::detail::invalid_value< double >(), const dindex v_idx=dindex_invalid)
The particle charge is not known in the navigation, but might be provided in a different context.
Definition data_record.hpp:56
auto position() const
Definition data_record.hpp:75
dindex volume() const
Get the containing volume index.
Definition data_record.hpp:95
void position(const point_t &position)
SettersSet the intersection position.
Definition data_record.hpp:125
dalgebra< typename detector_t::algebra_type, double > algebra_type
Algebra type used to store values in double precision.
Definition data_record.hpp:33
Contains the material parameters and the pathlength.
Definition data_record.hpp:303
double path
Pathlength of the track through the material.
Definition data_record.hpp:307
geometry::identifier geo_id
The surface the material belongs to.
Definition data_record.hpp:305
double mat_X0
Radiation length.
Definition data_record.hpp:311
double mat_L0
Interaction length.
Definition data_record.hpp:313
double thickness
Material thickness/radius.
Definition data_record.hpp:309
Data for a single step.
Definition data_record.hpp:318
std::size_t n_rkn_trials() const
Definition data_record.hpp:354
geometry::identifier identifier() const
Definition data_record.hpp:381
intersection_type & intersection()
Definition data_record.hpp:401
intersection_record< detector_t >::intersection_type intersection_type
Intersection type associated with the detector.
Definition data_record.hpp:334
void step_size(scalar_type step_size)
Set the new step size.
Definition data_record.hpp:341
typename step_record_type::bound_param_type bound_param_type
Bound track parameter type.
Definition data_record.hpp:330
step_record< algebra_type > step_record_type
Type storing the propagation step data.
Definition data_record.hpp:326
void p_mag(scalar_type p_mag)
Set the new total momentum magnitude.
Definition data_record.hpp:377
scalar_type path_length() const
Definition data_record.hpp:345
void bound_track_param(const bound_param_type &bound_param)
Set the new bound parameters.
Definition data_record.hpp:428
void n_rkn_trials(std::size_t n_rkn_trials)
Set the new number of RKN iterations.
Definition data_record.hpp:357
scalar_type p_mag() const
Definition data_record.hpp:372
typename step_record_type::free_matrix_type free_matrix_type
Free track matrix type.
Definition data_record.hpp:332
void identifier(geometry::identifier geo_id)
Set the new geometry identifier.
Definition data_record.hpp:390
dscalar< algebra_type > scalar_type
Scalar type associated with the detector algebra.
Definition data_record.hpp:324
void charge(scalar_type charge)
Set the new charge.
Definition data_record.hpp:368
bound_param_type & bound_track_param()
Definition data_record.hpp:425
scalar_type step_size() const
Definition data_record.hpp:338
dvalue< algebra_type > value_type
Value type associated with the detector algebra.
Definition data_record.hpp:322
free_param_type free_track_param() const
Definition data_record.hpp:414
void path_length(scalar_type path_length)
Set the new path length.
Definition data_record.hpp:348
typename step_record_type::track_param_type free_param_type
Free track parameter type.
Definition data_record.hpp:328
scalar_type charge() const
Definition data_record.hpp:363
void free_track_param(const free_param_type &free_param)
Set the new free track parameters.
Definition data_record.hpp:419
void intersection(const intersection_type &intr)
Set the new intersection data.
Definition data_record.hpp:408
void jacobian(const free_matrix_type &jac)
Set the new Jacobian.
Definition data_record.hpp:445
const bound_param_type & bound_track_param() const
Definition data_record.hpp:433
free_matrix_type & jacobian()
Definition data_record.hpp:439
const free_matrix_type & jacobian() const
Definition data_record.hpp:442
const intersection_type & intersection() const
Definition data_record.hpp:396
typename detector_t::algebra_type algebra_type
Detector algebra type.
Definition data_record.hpp:320
Data for a single step.
Definition data_record.hpp:174
dvector3D< algebra_t > vector3_type
3D vector type used by the record.
Definition data_record.hpp:182
dalgebra< algebra_t, double > algebra_type
Algebra type used to store values in double precision.
Definition data_record.hpp:176
scalar_type m_step_size
Definition data_record.hpp:191
scalar_type step_size() const
GettersGet the step size.
Definition data_record.hpp:212
free_track_parameters< algebra_t > track_param_type
Free track parameter type stored by the record.
Definition data_record.hpp:184
void jacobian(const jacobian_t &jac)
Set the transport Jacobian.
Definition data_record.hpp:296
void nav_direction(const navigation::direction nav_dir)
Set the navigation direction.
Definition data_record.hpp:273
std::size_t m_n_total_trials
Definition data_record.hpp:195
dscalar< algebra_t > scalar_type
Scalar type used by the record.
Definition data_record.hpp:180
track_param_type m_free_params
Definition data_record.hpp:201
void identifier(const geometry::identifier geo_id)
Set the geometry identifier.
Definition data_record.hpp:278
free_matrix_type jacobian() const
Get the transport Jacobian.
Definition data_record.hpp:249
dvalue< algebra_t > value_t
Value type associated with the algebra.
Definition data_record.hpp:178
void path_length(const scalar_type path_length)
Set the accumulated path length.
Definition data_record.hpp:263
navigation::direction nav_direction() const
Get the navigation direction.
Definition data_record.hpp:226
scalar_type path_length() const
Get the accumulated path length.
Definition data_record.hpp:218
void free_param(const free_param_t ¶m)
Set the free track parameters.
Definition data_record.hpp:284
bound_track_parameters< algebra_t > bound_param_type
Bound track parameter type stored by the record.
Definition data_record.hpp:186
navigation::direction m_nav_dir
Definition data_record.hpp:197
scalar_type m_path_length
Definition data_record.hpp:193
free_matrix_type m_jacobian
Definition data_record.hpp:205
std::size_t n_trials() const
Get the number of propagation trials.
Definition data_record.hpp:223
free_matrix< algebra_t > free_matrix_type
Free track matrix type stored by the record.
Definition data_record.hpp:188
geometry::identifier m_identifier
Definition data_record.hpp:199
bound_param_type bound_param() const
Get the bound track parameters.
Definition data_record.hpp:243
void n_trials(const std::size_t n_trial)
Set the number of propagation trials.
Definition data_record.hpp:268
geometry::identifier identifier() const
Get the geometry identifier.
Definition data_record.hpp:231
void bound_param(const bound_param_t ¶m)
Set the bound track parameters.
Definition data_record.hpp:290
bound_param_type m_bound_params
Definition data_record.hpp:203
void step_size(const scalar_type step_size)
SettersSet the step size.
Definition data_record.hpp:258
track_param_type free_param() const
Get the free track parameters.
Definition data_record.hpp:237
static constexpr scalar_t GeV
Native energy unit, the gigaelectronvolt.
Definition units.hpp:81