16 using BoundState = std::tuple<BoundParameters, Jacobian, double>;
17 using CurvilinearState = std::tuple<CurvilinearParameters, Jacobian, double>;
26 const double x = direction(0);
27 const double y = direction(1);
28 const double z = direction(2);
30 const double cosTheta =
z;
31 const double sinTheta = sqrt(x * x + y * y);
32 const double invSinTheta = 1. / sinTheta;
33 const double cosPhi = x * invSinTheta;
34 const double sinPhi = y * invSinTheta;
39 jacToCurv(0, 0) = -sinPhi;
40 jacToCurv(0, 1) = cosPhi;
41 jacToCurv(1, 0) = -cosPhi * cosTheta;
42 jacToCurv(1, 1) = -sinPhi * cosTheta;
43 jacToCurv(1, 2) = sinTheta;
47 const double c = sqrt(y * y + z * z);
48 const double invC = 1. /
c;
49 jacToCurv(0, 1) = -z * invC;
50 jacToCurv(0, 2) = y * invC;
52 jacToCurv(1, 1) = -x * y * invC;
53 jacToCurv(1, 2) = -x * z * invC;
58 jacToCurv(2, 4) = -sinPhi * invSinTheta;
59 jacToCurv(2, 5) = cosPhi * invSinTheta;
60 jacToCurv(3, 4) = cosPhi * cosTheta;
61 jacToCurv(3, 5) = sinPhi * cosTheta;
62 jacToCurv(3, 6) = -sinTheta;
86 std::reference_wrapper<const GeometryContext>
geoContext,
92 auto rframeT = surface.initJacobianToLocal(geoContext, jacToLocal,
97 geoContext, parameters.segment<3>(
eFreePos0),
98 parameters.segment<3>(
eFreeDir0), rframeT, jacobianLocalToGlobal);
99 jacobianLocalToGlobal -= derivatives * sVec;
125 const ActsRowVectorD<3> normVec(direction);
128 jacobianLocalToGlobal.template topLeftCorner<3, eBoundParametersSize>();
129 jacobianLocalToGlobal -= derivatives * sfactors;
132 return freeToCurvilinearJacobian(direction);
146 void reinitializeJacobians(
147 std::reference_wrapper<const GeometryContext> geoContext,
155 transportJacobian = FreeMatrix::Identity();
156 derivatives = FreeVector::Zero();
157 jacobianLocalToGlobal = BoundToFreeMatrix::Zero();
163 surface.globalToLocal(geoContext, position, direction, loc);
167 surface.initJacobianToGlobal(geoContext, jacobianLocalToGlobal, position,
180 void reinitializeJacobians(
FreeMatrix& transportJacobian,
185 transportJacobian = FreeMatrix::Identity();
186 derivatives = FreeVector::Zero();
187 jacobianLocalToGlobal = BoundToFreeMatrix::Zero();
190 const double x = direction(0);
191 const double y = direction(1);
192 const double z = direction(2);
194 const double cosTheta =
z;
195 const double sinTheta = sqrt(x * x + y * y);
196 const double invSinTheta = 1. / sinTheta;
197 const double cosPhi = x * invSinTheta;
198 const double sinPhi = y * invSinTheta;
200 jacobianLocalToGlobal(0,
eLOC_0) = -sinPhi;
201 jacobianLocalToGlobal(0,
eLOC_1) = -cosPhi * cosTheta;
202 jacobianLocalToGlobal(1,
eLOC_0) = cosPhi;
203 jacobianLocalToGlobal(1,
eLOC_1) = -sinPhi * cosTheta;
204 jacobianLocalToGlobal(2,
eLOC_1) = sinTheta;
205 jacobianLocalToGlobal(3,
eT) = 1;
206 jacobianLocalToGlobal(4,
ePHI) = -sinTheta * sinPhi;
207 jacobianLocalToGlobal(4,
eTHETA) = cosTheta * cosPhi;
208 jacobianLocalToGlobal(5,
ePHI) = sinTheta * cosPhi;
209 jacobianLocalToGlobal(5,
eTHETA) = cosTheta * sinPhi;
210 jacobianLocalToGlobal(6,
eTHETA) = -sinTheta;
211 jacobianLocalToGlobal(7,
eQOP) = 1;
217 BoundState
boundState(std::reference_wrapper<const GeometryContext> geoContext,
221 const FreeVector& parameters,
bool covTransport,
222 double accumulatedPath,
const Surface& surface) {
224 std::optional<BoundSymMatrix> cov = std::nullopt;
227 transportJacobian, derivatives, jacobianLocalToGlobal,
228 parameters, surface);
229 cov = covarianceMatrix;
235 const double charge = std::copysign(1., parameters[eFreeQOverP]);
237 BoundParameters boundParameters(geoContext, cov, position, momentum, charge,
240 return std::make_tuple(std::move(boundParameters), jacobian, accumulatedPath);
250 bool covTransport,
double accumulatedPath) {
254 std::optional<BoundSymMatrix> cov = std::nullopt;
257 derivatives, jacobianLocalToGlobal, direction);
258 cov = covarianceMatrix;
263 const double charge = std::copysign(1., parameters[eFreeQOverP]);
268 return std::make_tuple(std::move(curvilinearParameters), jacobian,
277 jacobianLocalToGlobal = transportJacobian * jacobianLocalToGlobal;
279 surfaceDerivative(direction, jacobianLocalToGlobal, derivatives);
280 const Jacobian jacFull = jacToLocal * jacobianLocalToGlobal;
283 covarianceMatrix = jacFull * covarianceMatrix * jacFull.transpose();
286 reinitializeJacobians(transportJacobian, derivatives, jacobianLocalToGlobal,
294 std::reference_wrapper<const GeometryContext> geoContext,
300 jacobianLocalToGlobal = transportJacobian * jacobianLocalToGlobal;
302 geoContext, parameters, jacobianLocalToGlobal, derivatives, surface);
303 const Jacobian jacFull = jacToLocal * jacobianLocalToGlobal;
306 covarianceMatrix = jacFull * covarianceMatrix * jacFull.transpose();
309 reinitializeJacobians(geoContext, transportJacobian, derivatives,
310 jacobianLocalToGlobal, parameters, surface);