Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:25:30

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
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   // energy loss changes momentum and energy
0045   BOOST_CHECK_LT(after.absoluteMomentum(), before.absoluteMomentum());
0046   BOOST_CHECK_LT(after.energy(), before.energy());
0047   // energy loss creates no new particles
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   // Get the four momenta
0054   Acts::Vector4 p0 = before.fourMomentum();
0055   Acts::Vector4 p1 = after.fourMomentum();
0056   Acts::Vector4 k = outgoing[0].fourMomentum();
0057 
0058   // Test for similar invariant masses
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 }  // namespace ActsTests