33 template <
typename scalar_t>
47 std::array<Scalar, 4>
dLdl{};
49 std::array<Scalar, 4>
qop{};
51 std::array<Scalar, 4>
dPds{};
57 std::array<Scalar, 4>
tKi{};
77 template <
typename propagator_state_t,
typename stepper_t,
86 if (absQ == 0. || mass == 0. ||
87 stepper.absoluteMomentum(state.stepping) <
88 state.options.momentumCutOff) {
93 if (!navigator.currentVolumeMaterial(state.navigation)) {
118 template <
typename propagator_state_t,
typename stepper_t,
119 typename navigator_t>
122 std::array<Scalar, 4>& kQoP,
const int i = 0,
const double h = 0.,
127 double q = stepper.charge(state.stepping);
134 auto volumeMaterial = navigator.currentVolumeMaterial(state.navigation);
136 material = volumeMaterial->material(position.template cast<double>());
139 qop[0] = stepper.qOverP(state.stepping);
142 knew =
qop[0] * stepper.direction(state.stepping).cross(bField);
146 tKi[0] = hypot(1, mass *
qop[0]);
156 (stepper.direction(state.stepping) +
h * kprev).
cross(bField);
159 Lambdappi[
i] = -qopNew * qopNew * qopNew *
g *
energy[
i] / (q * q);
160 tKi[
i] = hypot(1, mass * qopNew);
161 kQoP[
i] = Lambdappi[
i];
180 template <
typename propagator_state_t,
typename stepper_t,
181 typename navigator_t>
182 bool finalize(propagator_state_t& state,
const stepper_t& stepper,
183 const navigator_t& ,
const double h)
const {
192 stepper.absoluteMomentum(state.stepping) +
196 if (newMomentum < state.options.momentumCutOff) {
201 state.stepping.derivative(7) = -hypot(mass, newMomentum) *
g /
202 (newMomentum * newMomentum * newMomentum);
206 stepper.charge(state.stepping) / newMomentum;
208 state.stepping.derivative(3) = hypot(1, mass / newMomentum);
234 template <
typename propagator_state_t,
typename stepper_t,
235 typename navigator_t>
236 bool finalize(propagator_state_t& state,
const stepper_t& stepper,
237 const navigator_t& navigator,
const double h,
239 return finalize(state, stepper, navigator, h) &&
255 template <
typename propagator_state_t,
typename stepper_t,
256 typename navigator_t>
258 const navigator_t& ,
const double h,
283 auto& sd = state.stepping.stepData;
284 auto dir = stepper.direction(state.stepping);
288 D = FreeMatrix::Identity();
289 const double half_h = h * 0.5;
293 auto dFdT = D.block<3, 3>(0, 4);
294 auto dFdL = D.block<3, 1>(0, 7);
296 auto dGdT = D.block<3, 3>(4, 4);
297 auto dGdL = D.block<3, 1>(4, 7);
304 Vector3 dk1dL = Vector3::Zero();
305 Vector3 dk2dL = Vector3::Zero();
306 Vector3 dk3dL = Vector3::Zero();
307 Vector3 dk4dL = Vector3::Zero();
310 std::array<double, 4> jdL{};
314 dk1dL = dir.cross(sd.B_first);
316 jdL[1] =
dLdl[1] * (1. + half_h * jdL[0]);
317 dk2dL = (1. + half_h * jdL[0]) * (dir + half_h * sd.k1).cross(sd.B_middle) +
318 qop[1] * half_h * dk1dL.cross(sd.B_middle);
320 jdL[2] =
dLdl[2] * (1. + half_h * jdL[1]);
321 dk3dL = (1. + half_h * jdL[1]) * (dir + half_h * sd.k2).cross(sd.B_middle) +
322 qop[2] * half_h * dk2dL.cross(sd.B_middle);
324 jdL[3] =
dLdl[3] * (1. + h * jdL[2]);
325 dk4dL = (1. + h * jdL[2]) * (dir + h * sd.k3).cross(sd.B_last) +
326 qop[3] * h * dk3dL.cross(sd.B_last);
328 dk1dT(0, 1) = sd.B_first.z();
329 dk1dT(0, 2) = -sd.B_first.y();
330 dk1dT(1, 0) = -sd.B_first.z();
331 dk1dT(1, 2) = sd.B_first.x();
332 dk1dT(2, 0) = sd.B_first.y();
333 dk1dT(2, 1) = -sd.B_first.x();
336 dk2dT += half_h * dk1dT;
339 dk3dT += half_h * dk2dT;
346 dFdT += h / 6. * (dk1dT + dk2dT + dk3dT);
349 dFdL = h * h / 6. * (dk1dL + dk2dL + dk3dL);
351 dGdT += h / 6. * (dk1dT + 2. * (dk2dT + dk3dT) + dk4dT);
353 dGdL = h / 6. * (dk1dL + 2. * (dk2dL + dk3dL) + dk4dL);
356 D(7, 7) += (h / 6.) * (jdL[0] + 2. * (jdL[1] + jdL[2]) + jdL[3]);
365 double dtp1dl =
qop[0] * mass * mass / hypot(1,
qop[0] * mass);
373 double dtp2dl = qopNew * mass * mass / std::hypot(1, qopNew * mass);
374 qopNew =
qop[0] + half_h * Lambdappi[1];
381 double dtp3dl = qopNew * mass * mass / hypot(1, qopNew * mass);
382 qopNew =
qop[0] + half_h * Lambdappi[2];
383 double dtp4dl = qopNew * mass * mass / hypot(1, qopNew * mass);
389 D(3, 7) = (h / 6.) * (dtp1dl + 2. * (dtp2dl + dtp3dl) + dtp4dl);
400 template <
typename propagator_state_t,
typename stepper_t>
402 const stepper_t& stepper) {
415 if (state.options.meanEnergyLoss) {
427 if (state.stepping.covTransport) {
430 if (state.options.includeGgradient) {
431 if (state.options.meanEnergyLoss) {
433 slab, absPdg, mass, static_cast<float>(
qop[0]), absQ);
437 slab, absPdg, mass, static_cast<float>(
qop[0]), absQ);
457 template <
typename propagator_state_t,
typename stepper_t>
459 const propagator_state_t& state,
460 const stepper_t& stepper,
const int i) {
470 if (state.stepping.covTransport) {