Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-15 08:05:18

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