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