Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-26 07:35:32

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