File indexing completed on 2026-11-08 09:25:35
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <boost/test/data/test_case.hpp>
0010 #include <boost/test/unit_test.hpp>
0011
0012 #include "Acts/Geometry/GeometryContext.hpp"
0013 #include "Acts/MagneticField/ConstantBField.hpp"
0014 #include "Acts/MagneticField/MagneticFieldContext.hpp"
0015 #include "Acts/Propagator/GenericRungeKuttaStepper.hpp"
0016 #include "Acts/Propagator/HelixStepper.hpp"
0017 #include "Acts/Propagator/Propagator.hpp"
0018
0019 #include <utility>
0020
0021 #include "PropagationDatasets.hpp"
0022 #include "PropagationTests.hpp"
0023
0024 namespace {
0025
0026 namespace ds = ActsTests::PropagationDatasets;
0027
0028 using namespace Acts;
0029 using namespace UnitLiterals;
0030
0031 using MagneticField = ConstantBField;
0032 using GenericRungeKuttaPropagator = Propagator<GenericRungeKuttaStepper>;
0033 using HelixPropagator = Propagator<HelixStepper>;
0034
0035
0036 constexpr auto epsPos = 1_um;
0037 constexpr auto epsTime = 1_um;
0038 constexpr auto epsDir = 0.125_mrad;
0039 constexpr auto epsMom = 1_eV;
0040 constexpr auto epsCov = 0.025;
0041
0042
0043
0044
0045
0046
0047
0048 struct TargetReached : public SurfaceReached {
0049 TargetReached() : SurfaceReached(-1_cm) {}
0050 };
0051
0052 const auto geoCtx = GeometryContext::dangerouslyDefaultConstruct();
0053 const MagneticFieldContext magCtx;
0054
0055 inline std::pair<GenericRungeKuttaPropagator, HelixPropagator> makePropagators(
0056 double bz) {
0057 auto field = std::make_shared<MagneticField>(Vector3(0.0, 0.0, bz));
0058 return {GenericRungeKuttaPropagator(GenericRungeKuttaStepper(field)),
0059 HelixPropagator(HelixStepper(field))};
0060 }
0061
0062 }
0063
0064 BOOST_AUTO_TEST_SUITE(PropagationCompareGenericRungeKuttaHelixConstant)
0065
0066 BOOST_DATA_TEST_CASE(Forward,
0067 ds::phi* ds::thetaWithoutBeam* ds::absMomentum*
0068 ds::chargeNonZero* ds::pathLength* ds::magneticField,
0069 phi, theta, p, q, s, bz) {
0070 auto [genericRungeKuttaPropagator, helixPropagator] = makePropagators(bz);
0071 runForwardComparisonTest(
0072 genericRungeKuttaPropagator, helixPropagator, geoCtx, magCtx,
0073 makeParametersCurvilinearWithCovariance(phi, theta, p, q), s, epsPos,
0074 epsTime, epsDir, epsMom, epsCov);
0075 }
0076
0077 BOOST_DATA_TEST_CASE(ToCylinderAlongZ,
0078 ds::phi* ds::thetaWithoutBeam* ds::absMomentum*
0079 ds::chargeNonZero* ds::pathLength* ds::magneticField,
0080 phi, theta, p, q, s, bz) {
0081 auto [genericRungeKuttaPropagator, helixPropagator] = makePropagators(bz);
0082 runToSurfaceComparisonTest(
0083 genericRungeKuttaPropagator, helixPropagator, geoCtx, magCtx,
0084 makeParametersCurvilinearWithCovariance(phi, theta, p, q), s,
0085 ZCylinderSurfaceBuilder(), epsPos, epsTime, epsDir, epsMom, epsCov);
0086 }
0087
0088 BOOST_DATA_TEST_CASE(
0089 ToDisc,
0090 ds::phiWithoutAmbiguity* ds::thetaWithoutBeam* ds::absMomentum*
0091 ds::chargeNonZero* ds::pathLength* ds::magneticField,
0092 phi, theta, p, q, s, bz) {
0093 auto [genericRungeKuttaPropagator, helixPropagator] = makePropagators(bz);
0094 runToSurfaceComparisonTest(
0095 genericRungeKuttaPropagator, helixPropagator, geoCtx, magCtx,
0096 makeParametersCurvilinearWithCovariance(phi, theta, p, q), s,
0097 DiscSurfaceBuilder(), epsPos, epsTime, epsDir, epsMom, epsCov,
0098 TargetReached());
0099 }
0100
0101 BOOST_DATA_TEST_CASE(ToPlane,
0102 ds::phi* ds::thetaWithoutBeam* ds::absMomentum*
0103 ds::chargeNonZero* ds::pathLength* ds::magneticField,
0104 phi, theta, p, q, s, bz) {
0105 auto [genericRungeKuttaPropagator, helixPropagator] = makePropagators(bz);
0106 runToSurfaceComparisonTest(
0107 genericRungeKuttaPropagator, helixPropagator, geoCtx, magCtx,
0108 makeParametersCurvilinearWithCovariance(phi, theta, p, q), s,
0109 PlaneSurfaceBuilder(), epsPos, epsTime, epsDir, epsMom, epsCov,
0110 TargetReached());
0111 }
0112
0113 BOOST_DATA_TEST_CASE(ToStrawAlongZ,
0114 ds::phi* ds::thetaWithoutBeam* ds::absMomentum*
0115 ds::chargeNonZero* ds::pathLength* ds::magneticField,
0116 phi, theta, p, q, s, bz) {
0117 auto [genericRungeKuttaPropagator, helixPropagator] = makePropagators(bz);
0118 runToSurfaceComparisonTest(
0119 genericRungeKuttaPropagator, helixPropagator, geoCtx, magCtx,
0120 makeParametersCurvilinearWithCovariance(phi, theta, p, q), s,
0121 ZStrawSurfaceBuilder(), epsPos, epsTime, epsDir, epsMom, epsCov);
0122 }
0123
0124 BOOST_AUTO_TEST_SUITE_END()