Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:12:30

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