38 std::array<double, 4>
dLdl;
40 std::array<double, 4>
qop;
42 std::array<double, 4>
dPds;
48 std::array<double, 4>
tKi;
63 template <
typename propagator_state_t,
typename stepper_t>
64 int bid(
const propagator_state_t& state,
const stepper_t&
stepper)
const {
66 if (stepper.charge(state.stepping) == 0. || state.options.mass == 0. ||
67 stepper.momentum(state.stepping) < state.options.momentumCutOff) {
72 if (!state.navigation.currentVolume ||
73 !state.navigation.currentVolume->volumeMaterial()) {
92 template <
typename propagator_state_t,
typename stepper_t>
93 bool k(
const propagator_state_t& state,
const stepper_t&
stepper,
95 const int i = 0,
const double h = 0.,
100 auto volumeMaterial = state.navigation.currentVolume->volumeMaterial();
102 material = (volumeMaterial->material(position));
108 knew =
qop[0] * stepper.direction(state.stepping).cross(bField);
112 (stepper.charge(state.stepping) * stepper.charge(state.stepping));
114 tKi[0] = std::hypot(1, state.options.mass *
qop[0]);
124 (stepper.direction(state.stepping) +
h * kprev).
cross(bField);
128 -qopNew * qopNew * qopNew *
g *
energy[i] /
129 (stepper.charge(state.stepping) * stepper.charge(state.stepping) *
131 tKi[i] = std::hypot(1, state.options.mass * qopNew);
132 kQoP[i] = Lambdappi[i];
147 template <
typename propagator_state_t,
typename stepper_t>
148 bool finalize(propagator_state_t& state,
const stepper_t& stepper,
149 const double h)
const {
152 stepper.momentum(state.stepping) +
156 if (newMomentum < state.options.momentumCutOff) {
161 state.stepping.derivative(7) =
162 -std::sqrt(state.options.mass * state.options.mass +
163 newMomentum * newMomentum) *
164 g / (newMomentum * newMomentum * newMomentum);
167 state.stepping.p = newMomentum;
169 state.stepping.derivative(3) =
170 std::hypot(1, state.options.mass / newMomentum);
172 state.stepping.t += (h / 6.) * (
tKi[0] + 2. * (
tKi[1] +
tKi[2]) +
tKi[3]);
190 template <
typename propagator_state_t,
typename stepper_t>
191 bool finalize(propagator_state_t& state,
const stepper_t& stepper,
205 template <
typename propagator_state_t,
typename stepper_t>
228 auto& sd = state.stepping.stepData;
229 auto dir = stepper.direction(state.stepping);
231 D = FreeMatrix::Identity();
232 const double half_h = h * 0.5;
236 auto dFdT = D.block<3, 3>(0, 4);
237 auto dFdL = D.block<3, 1>(0, 7);
239 auto dGdT = D.block<3, 3>(4, 4);
240 auto dGdL = D.block<3, 1>(4, 7);
253 std::array<double, 4> jdL;
257 dk1dL = dir.cross(sd.B_first);
259 jdL[1] =
dLdl[1] * (1. + half_h * jdL[0]);
260 dk2dL = (1. + half_h * jdL[0]) * (dir + half_h * sd.k1).cross(sd.B_middle) +
261 qop[1] * half_h * dk1dL.cross(sd.B_middle);
263 jdL[2] =
dLdl[2] * (1. + half_h * jdL[1]);
264 dk3dL = (1. + half_h * jdL[1]) * (dir + half_h * sd.k2).cross(sd.B_middle) +
265 qop[2] * half_h * dk2dL.cross(sd.B_middle);
267 jdL[3] =
dLdl[3] * (1. + h * jdL[2]);
268 dk4dL = (1. + h * jdL[2]) * (dir + h * sd.k3).cross(sd.B_last) +
269 qop[3] * h * dk3dL.cross(sd.B_last);
271 dk1dT(0, 1) = sd.B_first.z();
272 dk1dT(0, 2) = -sd.B_first.y();
273 dk1dT(1, 0) = -sd.B_first.z();
274 dk1dT(1, 2) = sd.B_first.x();
275 dk1dT(2, 0) = sd.B_first.y();
276 dk1dT(2, 1) = -sd.B_first.x();
279 dk2dT += half_h * dk1dT;
282 dk3dT += half_h * dk2dT;
289 dFdT += h / 6. * (dk1dT + dk2dT + dk3dT);
292 dFdL = h * h / 6. * (dk1dL + dk2dL + dk3dL);
294 dGdT += h / 6. * (dk1dT + 2. * (dk2dT + dk3dT) + dk4dT);
296 dGdL = h / 6. * (dk1dL + 2. * (dk2dL + dk3dL) + dk4dL);
299 D(7, 7) += (h / 6.) * (jdL[0] + 2. * (jdL[1] + jdL[2]) + jdL[3]);
310 double dtp1dl =
qop[0] * state.options.mass * state.options.mass /
311 std::hypot(1,
qop[0] * state.options.mass);
321 double dtp2dl = qopNew * state.options.mass * state.options.mass /
322 std::hypot(1, qopNew * state.options.mass);
323 qopNew =
qop[0] + half_h * Lambdappi[1];
332 double dtp3dl = qopNew * state.options.mass * state.options.mass /
333 std::hypot(1, qopNew * state.options.mass);
334 qopNew =
qop[0] + half_h * Lambdappi[2];
335 double dtp4dl = qopNew * state.options.mass * state.options.mass /
336 std::hypot(1, qopNew * state.options.mass);
342 D(3, 7) = (h / 6.) * (dtp1dl + 2. * (dtp2dl + dtp3dl) + dtp4dl);
351 template <
typename propagator_state_t>
357 if (state.options.meanEnergyLoss) {
359 state.options.mass,
qop[0]);
364 state.options.mass,
qop[0]);
369 if (state.stepping.covTransport) {
372 if (state.options.includeGgradient) {
373 if (state.options.meanEnergyLoss) {
375 slab, state.options.absPdgCode, state.options.mass,
qop[0]);
379 slab, state.options.absPdgCode, state.options.mass,
qop[0]);
398 template <
typename stepper_state_t,
typename stepper_t>
400 const stepper_state_t& state,
const stepper_t& stepper,
408 if (state.covTransport) {
417 template <
typename action_list_t = ActionList<>,
418 typename aborter_list_t = AbortList<>>
431 std::reference_wrapper<const GeometryContext>
gctx,
432 std::reference_wrapper<const MagneticFieldContext> mctx,
450 template <
typename extended_aborter_list_t>
452 extended_aborter_list_t aborters)
const {
471 eoptions.
abortList = std::move(aborters);