Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PropagationAtlasConstant.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PropagationAtlasConstant.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2020 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #include <boost/test/data/test_case.hpp>
10 #include <boost/test/unit_test.hpp>
11 
19 
20 #include <limits>
21 
22 #include "PropagationDatasets.hpp"
23 #include "PropagationTests.hpp"
24 
25 namespace {
26 
27 namespace ds = ActsTests::PropagationDatasets;
28 using namespace Acts::UnitLiterals;
29 
33 using RiddersPropagator = Acts::RiddersPropagator<Propagator>;
34 
35 // absolute parameter tolerances for position, direction, and absolute momentum
36 constexpr auto epsPos = 1_um;
37 constexpr auto epsDir = 0.125_mrad;
38 constexpr auto epsMom = 1_eV;
39 // relative covariance tolerance
40 constexpr auto epsCov = 0.025;
41 
44 
45 inline Propagator makePropagator(double Bz) {
46  auto magField = std::make_shared<MagneticField>(Acts::Vector3(0.0, 0.0, Bz));
47  Stepper stepper(std::move(magField));
48  return Propagator(std::move(stepper));
49 }
50 
51 inline RiddersPropagator makeRiddersPropagator(double Bz) {
52  auto magField = std::make_shared<MagneticField>(Acts::Vector3(0.0, 0.0, Bz));
53  Stepper stepper(std::move(magField));
54  return RiddersPropagator(std::move(stepper));
55 }
56 
57 } // namespace
58 
59 BOOST_AUTO_TEST_SUITE(PropagationAtlasConstant)
60 
61 // check that the propagation is reversible and self-consistent
62 
63 BOOST_DATA_TEST_CASE(ForwardBackward,
64  ds::phi* ds::theta* ds::absMomentum* ds::chargeNonZero*
65  ds::pathLength* ds::magneticField,
66  phi, theta, p, q, s, bz) {
67  runForwardBackwardTest(makePropagator(bz), geoCtx, magCtx,
68  makeParametersCurvilinear(phi, theta, p, q), s, epsPos,
69  epsDir, epsMom);
70 }
71 
72 // check that reachable surfaces are correctly reached
73 
74 // True forward/backward tracks do not work with z cylinders
75 BOOST_DATA_TEST_CASE(ToCylinderAlongZ,
78  phi, theta, p, q, s, bz) {
79  runToSurfaceTest(makePropagator(bz), geoCtx, magCtx,
81  ZCylinderSurfaceBuilder(), epsPos, epsDir, epsMom);
82 }
83 
87  phi, theta, p, q, s, bz) {
88  runToSurfaceTest(makePropagator(bz), geoCtx, magCtx,
90  DiscSurfaceBuilder(), epsPos, epsDir, epsMom);
91 }
92 
96  phi, theta, p, q, s, bz) {
97  runToSurfaceTest(makePropagator(bz), geoCtx, magCtx,
99  PlaneSurfaceBuilder(), epsPos, epsDir, epsMom);
100 }
101 
102 // True forward/backward tracks do not work with z straws
103 BOOST_DATA_TEST_CASE(ToStrawAlongZ,
106  phi, theta, p, q, s, bz) {
107  runToSurfaceTest(makePropagator(bz), geoCtx, magCtx,
109  ZStrawSurfaceBuilder(), epsPos, epsDir, epsMom);
110 }
111 
112 // check covariance transport using the ridders propagator for comparison
113 
114 BOOST_DATA_TEST_CASE(CovarianceCurvilinear,
117  phi, theta, p, q, s, bz) {
119  makePropagator(bz), makeRiddersPropagator(bz), geoCtx, magCtx,
121  epsDir, epsMom, epsCov);
122 }
123 
125  CovarianceToCylinderAlongZ,
128  phi, theta, p, q, s, bz) {
130  makePropagator(bz), makeRiddersPropagator(bz), geoCtx, magCtx,
132  ZCylinderSurfaceBuilder(), epsPos, epsDir, epsMom, epsCov);
133 }
134 
135 BOOST_DATA_TEST_CASE(CovarianceToDisc,
138  phi, theta, p, q, s, bz) {
140  makePropagator(bz), makeRiddersPropagator(bz), geoCtx, magCtx,
142  DiscSurfaceBuilder(), epsPos, epsDir, epsMom, epsCov);
143 }
144 
145 BOOST_DATA_TEST_CASE(CovarianceToPlane,
148  phi, theta, p, q, s, bz) {
150  makePropagator(bz), makeRiddersPropagator(bz), geoCtx, magCtx,
152  PlaneSurfaceBuilder(), epsPos, epsDir, epsMom, epsCov);
153 }
154 
155 BOOST_DATA_TEST_CASE(CovarianceToStrawAlongZ,
158  phi, theta, p, q, s, bz) {
159  // the numerical covariance transport to straw surfaces does not seem to be
160  // stable. use a higher tolerance for now.
162  makePropagator(bz), makeRiddersPropagator(bz), geoCtx, magCtx,
164  ZStrawSurfaceBuilder(), epsPos, epsDir, epsMom, 0.125);
165 }
166 
167 BOOST_AUTO_TEST_SUITE_END()