9 #include <boost/test/data/test_case.hpp>
10 #include <boost/test/tools/output_test_stream.hpp>
11 #include <boost/test/unit_test.hpp>
33 namespace tt = boost::test_tools;
34 using namespace Acts::UnitLiterals;
54 using BField = ConstantBField;
59 const double Bz = 2
_T;
84 template <
typename propagator_t>
87 double p = pT / sin(theta);
88 double q = -1 + 2 *
charge;
99 10_mm, 0, 0.123, 0, 0.5, 0,
100 0, 10_mm, 0, 0.162, 0, 0,
101 0.123, 0, 0.1, 0, 0, 0,
102 0, 0.162, 0, 0.1, 0, 0,
103 0.5, 0, 0, 0, 1_e / 10_GeV, 0,
106 std::cout << cov.determinant() << std::endl;
117 fwdOptions.maxStepSize = 25_cm;
121 auto& fwdMaterialInteractor =
122 fwdOptions.actionList.template get<MaterialInteractor>();
123 fwdMaterialInteractor.recordInteractions =
true;
124 fwdMaterialInteractor.energyLoss =
false;
125 fwdMaterialInteractor.multipleScattering =
false;
128 std::cout <<
">>> Forward Propagation : start." << std::endl;
131 const auto& fwdResult = prop.propagate(start, fwdOptions).value();
132 auto& fwdMaterial = fwdResult.template get<MaterialInteractor::result_type>();
134 double fwdStepMaterialInX0 = 0.;
135 double fwdStepMaterialInL0 = 0.;
137 BOOST_CHECK_NE(fwdMaterial.materialInX0, 0.);
138 BOOST_CHECK_NE(fwdMaterial.materialInL0, 0.);
140 for (
auto& mInteraction : fwdMaterial.materialInteractions) {
141 fwdStepMaterialInX0 += mInteraction.materialSlab.thicknessInX0();
142 fwdStepMaterialInL0 += mInteraction.materialSlab.thicknessInL0();
150 std::cout <<
">>> Material steps found on ..." << std::endl;
151 for (
auto& fwdStepsC : fwdMaterial.materialInteractions) {
152 std::cout <<
"--> Surface with " << fwdStepsC.surface->geometryId()
159 bwdOptions.maxStepSize = -25_cm;
164 auto& bwdMaterialInteractor =
165 bwdOptions.actionList.template get<MaterialInteractor>();
166 bwdMaterialInteractor.recordInteractions =
true;
167 bwdMaterialInteractor.energyLoss =
false;
168 bwdMaterialInteractor.multipleScattering =
false;
173 std::cout <<
">>> Backward Propagation : start." << std::endl;
175 const auto& bwdResult =
176 prop.propagate(*fwdResult.endParameters.get(), startSurface, bwdOptions)
180 std::cout <<
">>> Backward Propagation : end." << std::endl;
184 bwdResult.template get<typename MaterialInteractor::result_type>();
186 double bwdStepMaterialInX0 = 0.;
187 double bwdStepMaterialInL0 = 0.;
190 BOOST_CHECK_NE(bwdMaterial.materialInX0, 0.);
191 BOOST_CHECK_NE(bwdMaterial.materialInL0, 0.);
193 for (
auto& mInteraction : bwdMaterial.materialInteractions) {
194 bwdStepMaterialInX0 += mInteraction.materialSlab.thicknessInX0();
195 bwdStepMaterialInL0 += mInteraction.materialSlab.thicknessInL0();
204 std::cout <<
">>> Material steps found on ..." << std::endl;
205 for (
auto& bwdStepsC : bwdMaterial.materialInteractions) {
206 std::cout <<
"--> Surface with " << bwdStepsC.surface->geometryId()
212 BOOST_CHECK_EQUAL(bwdMaterial.materialInteractions.size(),
213 fwdMaterial.materialInteractions.size());
221 fwdStepOptions.maxStepSize = 25_cm;
225 auto& fwdStepMaterialInteractor =
226 fwdStepOptions.actionList.template get<MaterialInteractor>();
227 fwdStepMaterialInteractor.recordInteractions =
true;
228 fwdStepMaterialInteractor.energyLoss =
false;
229 fwdStepMaterialInteractor.multipleScattering =
false;
231 double fwdStepStepMaterialInX0 = 0.;
232 double fwdStepStepMaterialInL0 = 0.;
236 std::cout <<
">>> Forward steps to be processed sequentially ..."
238 for (
auto& fwdStepsC : fwdMaterial.materialInteractions) {
239 std::cout <<
"--> Surface with " << fwdStepsC.surface->geometryId()
246 std::vector<std::unique_ptr<const BoundTrackParameters>> stepParameters;
247 for (
auto& fwdSteps : fwdMaterial.materialInteractions) {
249 std::cout <<
">>> Forward step : "
251 << fwdSteps.surface->geometryId() << std::endl;
255 const auto& fwdStep =
256 prop.propagate(*sParameters, (*fwdSteps.surface), fwdStepOptions)
259 auto& fwdStepMaterial =
260 fwdStep.template get<typename MaterialInteractor::result_type>();
261 fwdStepStepMaterialInX0 += fwdStepMaterial.materialInX0;
262 fwdStepStepMaterialInL0 += fwdStepMaterial.materialInL0;
264 if (fwdStep.endParameters !=
nullptr) {
266 stepParameters.push_back(std::make_unique<BoundTrackParameters>(
267 (*fwdStep.endParameters.get())));
268 sParameters = stepParameters.back().get();
272 const Surface& dSurface = fwdResult.endParameters->referenceSurface();
275 std::cout <<
">>> Forward step : "
280 const auto& fwdStepFinal =
281 prop.propagate(*sParameters, dSurface, fwdStepOptions).
value();
283 auto& fwdStepMaterial =
284 fwdStepFinal.template get<typename MaterialInteractor::result_type>();
285 fwdStepStepMaterialInX0 += fwdStepMaterial.materialInX0;
286 fwdStepStepMaterialInL0 += fwdStepMaterial.materialInL0;
296 bwdStepOptions.maxStepSize = -25_cm;
298 bwdStepOptions.direction =
backward;
301 auto& bwdStepMaterialInteractor =
302 bwdStepOptions.actionList.template get<MaterialInteractor>();
303 bwdStepMaterialInteractor.recordInteractions =
true;
304 bwdStepMaterialInteractor.multipleScattering =
false;
305 bwdStepMaterialInteractor.energyLoss =
false;
307 double bwdStepStepMaterialInX0 = 0.;
308 double bwdStepStepMaterialInL0 = 0.;
312 std::cout <<
">>> Backward steps to be processed sequentially ..."
314 for (
auto& bwdStepsC : bwdMaterial.materialInteractions) {
315 std::cout <<
"--> Surface with " << bwdStepsC.surface->geometryId()
321 sParameters = fwdResult.endParameters.
get();
322 for (
auto& bwdSteps : bwdMaterial.materialInteractions) {
324 std::cout <<
">>> Backward step : "
326 << bwdSteps.surface->geometryId() << std::endl;
329 const auto& bwdStep =
330 prop.propagate(*sParameters, (*bwdSteps.surface), bwdStepOptions)
333 auto& bwdStepMaterial =
334 bwdStep.template get<typename MaterialInteractor::result_type>();
335 bwdStepStepMaterialInX0 += bwdStepMaterial.materialInX0;
336 bwdStepStepMaterialInL0 += bwdStepMaterial.materialInL0;
338 if (bwdStep.endParameters !=
nullptr) {
340 stepParameters.push_back(std::make_unique<BoundTrackParameters>(
341 *(bwdStep.endParameters.get())));
342 sParameters = stepParameters.back().get();
349 std::cout <<
">>> Backward step : "
354 const auto& bwdStepFinal =
355 prop.propagate(*sParameters, dbSurface, bwdStepOptions).
value();
357 auto& bwdStepMaterial =
358 bwdStepFinal.template get<typename MaterialInteractor::result_type>();
359 bwdStepStepMaterialInX0 += bwdStepMaterial.materialInX0;
360 bwdStepStepMaterialInL0 += bwdStepMaterial.materialInL0;
368 auto& covfwdMaterialInteractor =
369 fwdOptions.actionList.template get<MaterialInteractor>();
370 covfwdMaterialInteractor.recordInteractions =
false;
371 covfwdMaterialInteractor.energyLoss =
true;
372 covfwdMaterialInteractor.multipleScattering =
true;
375 const auto& covfwdResult = prop.propagate(start, fwdOptions).value();
379 covfwdResult.endParameters->covariance().value().determinant());
385 test_material_collector,
386 bdata::random((bdata::seed = 20,
387 bdata::distribution =
388 std::uniform_real_distribution<>(0.5_GeV, 10_GeV))) ^
389 bdata::random((bdata::seed = 21,
390 bdata::distribution =
391 std::uniform_real_distribution<>(-
M_PI,
M_PI))) ^
392 bdata::random((bdata::seed = 22,
393 bdata::distribution =
394 std::uniform_real_distribution<>(1.0,
M_PI - 1.0))) ^
397 bdata::distribution = std::uniform_int_distribution<>(0, 1))) ^
400 bdata::distribution = std::uniform_int_distribution<>(0, 100))) ^