32 using namespace Acts::UnitLiterals;
35 template <
typename bfield_t>
40 using BoundState = std::tuple<BoundTrackParameters, Jacobian, double>;
42 std::tuple<CurvilinearTrackParameters, Jacobian, double>;
61 template <
typename Parameters>
62 State(std::reference_wrapper<const GeometryContext>
gctx,
63 std::reference_wrapper<const MagneticFieldContext> mctx,
84 const auto pos = pars.position(gctx);
85 const auto Vp = pars.parameters();
87 double Sf, Cf, Ce, Se;
89 Cf =
cos(Vp[eBoundPhi]);
91 Ce =
cos(Vp[eBoundTheta]);
96 pVector[3] = pars.time();
103 if (
std::abs(pVector[7]) < .000000000000001) {
104 pVector[7] < 0. ? pVector[7] = -.000000000000001
105 : pVector[7] = .000000000000001;
109 if (pars.covariance()) {
114 const auto transform = pars.referenceSurface().referenceFrame(
147 pVector[28] = -Sf * Se;
148 pVector[36] = Cf * Ce;
154 pVector[29] = Cf * Se;
155 pVector[37] = Sf * Ce;
179 const auto&
surface = pars.referenceSurface();
182 double lCf =
cos(Vp[1]);
183 double lSf = sin(Vp[1]);
186 double d0 = lCf * Ax[0] + lSf * Ay[0];
187 double d1 = lCf * Ax[1] + lSf * Ay[1];
188 double d2 = lCf * Ax[2] + lSf * Ay[2];
192 pVector[16] = Vp[0] * (lCf * Ay[0] - lSf * Ax[0]);
193 pVector[17] = Vp[0] * (lCf * Ay[1] - lSf * Ax[1]);
194 pVector[18] = Vp[0] * (lCf * Ay[2] - lSf * Ax[2]);
209 double PC = pVector[4] * C[0] + pVector[5] * C[1] + pVector[6] * C[2];
212 double Bx2 = -A[2] * pVector[29];
213 double Bx3 = A[1] * pVector[38] - A[2] * pVector[37];
215 double By2 = A[2] * pVector[28];
216 double By3 = A[2] * pVector[36] - A[0] * pVector[38];
218 double Bz2 = A[0] * pVector[29] - A[1] * pVector[28];
219 double Bz3 = A[0] * pVector[37] - A[1] * pVector[36];
221 double B2 = B[0] * Bx2 + B[1] * By2 + B[2] * Bz2;
222 double B3 = B[0] * Bx3 + B[1] * By3 + B[2] * Bz3;
224 Bx2 = (Bx2 - B[0] * B2) * Bn;
225 Bx3 = (Bx3 - B[0] * B3) * Bn;
226 By2 = (By2 - B[1] * B2) * Bn;
227 By3 = (By3 - B[1] * B3) * Bn;
228 Bz2 = (Bz2 - B[2] * B2) * Bn;
229 Bz3 = (Bz3 - B[2] * B3) * Bn;
232 pVector[24] = Bx2 * Vp[0];
233 pVector[32] = Bx3 * Vp[0];
234 pVector[25] = By2 * Vp[0];
235 pVector[33] = By3 * Vp[0];
236 pVector[26] = Bz2 * Vp[0];
237 pVector[34] = Bz3 * Vp[0];
245 bool state_ready =
false;
274 bool covTransport =
false;
278 double pathAccumulated = 0.;
284 double previousStepSize = 0.;
299 std::string debugString =
"";
301 size_t debugPfxWidth = 30;
302 size_t debugMsgWidth = 50;
333 double Sf, Cf, Ce, Se;
335 Cf =
cos(boundParams[eBoundPhi]);
337 Ce =
cos(boundParams[eBoundTheta]);
404 double lSf = sin(boundParams[eBoundLoc1]);
407 double d0 = lCf * Ax[0] + lSf * Ay[0];
408 double d1 = lCf * Ax[1] + lSf * Ay[1];
409 double d2 = lCf * Ax[2] + lSf * Ay[2];
434 double Bx2 = -A[2] * state.
pVector[29];
437 double By2 = A[2] * state.
pVector[28];
443 double B2 = B[0] * Bx2 + B[1] * By2 + B[2] * Bz2;
444 double B3 = B[0] * Bx3 + B[1] * By3 + B[2] * Bz3;
446 Bx2 = (Bx2 - B[0] * B2) * Bn;
447 Bx3 = (Bx3 - B[0] * B3) * Bn;
448 By2 = (By2 - B[1] * B2) * Bn;
449 By3 = (By3 - B[1] * B3) * Bn;
450 Bz2 = (Bz2 - B[2] * B2) * Bn;
451 Bz3 = (Bz3 - B[2] * B3) * Bn;
490 return state.
pVector[7] > 0. ? 1. : -1.;
513 return detail::updateSingleSurfaceStatus<AtlasStepper>(*
this, state,
525 template <
typename object_
intersection_t>
526 void updateStepSize(
State& state,
const object_intersection_t& oIntersection,
528 detail::updateSingleStepSize<AtlasStepper>(state, oIntersection,
release);
579 const auto qOverP = state.
pVector[7];
582 std::optional<Covariance> covOpt = std::nullopt;
590 pos4, dir, qOverP, std::move(covOpt));
618 const auto qOverP = state.
pVector[7];
620 std::optional<Covariance> covOpt = std::nullopt;
643 state.
pVector[4] = direction.x();
644 state.
pVector[5] = direction.y();
645 state.
pVector[6] = direction.z();
651 : state.
pVector[7] = .000000000000001;
670 const Vector3D& udirection,
double up,
double time)
const {
672 state.
pVector[0] = uposition[0];
673 state.
pVector[1] = uposition[1];
674 state.
pVector[2] = uposition[2];
676 state.
pVector[4] = udirection[0];
677 state.
pVector[5] = udirection[1];
678 state.
pVector[6] = udirection[2];
691 for (
unsigned int i = 0; i < 60; ++i) {
695 double p = 1. / P[7];
703 double An = sqrt(P[4] * P[4] + P[5] * P[5]);
715 double Ay[3] = {-Ax[1] * P[6], Ax[0] * P[6], An};
716 double S[3] = {P[4], P[5], P[6]};
718 double A = P[4] * S[0] + P[5] * S[1] + P[6] * S[2];
726 double s0 = P[8] * S[0] + P[9] * S[1] + P[10] * S[2];
727 double s1 = P[16] * S[0] + P[17] * S[1] + P[18] * S[2];
728 double s2 = P[24] * S[0] + P[25] * S[1] + P[26] * S[2];
729 double s3 = P[32] * S[0] + P[33] * S[1] + P[34] * S[2];
730 double s4 = P[40] * S[0] + P[41] * S[1] + P[42] * S[2];
734 P[10] -= (s0 * P[6]);
735 P[11] -= (s0 * P[59]);
736 P[12] -= (s0 * P[56]);
737 P[13] -= (s0 * P[57]);
738 P[14] -= (s0 * P[58]);
739 P[16] -= (s1 * P[4]);
740 P[17] -= (s1 * P[5]);
741 P[18] -= (s1 * P[6]);
742 P[19] -= (s1 * P[59]);
743 P[20] -= (s1 * P[56]);
744 P[21] -= (s1 * P[57]);
745 P[22] -= (s1 * P[58]);
746 P[24] -= (s2 * P[4]);
747 P[25] -= (s2 * P[5]);
748 P[26] -= (s2 * P[6]);
749 P[27] -= (s2 * P[59]);
750 P[28] -= (s2 * P[56]);
751 P[29] -= (s2 * P[57]);
752 P[30] -= (s2 * P[58]);
753 P[32] -= (s3 * P[4]);
754 P[33] -= (s3 * P[5]);
755 P[34] -= (s3 * P[6]);
756 P[35] -= (s3 * P[59]);
757 P[36] -= (s3 * P[56]);
758 P[37] -= (s3 * P[57]);
759 P[38] -= (s3 * P[58]);
760 P[40] -= (s4 * P[4]);
761 P[41] -= (s4 * P[5]);
762 P[42] -= (s4 * P[6]);
763 P[43] -= (s4 * P[59]);
764 P[44] -= (s4 * P[56]);
765 P[45] -= (s4 * P[57]);
766 P[46] -= (s4 * P[58]);
768 double P3, P4,
C = P[4] * P[4] + P[5] * P[5];
782 state.
jacobian[0] = Ax[0] * P[8] + Ax[1] * P[9];
783 state.
jacobian[1] = Ax[0] * P[16] + Ax[1] * P[17];
784 state.
jacobian[2] = Ax[0] * P[24] + Ax[1] * P[25];
785 state.
jacobian[3] = Ax[0] * P[32] + Ax[1] * P[33];
786 state.
jacobian[4] = Ax[0] * P[40] + Ax[1] * P[41];
789 state.
jacobian[6] = Ay[0] * P[8] + Ay[1] * P[9] + Ay[2] * P[10];
791 Ay[0] * P[16] + Ay[1] * P[17] + Ay[2] * P[18];
793 Ay[0] * P[24] + Ay[1] * P[25] + Ay[2] * P[26];
795 Ay[0] * P[32] + Ay[1] * P[33] + Ay[2] * P[34];
797 Ay[0] * P[40] + Ay[1] * P[41] + Ay[2] * P[42];
800 state.
jacobian[12] = P3 * P[13] - P4 * P[12];
801 state.
jacobian[13] = P3 * P[21] - P4 * P[20];
802 state.
jacobian[14] = P3 * P[29] - P4 * P[28];
803 state.
jacobian[15] = P3 * P[37] - P4 * P[36];
804 state.
jacobian[16] = P3 * P[45] - P4 * P[44];
828 Eigen::Map<Eigen::Matrix<double, eBoundSize, eBoundSize, Eigen::RowMajor>>
854 double Ax[3] = {fFrame(0, 0), fFrame(1, 0), fFrame(2, 0)};
855 double Ay[3] = {fFrame(0, 1), fFrame(1, 1), fFrame(2, 1)};
856 double S[3] = {fFrame(0, 2), fFrame(1, 2), fFrame(2, 2)};
896 double a = (1. -
d) * (1. + d);
902 double X = d * Ay[0] - state.
pVector[4];
903 double Y = d * Ay[1] - state.
pVector[5];
904 double Z = d * Ay[2] - state.
pVector[6];
907 double d0 = state.
pVector[12] * Ay[0] + state.
pVector[13] * Ay[1] +
909 double d1 = state.
pVector[20] * Ay[0] + state.
pVector[21] * Ay[1] +
911 double d2 = state.
pVector[28] * Ay[0] + state.
pVector[29] * Ay[1] +
913 double d3 = state.
pVector[36] * Ay[0] + state.
pVector[37] * Ay[1] +
915 double d4 = state.
pVector[44] * Ay[0] + state.
pVector[45] * Ay[1] +
920 x * (d0 * Ay[0] - state.
pVector[12])) +
921 (y * (d0 * Ay[1] - state.
pVector[13]) +
922 z * (d0 * Ay[2] - state.
pVector[14]))) *
927 x * (d1 * Ay[0] - state.
pVector[20])) +
928 (y * (d1 * Ay[1] - state.
pVector[21]) +
929 z * (d1 * Ay[2] - state.
pVector[22]))) *
933 x * (d2 * Ay[0] - state.
pVector[28])) +
934 (y * (d2 * Ay[1] - state.
pVector[29]) +
935 z * (d2 * Ay[2] - state.
pVector[30]))) *
939 x * (d3 * Ay[0] - state.
pVector[36])) +
940 (y * (d3 * Ay[1] - state.
pVector[37]) +
941 z * (d3 * Ay[2] - state.
pVector[38]))) *
945 x * (d4 * Ay[0] - state.
pVector[44])) +
946 (y * (d4 * Ay[1] - state.
pVector[45]) +
947 z * (d4 * Ay[2] - state.
pVector[46]))) *
1005 double MA[3] = {Ax[0], Ax[1], Ax[2]};
1006 double MB[3] = {Ay[0], Ay[1], Ay[2]};
1014 double RC = d[0] * Ax[0] + d[1] * Ax[1] + d[2] * Ax[2];
1015 double RS = d[0] * Ay[0] + d[1] * Ay[1] + d[2] * Ay[2];
1016 double R2 = RC * RC + RS * RS;
1019 double Ri = 1. / sqrt(R2);
1020 MA[0] = (RC * Ax[0] + RS * Ay[0]) * Ri;
1021 MA[1] = (RC * Ax[1] + RS * Ay[1]) * Ri;
1022 MA[2] = (RC * Ax[2] + RS * Ay[2]) * Ri;
1023 MB[0] = (RC * Ay[0] - RS * Ax[0]) * (Ri = 1. / R2);
1024 MB[1] = (RC * Ay[1] - RS * Ax[1]) * Ri;
1025 MB[2] = (RC * Ay[2] - RS * Ax[2]) * Ri;
1085 Eigen::Map<Eigen::Matrix<double, eBoundSize, eBoundSize, Eigen::RowMajor>>
1093 template <
typename propagator_state_t>
1096 auto&
h = state.stepping.stepSize;
1097 bool Jac = state.stepping.useJacobian;
1099 double*
R = &(state.stepping.pVector[0]);
1100 double* A = &(state.stepping.pVector[4]);
1101 double* sA = &(state.stepping.pVector[56]);
1103 double Pi = 0.5 * state.stepping.pVector[7];
1108 if (state.stepping.newfield) {
1111 f0 = getField(state.stepping, pos);
1113 f0 = state.stepping.field;
1121 double S3 = (1. / 3.) *
h, S4 = .25 *
h, PS2 = Pi *
h;
1126 double H0[3] = {f0[0] * PS2, f0[1] * PS2, f0[2] * PS2};
1128 double A0 = A[1] * H0[2] - A[2] * H0[1];
1129 double B0 = A[2] * H0[0] - A[0] * H0[2];
1130 double C0 = A[0] * H0[1] - A[1] * H0[0];
1132 double A2 = A0 + A[0];
1133 double B2 = B0 + A[1];
1134 double C2 = C0 + A[2];
1136 double A1 = A2 + A[0];
1137 double B1 = B2 + A[1];
1138 double C1 = C2 + A[2];
1144 const Vector3D pos(R[0] + A1 * S4, R[1] + B1 * S4, R[2] + C1 * S4);
1146 f = getField(state.stepping, pos);
1152 double H1[3] = {f[0] * PS2, f[1] * PS2, f[2] * PS2};
1154 double A3 = (A[0] + B2 * H1[2]) - C2 * H1[1];
1155 double B3 = (A[1] + C2 * H1[0]) - A2 * H1[2];
1156 double C3 = (A[2] + A2 * H1[1]) - B2 * H1[0];
1158 double A4 = (A[0] + B3 * H1[2]) - C3 * H1[1];
1159 double B4 = (A[1] + C3 * H1[0]) - A3 * H1[2];
1160 double C4 = (A[2] + A3 * H1[1]) - B3 * H1[0];
1162 double A5 = 2. * A4 - A[0];
1163 double B5 = 2. * B4 - A[1];
1164 double C5 = 2. * C4 - A[2];
1170 const Vector3D pos(R[0] + h * A4, R[1] + h * B4, R[2] + h * C4);
1172 f = getField(state.stepping, pos);
1178 double H2[3] = {f[0] * PS2, f[1] * PS2, f[2] * PS2};
1180 double A6 = B5 * H2[2] - C5 * H2[1];
1181 double B6 = C5 * H2[0] - A5 * H2[2];
1182 double C6 = A5 * H2[1] - B5 * H2[0];
1192 if (EST > state.options.tolerance) {
1202 double A00 = A[0], A11 = A[1], A22 = A[2];
1204 A[0] = 2. * A3 + (A0 + A5 + A6);
1205 A[1] = 2. * B3 + (B0 + B5 + B6);
1206 A[2] = 2. * C3 + (C0 + C5 + C6);
1208 double D = (A[0] * A[0] + A[1] * A[1]) + (A[2] * A[2] - 9.);
1210 D = (1. / 3.) - ((1. / 648.) * D) * (12. - D);
1212 R[0] += (A2 + A3 + A4) * S3;
1213 R[1] += (B2 + B3 + B4) * S3;
1214 R[2] += (C2 + C3 + C4) * S3;
1223 state.stepping.pVector[3] +=
1224 h * std::hypot(1, state.options.mass /
momentum(state.stepping));
1225 state.stepping.pVector[59] =
1226 std::hypot(1, state.options.mass /
momentum(state.stepping));
1227 state.stepping.field = f;
1228 state.stepping.newfield =
false;
1232 h * state.options.mass * state.options.mass *
1235 std::hypot(1., state.options.mass /
momentum(state.stepping)));
1236 state.stepping.pVector[43] += dtdl;
1240 double* d2A = &state.stepping.pVector[28];
1241 double* d3A = &state.stepping.pVector[36];
1242 double* d4A = &state.stepping.pVector[44];
1243 double d2A0 = H0[2] * d2A[1] - H0[1] * d2A[2];
1244 double d2B0 = H0[0] * d2A[2] - H0[2] * d2A[0];
1245 double d2C0 = H0[1] * d2A[0] - H0[0] * d2A[1];
1246 double d3A0 = H0[2] * d3A[1] - H0[1] * d3A[2];
1247 double d3B0 = H0[0] * d3A[2] - H0[2] * d3A[0];
1248 double d3C0 = H0[1] * d3A[0] - H0[0] * d3A[1];
1249 double d4A0 = (A0 + H0[2] * d4A[1]) - H0[1] * d4A[2];
1250 double d4B0 = (B0 + H0[0] * d4A[2]) - H0[2] * d4A[0];
1251 double d4C0 = (C0 + H0[1] * d4A[0]) - H0[0] * d4A[1];
1252 double d2A2 = d2A0 + d2A[0];
1253 double d2B2 = d2B0 + d2A[1];
1254 double d2C2 = d2C0 + d2A[2];
1255 double d3A2 = d3A0 + d3A[0];
1256 double d3B2 = d3B0 + d3A[1];
1257 double d3C2 = d3C0 + d3A[2];
1258 double d4A2 = d4A0 + d4A[0];
1259 double d4B2 = d4B0 + d4A[1];
1260 double d4C2 = d4C0 + d4A[2];
1261 double d0 = d4A[0] - A00;
1262 double d1 = d4A[1] - A11;
1263 double d2 = d4A[2] - A22;
1264 double d2A3 = (d2A[0] + d2B2 * H1[2]) - d2C2 * H1[1];
1265 double d2B3 = (d2A[1] + d2C2 * H1[0]) - d2A2 * H1[2];
1266 double d2C3 = (d2A[2] + d2A2 * H1[1]) - d2B2 * H1[0];
1267 double d3A3 = (d3A[0] + d3B2 * H1[2]) - d3C2 * H1[1];
1268 double d3B3 = (d3A[1] + d3C2 * H1[0]) - d3A2 * H1[2];
1269 double d3C3 = (d3A[2] + d3A2 * H1[1]) - d3B2 * H1[0];
1270 double d4A3 = ((A3 + d0) + d4B2 * H1[2]) - d4C2 * H1[1];
1271 double d4B3 = ((B3 + d1) + d4C2 * H1[0]) - d4A2 * H1[2];
1272 double d4C3 = ((C3 + d2) + d4A2 * H1[1]) - d4B2 * H1[0];
1273 double d2A4 = (d2A[0] + d2B3 * H1[2]) - d2C3 * H1[1];
1274 double d2B4 = (d2A[1] + d2C3 * H1[0]) - d2A3 * H1[2];
1275 double d2C4 = (d2A[2] + d2A3 * H1[1]) - d2B3 * H1[0];
1276 double d3A4 = (d3A[0] + d3B3 * H1[2]) - d3C3 * H1[1];
1277 double d3B4 = (d3A[1] + d3C3 * H1[0]) - d3A3 * H1[2];
1278 double d3C4 = (d3A[2] + d3A3 * H1[1]) - d3B3 * H1[0];
1279 double d4A4 = ((A4 + d0) + d4B3 * H1[2]) - d4C3 * H1[1];
1280 double d4B4 = ((B4 + d1) + d4C3 * H1[0]) - d4A3 * H1[2];
1281 double d4C4 = ((C4 + d2) + d4A3 * H1[1]) - d4B3 * H1[0];
1282 double d2A5 = 2. * d2A4 - d2A[0];
1283 double d2B5 = 2. * d2B4 - d2A[1];
1284 double d2C5 = 2. * d2C4 - d2A[2];
1285 double d3A5 = 2. * d3A4 - d3A[0];
1286 double d3B5 = 2. * d3B4 - d3A[1];
1287 double d3C5 = 2. * d3C4 - d3A[2];
1288 double d4A5 = 2. * d4A4 - d4A[0];
1289 double d4B5 = 2. * d4B4 - d4A[1];
1290 double d4C5 = 2. * d4C4 - d4A[2];
1291 double d2A6 = d2B5 * H2[2] - d2C5 * H2[1];
1292 double d2B6 = d2C5 * H2[0] - d2A5 * H2[2];
1293 double d2C6 = d2A5 * H2[1] - d2B5 * H2[0];
1294 double d3A6 = d3B5 * H2[2] - d3C5 * H2[1];
1295 double d3B6 = d3C5 * H2[0] - d3A5 * H2[2];
1296 double d3C6 = d3A5 * H2[1] - d3B5 * H2[0];
1297 double d4A6 = d4B5 * H2[2] - d4C5 * H2[1];
1298 double d4B6 = d4C5 * H2[0] - d4A5 * H2[2];
1299 double d4C6 = d4A5 * H2[1] - d4B5 * H2[0];
1301 double* dR = &state.stepping.pVector[24];
1302 dR[0] += (d2A2 + d2A3 + d2A4) * S3;
1303 dR[1] += (d2B2 + d2B3 + d2B4) * S3;
1304 dR[2] += (d2C2 + d2C3 + d2C4) * S3;
1305 d2A[0] = ((d2A0 + 2. * d2A3) + (d2A5 + d2A6)) * (1. / 3.);
1306 d2A[1] = ((d2B0 + 2. * d2B3) + (d2B5 + d2B6)) * (1. / 3.);
1307 d2A[2] = ((d2C0 + 2. * d2C3) + (d2C5 + d2C6)) * (1. / 3.);
1309 dR = &state.stepping.pVector[32];
1310 dR[0] += (d3A2 + d3A3 + d3A4) * S3;
1311 dR[1] += (d3B2 + d3B3 + d3B4) * S3;
1312 dR[2] += (d3C2 + d3C3 + d3C4) * S3;
1313 d3A[0] = ((d3A0 + 2. * d3A3) + (d3A5 + d3A6)) * (1. / 3.);
1314 d3A[1] = ((d3B0 + 2. * d3B3) + (d3B5 + d3B6)) * (1. / 3.);
1315 d3A[2] = ((d3C0 + 2. * d3C3) + (d3C5 + d3C6)) * (1. / 3.);
1317 dR = &state.stepping.pVector[40];
1318 dR[0] += (d4A2 + d4A3 + d4A4) * S3;
1319 dR[1] += (d4B2 + d4B3 + d4B4) * S3;
1320 dR[2] += (d4C2 + d4C3 + d4C4) * S3;
1321 d4A[0] = ((d4A0 + 2. * d4A3) + (d4A5 + d4A6 + A6)) * (1. / 3.);
1322 d4A[1] = ((d4B0 + 2. * d4B3) + (d4B5 + d4B6 + B6)) * (1. / 3.);
1323 d4A[2] = ((d4C0 + 2. * d4C3) + (d4C5 + d4C6 + C6)) * (1. / 3.);
1326 state.stepping.pathAccumulated +=
h;
1331 state.stepping.pathAccumulated +=
h;
1339 double m_overstepLimit = -50_um;