9 #include <boost/test/data/test_case.hpp>
10 #include <boost/test/tools/output_test_stream.hpp>
11 #include <boost/test/unit_test.hpp>
47 namespace tt = boost::test_tools;
48 using namespace Acts::UnitLiterals;
68 using BField = ConstantBField;
73 const double Bz = 2_T;
97 template <
typename propagator_t>
100 double p = pT / sin(theta);
101 double q = -1 + 2 *
charge;
112 10_mm, 0, 0.123, 0, 0.5, 0,
113 0, 10_mm, 0, 0.162, 0, 0,
114 0.123, 0, 0.1, 0, 0, 0,
115 0, 0.162, 0, 0.1, 0, 0,
116 0.5, 0, 0, 0, 1_e / 10_GeV, 0,
119 std::cout << cov.determinant() << std::endl;
124 using ActionListType = ActionList<MaterialInteractor>;
125 using AbortListType = AbortList<>;
130 fwdOptions.maxStepSize = 25_cm;
134 auto& fwdMaterialInteractor =
135 fwdOptions.actionList.template get<MaterialInteractor>();
136 fwdMaterialInteractor.recordInteractions =
true;
137 fwdMaterialInteractor.energyLoss =
false;
138 fwdMaterialInteractor.multipleScattering =
false;
141 std::cout <<
">>> Forward Propagation : start." << std::endl;
144 const auto& fwdResult = prop.propagate(start, fwdOptions).value();
145 auto& fwdMaterial = fwdResult.template get<MaterialInteractor::result_type>();
147 double fwdStepMaterialInX0 = 0.;
148 double fwdStepMaterialInL0 = 0.;
150 BOOST_CHECK_NE(fwdMaterial.materialInX0, 0.);
151 BOOST_CHECK_NE(fwdMaterial.materialInL0, 0.);
153 for (
auto& mInteraction : fwdMaterial.materialInteractions) {
154 fwdStepMaterialInX0 += mInteraction.materialSlab.thicknessInX0();
155 fwdStepMaterialInL0 += mInteraction.materialSlab.thicknessInL0();
163 std::cout <<
">>> Material steps found on ..." << std::endl;
164 for (
auto& fwdStepsC : fwdMaterial.materialInteractions) {
165 std::cout <<
"--> Surface with " << fwdStepsC.surface->geometryId()
172 bwdOptions.maxStepSize = 25_cm;
177 auto& bwdMaterialInteractor =
178 bwdOptions.actionList.template get<MaterialInteractor>();
179 bwdMaterialInteractor.recordInteractions =
true;
180 bwdMaterialInteractor.energyLoss =
false;
181 bwdMaterialInteractor.multipleScattering =
false;
186 std::cout <<
">>> Backward Propagation : start." << std::endl;
188 const auto& bwdResult =
189 prop.propagate(*fwdResult.endParameters, startSurface, bwdOptions)
193 std::cout <<
">>> Backward Propagation : end." << std::endl;
197 bwdResult.template get<typename MaterialInteractor::result_type>();
199 double bwdStepMaterialInX0 = 0.;
200 double bwdStepMaterialInL0 = 0.;
203 BOOST_CHECK_NE(bwdMaterial.materialInX0, 0.);
204 BOOST_CHECK_NE(bwdMaterial.materialInL0, 0.);
206 for (
auto& mInteraction : bwdMaterial.materialInteractions) {
207 bwdStepMaterialInX0 += mInteraction.materialSlab.thicknessInX0();
208 bwdStepMaterialInL0 += mInteraction.materialSlab.thicknessInL0();
217 std::cout <<
">>> Material steps found on ..." << std::endl;
218 for (
auto& bwdStepsC : bwdMaterial.materialInteractions) {
219 std::cout <<
"--> Surface with " << bwdStepsC.surface->geometryId()
225 BOOST_CHECK_EQUAL(bwdMaterial.materialInteractions.size(),
226 fwdMaterial.materialInteractions.size());
234 fwdStepOptions.maxStepSize = 25_cm;
238 auto& fwdStepMaterialInteractor =
239 fwdStepOptions.actionList.template get<MaterialInteractor>();
240 fwdStepMaterialInteractor.recordInteractions =
true;
241 fwdStepMaterialInteractor.energyLoss =
false;
242 fwdStepMaterialInteractor.multipleScattering =
false;
244 double fwdStepStepMaterialInX0 = 0.;
245 double fwdStepStepMaterialInL0 = 0.;
249 std::cout <<
">>> Forward steps to be processed sequentially ..."
251 for (
auto& fwdStepsC : fwdMaterial.materialInteractions) {
252 std::cout <<
"--> Surface with " << fwdStepsC.surface->geometryId()
259 std::vector<BoundTrackParameters> stepParameters;
260 for (
auto& fwdSteps : fwdMaterial.materialInteractions) {
262 std::cout <<
">>> Forward step : "
264 << fwdSteps.surface->geometryId() << std::endl;
268 const auto& fwdStep =
269 prop.propagate(sParameters, (*fwdSteps.surface), fwdStepOptions)
272 auto& fwdStepMaterial =
273 fwdStep.template get<typename MaterialInteractor::result_type>();
274 fwdStepStepMaterialInX0 += fwdStepMaterial.materialInX0;
275 fwdStepStepMaterialInL0 += fwdStepMaterial.materialInL0;
277 if (fwdStep.endParameters.has_value()) {
279 stepParameters.push_back(*fwdStep.endParameters);
280 sParameters = stepParameters.back();
284 const Surface& dSurface = fwdResult.endParameters->referenceSurface();
287 std::cout <<
">>> Forward step : "
292 const auto& fwdStepFinal =
293 prop.propagate(sParameters, dSurface, fwdStepOptions).
value();
295 auto& fwdStepMaterial =
296 fwdStepFinal.template get<typename MaterialInteractor::result_type>();
297 fwdStepStepMaterialInX0 += fwdStepMaterial.materialInX0;
298 fwdStepStepMaterialInL0 += fwdStepMaterial.materialInL0;
308 bwdStepOptions.maxStepSize = 25_cm;
313 auto& bwdStepMaterialInteractor =
314 bwdStepOptions.actionList.template get<MaterialInteractor>();
315 bwdStepMaterialInteractor.recordInteractions =
true;
316 bwdStepMaterialInteractor.multipleScattering =
false;
317 bwdStepMaterialInteractor.energyLoss =
false;
319 double bwdStepStepMaterialInX0 = 0.;
320 double bwdStepStepMaterialInL0 = 0.;
324 std::cout <<
">>> Backward steps to be processed sequentially ..."
326 for (
auto& bwdStepsC : bwdMaterial.materialInteractions) {
327 std::cout <<
"--> Surface with " << bwdStepsC.surface->geometryId()
333 sParameters = *fwdResult.endParameters;
334 for (
auto& bwdSteps : bwdMaterial.materialInteractions) {
336 std::cout <<
">>> Backward step : "
338 << bwdSteps.surface->geometryId() << std::endl;
341 const auto& bwdStep =
342 prop.propagate(sParameters, (*bwdSteps.surface), bwdStepOptions)
345 auto& bwdStepMaterial =
346 bwdStep.template get<typename MaterialInteractor::result_type>();
347 bwdStepStepMaterialInX0 += bwdStepMaterial.materialInX0;
348 bwdStepStepMaterialInL0 += bwdStepMaterial.materialInL0;
350 if (bwdStep.endParameters.has_value()) {
352 stepParameters.push_back(*bwdStep.endParameters);
353 sParameters = stepParameters.back();
360 std::cout <<
">>> Backward step : "
365 const auto& bwdStepFinal =
366 prop.propagate(sParameters, dbSurface, bwdStepOptions).
value();
368 auto& bwdStepMaterial =
369 bwdStepFinal.template get<typename MaterialInteractor::result_type>();
370 bwdStepStepMaterialInX0 += bwdStepMaterial.materialInX0;
371 bwdStepStepMaterialInL0 += bwdStepMaterial.materialInL0;
379 auto& covfwdMaterialInteractor =
380 fwdOptions.actionList.template get<MaterialInteractor>();
381 covfwdMaterialInteractor.recordInteractions =
false;
382 covfwdMaterialInteractor.energyLoss =
true;
383 covfwdMaterialInteractor.multipleScattering =
true;
386 const auto& covfwdResult = prop.propagate(start, fwdOptions).value();
390 covfwdResult.endParameters->covariance().value().determinant());
396 test_material_collector,
398 bdata::distribution =
399 std::uniform_real_distribution<>(0.5_GeV, 10_GeV))) ^
401 bdata::distribution =
402 std::uniform_real_distribution<>(-M_PI, M_PI))) ^
404 bdata::distribution =
405 std::uniform_real_distribution<>(1.0, M_PI - 1.0))) ^
408 bdata::distribution = std::uniform_int_distribution<>(0, 1))) ^
411 bdata::distribution = std::uniform_int_distribution<>(0, 100))) ^