@@ -21,31 +21,27 @@ struct parameter_transporter : actor {
21
21
22
22
// / @name Type definitions for the struct
23
23
// / @{
24
-
24
+ using scalar_type = dscalar< algebra_t >;
25
25
// Transformation matching this struct
26
26
using transform3_type = dtransform3D<algebra_t >;
27
- // scalar_type
28
- using scalar_type = dscalar<algebra_t >;
29
27
// Matrix actor
30
28
using matrix_operator = dmatrix_operator<algebra_t >;
31
- // 2D matrix type
32
- template <std::size_t ROWS, std::size_t COLS>
33
- using matrix_type = dmatrix<algebra_t , ROWS, COLS>;
34
29
// bound matrix type
35
30
using bound_matrix_t = bound_matrix<algebra_t >;
31
+ // Matrix type for bound to free jacobian
32
+ using bound_to_free_matrix_t = bound_to_free_matrix<algebra_t >;
36
33
// / @}
37
34
38
- struct state {};
39
-
40
35
struct get_full_jacobian_kernel {
41
36
42
37
template <typename mask_group_t , typename index_t ,
43
- typename propagator_state_t >
38
+ typename stepper_state_t >
44
39
DETRAY_HOST_DEVICE inline bound_matrix_t operator ()(
45
40
const mask_group_t & /* mask_group*/ , const index_t & /* index*/ ,
46
41
const transform3_type& trf3,
47
- const bound_to_free_matrix<algebra_t >& bound_to_free_jacobian,
48
- const propagator_state_t & propagation) const {
42
+ const bound_to_free_matrix_t & bound_to_free_jacobian,
43
+ const material<scalar_type>* vol_mat_ptr,
44
+ const stepper_state_t & stepping) const {
49
45
50
46
using frame_t = typename mask_group_t ::value_type::shape::
51
47
template local_frame_type<algebra_t >;
@@ -56,38 +52,28 @@ struct parameter_transporter : actor {
56
52
using free_to_bound_matrix_t =
57
53
typename jacobian_engine_t ::free_to_bound_matrix_type;
58
54
59
- // Stepper and Navigator states
60
- auto & stepping = propagation._stepping ;
61
-
62
- // Free vector
63
- const auto & free_params = stepping ();
64
-
65
55
// Free to bound jacobian at the destination surface
66
56
const free_to_bound_matrix_t free_to_bound_jacobian =
67
- jacobian_engine_t::free_to_bound_jacobian (trf3, free_params);
68
-
69
- // Transport jacobian in free coordinate
70
- const free_matrix_t & free_transport_jacobian =
71
- stepping.transport_jacobian ();
57
+ jacobian_engine_t::free_to_bound_jacobian (trf3, stepping ());
72
58
73
59
// Path correction factor
74
- free_matrix_t path_correction = jacobian_engine_t::path_correction (
75
- stepping ().pos (), stepping ().dir (), stepping.dtds (),
76
- stepping.dqopds (), trf3);
60
+ const free_matrix_t path_correction =
61
+ jacobian_engine_t::path_correction (
62
+ stepping ().pos (), stepping ().dir (), stepping.dtds (),
63
+ stepping.dqopds (vol_mat_ptr), trf3);
77
64
78
65
const free_matrix_t correction_term =
79
66
matrix_operator ()
80
67
.template identity <e_free_size, e_free_size>() +
81
68
path_correction;
82
69
83
70
return free_to_bound_jacobian * correction_term *
84
- free_transport_jacobian * bound_to_free_jacobian;
71
+ stepping. transport_jacobian () * bound_to_free_jacobian;
85
72
}
86
73
};
87
74
88
75
template <typename propagator_state_t >
89
- DETRAY_HOST_DEVICE void operator ()(state& /* actor_state*/ ,
90
- propagator_state_t & propagation) const {
76
+ DETRAY_HOST_DEVICE void operator ()(propagator_state_t & propagation) const {
91
77
auto & stepping = propagation._stepping ;
92
78
const auto & navigation = propagation._navigation ;
93
79
@@ -97,46 +83,51 @@ struct parameter_transporter : actor {
97
83
return ;
98
84
}
99
85
100
- using detector_type = typename propagator_state_t ::detector_type;
101
- using geo_cxt_t = typename detector_type::geometry_context;
102
- const geo_cxt_t ctx{};
86
+ typename propagator_state_t ::detector_type::geometry_context ctx{};
103
87
104
88
// Current Surface
105
89
const auto sf = navigation.get_surface ();
106
90
91
+ // Bound track params of departure surface
92
+ auto & bound_params = stepping.bound_params ();
93
+
107
94
// Covariance is transported only when the previous surface is an
108
95
// actual tracking surface. (i.e. This disables the covariance transport
109
96
// from curvilinear frame)
110
- if (!detail::is_invalid_value (stepping. prev_sf_index () )) {
97
+ if (!bound_params. surface_link (). is_invalid ( )) {
111
98
112
99
// Previous surface
113
- tracking_surface<detector_type> prev_sf{navigation.detector (),
114
- stepping. prev_sf_index ()};
100
+ tracking_surface prev_sf{navigation.detector (),
101
+ bound_params. surface_link ()};
115
102
116
- const bound_to_free_matrix< algebra_t > bound_to_free_jacobian =
117
- prev_sf.bound_to_free_jacobian (ctx, stepping. bound_params () );
103
+ const bound_to_free_matrix_t bound_to_free_jacobian =
104
+ prev_sf.bound_to_free_jacobian (ctx, bound_params);
118
105
106
+ auto vol = navigation.get_volume ();
107
+ const auto vol_mat_ptr =
108
+ vol.has_material () ? vol.material_parameters (stepping ().pos ())
109
+ : nullptr ;
119
110
stepping.set_full_jacobian (
120
111
sf.template visit_mask <get_full_jacobian_kernel>(
121
- sf.transform (ctx), bound_to_free_jacobian, propagation));
112
+ sf.transform (ctx), bound_to_free_jacobian, vol_mat_ptr,
113
+ propagation._stepping ));
122
114
123
115
// Calculate surface-to-surface covariance transport
124
116
const bound_matrix_t new_cov =
125
- stepping.full_jacobian () *
126
- stepping.bound_params ().covariance () *
117
+ stepping.full_jacobian () * bound_params.covariance () *
127
118
matrix_operator ().transpose (stepping.full_jacobian ());
119
+
128
120
stepping.bound_params ().set_covariance (new_cov);
129
121
}
130
122
131
123
// Convert free to bound vector
132
- stepping. bound_params () .set_parameter_vector (
124
+ bound_params.set_parameter_vector (
133
125
sf.free_to_bound_vector (ctx, stepping ()));
134
126
135
127
// Set surface link
136
- stepping.bound_params ().set_surface_link (sf.barcode ());
137
-
138
- return ;
128
+ bound_params.set_surface_link (sf.barcode ());
139
129
}
130
+
140
131
}; // namespace detray
141
132
142
133
} // namespace detray
0 commit comments