@@ -94,26 +94,12 @@ struct parameter_transporter : actor {
94
94
// from curvilinear frame)
95
95
if (!bound_params.surface_link ().is_invalid ()) {
96
96
97
- // Previous surface
98
- tracking_surface prev_sf{navigation.detector (),
99
- bound_params.surface_link ()};
100
-
101
- const bound_to_free_matrix_t bound_to_free_jacobian =
102
- prev_sf.bound_to_free_jacobian (gctx, bound_params);
103
-
104
- auto vol = navigation.get_volume ();
105
- const auto vol_mat_ptr =
106
- vol.has_material () ? vol.material_parameters (stepping ().pos ())
107
- : nullptr ;
108
- stepping.set_full_jacobian (
109
- sf.template visit_mask <get_full_jacobian_kernel>(
110
- sf.transform (gctx), bound_to_free_jacobian, vol_mat_ptr,
111
- propagation._stepping ));
97
+ const auto full_jacobian = get_full_jacobian (propagation);
112
98
113
99
// Calculate surface-to-surface covariance transport
114
- const bound_matrix_t new_cov =
115
- stepping. full_jacobian () * bound_params.covariance () *
116
- matrix::transpose (stepping. full_jacobian () );
100
+ const bound_matrix_t new_cov = full_jacobian *
101
+ bound_params.covariance () *
102
+ matrix::transpose (full_jacobian);
117
103
118
104
stepping.bound_params ().set_covariance (new_cov);
119
105
}
@@ -126,6 +112,39 @@ struct parameter_transporter : actor {
126
112
bound_params.set_surface_link (sf.barcode ());
127
113
}
128
114
115
+ template <typename propagator_state_t >
116
+ DETRAY_HOST_DEVICE inline bound_matrix_t get_full_jacobian (
117
+ propagator_state_t & propagation) const {
118
+
119
+ const auto & stepping = propagation._stepping ;
120
+ const auto & navigation = propagation._navigation ;
121
+
122
+ // Geometry context for this track
123
+ const auto & gctx = propagation._context ;
124
+
125
+ // Current Surface
126
+ const auto sf = navigation.get_surface ();
127
+
128
+ // Bound track params of departure surface
129
+ auto & bound_params = stepping.bound_params ();
130
+
131
+ // Previous surface
132
+ tracking_surface prev_sf{navigation.detector (),
133
+ bound_params.surface_link ()};
134
+
135
+ const bound_to_free_matrix_t bound_to_free_jacobian =
136
+ prev_sf.bound_to_free_jacobian (gctx, bound_params);
137
+
138
+ auto vol = navigation.get_volume ();
139
+ const auto vol_mat_ptr = vol.has_material ()
140
+ ? vol.material_parameters (stepping ().pos ())
141
+ : nullptr ;
142
+
143
+ return sf.template visit_mask <get_full_jacobian_kernel>(
144
+ sf.transform (gctx), bound_to_free_jacobian, vol_mat_ptr,
145
+ propagation._stepping );
146
+ }
147
+
129
148
}; // namespace detray
130
149
131
150
} // namespace detray
0 commit comments