35 std::array<double, 4>
dLdl;
37 std::array<double, 4>
qop;
39 std::array<double, 4>
dPds;
45 std::array<double, 4>
tKi;
60 template <
typename propagator_state_t,
typename stepper_t>
61 int bid(
const propagator_state_t& state,
const stepper_t&
stepper)
const {
63 if (stepper.charge(state.stepping) == 0. || state.options.mass == 0. ||
64 stepper.momentum(state.stepping) < state.options.momentumCutOff) {
69 if (!state.navigation.currentVolume ||
70 !state.navigation.currentVolume->volumeMaterial()) {
89 template <
typename propagator_state_t,
typename stepper_t>
90 bool k(
const propagator_state_t& state,
const stepper_t&
stepper,
92 const int i = 0,
const double h = 0.,
97 auto volumeMaterial = state.navigation.currentVolume->volumeMaterial();
99 material = (volumeMaterial->material(position));
105 knew =
qop[0] * stepper.direction(state.stepping).cross(bField);
109 (stepper.charge(state.stepping) * stepper.charge(state.stepping));
111 tKi[0] = std::hypot(1, state.options.mass *
qop[0]);
121 (stepper.direction(state.stepping) +
h * kprev).
cross(bField);
125 -qopNew * qopNew * qopNew *
g *
energy[i] /
126 (stepper.charge(state.stepping) * stepper.charge(state.stepping) *
128 tKi[i] = std::hypot(1, state.options.mass * qopNew);
129 kQoP[i] = Lambdappi[i];
144 template <
typename propagator_state_t,
typename stepper_t>
145 bool finalize(propagator_state_t& state,
const stepper_t& stepper,
146 const double h)
const {
149 stepper.momentum(state.stepping) +
153 if (newMomentum < state.options.momentumCutOff) {
158 state.stepping.derivative(7) =
159 -std::sqrt(state.options.mass * state.options.mass +
160 newMomentum * newMomentum) *
161 g / (newMomentum * newMomentum * newMomentum);
164 state.stepping.p = newMomentum;
166 state.stepping.derivative(3) =
167 std::hypot(1, state.options.mass / newMomentum);
169 state.stepping.t += (h / 6.) * (
tKi[0] + 2. * (
tKi[1] +
tKi[2]) +
tKi[3]);
187 template <
typename propagator_state_t,
typename stepper_t>
188 bool finalize(propagator_state_t& state,
const stepper_t& stepper,
202 template <
typename propagator_state_t,
typename stepper_t>
225 auto& sd = state.stepping.stepData;
226 auto dir = stepper.direction(state.stepping);
228 D = FreeMatrix::Identity();
229 const double half_h = h * 0.5;
233 auto dFdT = D.block<3, 3>(0, 4);
234 auto dFdL = D.block<3, 1>(0, 7);
236 auto dGdT = D.block<3, 3>(4, 4);
237 auto dGdL = D.block<3, 1>(4, 7);
250 std::array<double, 4> jdL;
254 dk1dL =
dir.cross(sd.B_first);
256 jdL[1] =
dLdl[1] * (1. + half_h * jdL[0]);
257 dk2dL = (1. + half_h * jdL[0]) * (
dir + half_h * sd.k1).cross(sd.B_middle) +
258 qop[1] * half_h * dk1dL.cross(sd.B_middle);
260 jdL[2] =
dLdl[2] * (1. + half_h * jdL[1]);
261 dk3dL = (1. + half_h * jdL[1]) * (
dir + half_h * sd.k2).cross(sd.B_middle) +
262 qop[2] * half_h * dk2dL.cross(sd.B_middle);
264 jdL[3] =
dLdl[3] * (1. + h * jdL[2]);
265 dk4dL = (1. + h * jdL[2]) * (
dir + h * sd.k3).cross(sd.B_last) +
266 qop[3] * h * dk3dL.cross(sd.B_last);
268 dk1dT(0, 1) = sd.B_first.z();
269 dk1dT(0, 2) = -sd.B_first.y();
270 dk1dT(1, 0) = -sd.B_first.z();
271 dk1dT(1, 2) = sd.B_first.x();
272 dk1dT(2, 0) = sd.B_first.y();
273 dk1dT(2, 1) = -sd.B_first.x();
276 dk2dT += half_h * dk1dT;
279 dk3dT += half_h * dk2dT;
286 dFdT += h / 6. * (dk1dT + dk2dT + dk3dT);
289 dFdL = h * h / 6. * (dk1dL + dk2dL + dk3dL);
291 dGdT += h / 6. * (dk1dT + 2. * (dk2dT + dk3dT) + dk4dT);
293 dGdL = h / 6. * (dk1dL + 2. * (dk2dL + dk3dL) + dk4dL);
296 D(7, 7) += (h / 6.) * (jdL[0] + 2. * (jdL[1] + jdL[2]) + jdL[3]);
307 double dtp1dl =
qop[0] * state.options.mass * state.options.mass /
308 std::hypot(1,
qop[0] * state.options.mass);
318 double dtp2dl = qopNew * state.options.mass * state.options.mass /
319 std::hypot(1, qopNew * state.options.mass);
320 qopNew =
qop[0] + half_h * Lambdappi[1];
329 double dtp3dl = qopNew * state.options.mass * state.options.mass /
330 std::hypot(1, qopNew * state.options.mass);
331 qopNew =
qop[0] + half_h * Lambdappi[2];
332 double dtp4dl = qopNew * state.options.mass * state.options.mass /
333 std::hypot(1, qopNew * state.options.mass);
339 D(3, 7) = (h / 6.) * (dtp1dl + 2. * (dtp2dl + dtp3dl) + dtp4dl);
348 template <
typename propagator_state_t>
354 if (state.options.meanEnergyLoss) {
356 state.options.mass,
qop[0]);
361 state.options.mass,
qop[0]);
366 if (state.stepping.covTransport) {
369 if (state.options.includeGgradient) {
370 if (state.options.meanEnergyLoss) {
372 slab, state.options.absPdgCode, state.options.mass,
qop[0]);
376 slab, state.options.absPdgCode, state.options.mass,
qop[0]);
395 template <
typename stepper_state_t,
typename stepper_t>
397 const stepper_state_t& state,
const stepper_t& stepper,
405 if (state.covTransport) {
414 template <
typename action_list_t = ActionList<>,
415 typename aborter_list_t = AbortList<>>
428 std::reference_wrapper<const GeometryContext>
gctx,
429 std::reference_wrapper<const MagneticFieldContext> mctx)
446 template <
typename extended_aborter_list_t>
448 extended_aborter_list_t aborters)
const {
471 eoptions.
abortList = std::move(aborters);