Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /acts/Tests/IntegrationTests/PropagationHelixConstant.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/HelixStepper.hpp"
0016 #include "Acts/Propagator/Propagator.hpp"
0017 #include "Acts/Propagator/RiddersStepper.hpp"
0018 
0019 #include "PropagationDatasets.hpp"
0020 #include "PropagationTests.hpp"
0021 
0022 namespace {
0023 
0024 namespace ds = ActsTests::PropagationDatasets;
0025 
0026 using namespace Acts;
0027 using namespace UnitLiterals;
0028 
0029 using MagneticField = ConstantBField;
0030 using Stepper = HelixStepper;
0031 using RiddersStepper = Experimental::RiddersStepper<Stepper>;
0032 using TestPropagator = Propagator<Stepper>;
0033 using TestRiddersPropagator = Propagator<RiddersStepper>;
0034 
0035 // The helix is exact in a constant field, so the tolerances are tighter than
0036 // for the Runge-Kutta steppers.
0037 constexpr auto epsPos = 1_nm;
0038 constexpr auto epsTime = 1_nm;
0039 constexpr auto epsDir = 1e-6_mrad;
0040 constexpr auto epsMom = 1_eV;
0041 constexpr auto epsCov = 0.025;
0042 
0043 // A step to the straight-line distance of a surface passes a surface
0044 // perpendicular to the track by about |(q/p) T x B|^2 h^3 / 3, which is up to
0045 // about 2 mm for these datasets. The next step goes back, so accept
0046 // intersections that far behind the track. Only for planes and discs: they
0047 // have one intersection, while the target cylinder can have its second
0048 // intersection within 1 cm behind the track.
0049 struct TargetReached : public SurfaceReached {
0050   TargetReached() : SurfaceReached(-1_cm) {}
0051 };
0052 
0053 const auto geoCtx = GeometryContext::dangerouslyDefaultConstruct();
0054 const MagneticFieldContext magCtx;
0055 
0056 inline TestPropagator makePropagator(double bz) {
0057   auto magField = std::make_shared<MagneticField>(Vector3(0.0, 0.0, bz));
0058   Stepper stepper(std::move(magField));
0059   return TestPropagator(std::move(stepper));
0060 }
0061 
0062 inline TestRiddersPropagator makeRiddersPropagator(double bz) {
0063   auto magField = std::make_shared<MagneticField>(Vector3(0.0, 0.0, bz));
0064   RiddersStepper stepper(std::move(magField));
0065   return TestRiddersPropagator(std::move(stepper));
0066 }
0067 
0068 }  // namespace
0069 
0070 BOOST_AUTO_TEST_SUITE(PropagationHelixConstant)
0071 
0072 BOOST_DATA_TEST_CASE(ForwardBackward,
0073                      ds::phi* ds::thetaWithoutBeam* ds::absMomentum*
0074                          ds::chargeNonZero* ds::pathLength* ds::magneticField,
0075                      phi, theta, p, q, s, bz) {
0076   runForwardBackwardTest(makePropagator(bz), geoCtx, magCtx,
0077                          makeParametersCurvilinear(phi, theta, p, q), s, epsPos,
0078                          epsTime, epsDir, epsMom);
0079 }
0080 
0081 BOOST_DATA_TEST_CASE(ToCylinderAlongZ,
0082                      ds::phi* ds::thetaWithoutBeam* ds::absMomentum*
0083                          ds::chargeNonZero* ds::pathLength* ds::magneticField,
0084                      phi, theta, p, q, s, bz) {
0085   runToSurfaceTest(makePropagator(bz), geoCtx, magCtx,
0086                    makeParametersCurvilinear(phi, theta, p, q), s,
0087                    ZCylinderSurfaceBuilder(), 1_um, 1_um, 0.125_mrad, epsMom);
0088 }
0089 
0090 BOOST_DATA_TEST_CASE(ToDisc,
0091                      ds::phi* ds::thetaWithoutBeam* ds::absMomentum*
0092                          ds::chargeNonZero* ds::pathLength* ds::magneticField,
0093                      phi, theta, p, q, s, bz) {
0094   runToSurfaceTest(makePropagator(bz), geoCtx, magCtx,
0095                    makeParametersCurvilinear(phi, theta, p, q), s,
0096                    DiscSurfaceBuilder(), 1_um, 1_um, 0.125_mrad, epsMom,
0097                    TargetReached());
0098 }
0099 
0100 BOOST_DATA_TEST_CASE(ToPlane,
0101                      ds::phi* ds::thetaWithoutBeam* ds::absMomentum*
0102                          ds::chargeNonZero* ds::pathLength* ds::magneticField,
0103                      phi, theta, p, q, s, bz) {
0104   runToSurfaceTest(makePropagator(bz), geoCtx, magCtx,
0105                    makeParametersCurvilinear(phi, theta, p, q), s,
0106                    PlaneSurfaceBuilder(), 1_um, 1_um, 0.125_mrad, epsMom,
0107                    TargetReached());
0108 }
0109 
0110 BOOST_DATA_TEST_CASE(ToStrawAlongZ,
0111                      ds::phi* ds::thetaWithoutBeam* ds::absMomentum*
0112                          ds::chargeNonZero* ds::pathLength* ds::magneticField,
0113                      phi, theta, p, q, s, bz) {
0114   runToSurfaceTest(makePropagator(bz), geoCtx, magCtx,
0115                    makeParametersCurvilinear(phi, theta, p, q), s,
0116                    ZStrawSurfaceBuilder(), 1_um, 1_um, 0.125_mrad, epsMom);
0117 }
0118 
0119 BOOST_DATA_TEST_CASE(CovarianceCurvilinear,
0120                      ds::phi* ds::thetaWithoutBeam* ds::absMomentum*
0121                          ds::chargeNonZero* ds::pathLength* ds::magneticField,
0122                      phi, theta, p, q, s, bz) {
0123   runForwardComparisonTest(
0124       makePropagator(bz), makeRiddersPropagator(bz), geoCtx, magCtx,
0125       makeParametersCurvilinearWithCovariance(phi, theta, p, q), s, epsPos,
0126       epsTime, epsDir, epsMom, epsCov);
0127 }
0128 
0129 BOOST_DATA_TEST_CASE(
0130     CovarianceToCylinderAlongZ,
0131     ds::phiWithoutAmbiguity* ds::thetaWithoutBeam* ds::absMomentum*
0132         ds::chargeNonZero* ds::pathLength* ds::magneticField,
0133     phi, theta, p, q, s, bz) {
0134   runToSurfaceComparisonTest(
0135       makePropagator(bz), makeRiddersPropagator(bz), geoCtx, magCtx,
0136       makeParametersCurvilinearWithCovariance(phi, theta, p, q), s,
0137       ZCylinderSurfaceBuilder(), 1_um, 1_um, 0.125_mrad, epsMom, epsCov);
0138 }
0139 
0140 BOOST_DATA_TEST_CASE(CovarianceToDisc,
0141                      ds::phi* ds::thetaWithoutBeam* ds::absMomentum*
0142                          ds::chargeNonZero* ds::pathLength* ds::magneticField,
0143                      phi, theta, p, q, s, bz) {
0144   runToSurfaceComparisonTest(
0145       makePropagator(bz), makeRiddersPropagator(bz), geoCtx, magCtx,
0146       makeParametersCurvilinearWithCovariance(phi, theta, p, q), s,
0147       DiscSurfaceBuilder(), 1_um, 1_um, 0.125_mrad, epsMom, epsCov,
0148       TargetReached());
0149 }
0150 
0151 BOOST_DATA_TEST_CASE(CovarianceToPlane,
0152                      ds::phi* ds::thetaWithoutBeam* ds::absMomentum*
0153                          ds::chargeNonZero* ds::pathLength* ds::magneticField,
0154                      phi, theta, p, q, s, bz) {
0155   runToSurfaceComparisonTest(
0156       makePropagator(bz), makeRiddersPropagator(bz), geoCtx, magCtx,
0157       makeParametersCurvilinearWithCovariance(phi, theta, p, q), s,
0158       PlaneSurfaceBuilder(), 1_um, 1_um, 0.125_mrad, epsMom, epsCov,
0159       TargetReached());
0160 }
0161 
0162 BOOST_DATA_TEST_CASE(CovarianceToStrawAlongZ,
0163                      ds::phi* ds::thetaWithoutBeam* ds::absMomentum*
0164                          ds::chargeNonZero* ds::pathLength* ds::magneticField,
0165                      phi, theta, p, q, s, bz) {
0166   // the numerical covariance transport to straw surfaces does not seem to be
0167   // stable. use a higher tolerance for now.
0168   runToSurfaceComparisonTest(
0169       makePropagator(bz), makeRiddersPropagator(bz), geoCtx, magCtx,
0170       makeParametersCurvilinearWithCovariance(phi, theta, p, q), s,
0171       ZStrawSurfaceBuilder(), 1_um, 1_um, 0.125_mrad, epsMom, 0.125);
0172 }
0173 
0174 BOOST_AUTO_TEST_SUITE_END()