Back to home page

EIC code displayed by LXR

 
 

    


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

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