20 using BoundState = std::tuple<BoundTrackParameters, Jacobian, double>;
21 using CurvilinearState =
22 std::tuple<CurvilinearTrackParameters, Jacobian, double>;
31 const double x = direction(0);
32 const double y = direction(1);
33 const double z = direction(2);
35 const double cosTheta =
z;
36 const double sinTheta = sqrt(x * x + y * y);
37 const double invSinTheta = 1. / sinTheta;
38 const double cosPhi = x * invSinTheta;
39 const double sinPhi = y * invSinTheta;
44 jacToCurv(0, 0) = -sinPhi;
45 jacToCurv(0, 1) = cosPhi;
46 jacToCurv(1, 0) = -cosPhi * cosTheta;
47 jacToCurv(1, 1) = -sinPhi * cosTheta;
48 jacToCurv(1, 2) = sinTheta;
52 const double c = sqrt(y * y + z * z);
53 const double invC = 1. /
c;
54 jacToCurv(0, 1) = -z * invC;
55 jacToCurv(0, 2) = y * invC;
57 jacToCurv(1, 1) = -x * y * invC;
58 jacToCurv(1, 2) = -x * z * invC;
63 jacToCurv(2, 4) = -sinPhi * invSinTheta;
64 jacToCurv(2, 5) = cosPhi * invSinTheta;
65 jacToCurv(3, 4) = cosPhi * cosTheta;
66 jacToCurv(3, 5) = sinPhi * cosTheta;
67 jacToCurv(3, 6) = -sinTheta;
91 std::reference_wrapper<const GeometryContext>
geoContext,
97 auto rframeT = surface.initJacobianToLocal(geoContext, jacToLocal,
102 geoContext, parameters.segment<3>(
eFreePos0),
103 parameters.segment<3>(
eFreeDir0), rframeT, jacobianLocalToGlobal);
104 jacobianLocalToGlobal -= derivatives * sVec;
130 const ActsRowVectorD<3> normVec(direction);
132 normVec * jacobianLocalToGlobal.template topLeftCorner<3, eBoundSize>();
133 jacobianLocalToGlobal -= derivatives * sfactors;
136 return freeToCurvilinearJacobian(direction);
150 void reinitializeJacobians(
151 std::reference_wrapper<const GeometryContext> geoContext,
159 transportJacobian = FreeMatrix::Identity();
160 derivatives = FreeVector::Zero();
161 jacobianLocalToGlobal = BoundToFreeMatrix::Zero();
166 auto lpResult = surface.globalToLocal(geoContext, position, direction);
167 if (not lpResult.ok()) {
171 "Inconsistency in global to local transformation during propagation.")
173 auto loc = lpResult.value();
177 surface.initJacobianToGlobal(geoContext, jacobianLocalToGlobal, position,
190 void reinitializeJacobians(
FreeMatrix& transportJacobian,
195 transportJacobian = FreeMatrix::Identity();
196 derivatives = FreeVector::Zero();
197 jacobianLocalToGlobal = BoundToFreeMatrix::Zero();
200 const double x = direction(0);
201 const double y = direction(1);
202 const double z = direction(2);
204 const double cosTheta =
z;
205 const double sinTheta = sqrt(x * x + y * y);
206 const double invSinTheta = 1. / sinTheta;
207 const double cosPhi = x * invSinTheta;
208 const double sinPhi = y * invSinTheta;
210 jacobianLocalToGlobal(0,
eBoundLoc0) = -sinPhi;
211 jacobianLocalToGlobal(0,
eBoundLoc1) = -cosPhi * cosTheta;
212 jacobianLocalToGlobal(1,
eBoundLoc0) = cosPhi;
213 jacobianLocalToGlobal(1,
eBoundLoc1) = -sinPhi * cosTheta;
214 jacobianLocalToGlobal(2,
eBoundLoc1) = sinTheta;
216 jacobianLocalToGlobal(4,
eBoundPhi) = -sinTheta * sinPhi;
217 jacobianLocalToGlobal(4,
eBoundTheta) = cosTheta * cosPhi;
218 jacobianLocalToGlobal(5,
eBoundPhi) = sinTheta * cosPhi;
219 jacobianLocalToGlobal(5,
eBoundTheta) = cosTheta * sinPhi;
227 BoundState
boundState(std::reference_wrapper<const GeometryContext> geoContext,
231 const FreeVector& parameters,
bool covTransport,
232 double accumulatedPath,
const Surface& surface) {
234 std::optional<BoundSymMatrix>
cov = std::nullopt;
237 transportJacobian, derivatives, jacobianLocalToGlobal,
238 parameters, surface);
239 cov = covarianceMatrix;
245 return std::make_tuple(
247 jacobian, accumulatedPath);
256 bool covTransport,
double accumulatedPath) {
260 std::optional<BoundSymMatrix>
cov = std::nullopt;
263 derivatives, jacobianLocalToGlobal, direction);
264 cov = covarianceMatrix;
273 pos4, direction, parameters[
eFreeQOverP], std::move(cov));
275 return std::make_tuple(std::move(curvilinearParams), jacobian,
284 jacobianLocalToGlobal = transportJacobian * jacobianLocalToGlobal;
286 surfaceDerivative(direction, jacobianLocalToGlobal, derivatives);
287 const Jacobian jacFull = jacToLocal * jacobianLocalToGlobal;
290 covarianceMatrix = jacFull * covarianceMatrix * jacFull.transpose();
293 reinitializeJacobians(transportJacobian, derivatives, jacobianLocalToGlobal,
301 std::reference_wrapper<const GeometryContext> geoContext,
307 jacobianLocalToGlobal = transportJacobian * jacobianLocalToGlobal;
309 geoContext, parameters, jacobianLocalToGlobal, derivatives, surface);
310 const Jacobian jacFull = jacToLocal * jacobianLocalToGlobal;
313 covarianceMatrix = jacFull * covarianceMatrix * jacFull.transpose();
316 reinitializeJacobians(geoContext, transportJacobian, derivatives,
317 jacobianLocalToGlobal, parameters, surface);