Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /acts/Tests/IntegrationTests/PropagationCompareHelixEigenConstant.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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/HelixStepper.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 HelixPropagator = Propagator<HelixStepper>;
0033 using EigenStepper = EigenStepper<>;
0034 using EigenPropagator = Propagator<EigenStepper>;
0035 
0036 // The forward-backward and Ridders tests are blind to a wrong sign of the
0037 // bending, so compare against an independent integrator.
0038 constexpr auto epsPos = 1_um;
0039 constexpr auto epsTime = 1_um;
0040 constexpr auto epsDir = 0.125_mrad;
0041 constexpr auto epsMom = 1_eV;
0042 constexpr auto epsCov = 0.025;
0043 
0044 // A step to the straight-line distance of a surface passes a surface
0045 // perpendicular to the track by about |(q/p) T x B|^2 h^3 / 3, which is up to
0046 // about 2 mm for these datasets. The next step goes back, so accept
0047 // intersections that far behind the track. Only for planes and discs: they
0048 // have one intersection, while the target cylinder can have its second
0049 // intersection within 1 cm behind the track.
0050 struct TargetReached : public SurfaceReached {
0051   TargetReached() : SurfaceReached(-1_cm) {}
0052 };
0053 
0054 const auto geoCtx = GeometryContext::dangerouslyDefaultConstruct();
0055 const MagneticFieldContext magCtx;
0056 
0057 inline std::pair<HelixPropagator, EigenPropagator> makePropagators(double bz) {
0058   auto field = std::make_shared<MagneticField>(Vector3(0.0, 0.0, bz));
0059   return {HelixPropagator(HelixStepper(field)),
0060           EigenPropagator(EigenStepper(field))};
0061 }
0062 
0063 }  // namespace
0064 
0065 BOOST_AUTO_TEST_SUITE(PropagationCompareHelixEigenConstant)
0066 
0067 BOOST_DATA_TEST_CASE(Forward,
0068                      ds::phi* ds::thetaWithoutBeam* ds::absMomentum*
0069                          ds::chargeNonZero* ds::pathLength* ds::magneticField,
0070                      phi, theta, p, q, s, bz) {
0071   auto [helixPropagator, eigenPropagator] = makePropagators(bz);
0072   runForwardComparisonTest(
0073       helixPropagator, eigenPropagator, geoCtx, magCtx,
0074       makeParametersCurvilinearWithCovariance(phi, theta, p, q), s, epsPos,
0075       epsTime, epsDir, epsMom, epsCov);
0076 }
0077 
0078 BOOST_DATA_TEST_CASE(ToCylinderAlongZ,
0079                      ds::phi* ds::thetaWithoutBeam* ds::absMomentum*
0080                          ds::chargeNonZero* ds::pathLength* ds::magneticField,
0081                      phi, theta, p, q, s, bz) {
0082   auto [helixPropagator, eigenPropagator] = makePropagators(bz);
0083   runToSurfaceComparisonTest(
0084       helixPropagator, eigenPropagator, geoCtx, magCtx,
0085       makeParametersCurvilinearWithCovariance(phi, theta, p, q), s,
0086       ZCylinderSurfaceBuilder(), epsPos, epsTime, epsDir, epsMom, epsCov);
0087 }
0088 
0089 BOOST_DATA_TEST_CASE(
0090     ToDisc,
0091     ds::phiWithoutAmbiguity* ds::thetaWithoutBeam* ds::absMomentum*
0092         ds::chargeNonZero* ds::pathLength* ds::magneticField,
0093     phi, theta, p, q, s, bz) {
0094   auto [helixPropagator, eigenPropagator] = makePropagators(bz);
0095   runToSurfaceComparisonTest(
0096       helixPropagator, eigenPropagator, geoCtx, magCtx,
0097       makeParametersCurvilinearWithCovariance(phi, theta, p, q), s,
0098       DiscSurfaceBuilder(), epsPos, epsTime, epsDir, epsMom, epsCov,
0099       TargetReached());
0100 }
0101 
0102 BOOST_DATA_TEST_CASE(ToPlane,
0103                      ds::phi* ds::thetaWithoutBeam* ds::absMomentum*
0104                          ds::chargeNonZero* ds::pathLength* ds::magneticField,
0105                      phi, theta, p, q, s, bz) {
0106   auto [helixPropagator, eigenPropagator] = makePropagators(bz);
0107   runToSurfaceComparisonTest(
0108       helixPropagator, eigenPropagator, geoCtx, magCtx,
0109       makeParametersCurvilinearWithCovariance(phi, theta, p, q), s,
0110       PlaneSurfaceBuilder(), epsPos, epsTime, epsDir, epsMom, epsCov,
0111       TargetReached());
0112 }
0113 
0114 BOOST_DATA_TEST_CASE(ToStrawAlongZ,
0115                      ds::phi* ds::thetaWithoutBeam* ds::absMomentum*
0116                          ds::chargeNonZero* ds::pathLength* ds::magneticField,
0117                      phi, theta, p, q, s, bz) {
0118   auto [helixPropagator, eigenPropagator] = makePropagators(bz);
0119   runToSurfaceComparisonTest(
0120       helixPropagator, eigenPropagator, geoCtx, magCtx,
0121       makeParametersCurvilinearWithCovariance(phi, theta, p, q), s,
0122       ZStrawSurfaceBuilder(), epsPos, epsTime, epsDir, epsMom, epsCov);
0123 }
0124 
0125 BOOST_AUTO_TEST_SUITE_END()