Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-15 07:48:44

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 "ActsFatras/EventData/Particle.hpp"
0013 #include "ActsFatras/Physics/ElectroMagnetic/BetheBloch.hpp"
0014 #include "ActsTests/CommonHelpers/PredefinedMaterials.hpp"
0015 
0016 #include <array>
0017 #include <random>
0018 
0019 #include "Dataset.hpp"
0020 
0021 using Generator = std::ranlux48;
0022 
0023 namespace ActsTests {
0024 
0025 BOOST_AUTO_TEST_SUITE(PhysicsSuite)
0026 
0027 BOOST_DATA_TEST_CASE(FatrasBetheBloch, Dataset::parameters, pdg, phi, theta, p,
0028                      seed) {
0029   Generator gen(seed);
0030   const ActsFatras::Particle before = Dataset::makeParticle(pdg, phi, theta, p);
0031   ActsFatras::Particle after = before;
0032 
0033   ActsFatras::BetheBloch process;
0034   const auto outgoing = process(gen, makeUnitSlab(), after);
0035 
0036   // energy loss creates no new particles
0037   BOOST_CHECK(outgoing.empty());
0038   // energy loss changes momentum and energy
0039   if (after.isAlive()) {
0040     BOOST_CHECK_LT(after.absoluteMomentum(), before.absoluteMomentum());
0041     BOOST_CHECK_LT(after.energy(), before.energy());
0042   } else {
0043     BOOST_CHECK_EQUAL(after.outcome(),
0044                       ActsFatras::SimulationOutcome::KilledInteraction);
0045   }
0046 }
0047 
0048 BOOST_AUTO_TEST_SUITE_END()
0049 
0050 }  // namespace ActsTests