Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-18 08:22:21

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 
0028 using namespace Acts;
0029 using namespace UnitLiterals;
0030 
0031 using MagneticField = ConstantBField;
0032 using AtlasStepper = AtlasStepper;
0033 using AtlasPropagator = Propagator<AtlasStepper>;
0034 using EigenStepper = EigenStepper<>;
0035 using EigenPropagator = Propagator<EigenStepper>;
0036 
0037 // absolute parameter tolerances for position, direction, and absolute momentum
0038 constexpr auto epsPos = 1_um;
0039 constexpr auto epsDir = 0.125_mrad;
0040 constexpr auto epsMom = 1_eV;
0041 // relative covariance tolerance
0042 constexpr auto epsCov = 0.1;
0043 
0044 const GeometryContext geoCtx;
0045 const MagneticFieldContext magCtx;
0046 
0047 inline std::pair<AtlasPropagator, EigenPropagator> makePropagators(double bz) {
0048   auto field = std::make_shared<MagneticField>(Vector3(0.0, 0.0, bz));
0049   return {AtlasPropagator(AtlasStepper(field)),
0050           EigenPropagator(EigenStepper(field))};
0051 }
0052 
0053 }  // namespace
0054 
0055 BOOST_AUTO_TEST_SUITE(PropagationCompareAtlasEigenConstant)
0056 
0057 BOOST_DATA_TEST_CASE(Forward,
0058                      ds::phi*(ds::thetaWithoutBeam)*ds::absMomentum*
0059                          ds::chargeNonZero* ds::pathLength* ds::magneticField,
0060                      phi, theta, p, q, s, bz) {
0061   auto [atlasPropagator, eigenPropagator] = makePropagators(bz);
0062   runForwardComparisonTest(
0063       atlasPropagator, eigenPropagator, geoCtx, magCtx,
0064       makeParametersCurvilinearWithCovariance(phi, theta, p, q), s, epsPos,
0065       epsDir, epsMom, epsCov);
0066 }
0067 
0068 BOOST_DATA_TEST_CASE(ToCylinderAlongZ,
0069                      ds::phi* ds::thetaWithoutBeam* ds::absMomentum*
0070                          ds::chargeNonZero* ds::pathLength* ds::magneticField,
0071                      phi, theta, p, q, s, bz) {
0072   auto [atlasPropagator, eigenPropagator] = makePropagators(bz);
0073   runToSurfaceComparisonTest(
0074       atlasPropagator, eigenPropagator, geoCtx, magCtx,
0075       makeParametersCurvilinearWithCovariance(phi, theta, p, q), s,
0076       ZCylinderSurfaceBuilder(), epsPos, epsDir, epsMom, epsCov);
0077 }
0078 
0079 BOOST_DATA_TEST_CASE(
0080     ToDisc,
0081     ds::phiWithoutAmbiguity* ds::thetaWithoutBeam* ds::absMomentum*
0082         ds::chargeNonZero* ds::pathLength* ds::magneticField,
0083     phi, theta, p, q, s, bz) {
0084   auto [atlasPropagator, eigenPropagator] = makePropagators(bz);
0085   runToSurfaceComparisonTest(
0086       atlasPropagator, eigenPropagator, geoCtx, magCtx,
0087       makeParametersCurvilinearWithCovariance(phi, theta, p, q), s,
0088       DiscSurfaceBuilder(), epsPos, epsDir, epsMom, epsCov);
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   auto [atlasPropagator, eigenPropagator] = makePropagators(bz);
0096   runToSurfaceComparisonTest(
0097       atlasPropagator, eigenPropagator, geoCtx, magCtx,
0098       makeParametersCurvilinearWithCovariance(phi, theta, p, q), s,
0099       PlaneSurfaceBuilder(), epsPos, epsDir, epsMom, epsCov);
0100 }
0101 
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   auto [atlasPropagator, eigenPropagator] = makePropagators(bz);
0107   runToSurfaceComparisonTest(
0108       atlasPropagator, eigenPropagator, geoCtx, magCtx,
0109       makeParametersCurvilinearWithCovariance(phi, theta, p, q), s,
0110       ZStrawSurfaceBuilder(), epsPos, epsDir, epsMom, epsCov);
0111 }
0112 
0113 BOOST_AUTO_TEST_SUITE_END()