9 #include <boost/test/data/test_case.hpp>
10 #include <boost/test/tools/output_test_stream.hpp>
11 #include <boost/test/unit_test.hpp>
43 #include <system_error>
49 struct FreeToBoundCorrection;
53 namespace tt = boost::test_tools;
54 using namespace Acts::UnitLiterals;
65 struct PropagatorState {
71 using BoundState = std::tuple<BoundTrackParameters, Jacobian, double>;
73 std::tuple<CurvilinearTrackParameters, Jacobian, double>;
76 template <
typename,
typename>
98 double pathAccumulated = 0.;
104 double previousStepSize = 0.;
116 const double )
const {}
131 return (state.
q == 0 ? 1 : state.
q) / state.
p;
154 return detail::updateSingleSurfaceStatus<Stepper>(
158 template <
typename object_
intersection_t>
160 const object_intersection_t& oIntersection,
162 detail::updateSingleStepSize<Stepper>(
state, oIntersection, release);
167 bool release =
true)
const {
192 return bound.error();
202 state.
q / state.
p, std::nullopt,
230 static_assert(StepperConcept<Stepper>,
231 "Dummy stepper does not fulfill concept");
240 size_t debugPfxWidth = 30;
241 size_t debugMsgWidth = 50;
258 bool targetReached =
false;
273 template <
typename stepper_state_t>
274 void step(stepper_state_t& sstate) {
291 size_t navLay,
size_t navBound,
size_t extSurf) {
333 Vector4 position4(0., 0., 0, 0);
338 state.options.debug =
debug;
341 state.stepping.pos4 = position4;
342 state.stepping.dir = momentum.normalized();
361 nullptr,
nullptr,
nullptr,
nullptr,
362 nullptr,
nullptr,
nullptr));
377 nullptr,
nullptr,
nullptr,
nullptr,
378 nullptr,
nullptr,
nullptr));
390 state.navigation.navigationBreak =
true;
392 state.navigation.targetReached =
true;
396 nullptr,
nullptr,
nullptr,
nullptr,
397 nullptr,
nullptr,
nullptr));
400 state.navigation.targetReached =
false;
401 state.navigation.targetSurface =
nullptr;
405 nullptr,
nullptr,
nullptr,
nullptr,
406 nullptr,
nullptr,
nullptr));
410 startSurf->
center(state.geoContext);
411 const Surface* targetSurf = startSurf;
412 state.navigation.targetSurface = targetSurf;
416 state.navigation,
nullptr,
nullptr,
nullptr,
nullptr, targetSurf,
417 nullptr,
nullptr,
nullptr, targetSurf));
424 state.stepping.pos4 << 0., 0., 0., 0.;
427 state.geoContext, stepper.
position(state.stepping));
429 state.geoContext, stepper.
position(state.stepping));
433 startLay,
nullptr,
nullptr, startVol,
434 nullptr,
nullptr,
nullptr));
438 state.navigation.startSurface = startSurf;
442 state.navigation, worldVol, startVol, startLay, startSurf, startSurf,
443 startVol,
nullptr,
nullptr,
nullptr));
447 state.navigation.startVolume = startVol;
451 startLay,
nullptr,
nullptr, startVol,
452 nullptr,
nullptr,
nullptr));
475 Vector4 position4(0., 0., 0, 0);
480 state.options.debug =
debug;
483 state.stepping.pos4 = position4;
484 state.stepping.dir = momentum.normalized();
488 std::cout <<
"<<<<<<<<<<<<<<<<<<<<< FORWARD NAVIGATION >>>>>>>>>>>>>>>>>>"
500 BOOST_CHECK_NE(state.navigation.currentVolume,
nullptr);
502 BOOST_CHECK_EQUAL(state.navigation.currentVolume,
503 state.navigation.startVolume);
505 BOOST_CHECK_EQUAL(state.navigation.currentSurface,
nullptr);
507 BOOST_CHECK_EQUAL(state.navigation.navLayers.size(), 0
u);
511 BOOST_CHECK_EQUAL(state.navigation.navLayers.size(), 1
u);
513 BOOST_CHECK(state.navigation.navLayerIndex == 0);
515 double beamPipeR =
perp(state.navigation.navLayer().position());
520 std::cout <<
"<<< Test 1a >>> initialize at "
521 <<
toString(state.stepping.pos4) << std::endl;
522 std::cout << state.options.debugString << std::endl;
524 state.options.debugString =
"";
528 step(state.stepping);
534 BOOST_CHECK_EQUAL(state.navigation.currentVolume,
535 state.navigation.startVolume);
537 BOOST_CHECK_EQUAL(state.navigation.navLayers.size(), 1
u);
539 BOOST_CHECK(state.navigation.navLayerIndex == 0);
544 std::cout <<
"<<< Test 1b >>> step to the BeamPipe at "
545 <<
toString(state.stepping.pos4) << std::endl;
546 std::cout << state.options.debugString << std::endl;
547 state.options.debugString =
"";
551 step(state.stepping);
560 std::cout <<
"<<< Test 1c >>> step to the Boundary at "
561 <<
toString(state.stepping.pos4) << std::endl;
562 std::cout << state.options.debugString << std::endl;
563 state.options.debugString =
"";
567 step(state.stepping);
575 std::cout <<
"<<< Test 1d >>> step to 1st layer at "
576 <<
toString(state.stepping.pos4) << std::endl;
577 std::cout << state.options.debugString << std::endl;
578 state.options.debugString =
"";
582 for (
size_t isf = 0; isf < 5; ++isf) {
583 step(state.stepping);
591 std::cout <<
"<<< Test 1e-1i >>> step within 1st layer at "
592 <<
toString(state.stepping.pos4) << std::endl;
593 std::cout << state.options.debugString << std::endl;
594 state.options.debugString =
"";
599 step(state.stepping);
607 std::cout <<
"<<< Test 1j >>> step to 2nd layer at "
608 <<
toString(state.stepping.pos4) << std::endl;
609 std::cout << state.options.debugString << std::endl;
610 state.options.debugString =
"";
614 for (
size_t isf = 0; isf < 5; ++isf) {
615 step(state.stepping);
623 std::cout <<
"<<< Test 1k-1o >>> step within 2nd layer at "
624 <<
toString(state.stepping.pos4) << std::endl;
625 std::cout << state.options.debugString << std::endl;
626 state.options.debugString =
"";
631 step(state.stepping);
639 std::cout <<
"<<< Test 1p >>> step to 3rd layer at "
640 <<
toString(state.stepping.pos4) << std::endl;
641 std::cout << state.options.debugString << std::endl;
642 state.options.debugString =
"";
646 for (
size_t isf = 0; isf < 3; ++isf) {
647 step(state.stepping);
655 std::cout <<
"<<< Test 1q-1s >>> step within 3rd layer at "
656 <<
toString(state.stepping.pos4) << std::endl;
657 std::cout << state.options.debugString << std::endl;
658 state.options.debugString =
"";
663 step(state.stepping);
671 std::cout <<
"<<< Test 1t >>> step to 4th layer at "
672 <<
toString(state.stepping.pos4) << std::endl;
673 std::cout << state.options.debugString << std::endl;
674 state.options.debugString =
"";
678 for (
size_t isf = 0; isf < 3; ++isf) {
679 step(state.stepping);
687 std::cout <<
"<<< Test 1t-1v >>> step within 4th layer at "
688 <<
toString(state.stepping.pos4) << std::endl;
689 std::cout << state.options.debugString << std::endl;
690 state.options.debugString =
"";
695 step(state.stepping);
703 std::cout <<
"<<< Test 1w >>> step to boundary at "
704 <<
toString(state.stepping.pos4) << std::endl;
705 std::cout << state.options.debugString << std::endl;
706 state.options.debugString =
"";
712 std::cout <<
"<<<<<<<<<<<<<<<<<<<<< BVH Navigation >>>>>>>>>>>>>>>>>>"
717 Vector4 BVHPosition4(0., 0., 0, 0);
718 Vector3 BVHMomentum(1., 1., 0.);
722 BVHState.options.debug =
debug;
725 BVHState.stepping.pos4 = BVHPosition4;
726 BVHState.stepping.dir = BVHMomentum.normalized();
731 BVHNavigator.initialize(BVHState, BVHStepper);
734 BOOST_CHECK_NE(BVHState.navigation.currentVolume,
nullptr);
736 BOOST_CHECK_EQUAL(BVHState.navigation.currentVolume,
737 BVHState.navigation.startVolume);
739 BOOST_CHECK_EQUAL(BVHState.navigation.currentSurface,
nullptr);
741 BOOST_CHECK_EQUAL(BVHState.navigation.navLayers.size(), 0
u);
745 BOOST_CHECK_EQUAL(BVHState.navigation.navLayers.size(), 0
u);
747 BOOST_CHECK_EQUAL(BVHState.navigation.navSurfaces.size(), 42
u);