9 #include <boost/test/test_tools.hpp>
10 #include <boost/test/unit_test.hpp>
48 #include <type_traits>
54 using namespace Acts::UnitLiterals;
63 : stepping(std::
move(stepperState)) {}
79 static constexpr
auto eps = 1024 * std::numeric_limits<double>::epsilon();
86 std::make_shared<ConstantBField>(
Vector3(0.1_T, -0.2_T, 2_T));
93 static constexpr
auto absMom = 1_GeV;
112 BOOST_CHECK(!
state.covTransport);
113 BOOST_CHECK_EQUAL(
state.covariance,
nullptr);
114 BOOST_CHECK_EQUAL(
state.pVector[0],
pos.x());
115 BOOST_CHECK_EQUAL(
state.pVector[1],
pos.y());
116 BOOST_CHECK_EQUAL(
state.pVector[2],
pos.z());
117 BOOST_CHECK_EQUAL(
state.pVector[3],
time);
122 BOOST_CHECK_EQUAL(
state.pathAccumulated, 0.);
124 BOOST_CHECK_EQUAL(
state.previousStepSize, 0.);
136 BOOST_CHECK(
state.covTransport);
137 BOOST_CHECK_EQUAL(*
state.covariance,
cov);
138 BOOST_CHECK_EQUAL(
state.pVector[0],
pos.x());
139 BOOST_CHECK_EQUAL(
state.pVector[1],
pos.y());
140 BOOST_CHECK_EQUAL(
state.pVector[2],
pos.z());
141 BOOST_CHECK_EQUAL(
state.pVector[3],
time);
146 BOOST_CHECK_EQUAL(
state.pathAccumulated, 0.);
148 BOOST_CHECK_EQUAL(
state.previousStepSize, 0.);
177 auto newPos4 = (
pos4 +
Vector4(1_mm, 2_mm, 3_mm, 20_ns)).eval();
178 auto newPos = newPos4.segment<3>(
ePos0);
179 auto newTime = newPos4[
eTime];
181 auto newAbsMom = 0.9 *
absMom;
184 auto plane = Surface::makeShared<PlaneSurface>(newPos, newUnitDir);
201 state.state_ready =
false;
202 BOOST_CHECK(params.covariance().has_value());
203 stepper.update(
state, freeParams, params.parameters(), *params.covariance(),
221 auto newPos = (
pos +
Vector3(1_mm, 2_mm, 3_mm)).eval();
222 auto newTime =
time + 20_ns;
224 auto newAbsMom = 0.9 *
absMom;
226 stepper.update(
state, newPos, newUnitDir,
charge / newAbsMom, newTime);
250 BOOST_CHECK_EQUAL(pars.charge(),
charge);
251 BOOST_CHECK(pars.covariance().has_value());
252 BOOST_CHECK_NE(*pars.covariance(),
cov);
273 BOOST_CHECK_EQUAL(pars.charge(),
charge);
274 BOOST_CHECK(pars.covariance().has_value());
275 BOOST_CHECK_NE(*pars.covariance(),
cov);
293 auto res = stepper.step(state,
navigator);
294 BOOST_CHECK(res.ok());
297 auto h = res.value();
303 BOOST_CHECK_LT(0, deltaPos.norm());
306 BOOST_CHECK_LT(0, std::abs(deltaTime));
309 BOOST_CHECK_LT(projDir, 1);
327 auto res = stepper.step(state,
navigator);
328 BOOST_CHECK(res.ok());
331 auto h = res.value();
337 BOOST_CHECK_LT(0, deltaPos.norm());
340 BOOST_CHECK_LT(0, std::abs(deltaTime));
343 BOOST_CHECK_LT(projDir, 1);
349 stepper.transportCovarianceToCurvilinear(state.
stepping);
367 Vector3 newPos(1.5, -2.5, 3.5);
368 auto newAbsMom = 4.2 *
absMom;
369 double newTime = 7.5;
370 double newCharge = 1.;
373 newCharge / newAbsMom, newCov,
380 auto copyState = [&](
auto&
field,
const auto& other) {
381 using field_t = std::decay_t<decltype(field)>;
385 copy.state_ready = other.state_ready;
386 copy.useJacobian = other.useJacobian;
387 copy.step = other.step;
388 copy.maxPathLength = other.maxPathLength;
389 copy.mcondition = other.mcondition;
390 copy.needgradient = other.needgradient;
391 copy.newfield = other.newfield;
392 copy.field = other.field;
393 copy.pVector = other.pVector;
396 copy.covariance = other.covariance;
397 copy.covTransport = other.covTransport;
400 copy.pathAccumulated = other.pathAccumulated;
401 copy.stepSize = other.stepSize;
402 copy.previousStepSize = other.previousStepSize;
403 copy.tolerance = other.tolerance;
406 MagneticFieldProvider::Cache::make<typename field_t::Cache>(
407 other.fieldCache.template get<typename field_t::Cache>());
409 copy.geoContext = other.geoContext;
410 copy.debug = other.debug;
411 copy.debugString = other.debugString;
412 copy.debugPfxWidth = other.debugPfxWidth;
413 copy.debugMsgWidth = other.debugMsgWidth;
425 BOOST_CHECK_EQUAL(*stateCopy.
covariance, newCov);
426 BOOST_CHECK_EQUAL(stepper.
position(stateCopy),
427 freeParams.template segment<3>(
eFreePos0));
428 BOOST_CHECK_EQUAL(stepper.
direction(stateCopy),
429 freeParams.template segment<3>(
eFreeDir0).normalized());
433 BOOST_CHECK_EQUAL(stepper.
time(stateCopy), freeParams[
eFreeTime]);
446 BOOST_CHECK_EQUAL(*stateCopy.
covariance, newCov);
447 BOOST_CHECK_EQUAL(stepper.
position(stateCopy),
448 freeParams.template segment<3>(
eFreePos0));
449 BOOST_CHECK_EQUAL(stepper.
direction(stateCopy),
450 freeParams.template segment<3>(
eFreeDir0).normalized());
452 std::abs(1. / freeParams[eFreeQOverP]));
454 BOOST_CHECK_EQUAL(stepper.
time(stateCopy), freeParams[
eFreeTime]);
457 std::numeric_limits<double>::max());
468 BOOST_CHECK_EQUAL(*stateCopy.
covariance, newCov);
469 BOOST_CHECK_EQUAL(stepper.
position(stateCopy),
470 freeParams.template segment<3>(
eFreePos0));
471 BOOST_CHECK_EQUAL(stepper.
direction(stateCopy),
472 freeParams.template segment<3>(
eFreeDir0).normalized());
474 std::abs(1. / freeParams[eFreeQOverP]));
476 BOOST_CHECK_EQUAL(stepper.
time(stateCopy), freeParams[
eFreeTime]);
479 std::numeric_limits<double>::max());
487 newPos << 0.5, -1.5, 0.;
491 newCov = 10.9 * Covariance::Identity();
493 auto disc = Surface::makeShared<DiscSurface>(trafo);
501 BOOST_CHECK(boundDisc.covariance().has_value());
502 stepper.resetState(stateDisc, boundDisc.
parameters(), *boundDisc.covariance(),
503 boundDisc.referenceSurface());
510 newPos << -2.06155, -2.06155, 3.5;
514 newCov = 8.7 * Covariance::Identity();
515 auto perigee = Surface::makeShared<PerigeeSurface>(trafo);
524 BOOST_CHECK(boundPerigee.covariance().has_value());
525 stepper.resetState(statePerigee, boundPerigee.
parameters(),
526 *boundPerigee.covariance(),
527 boundPerigee.referenceSurface());
534 auto straw = Surface::makeShared<StrawSurface>(trafo);
542 BOOST_CHECK(boundStraw.covariance().has_value());
543 stepper.resetState(stateStraw, boundStraw.
parameters(),
544 *boundStraw.covariance(), boundStraw.referenceSurface());
548 BOOST_CHECK_EQUAL_COLLECTIONS(
564 stepper.setStepSize(
state, -5_cm);
566 BOOST_CHECK_EQUAL(
state.stepSize.value(), -5_cm);
568 stepper.releaseStepSize(
state);
582 auto target = Surface::makeShared<PlaneSurface>(
589 stepper.updateStepSize(
600 stepper.updateStepSize(
610 BOOST_AUTO_TEST_SUITE_END()