9 #include <boost/test/data/test_case.hpp>
10 #include <boost/test/tools/output_test_stream.hpp>
11 #include <boost/test/unit_test.hpp>
34 namespace tt = boost::test_tools;
35 using namespace Acts::UnitLiterals;
55 using BField = ConstantBField;
60 const double Bz = 2
_T;
85 template <
typename propagator_t>
88 double dcharge = -1 + 2 *
charge;
98 double px = pT * cos(phi);
99 double py = pT * sin(phi);
100 double pz = pT / tan(theta);
109 10
_mm, 0, 0.123, 0, 0.5, 0,
110 0, 10
_mm, 0, 0.162, 0, 0,
111 0.123, 0, 0.1, 0, 0, 0,
112 0, 0.162, 0, 0.1, 0, 0,
113 0.5, 0, 0, 0, 1
_e / 10
_GeV, 0,
116 std::cout << cov.determinant() << std::endl;
128 fwdOptions.maxStepSize = 25
_cm;
133 auto& fwdMaterialInteractor =
134 fwdOptions.actionList.template get<MaterialInteractor>();
135 fwdMaterialInteractor.recordInteractions =
true;
136 fwdMaterialInteractor.energyLoss =
false;
137 fwdMaterialInteractor.multipleScattering =
false;
140 std::cout <<
">>> Forward Propagation : start." << std::endl;
143 const auto& fwdResult = prop.propagate(start, fwdOptions).value();
144 auto& fwdMaterial = fwdResult.template get<MaterialInteractor::result_type>();
146 double fwdStepMaterialInX0 = 0.;
147 double fwdStepMaterialInL0 = 0.;
149 BOOST_CHECK_NE(fwdMaterial.materialInX0, 0.);
150 BOOST_CHECK_NE(fwdMaterial.materialInL0, 0.);
152 for (
auto& mInteraction : fwdMaterial.materialInteractions) {
153 fwdStepMaterialInX0 += mInteraction.materialProperties.thicknessInX0();
154 fwdStepMaterialInL0 += mInteraction.materialProperties.thicknessInL0();
161 const auto& fwdOutput = fwdResult.template get<DebugOutput::result_type>();
162 std::cout <<
">>> Forward Propagation & Navigation output " << std::endl;
163 std::cout << fwdOutput.debugString << std::endl;
165 std::cout <<
">>> Material steps found on ..." << std::endl;
166 for (
auto& fwdStepsC : fwdMaterial.materialInteractions) {
167 std::cout <<
"--> Surface with " << fwdStepsC.surface->geoID()
174 bwdOptions.maxStepSize = -25
_cm;
180 auto& bwdMaterialInteractor =
181 bwdOptions.actionList.template get<MaterialInteractor>();
182 bwdMaterialInteractor.recordInteractions =
true;
183 bwdMaterialInteractor.energyLoss =
false;
184 bwdMaterialInteractor.multipleScattering =
false;
189 std::cout <<
">>> Backward Propagation : start." << std::endl;
191 const auto& bwdResult =
192 prop.propagate(*fwdResult.endParameters.get(), startSurface, bwdOptions)
196 std::cout <<
">>> Backward Propagation : end." << std::endl;
200 bwdResult.template get<typename MaterialInteractor::result_type>();
202 double bwdStepMaterialInX0 = 0.;
203 double bwdStepMaterialInL0 = 0.;
206 BOOST_CHECK_NE(bwdMaterial.materialInX0, 0.);
207 BOOST_CHECK_NE(bwdMaterial.materialInL0, 0.);
209 for (
auto& mInteraction : bwdMaterial.materialInteractions) {
210 bwdStepMaterialInX0 += mInteraction.materialProperties.thicknessInX0();
211 bwdStepMaterialInL0 += mInteraction.materialProperties.thicknessInL0();
219 const auto& bwd_output = bwdResult.template get<DebugOutput::result_type>();
220 std::cout <<
">>> Backward Propagation & Navigation output " << std::endl;
221 std::cout << bwd_output.debugString << std::endl;
223 std::cout <<
">>> Material steps found on ..." << std::endl;
224 for (
auto& bwdStepsC : bwdMaterial.materialInteractions) {
225 std::cout <<
"--> Surface with " << bwdStepsC.surface->geoID()
231 BOOST_CHECK_EQUAL(bwdMaterial.materialInteractions.size(),
232 fwdMaterial.materialInteractions.size());
240 fwdStepOptions.maxStepSize = 25
_cm;
245 auto& fwdStepMaterialInteractor =
246 fwdStepOptions.actionList.template get<MaterialInteractor>();
247 fwdStepMaterialInteractor.recordInteractions =
true;
248 fwdStepMaterialInteractor.energyLoss =
false;
249 fwdStepMaterialInteractor.multipleScattering =
false;
251 double fwdStepStepMaterialInX0 = 0.;
252 double fwdStepStepMaterialInL0 = 0.;
256 std::cout <<
">>> Forward steps to be processed sequentially ..."
258 for (
auto& fwdStepsC : fwdMaterial.materialInteractions) {
259 std::cout <<
"--> Surface with " << fwdStepsC.surface->geoID()
266 std::vector<std::unique_ptr<const BoundParameters>> stepParameters;
267 for (
auto& fwdSteps : fwdMaterial.materialInteractions) {
269 std::cout <<
">>> Forward step : "
271 << fwdSteps.surface->geoID() << std::endl;
275 const auto& fwdStep =
276 prop.propagate(*sParameters, (*fwdSteps.surface), fwdStepOptions)
280 const auto& fwdStepOutput =
281 fwdStep.template get<DebugOutput::result_type>();
282 std::cout << fwdStepOutput.debugString << std::endl;
285 auto& fwdStepMaterial =
286 fwdStep.template get<typename MaterialInteractor::result_type>();
287 fwdStepStepMaterialInX0 += fwdStepMaterial.materialInX0;
288 fwdStepStepMaterialInL0 += fwdStepMaterial.materialInL0;
290 if (fwdStep.endParameters !=
nullptr) {
292 stepParameters.push_back(
293 std::make_unique<BoundParameters>((*fwdStep.endParameters.get())));
294 sParameters = stepParameters.back().get();
298 const Surface& dSurface = fwdResult.endParameters->referenceSurface();
301 std::cout <<
">>> Forward step : "
303 << dSurface.
geoID() << std::endl;
306 const auto& fwdStepFinal =
307 prop.propagate(*sParameters, dSurface, fwdStepOptions).
value();
309 auto& fwdStepMaterial =
310 fwdStepFinal.template get<typename MaterialInteractor::result_type>();
311 fwdStepStepMaterialInX0 += fwdStepMaterial.materialInX0;
312 fwdStepStepMaterialInL0 += fwdStepMaterial.materialInL0;
320 const auto& fwdStepOutput =
321 fwdStepFinal.template get<DebugOutput::result_type>();
322 std::cout <<
">>> Forward final step propgation & navigation output "
324 std::cout << fwdStepOutput.debugString << std::endl;
331 bwdStepOptions.maxStepSize = -25
_cm;
333 bwdStepOptions.direction =
backward;
337 auto& bwdStepMaterialInteractor =
338 bwdStepOptions.actionList.template get<MaterialInteractor>();
339 bwdStepMaterialInteractor.recordInteractions =
true;
340 bwdStepMaterialInteractor.multipleScattering =
false;
341 bwdStepMaterialInteractor.energyLoss =
false;
343 double bwdStepStepMaterialInX0 = 0.;
344 double bwdStepStepMaterialInL0 = 0.;
348 std::cout <<
">>> Backward steps to be processed sequentially ..."
350 for (
auto& bwdStepsC : bwdMaterial.materialInteractions) {
351 std::cout <<
"--> Surface with " << bwdStepsC.surface->geoID()
357 sParameters = fwdResult.endParameters.
get();
358 for (
auto& bwdSteps : bwdMaterial.materialInteractions) {
360 std::cout <<
">>> Backward step : "
362 << bwdSteps.surface->geoID() << std::endl;
365 const auto& bwdStep =
366 prop.propagate(*sParameters, (*bwdSteps.surface), bwdStepOptions)
370 const auto& bwdStepOutput =
371 bwdStep.template get<DebugOutput::result_type>();
372 std::cout << bwdStepOutput.debugString << std::endl;
375 auto& bwdStepMaterial =
376 bwdStep.template get<typename MaterialInteractor::result_type>();
377 bwdStepStepMaterialInX0 += bwdStepMaterial.materialInX0;
378 bwdStepStepMaterialInL0 += bwdStepMaterial.materialInL0;
380 if (bwdStep.endParameters !=
nullptr) {
382 stepParameters.push_back(
383 std::make_unique<BoundParameters>(*(bwdStep.endParameters.get())));
384 sParameters = stepParameters.back().get();
391 std::cout <<
">>> Backward step : "
393 << dSurface.
geoID() << std::endl;
396 const auto& bwdStepFinal =
397 prop.propagate(*sParameters, dbSurface, bwdStepOptions).
value();
399 auto& bwdStepMaterial =
400 bwdStepFinal.template get<typename MaterialInteractor::result_type>();
401 bwdStepStepMaterialInX0 += bwdStepMaterial.materialInX0;
402 bwdStepStepMaterialInL0 += bwdStepMaterial.materialInL0;
410 const auto& bwdStepOutput =
411 bwdStepFinal.template get<DebugOutput::result_type>();
412 std::cout <<
">>> Backward final step propgation & navigation output "
414 std::cout << bwdStepOutput.debugString << std::endl;
419 auto& covfwdMaterialInteractor =
420 fwdOptions.actionList.template get<MaterialInteractor>();
421 covfwdMaterialInteractor.recordInteractions =
false;
422 covfwdMaterialInteractor.energyLoss =
true;
423 covfwdMaterialInteractor.multipleScattering =
true;
426 const auto& covfwdResult = prop.propagate(start, fwdOptions).value();
428 BOOST_TEST(cov.determinant() <=
429 covfwdResult.endParameters->covariance().value().determinant());
435 test_material_collector,
437 bdata::distribution =
438 std::uniform_real_distribution<>(0.5
_GeV, 10
_GeV))) ^
440 bdata::distribution =
441 std::uniform_real_distribution<>(-
M_PI,
M_PI))) ^
443 bdata::distribution =
444 std::uniform_real_distribution<>(1.0,
M_PI - 1.0))) ^
447 bdata::distribution = std::uniform_int_distribution<>(0, 1))) ^
450 bdata::distribution = std::uniform_int_distribution<>(0, 100))) ^