EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PropagationDenseConstant.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PropagationDenseConstant.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 
23 
24 #include <limits>
25 
26 #include "PropagationDatasets.hpp"
27 #include "PropagationTests.hpp"
28 
29 namespace {
30 
31 namespace ds = ActsTests::PropagationDatasets;
32 using namespace Acts::UnitLiterals;
33 
34 using MagneticField = Acts::ConstantBField;
38 using RiddersPropagator = Acts::RiddersPropagator<Propagator>;
39 
40 // absolute parameter tolerances for position, direction, and absolute momentum
41 constexpr auto epsPos = 10_um;
42 constexpr auto epsDir = 1_mrad;
43 constexpr auto epsMom = 5_MeV;
44 // relative covariance tolerance
45 constexpr auto epsCov = 0.05;
46 
49 
50 inline std::shared_ptr<const Acts::TrackingGeometry> makeDetector() {
51  using namespace Acts;
52 
53  // avoid rebuilding the tracking geometry for every propagator
54  static std::shared_ptr<const Acts::TrackingGeometry> detector;
55  if (not detector) {
57  vConf.position = {0., 0., 0.};
58  vConf.length = {4_m, 4_m, 4_m};
59  vConf.volumeMaterial = std::make_shared<const HomogeneousVolumeMaterial>(
62  conf.volumeCfg.push_back(vConf);
63  conf.position = {0., 0., 0.};
64  conf.length = {4_m, 4_m, 4_m};
65  CuboidVolumeBuilder cvb(conf);
67  tgbCfg.trackingVolumeBuilders.push_back(
68  [=](const auto& context, const auto& inner, const auto&) {
69  return cvb.trackingVolume(context, inner, nullptr);
70  });
72  }
73 
74  return detector;
75 }
76 
77 inline Propagator makePropagator(double bz) {
78  using namespace Acts;
79 
80  MagneticField magField(Acts::Vector3D(0.0, 0.0, bz));
81  Stepper stepper(std::move(magField));
82  return Propagator(std::move(stepper), Acts::Navigator(makeDetector()));
83 }
84 
85 inline RiddersPropagator makeRiddersPropagator(double bz) {
86  using namespace Acts;
87 
88  MagneticField magField(Acts::Vector3D(0.0, 0.0, bz));
89  Stepper stepper(std::move(magField));
90  return RiddersPropagator(std::move(stepper), Acts::Navigator(makeDetector()));
91 }
92 
93 } // namespace
94 
95 BOOST_AUTO_TEST_SUITE(PropagationDenseConstant)
96 
97 // check that the propagation is reversible and self-consistent
98 
99 // TODO does not seem to work as-is
100 BOOST_DATA_TEST_CASE(ForwardBackward,
101  ds::phi* ds::theta* ds::absMomentum* ds::chargeNonZero*
102  ds::pathLength* ds::magneticField,
103  phi, theta, p, q, s, bz) {
106  makePropagator(bz), geoCtx, magCtx,
107  makeParametersCurvilinear(phi, theta, p, q), s, epsPos, epsDir, epsMom);
108 }
109 
110 // check that reachable surfaces are correctly reached
111 
112 // True forward/backward tracks do not work with z cylinders
113 BOOST_DATA_TEST_CASE(ToCylinderAlongZ,
116  phi, theta, p, q, s, bz) {
119  makePropagator(bz), geoCtx, magCtx,
120  makeParametersCurvilinear(phi, theta, p, q), s, ZCylinderSurfaceBuilder(),
121  epsPos, epsDir, epsMom);
122 }
123 
127  phi, theta, p, q, s, bz) {
130  makePropagator(bz), geoCtx, magCtx,
131  makeParametersCurvilinear(phi, theta, p, q), s, DiscSurfaceBuilder(),
132  epsPos, epsDir, epsMom);
133 }
134 
138  phi, theta, p, q, s, bz) {
141  makePropagator(bz), geoCtx, magCtx,
142  makeParametersCurvilinear(phi, theta, p, q), s, PlaneSurfaceBuilder(),
143  epsPos, epsDir, epsMom);
144 }
145 
146 // True forward/backward tracks do not work with z straws
147 BOOST_DATA_TEST_CASE(ToStrawAlongZ,
150  phi, theta, p, q, s, bz) {
153  makePropagator(bz), geoCtx, magCtx,
154  makeParametersCurvilinear(phi, theta, p, q), s, ZStrawSurfaceBuilder(),
155  epsPos, epsDir, epsMom);
156 }
157 
158 // check covariance transport using the ridders propagator for comparison
159 
160 BOOST_DATA_TEST_CASE(CovarianceCurvilinear,
163  phi, theta, p, q, s, bz) {
166  makePropagator(bz), makeRiddersPropagator(bz), geoCtx, magCtx,
168  epsDir, epsMom, epsCov);
169 }
170 
171 // limit theta to ignore the covariance missmatches at high theta for now
172 BOOST_DATA_TEST_CASE(CovarianceToCylinderAlongZ,
175  phi, theta, p, q, s, bz) {
179  makePropagator(bz), makeRiddersPropagator(bz), geoCtx, magCtx,
181  ZCylinderSurfaceBuilder(), epsPos, epsDir, epsMom, epsCov);
182 }
183 
184 BOOST_DATA_TEST_CASE(CovarianceToDisc,
187  phi, theta, p, q, s, bz) {
191  makePropagator(bz), makeRiddersPropagator(bz), geoCtx, magCtx,
193  DiscSurfaceBuilder(), epsPos, epsDir, epsMom, epsCov);
194 }
195 
196 BOOST_DATA_TEST_CASE(CovarianceToPlane,
199  phi, theta, p, q, s, bz) {
203  makePropagator(bz), makeRiddersPropagator(bz), geoCtx, magCtx,
205  PlaneSurfaceBuilder(), epsPos, epsDir, epsMom, epsCov);
206 }
207 
208 // limit theta to ignore the covariance missmatches at high theta for now
209 BOOST_DATA_TEST_CASE(CovarianceToStrawAlongZ,
212  phi, theta, p, q, s, bz) {
216  makePropagator(bz), makeRiddersPropagator(bz), geoCtx, magCtx,
218  ZStrawSurfaceBuilder(), epsPos, epsDir, epsMom, epsCov);
219 }
220 
221 BOOST_AUTO_TEST_SUITE_END()