ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PropagationTests.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PropagationTests.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2017-2019 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 
12 #include <cmath>
13 #include <iostream>
14 
35 
36 namespace bdata = boost::unit_test::data;
37 namespace tt = boost::test_tools;
38 using namespace Acts::UnitLiterals;
39 
40 namespace Acts {
41 namespace IntegrationTest {
42 
46 using DenseStepperType =
56 
57 // number of tests
58 const int ntests = 100;
59 const int skip = 0;
60 const bool covtpr = true;
61 const bool debug = false;
62 
63 // setup propagator with constant B-field
64 const double Bz = 2_T;
65 BFieldType bField(0, 0, Bz);
73 
80 
83  vConf.position = {1.5_m, 0., 0.};
84  vConf.length = {3_m, 1_m, 1_m};
85 
86  vConf.volumeMaterial = std::make_shared<const HomogeneousVolumeMaterial>(
87  Material(352.8, 407., 9.012, 4., 1.848e-3));
89  conf.volumeCfg.push_back(vConf);
90  conf.position = {1.5_m, 0., 0.};
91  conf.length = {3_m, 1_m, 1_m};
92  CuboidVolumeBuilder cvb(conf);
94  tgbCfg.trackingVolumeBuilders.push_back(
95  [=](const auto& context, const auto& inner, const auto&) {
96  return cvb.trackingVolume(context, inner, nullptr);
97  });
98  TrackingGeometryBuilder tgb(tgbCfg);
99  std::shared_ptr<const TrackingGeometry> detector =
100  tgb.trackingGeometry(tgContext);
101  Navigator navi(detector);
102  return DensePropagatorType(dstepper, std::move(navi));
103 }
104 
105 // The constant field test
108  constant_bfieldforward_propagation_,
109  bdata::random((bdata::seed = 0,
110  bdata::distribution =
111  std::uniform_real_distribution<>(0.4_GeV, 10_GeV))) ^
112  bdata::random((bdata::seed = 1,
113  bdata::distribution =
114  std::uniform_real_distribution<>(-M_PI, M_PI))) ^
115  bdata::random((bdata::seed = 2,
116  bdata::distribution =
117  std::uniform_real_distribution<>(0.1, M_PI - 0.1))) ^
118  bdata::random(
119  (bdata::seed = 3,
120  bdata::distribution = std::uniform_int_distribution<>(0, 1))) ^
121  bdata::random(
122  (bdata::seed = 4,
123  bdata::distribution = std::uniform_int_distribution<>(0, 100))) ^
124  bdata::xrange(ntests),
125  pT, phi, theta, charge, time, index) {
126  if (index < skip) {
127  return;
128  }
129 
130  double dcharge = -1 + 2 * charge;
131  // constant field propagation atlas stepper
132  auto aposition = constant_field_propagation(apropagator, pT, phi, theta,
133  dcharge, time, Bz);
134  // constant field propagation eigen stepper
135  auto eposition = constant_field_propagation(epropagator, pT, phi, theta,
136  dcharge, time, Bz);
137  // check consistency
138  CHECK_CLOSE_REL(eposition, aposition, 1e-6);
139 }
140 
141 // The actual test - needs to be included to avoid
142 // template inside template definition through boost
143 #include "PropagationTestBase.hpp"
144 
145 } // namespace IntegrationTest
146 } // namespace Acts