Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:24:41

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
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/MagneticFieldContext.hpp"
0014 #include "Acts/Propagator/Propagator.hpp"
0015 #include "Acts/Propagator/RiddersPropagator.hpp"
0016 #include "Acts/Propagator/StraightLineStepper.hpp"
0017 
0018 #include "PropagationDatasets.hpp"
0019 #include "PropagationTests.hpp"
0020 
0021 namespace {
0022 
0023 namespace ds = ActsTests::PropagationDatasets;
0024 
0025 using namespace Acts;
0026 using namespace UnitLiterals;
0027 
0028 using Stepper = StraightLineStepper;
0029 using TestPropagator = Propagator<Stepper>;
0030 using RiddersPropagator = RiddersPropagator<TestPropagator>;
0031 
0032 // absolute parameter tolerances for position, direction, and absolute momentum
0033 constexpr auto epsPos = 1_um;
0034 constexpr auto epsDir = 0.125_mrad;
0035 constexpr auto epsMom = 1_eV;
0036 // relative covariance tolerance
0037 constexpr auto epsCov = 0.0125;
0038 
0039 const GeometryContext geoCtx;
0040 const MagneticFieldContext magCtx;
0041 
0042 const Stepper stepper;
0043 const TestPropagator propagator(stepper);
0044 const RiddersPropagator riddersPropagator(propagator);
0045 
0046 }  // namespace
0047 
0048 BOOST_AUTO_TEST_SUITE(PropagationStraightLine)
0049 
0050 // check that the propagation is reversible and self-consistent
0051 
0052 BOOST_DATA_TEST_CASE(ForwardBackward,
0053                      ds::phi* ds::thetaWithoutBeam* ds::absMomentum*
0054                          ds::chargeNonZero* ds::pathLength,
0055                      phi, theta, p, q, s) {
0056   runForwardBackwardTest(propagator, geoCtx, magCtx,
0057                          makeParametersCurvilinear(phi, theta, p, q), s, epsPos,
0058                          epsDir, epsMom);
0059 }
0060 
0061 // check that reachable surfaces are correctly reached
0062 
0063 // True forward/backward tracks do not work with z cylinders
0064 BOOST_DATA_TEST_CASE(ToCylinderAlongZ,
0065                      ds::phi* ds::thetaWithoutBeam* ds::absMomentum*
0066                          ds::chargeNonZero* ds::pathLength,
0067                      phi, theta, p, q, s) {
0068   runToSurfaceTest(propagator, geoCtx, magCtx,
0069                    makeParametersCurvilinear(phi, theta, p, q), s,
0070                    ZCylinderSurfaceBuilder(), epsPos, epsDir, epsMom);
0071 }
0072 
0073 BOOST_DATA_TEST_CASE(ToDisc,
0074                      ds::phi* ds::thetaWithoutBeam* ds::absMomentum*
0075                          ds::chargeNonZero* ds::pathLength,
0076                      phi, theta, p, q, s) {
0077   runToSurfaceTest(propagator, geoCtx, magCtx,
0078                    makeParametersCurvilinear(phi, theta, p, q), s,
0079                    DiscSurfaceBuilder(), epsPos, epsDir, epsMom);
0080 }
0081 
0082 BOOST_DATA_TEST_CASE(ToPlane,
0083                      ds::phi* ds::thetaWithoutBeam* ds::absMomentum*
0084                          ds::chargeNonZero* ds::pathLength,
0085                      phi, theta, p, q, s) {
0086   runToSurfaceTest(propagator, geoCtx, magCtx,
0087                    makeParametersCurvilinear(phi, theta, p, q), s,
0088                    PlaneSurfaceBuilder(), epsPos, epsDir, epsMom);
0089 }
0090 
0091 // True forward/backward tracks do not work with z straws
0092 BOOST_DATA_TEST_CASE(ToStrawAlongZ,
0093                      ds::phi* ds::thetaWithoutBeam* ds::absMomentum*
0094                          ds::chargeNonZero* ds::pathLength,
0095                      phi, theta, p, q, s) {
0096   runToSurfaceTest(propagator, geoCtx, magCtx,
0097                    makeParametersCurvilinear(phi, theta, p, q), s,
0098                    ZStrawSurfaceBuilder(), epsPos, epsDir, epsMom);
0099 }
0100 
0101 // check covariance transport using the ridders propagator for comparison
0102 
0103 BOOST_DATA_TEST_CASE(CovarianceCurvilinear,
0104                      ds::phi* ds::thetaWithoutBeam* ds::absMomentum*
0105                          ds::chargeNonZero* ds::pathLength,
0106                      phi, theta, p, q, s) {
0107   runForwardComparisonTest(
0108       propagator, riddersPropagator, geoCtx, magCtx,
0109       makeParametersCurvilinearWithCovariance(phi, theta, p, q), s, epsPos,
0110       epsDir, epsMom, epsCov);
0111 }
0112 
0113 BOOST_DATA_TEST_CASE(CovarianceToCylinderAlongZ,
0114                      ds::phiWithoutAmbiguity* ds::thetaWithoutBeam*
0115                          ds::absMomentum* ds::chargeNonZero* ds::pathLength,
0116                      phi, theta, p, q, s) {
0117   runToSurfaceComparisonTest(
0118       propagator, riddersPropagator, geoCtx, magCtx,
0119       makeParametersCurvilinearWithCovariance(phi, theta, p, q), s,
0120       ZCylinderSurfaceBuilder(), epsPos, epsDir, epsMom, epsCov);
0121 }
0122 
0123 BOOST_DATA_TEST_CASE(CovarianceToDisc,
0124                      ds::phiWithoutAmbiguity* ds::thetaWithoutBeam*
0125                          ds::absMomentum* ds::chargeNonZero* ds::pathLength,
0126                      phi, theta, p, q, s) {
0127   runToSurfaceComparisonTest(
0128       propagator, riddersPropagator, geoCtx, magCtx,
0129       makeParametersCurvilinearWithCovariance(phi, theta, p, q), s,
0130       DiscSurfaceBuilder(), epsPos, epsDir, epsMom, epsCov);
0131 }
0132 
0133 BOOST_DATA_TEST_CASE(CovarianceToPlane,
0134                      ds::phi* ds::thetaWithoutBeam* ds::absMomentum*
0135                          ds::chargeNonZero* ds::pathLength,
0136                      phi, theta, p, q, s) {
0137   runToSurfaceComparisonTest(
0138       propagator, riddersPropagator, geoCtx, magCtx,
0139       makeParametersCurvilinearWithCovariance(phi, theta, p, q), s,
0140       PlaneSurfaceBuilder(), epsPos, epsDir, epsMom, epsCov);
0141 }
0142 
0143 BOOST_DATA_TEST_CASE(CovarianceToStrawAlongZ,
0144                      ds::phi* ds::thetaWithoutBeam* ds::absMomentum*
0145                          ds::chargeNonZero* ds::pathLength,
0146                      phi, theta, p, q, s) {
0147   // the numerical covariance transport to straw surfaces does not seem to be
0148   // stable. use a higher tolerance for now.
0149   runToSurfaceComparisonTest(
0150       propagator, riddersPropagator, geoCtx, magCtx,
0151       makeParametersCurvilinearWithCovariance(phi, theta, p, q), s,
0152       ZStrawSurfaceBuilder(), epsPos, epsDir, epsMom, 0.125);
0153 }
0154 
0155 BOOST_AUTO_TEST_SUITE_END()