Analysis Software
Documentation for sPHENIX simulation 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 
24 
25 #include <limits>
26 
27 #include "PropagationDatasets.hpp"
28 #include "PropagationTests.hpp"
29 
30 namespace {
31 
32 namespace ds = ActsTests::PropagationDatasets;
33 using namespace Acts::UnitLiterals;
34 
39 using RiddersPropagator = Acts::RiddersPropagator<Propagator>;
40 
41 // absolute parameter tolerances for position, direction, and absolute momentum
42 constexpr auto epsPos = 10_um;
43 constexpr auto epsDir = 1_mrad;
44 constexpr auto epsMom = 5_MeV;
45 // relative covariance tolerance
46 constexpr auto epsCov = 0.07;
47 
50 
51 inline std::shared_ptr<const Acts::TrackingGeometry> makeDetector() {
52  using namespace Acts;
53 
54  // avoid rebuilding the tracking geometry for every propagator
55  static std::shared_ptr<const Acts::TrackingGeometry> detector;
56  if (not detector) {
58  vConf.position = {0., 0., 0.};
59  vConf.length = {4_m, 4_m, 4_m};
60  vConf.volumeMaterial = std::make_shared<const HomogeneousVolumeMaterial>(
63  conf.volumeCfg.push_back(vConf);
64  conf.position = {0., 0., 0.};
65  conf.length = {4_m, 4_m, 4_m};
66  CuboidVolumeBuilder cvb(conf);
68  tgbCfg.trackingVolumeBuilders.push_back(
69  [=](const auto& context, const auto& inner, const auto&) {
70  return cvb.trackingVolume(context, inner, nullptr);
71  });
73  }
74 
75  return detector;
76 }
77 
78 inline Propagator makePropagator(double bz) {
79  using namespace Acts;
80 
81  auto magField = std::make_shared<MagneticField>(Acts::Vector3(0.0, 0.0, bz));
82  Stepper stepper(std::move(magField));
83  auto logger = getDefaultLogger("Dense", Logging::INFO);
84  return Propagator(
86  Acts::Navigator{{makeDetector()}, logger->cloneWithSuffix("Nav")},
87  logger->cloneWithSuffix("Prop"));
88 }
89 
90 inline RiddersPropagator makeRiddersPropagator(double bz) {
91  using namespace Acts;
92 
93  auto magField = std::make_shared<MagneticField>(Acts::Vector3(0.0, 0.0, bz));
94  Stepper stepper(std::move(magField));
95  return RiddersPropagator(std::move(stepper),
96  Acts::Navigator{{makeDetector()}});
97 }
98 
99 } // namespace
100 
101 BOOST_AUTO_TEST_SUITE(PropagationDenseConstant)
102 
103 // check that the propagation is reversible and self-consistent
104 
105 // TODO does not seem to work as-is
106 BOOST_DATA_TEST_CASE(ForwardBackward,
107  ds::phi* ds::theta* ds::absMomentum* ds::chargeNonZero*
108  ds::pathLength* ds::magneticField,
109  phi, theta, p, q, s, bz) {
110  runForwardBackwardTest<Propagator, Acts::DenseStepperPropagatorOptions>(
111  makePropagator(bz), geoCtx, magCtx,
112  makeParametersCurvilinear(phi, theta, p, q), s, epsPos, epsDir, epsMom);
113 }
114 
115 // check that reachable surfaces are correctly reached
116 
117 // True forward/backward tracks do not work with z cylinders
118 BOOST_DATA_TEST_CASE(ToCylinderAlongZ,
121  phi, theta, p, q, s, bz) {
124  makePropagator(bz), geoCtx, magCtx,
125  makeParametersCurvilinear(phi, theta, p, q), s, ZCylinderSurfaceBuilder(),
126  epsPos, epsDir, epsMom);
127 }
128 
132  phi, theta, p, q, s, bz) {
135  makePropagator(bz), geoCtx, magCtx,
136  makeParametersCurvilinear(phi, theta, p, q), s, DiscSurfaceBuilder(),
137  epsPos, epsDir, epsMom);
138 }
139 
143  phi, theta, p, q, s, bz) {
146  makePropagator(bz), geoCtx, magCtx,
147  makeParametersCurvilinear(phi, theta, p, q), s, PlaneSurfaceBuilder(),
148  epsPos, epsDir, epsMom);
149 }
150 
151 // True forward/backward tracks do not work with z straws
152 BOOST_DATA_TEST_CASE(ToStrawAlongZ,
155  phi, theta, p, q, s, bz) {
158  makePropagator(bz), geoCtx, magCtx,
159  makeParametersCurvilinear(phi, theta, p, q), s, ZStrawSurfaceBuilder(),
160  epsPos, epsDir, epsMom);
161 }
162 
163 // check covariance transport using the ridders propagator for comparison
164 
165 BOOST_DATA_TEST_CASE(CovarianceCurvilinear,
168  phi, theta, p, q, s, bz) {
169  runForwardComparisonTest<Propagator, RiddersPropagator,
171  makePropagator(bz), makeRiddersPropagator(bz), geoCtx, magCtx,
173  epsDir, epsMom, epsCov);
174 }
175 
176 // limit theta to ignore the covariance mismatches at high theta for now
177 BOOST_DATA_TEST_CASE(CovarianceToCylinderAlongZ,
180  phi, theta, p, q, s, bz) {
181  runToSurfaceComparisonTest<Propagator, RiddersPropagator,
184  makePropagator(bz), makeRiddersPropagator(bz), geoCtx, magCtx,
186  ZCylinderSurfaceBuilder(), epsPos, epsDir, epsMom, epsCov);
187 }
188 
189 BOOST_DATA_TEST_CASE(CovarianceToDisc,
192  phi, theta, p, q, s, bz) {
195  makePropagator(bz), makeRiddersPropagator(bz), geoCtx, magCtx,
197  DiscSurfaceBuilder(), epsPos, epsDir, epsMom, epsCov);
198 }
199 
200 BOOST_DATA_TEST_CASE(CovarianceToPlane,
203  phi, theta, p, q, s, bz) {
206  makePropagator(bz), makeRiddersPropagator(bz), geoCtx, magCtx,
208  PlaneSurfaceBuilder(), epsPos, epsDir, epsMom, epsCov);
209 }
210 
211 // limit theta to ignore the covariance mismatches at high theta for now
212 BOOST_DATA_TEST_CASE(CovarianceToStrawAlongZ,
215  phi, theta, p, q, s, bz) {
216  runToSurfaceComparisonTest<Propagator, RiddersPropagator,
219  makePropagator(bz), makeRiddersPropagator(bz), geoCtx, magCtx,
221  ZStrawSurfaceBuilder(), epsPos, epsDir, epsMom, epsCov);
222 }
223 
224 BOOST_AUTO_TEST_SUITE_END()