Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PropagationAutodiffConstant.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PropagationAutodiffConstant.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 
20 
21 #include <limits>
22 
23 #include "../PropagationDatasets.hpp"
24 #include "../PropagationTests.hpp"
25 
26 namespace {
27 
28 namespace ds = ActsTests::PropagationDatasets;
29 using namespace Acts::UnitLiterals;
30 
32 using Extension =
36 using RiddersPropagator = Acts::RiddersPropagator<Propagator>;
37 
38 // absolute parameter tolerances for position, direction, and absolute momentum
39 constexpr auto epsPos = 1_um;
40 constexpr auto epsDir = 0.125_mrad;
41 constexpr auto epsMom = 1_eV;
42 // relative covariance tolerance
43 constexpr auto epsCov = 0.025;
44 
47 
48 inline Propagator makePropagator(double bz) {
49  auto magField = std::make_shared<MagneticField>(Acts::Vector3(0.0, 0.0, bz));
50  Stepper stepper(std::move(magField));
51  return Propagator(std::move(stepper));
52 }
53 
54 inline RiddersPropagator makeRiddersPropagator(double bz) {
55  auto magField = std::make_shared<MagneticField>(Acts::Vector3(0.0, 0.0, bz));
56  Stepper stepper(std::move(magField));
57  return RiddersPropagator(std::move(stepper));
58 }
59 
60 } // namespace
61 
62 BOOST_AUTO_TEST_SUITE(PropagationAutodiffConstant)
63 
64 // check that the propagation is reversible and self-consistent
65 
66 BOOST_DATA_TEST_CASE(ForwardBackward,
67  ds::phi* ds::theta* ds::absMomentum* ds::chargeNonZero*
68  ds::pathLength* ds::magneticField,
69  phi, theta, p, q, s, bz) {
70  runForwardBackwardTest(makePropagator(bz), geoCtx, magCtx,
71  makeParametersCurvilinear(phi, theta, p, q), s, epsPos,
72  epsDir, epsMom);
73 }
74 
75 // check that reachable surfaces are correctly reached
76 
77 // True forward/backward tracks do not work with z cylinders
78 BOOST_DATA_TEST_CASE(ToCylinderAlongZ,
81  phi, theta, p, q, s, bz) {
82  runToSurfaceTest(makePropagator(bz), geoCtx, magCtx,
84  ZCylinderSurfaceBuilder(), epsPos, epsDir, epsMom);
85 }
86 
90  phi, theta, p, q, s, bz) {
91  runToSurfaceTest(makePropagator(bz), geoCtx, magCtx,
93  DiscSurfaceBuilder(), epsPos, epsDir, epsMom);
94 }
95 
99  phi, theta, p, q, s, bz) {
100  runToSurfaceTest(makePropagator(bz), geoCtx, magCtx,
102  PlaneSurfaceBuilder(), epsPos, epsDir, epsMom);
103 }
104 
105 // True forward/backward tracks do not work with z straws
106 BOOST_DATA_TEST_CASE(ToStrawAlongZ,
109  phi, theta, p, q, s, bz) {
110  runToSurfaceTest(makePropagator(bz), geoCtx, magCtx,
112  ZStrawSurfaceBuilder(), epsPos, epsDir, epsMom);
113 }
114 
115 // check covariance transport using the ridders propagator for comparison
116 
117 BOOST_DATA_TEST_CASE(CovarianceCurvilinear,
120  phi, theta, p, q, s, bz) {
122  makePropagator(bz), makeRiddersPropagator(bz), geoCtx, magCtx,
124  epsDir, epsMom, epsCov);
125 }
126 
128  CovarianceToCylinderAlongZ,
131  phi, theta, p, q, s, bz) {
133  makePropagator(bz), makeRiddersPropagator(bz), geoCtx, magCtx,
135  ZCylinderSurfaceBuilder(), epsPos, epsDir, epsMom, epsCov);
136 }
137 
138 BOOST_DATA_TEST_CASE(CovarianceToDisc,
141  phi, theta, p, q, s, bz) {
143  makePropagator(bz), makeRiddersPropagator(bz), geoCtx, magCtx,
145  DiscSurfaceBuilder(), epsPos, epsDir, epsMom, epsCov);
146 }
147 
148 BOOST_DATA_TEST_CASE(CovarianceToPlane,
151  phi, theta, p, q, s, bz) {
153  makePropagator(bz), makeRiddersPropagator(bz), geoCtx, magCtx,
155  PlaneSurfaceBuilder(), epsPos, epsDir, epsMom, epsCov);
156 }
157 
158 BOOST_DATA_TEST_CASE(CovarianceToStrawAlongZ,
161  phi, theta, p, q, s, bz) {
162  // the numerical covariance transport to straw surfaces does not seem to be
163  // stable. use a higher tolerance for now.
165  makePropagator(bz), makeRiddersPropagator(bz), geoCtx, magCtx,
167  ZStrawSurfaceBuilder(), epsPos, epsDir, epsMom, 0.125);
168 }
169 
170 BOOST_AUTO_TEST_SUITE_END()