Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-17 08:00:10

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/ConstantBField.hpp"
0014 #include "Acts/MagneticField/MagneticFieldContext.hpp"
0015 #include "Acts/Propagator/AtlasStepper.hpp"
0016 #include "Acts/Propagator/Propagator.hpp"
0017 #include "Acts/Propagator/RiddersPropagator.hpp"
0018 
0019 #include "PropagationDatasets.hpp"
0020 #include "PropagationTests.hpp"
0021 
0022 namespace ds = ActsTests::PropagationDatasets;
0023 
0024 using namespace Acts;
0025 using namespace UnitLiterals;
0026 using namespace ActsTests;
0027 
0028 using MagneticField = ConstantBField;
0029 using Stepper = AtlasStepper;
0030 using TestPropagator = Propagator<Stepper>;
0031 using TestRiddersPropagator = RiddersPropagator<TestPropagator>;
0032 
0033 // absolute parameter tolerances for position, direction, and absolute momentum
0034 constexpr auto epsPos = 1_um;
0035 constexpr auto epsDir = 0.125_mrad;
0036 constexpr auto epsMom = 1_eV;
0037 // relative covariance tolerance
0038 constexpr auto epsCov = 0.025;
0039 
0040 const GeometryContext geoCtx;
0041 const MagneticFieldContext magCtx;
0042 
0043 inline TestPropagator makePropagator(double bz) {
0044   auto magField = std::make_shared<MagneticField>(Vector3(0.0, 0.0, bz));
0045   Stepper stepper(std::move(magField));
0046   return TestPropagator(std::move(stepper));
0047 }
0048 
0049 inline TestRiddersPropagator makeRiddersPropagator(double bz) {
0050   return TestRiddersPropagator(makePropagator(bz));
0051 }
0052 
0053 BOOST_AUTO_TEST_SUITE(PropagationAtlasConstant)
0054 
0055 // check that the propagation is reversible and self-consistent
0056 
0057 BOOST_DATA_TEST_CASE(ForwardBackward,
0058                      ds::phi* ds::thetaWithoutBeam* ds::absMomentum*
0059                          ds::chargeNonZero* ds::pathLength* ds::magneticField,
0060                      phi, theta, p, q, s, bz) {
0061   runForwardBackwardTest(makePropagator(bz), geoCtx, magCtx,
0062                          makeParametersCurvilinear(phi, theta, p, q), s, epsPos,
0063                          epsDir, epsMom);
0064 }
0065 
0066 // check that reachable surfaces are correctly reached
0067 
0068 // True forward/backward tracks do not work with z cylinders
0069 BOOST_DATA_TEST_CASE(ToCylinderAlongZ,
0070                      ds::phi* ds::thetaWithoutBeam* ds::absMomentum*
0071                          ds::chargeNonZero* ds::pathLength* ds::magneticField,
0072                      phi, theta, p, q, s, bz) {
0073   runToSurfaceTest(makePropagator(bz), geoCtx, magCtx,
0074                    makeParametersCurvilinear(phi, theta, p, q), s,
0075                    ZCylinderSurfaceBuilder(), epsPos, epsDir, epsMom);
0076 }
0077 
0078 BOOST_DATA_TEST_CASE(ToDisc,
0079                      ds::phi* ds::thetaWithoutBeam* ds::absMomentum*
0080                          ds::chargeNonZero* ds::pathLength* ds::magneticField,
0081                      phi, theta, p, q, s, bz) {
0082   runToSurfaceTest(makePropagator(bz), geoCtx, magCtx,
0083                    makeParametersCurvilinear(phi, theta, p, q), s,
0084                    DiscSurfaceBuilder(), epsPos, epsDir, epsMom);
0085 }
0086 
0087 BOOST_DATA_TEST_CASE(ToPlane,
0088                      ds::phi* ds::thetaWithoutBeam* ds::absMomentum*
0089                          ds::chargeNonZero* ds::pathLength* ds::magneticField,
0090                      phi, theta, p, q, s, bz) {
0091   runToSurfaceTest(makePropagator(bz), geoCtx, magCtx,
0092                    makeParametersCurvilinear(phi, theta, p, q), s,
0093                    PlaneSurfaceBuilder(), epsPos, epsDir, epsMom);
0094 }
0095 
0096 // True forward/backward tracks do not work with z straws
0097 BOOST_DATA_TEST_CASE(ToStrawAlongZ,
0098                      ds::phi* ds::thetaWithoutBeam* ds::absMomentum*
0099                          ds::chargeNonZero* ds::pathLength* ds::magneticField,
0100                      phi, theta, p, q, s, bz) {
0101   runToSurfaceTest(makePropagator(bz), geoCtx, magCtx,
0102                    makeParametersCurvilinear(phi, theta, p, q), s,
0103                    ZStrawSurfaceBuilder(), epsPos, epsDir, epsMom);
0104 }
0105 
0106 // check covariance transport using the ridders propagator for comparison
0107 
0108 BOOST_DATA_TEST_CASE(CovarianceCurvilinear,
0109                      ds::phi* ds::thetaWithoutBeam* ds::absMomentum*
0110                          ds::chargeNonZero* ds::pathLength* ds::magneticField,
0111                      phi, theta, p, q, s, bz) {
0112   runForwardComparisonTest(
0113       makePropagator(bz), makeRiddersPropagator(bz), geoCtx, magCtx,
0114       makeParametersCurvilinearWithCovariance(phi, theta, p, q), s, epsPos,
0115       epsDir, epsMom, epsCov);
0116 }
0117 
0118 BOOST_DATA_TEST_CASE(
0119     CovarianceToCylinderAlongZ,
0120     ds::phiWithoutAmbiguity* ds::thetaWithoutBeam* ds::absMomentum*
0121         ds::chargeNonZero* ds::pathLength* ds::magneticField,
0122     phi, theta, p, q, s, bz) {
0123   runToSurfaceComparisonTest(
0124       makePropagator(bz), makeRiddersPropagator(bz), geoCtx, magCtx,
0125       makeParametersCurvilinearWithCovariance(phi, theta, p, q), s,
0126       ZCylinderSurfaceBuilder(), epsPos, epsDir, epsMom, epsCov);
0127 }
0128 
0129 BOOST_DATA_TEST_CASE(CovarianceToDisc,
0130                      ds::phi* ds::thetaWithoutBeam* ds::absMomentum*
0131                          ds::chargeNonZero* ds::pathLength* ds::magneticField,
0132                      phi, theta, p, q, s, bz) {
0133   runToSurfaceComparisonTest(
0134       makePropagator(bz), makeRiddersPropagator(bz), geoCtx, magCtx,
0135       makeParametersCurvilinearWithCovariance(phi, theta, p, q), s,
0136       DiscSurfaceBuilder(), epsPos, epsDir, epsMom, epsCov);
0137 }
0138 
0139 BOOST_DATA_TEST_CASE(CovarianceToPlane,
0140                      ds::phi* ds::thetaWithoutBeam* ds::absMomentum*
0141                          ds::chargeNonZero* ds::pathLength* ds::magneticField,
0142                      phi, theta, p, q, s, bz) {
0143   runToSurfaceComparisonTest(
0144       makePropagator(bz), makeRiddersPropagator(bz), geoCtx, magCtx,
0145       makeParametersCurvilinearWithCovariance(phi, theta, p, q), s,
0146       PlaneSurfaceBuilder(), epsPos, epsDir, epsMom, epsCov);
0147 }
0148 
0149 BOOST_DATA_TEST_CASE(CovarianceToStrawAlongZ,
0150                      ds::phi* ds::thetaWithoutBeam* ds::absMomentum*
0151                          ds::chargeNonZero* ds::pathLength* ds::magneticField,
0152                      phi, theta, p, q, s, bz) {
0153   // the numerical covariance transport to straw surfaces does not seem to be
0154   // stable. use a higher tolerance for now.
0155   runToSurfaceComparisonTest(
0156       makePropagator(bz), makeRiddersPropagator(bz), geoCtx, magCtx,
0157       makeParametersCurvilinearWithCovariance(phi, theta, p, q), s,
0158       ZStrawSurfaceBuilder(), epsPos, epsDir, epsMom, 0.125);
0159 }
0160 
0161 BOOST_AUTO_TEST_SUITE_END()