9 #include <boost/test/unit_test.hpp>
39 namespace tt = boost::test_tools;
67 static constexpr
auto eps = 2 * std::numeric_limits<double>::epsilon();
92 BOOST_CHECK_EQUAL(slsState.
jacToGlobal, BoundToFreeMatrix::Zero());
93 BOOST_CHECK_EQUAL(slsState.
jacTransport, FreeMatrix::Identity());
94 BOOST_CHECK_EQUAL(slsState.
derivative, FreeVector::Zero());
96 BOOST_CHECK_EQUAL(slsState.
cov, Covariance::Zero());
105 BOOST_CHECK_EQUAL(slsState.
tolerance, tolerance);
119 BOOST_CHECK_NE(slsState.
jacToGlobal, BoundToFreeMatrix::Zero());
121 BOOST_CHECK_EQUAL(slsState.
cov, cov);
154 BOOST_CHECK_EQUAL(sls.
time(slsState),
time);
167 BOOST_CHECK_EQUAL(sls.
outputStepSize(slsState), originalStepSize);
171 auto curvPars = std::get<0>(curvState);
176 BOOST_CHECK(curvPars.covariance().has_value());
177 BOOST_CHECK_NE(*curvPars.covariance(),
cov);
185 double newTime(321.);
186 sls.
update(slsState, newPos, newMom.normalized(), charge / newMom.norm(),
192 BOOST_CHECK_EQUAL(sls.
time(slsState), newTime);
197 BOOST_CHECK_NE(slsState.
cov, cov);
198 BOOST_CHECK_NE(slsState.
jacToGlobal, BoundToFreeMatrix::Zero());
199 BOOST_CHECK_EQUAL(slsState.
jacTransport, FreeMatrix::Identity());
200 BOOST_CHECK_EQUAL(slsState.
derivative, FreeVector::Zero());
206 ps.stepping.covTransport =
false;
208 BOOST_CHECK_EQUAL(ps.stepping.stepSize.value(),
stepSize);
209 BOOST_CHECK_EQUAL(ps.stepping.stepSize.value(), h *
navDir);
211 BOOST_CHECK_GT(sls.
position(ps.stepping).norm(), newPos.norm());
215 BOOST_CHECK_LT(sls.
time(ps.stepping), newTime);
216 BOOST_CHECK_EQUAL(ps.stepping.derivative, FreeVector::Zero());
217 BOOST_CHECK_EQUAL(ps.stepping.jacTransport, FreeMatrix::Identity());
219 ps.stepping.covTransport =
true;
221 BOOST_CHECK_EQUAL(ps.stepping.stepSize.value(),
stepSize);
222 BOOST_CHECK_EQUAL(h2, h);
224 BOOST_CHECK_GT(sls.
position(ps.stepping).norm(), newPos.norm());
228 BOOST_CHECK_LT(sls.
time(ps.stepping), newTime);
229 BOOST_CHECK_NE(ps.stepping.derivative, FreeVector::Zero());
230 BOOST_CHECK_NE(ps.stepping.jacTransport, FreeMatrix::Identity());
237 double absMom2 = 8.5;
241 charge2 / absMom2, cov2,
254 BOOST_CHECK_NE(slsStateCopy.
jacToGlobal, BoundToFreeMatrix::Zero());
255 BOOST_CHECK_NE(slsStateCopy.
jacToGlobal, ps.stepping.jacToGlobal);
256 BOOST_CHECK_EQUAL(slsStateCopy.
jacTransport, FreeMatrix::Identity());
257 BOOST_CHECK_EQUAL(slsStateCopy.
derivative, FreeVector::Zero());
259 BOOST_CHECK_EQUAL(slsStateCopy.
cov, cov2);
261 freeParams.template segment<3>(
eFreePos0), 1
e-6);
263 freeParams.template segment<3>(
eFreeDir0).normalized(), 1
e-6);
269 BOOST_CHECK_EQUAL(slsStateCopy.
stepSize.
value(), navDir * stepSize2);
271 ps.stepping.previousStepSize);
272 BOOST_CHECK_EQUAL(slsStateCopy.
tolerance, ps.stepping.tolerance);
275 slsStateCopy = ps.stepping;
279 BOOST_CHECK_NE(slsStateCopy.
jacToGlobal, BoundToFreeMatrix::Zero());
280 BOOST_CHECK_NE(slsStateCopy.
jacToGlobal, ps.stepping.jacToGlobal);
281 BOOST_CHECK_EQUAL(slsStateCopy.
jacTransport, FreeMatrix::Identity());
282 BOOST_CHECK_EQUAL(slsStateCopy.
derivative, FreeVector::Zero());
284 BOOST_CHECK_EQUAL(slsStateCopy.
cov, cov2);
286 freeParams.template segment<3>(
eFreePos0), 1
e-6);
288 freeParams.template segment<3>(
eFreeDir0), 1
e-6);
290 std::abs(1. / freeParams[eFreeQOverP]), 1
e-6);
295 std::numeric_limits<double>::max());
297 ps.stepping.previousStepSize);
298 BOOST_CHECK_EQUAL(slsStateCopy.
tolerance, ps.stepping.tolerance);
301 slsStateCopy = ps.stepping;
305 BOOST_CHECK_NE(slsStateCopy.
jacToGlobal, BoundToFreeMatrix::Zero());
306 BOOST_CHECK_NE(slsStateCopy.
jacToGlobal, ps.stepping.jacToGlobal);
307 BOOST_CHECK_EQUAL(slsStateCopy.
jacTransport, FreeMatrix::Identity());
308 BOOST_CHECK_EQUAL(slsStateCopy.
derivative, FreeVector::Zero());
310 BOOST_CHECK_EQUAL(slsStateCopy.
cov, cov2);
312 freeParams.template segment<3>(
eFreePos0), 1
e-6);
314 freeParams.template segment<3>(
eFreeDir0).normalized(), 1
e-6);
316 std::abs(1. / freeParams[eFreeQOverP]), 1
e-6);
321 std::numeric_limits<double>::max());
323 ps.stepping.previousStepSize);
324 BOOST_CHECK_EQUAL(slsStateCopy.
tolerance, ps.stepping.tolerance);
327 auto plane = Surface::makeShared<PlaneSurface>(
pos, dir);
337 Surface::makeShared<PlaneSurface>(pos + navDir * 2. * dir, dir);
367 CHECK_CLOSE_ABS(boundPars.position(tgContext), bp.position(tgContext), 1
e-6);
371 BOOST_CHECK(boundPars.covariance().has_value());
372 BOOST_CHECK_NE(*boundPars.covariance(),
cov);
379 BOOST_CHECK_NE(slsState.
cov, cov);
380 BOOST_CHECK_NE(slsState.
jacToGlobal, BoundToFreeMatrix::Zero());
381 BOOST_CHECK_EQUAL(slsState.
jacTransport, FreeMatrix::Identity());
382 BOOST_CHECK_EQUAL(slsState.
derivative, FreeVector::Zero());
386 bp.referenceSurface(),
tgContext, bp.parameters());
390 BOOST_CHECK(bp.covariance().has_value());
391 sls.
update(slsState, freeParams, bp.parameters(), 2 * (*bp.covariance()),