Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-06 07:53:05

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/EigenStepper.hpp"
0017 #include "Acts/Propagator/Propagator.hpp"
0018 
0019 #include <utility>
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 AtlasStepper = Acts::AtlasStepper;
0031 using AtlasPropagator = Acts::Propagator<AtlasStepper>;
0032 using EigenStepper = Acts::EigenStepper<>;
0033 using EigenPropagator = Acts::Propagator<EigenStepper>;
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.1;
0041 
0042 const Acts::GeometryContext geoCtx;
0043 const Acts::MagneticFieldContext magCtx;
0044 
0045 inline std::pair<AtlasPropagator, EigenPropagator> makePropagators(double bz) {
0046   auto field = std::make_shared<MagneticField>(Acts::Vector3(0.0, 0.0, bz));
0047   return {AtlasPropagator(AtlasStepper(field)),
0048           EigenPropagator(EigenStepper(field))};
0049 }
0050 
0051 }  // namespace
0052 
0053 BOOST_AUTO_TEST_SUITE(PropagationCompareAtlasEigenConstant)
0054 
0055 BOOST_DATA_TEST_CASE(Forward,
0056                      ds::phi*(ds::thetaWithoutBeam)*ds::absMomentum*
0057                          ds::chargeNonZero* ds::pathLength* ds::magneticField,
0058                      phi, theta, p, q, s, bz) {
0059   auto [atlasPropagator, eigenPropagator] = makePropagators(bz);
0060   runForwardComparisonTest(
0061       atlasPropagator, eigenPropagator, geoCtx, magCtx,
0062       makeParametersCurvilinearWithCovariance(phi, theta, p, q), s, epsPos,
0063       epsDir, epsMom, epsCov);
0064 }
0065 
0066 BOOST_DATA_TEST_CASE(ToCylinderAlongZ,
0067                      ds::phi* ds::thetaWithoutBeam* ds::absMomentum*
0068                          ds::chargeNonZero* ds::pathLength* ds::magneticField,
0069                      phi, theta, p, q, s, bz) {
0070   auto [atlasPropagator, eigenPropagator] = makePropagators(bz);
0071   runToSurfaceComparisonTest(
0072       atlasPropagator, eigenPropagator, geoCtx, magCtx,
0073       makeParametersCurvilinearWithCovariance(phi, theta, p, q), s,
0074       ZCylinderSurfaceBuilder(), epsPos, epsDir, epsMom, epsCov);
0075 }
0076 
0077 BOOST_DATA_TEST_CASE(
0078     ToDisc,
0079     ds::phiWithoutAmbiguity* ds::thetaWithoutBeam* ds::absMomentum*
0080         ds::chargeNonZero* ds::pathLength* ds::magneticField,
0081     phi, theta, p, q, s, bz) {
0082   auto [atlasPropagator, eigenPropagator] = makePropagators(bz);
0083   runToSurfaceComparisonTest(
0084       atlasPropagator, eigenPropagator, geoCtx, magCtx,
0085       makeParametersCurvilinearWithCovariance(phi, theta, p, q), s,
0086       DiscSurfaceBuilder(), epsPos, epsDir, epsMom, epsCov);
0087 }
0088 
0089 BOOST_DATA_TEST_CASE(ToPlane,
0090                      ds::phi* ds::thetaWithoutBeam* ds::absMomentum*
0091                          ds::chargeNonZero* ds::pathLength* ds::magneticField,
0092                      phi, theta, p, q, s, bz) {
0093   auto [atlasPropagator, eigenPropagator] = makePropagators(bz);
0094   runToSurfaceComparisonTest(
0095       atlasPropagator, eigenPropagator, geoCtx, magCtx,
0096       makeParametersCurvilinearWithCovariance(phi, theta, p, q), s,
0097       PlaneSurfaceBuilder(), epsPos, epsDir, epsMom, epsCov);
0098 }
0099 
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   auto [atlasPropagator, eigenPropagator] = makePropagators(bz);
0105   runToSurfaceComparisonTest(
0106       atlasPropagator, eigenPropagator, geoCtx, magCtx,
0107       makeParametersCurvilinearWithCovariance(phi, theta, p, q), s,
0108       ZStrawSurfaceBuilder(), epsPos, epsDir, epsMom, epsCov);
0109 }
0110 
0111 BOOST_AUTO_TEST_SUITE_END()