File indexing completed on 2025-12-16 09:25:30
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <boost/test/data/test_case.hpp>
0010 #include <boost/test/unit_test.hpp>
0011
0012 #include "Acts/Definitions/Algebra.hpp"
0013 #include "Acts/Definitions/Common.hpp"
0014 #include "Acts/Definitions/PdgParticle.hpp"
0015 #include "ActsFatras/EventData/Particle.hpp"
0016 #include "ActsFatras/Physics/ElectroMagnetic/BetheHeitler.hpp"
0017 #include "ActsTests/CommonHelpers/FloatComparisons.hpp"
0018 #include "ActsTests/CommonHelpers/PredefinedMaterials.hpp"
0019
0020 #include <array>
0021 #include <random>
0022 #include <utility>
0023
0024 #include "Dataset.hpp"
0025
0026 using Generator = std::ranlux48;
0027
0028 namespace ActsTests {
0029
0030 BOOST_AUTO_TEST_SUITE(PhysicsSuite)
0031
0032 BOOST_DATA_TEST_CASE(
0033 FatrasBetheHeitler,
0034 Dataset::momentumPhi* Dataset::momentumTheta* Dataset::momentumAbs ^
0035 Dataset::rngSeed,
0036 phi, theta, p, seed) {
0037 Generator gen(seed);
0038 ActsFatras::Particle before =
0039 Dataset::makeParticle(Acts::PdgParticle::eElectron, phi, theta, p);
0040 ActsFatras::Particle after = before;
0041
0042 ActsFatras::BetheHeitler process;
0043 const auto outgoing = process(gen, makeUnitSlab(), after);
0044
0045 BOOST_CHECK_LT(after.absoluteMomentum(), before.absoluteMomentum());
0046 BOOST_CHECK_LT(after.energy(), before.energy());
0047
0048 BOOST_CHECK_EQUAL(outgoing.size(), 1);
0049 BOOST_CHECK_GT(outgoing[0].absoluteMomentum(), 0.);
0050 BOOST_CHECK_EQUAL(outgoing[0].pathInX0(), 0.);
0051 BOOST_CHECK_EQUAL(outgoing[0].pathInL0(), 0.);
0052
0053
0054 Acts::Vector4 p0 = before.fourMomentum();
0055 Acts::Vector4 p1 = after.fourMomentum();
0056 Acts::Vector4 k = outgoing[0].fourMomentum();
0057
0058
0059 Acts::Vector4 sum = p1 + k;
0060 double s = sum(Acts::eEnergy) * sum(Acts::eEnergy) -
0061 sum.template segment<3>(Acts::eMom0).norm() *
0062 sum.template segment<3>(Acts::eMom0).norm();
0063 double s0 = p0(Acts::eEnergy) * p0(Acts::eEnergy) -
0064 p0.template segment<3>(Acts::eMom0).norm() *
0065 p0.template segment<3>(Acts::eMom0).norm();
0066 CHECK_CLOSE_OR_SMALL(s, s0, 1e-2, 1e-2);
0067 }
0068
0069 BOOST_AUTO_TEST_SUITE_END()
0070
0071 }