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