Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PropagationEigenConstant.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PropagationEigenConstant.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 
18 
19 #include <limits>
20 
21 #include "PropagationDatasets.hpp"
22 #include "PropagationTests.hpp"
23 
24 namespace {
25 
26 namespace ds = ActsTests::PropagationDatasets;
27 using namespace Acts::UnitLiterals;
28 
32 using RiddersPropagator = Acts::RiddersPropagator<Propagator>;
33 
34 // absolute parameter tolerances for position, direction, and absolute momentum
35 constexpr auto epsPos = 1_um;
36 constexpr auto epsDir = 0.125_mrad;
37 constexpr auto epsMom = 1_eV;
38 // relative covariance tolerance
39 constexpr auto epsCov = 0.025;
40 
43 
44 inline Propagator makePropagator(double bz) {
45  auto magField = std::make_shared<MagneticField>(Acts::Vector3(0.0, 0.0, bz));
46  Stepper stepper(std::move(magField));
47  return Propagator(std::move(stepper));
48 }
49 
50 inline RiddersPropagator makeRiddersPropagator(double bz) {
51  auto magField = std::make_shared<MagneticField>(Acts::Vector3(0.0, 0.0, bz));
52  Stepper stepper(std::move(magField));
53  return RiddersPropagator(std::move(stepper));
54 }
55 
56 } // namespace
57 
58 BOOST_AUTO_TEST_SUITE(PropagationEigenConstant)
59 
60 // check that the propagation is reversible and self-consistent
61 
62 BOOST_DATA_TEST_CASE(ForwardBackward,
63  ds::phi* ds::theta* ds::absMomentum* ds::chargeNonZero*
64  ds::pathLength* ds::magneticField,
65  phi, theta, p, q, s, bz) {
66  runForwardBackwardTest(makePropagator(bz), geoCtx, magCtx,
67  makeParametersCurvilinear(phi, theta, p, q), s, epsPos,
68  epsDir, epsMom);
69 }
70 
71 // check that reachable surfaces are correctly reached
72 
73 // True forward/backward tracks do not work with z cylinders
74 BOOST_DATA_TEST_CASE(ToCylinderAlongZ,
77  phi, theta, p, q, s, bz) {
78  runToSurfaceTest(makePropagator(bz), geoCtx, magCtx,
80  ZCylinderSurfaceBuilder(), epsPos, epsDir, epsMom);
81 }
82 
86  phi, theta, p, q, s, bz) {
87  runToSurfaceTest(makePropagator(bz), geoCtx, magCtx,
89  DiscSurfaceBuilder(), epsPos, epsDir, epsMom);
90 }
91 
95  phi, theta, p, q, s, bz) {
96  runToSurfaceTest(makePropagator(bz), geoCtx, magCtx,
98  PlaneSurfaceBuilder(), epsPos, epsDir, epsMom);
99 }
100 
101 // True forward/backward tracks do not work with z straws
102 BOOST_DATA_TEST_CASE(ToStrawAlongZ,
105  phi, theta, p, q, s, bz) {
106  runToSurfaceTest(makePropagator(bz), geoCtx, magCtx,
108  ZStrawSurfaceBuilder(), epsPos, epsDir, epsMom);
109 }
110 
111 // check covariance transport using the ridders propagator for comparison
112 
113 BOOST_DATA_TEST_CASE(CovarianceCurvilinear,
116  phi, theta, p, q, s, bz) {
118  makePropagator(bz), makeRiddersPropagator(bz), geoCtx, magCtx,
120  epsDir, epsMom, epsCov);
121 }
122 
124  CovarianceToCylinderAlongZ,
127  phi, theta, p, q, s, bz) {
129  makePropagator(bz), makeRiddersPropagator(bz), geoCtx, magCtx,
131  ZCylinderSurfaceBuilder(), epsPos, epsDir, epsMom, epsCov);
132 }
133 
134 BOOST_DATA_TEST_CASE(CovarianceToDisc,
137  phi, theta, p, q, s, bz) {
139  makePropagator(bz), makeRiddersPropagator(bz), geoCtx, magCtx,
141  DiscSurfaceBuilder(), epsPos, epsDir, epsMom, epsCov);
142 }
143 
144 BOOST_DATA_TEST_CASE(CovarianceToPlane,
147  phi, theta, p, q, s, bz) {
149  makePropagator(bz), makeRiddersPropagator(bz), geoCtx, magCtx,
151  PlaneSurfaceBuilder(), epsPos, epsDir, epsMom, epsCov);
152 }
153 
154 BOOST_DATA_TEST_CASE(CovarianceToStrawAlongZ,
157  phi, theta, p, q, s, bz) {
158  // the numerical covariance transport to straw surfaces does not seem to be
159  // stable. use a higher tolerance for now.
161  makePropagator(bz), makeRiddersPropagator(bz), geoCtx, magCtx,
163  ZStrawSurfaceBuilder(), epsPos, epsDir, epsMom, 0.125);
164 }
165 
166 BOOST_AUTO_TEST_SUITE_END()