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/EigenStepper.hpp"
0016 #include "Acts/Propagator/Propagator.hpp"
0017 #include "Acts/Propagator/StraightLineStepper.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 EigenStepper = Acts::EigenStepper<>;
0031 using EigenPropagator = Acts::Propagator<EigenStepper>;
0032 using StraightLineStepper = Acts::StraightLineStepper;
0033 using StraightLinePropagator = Acts::Propagator<StraightLineStepper>;
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.00125;
0041 
0042 constexpr auto bz = 2_T;
0043 
0044 const Acts::GeometryContext geoCtx;
0045 const Acts::MagneticFieldContext magCtx;
0046 const auto magFieldZero =
0047     std::make_shared<MagneticField>(Acts::Vector3::Zero());
0048 const auto magFieldNonZero =
0049     std::make_shared<MagneticField>(Acts::Vector3::UnitZ() * bz);
0050 const EigenPropagator eigenPropagatorZero{EigenStepper(magFieldZero)};
0051 const EigenPropagator eigenPropagatorNonZero{EigenStepper(magFieldNonZero)};
0052 const StraightLinePropagator straightPropagator{StraightLineStepper()};
0053 
0054 }  // namespace
0055 
0056 BOOST_AUTO_TEST_SUITE(PropagationCompareEigenStraightLine)
0057 
0058 // TODO both the eigen stepper and the straight line stepper do not seem to
0059 //      handle the neutral parameters correctly. the results contain inf/nan.
0060 //      fix the propagators and re-enable the tests.
0061 
0062 // BOOST_DATA_TEST_CASE(NeutralZeroMagneticField,
0063 //                      ds::phi* ds::theta* ds::absMomentum* ds::pathLength,
0064 //                      phi, theta, p, s) {
0065 //   runFreePropagationComparisonTest(
0066 //       eigenPropagatorZero, straightPropagator, geoCtx, magCtx,
0067 //       makeParametersCurvilinearNeutral(phi, theta, p), s, epsPos, epsDir,
0068 //       epsMom, epsCov);
0069 // }
0070 
0071 // BOOST_DATA_TEST_CASE(NeutralNonZeroMagneticField,
0072 //                      ds::phi* ds::theta* ds::absMomentum* ds::pathLength,
0073 //                      phi, theta, p, s) {
0074 //   runFreePropagationComparisonTest(
0075 //       eigenPropagatorNonZero, straightPropagator, geoCtx, magCtx,
0076 //       makeParametersCurvilinearNeutral(phi, theta, p), s, epsPos, epsDir,
0077 //       epsMom, epsCov);
0078 // }
0079 
0080 BOOST_DATA_TEST_CASE(
0081     ChargedZeroMagneticField,
0082     ds::phi* ds::theta* ds::absMomentum* ds::chargeNonZero* ds::pathLength, phi,
0083     theta, p, q, s) {
0084   runForwardComparisonTest(eigenPropagatorZero, straightPropagator, geoCtx,
0085                            magCtx, makeParametersCurvilinear(phi, theta, p, q),
0086                            s, epsPos, epsDir, epsMom, epsCov);
0087 }
0088 
0089 // TODO add comparison tests between the straight line and eigen propagator for
0090 //      a charged particle w/ infinite momentum in a non-zero magnetic field.
0091 //      these should be identical. requires proper handling of q/p=0 in the
0092 //      track parameters.
0093 
0094 BOOST_AUTO_TEST_SUITE_END()