ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EnergyLossTests.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file EnergyLossTests.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2018-2020 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #include <boost/test/data/test_case.hpp>
10 #include <boost/test/unit_test.hpp>
11 
12 #include <random>
13 
19 #include "Dataset.hpp"
20 
21 using Generator = std::ranlux48;
22 
23 BOOST_AUTO_TEST_SUITE(FatrasEnergyLoss)
24 
25 BOOST_DATA_TEST_CASE(BetheBloch, Dataset::parameters, pdg, phi, lambda, p,
26  seed) {
27  Generator gen(seed);
28  ActsFatras::Particle before = Dataset::makeParticle(pdg, phi, lambda, p);
29  ActsFatras::Particle after = before;
30 
31  ActsFatras::BetheBloch process;
32  const auto outgoing = process(gen, Acts::Test::makeUnitSlab(), after);
33  // energy loss changes momentum and energy
34  BOOST_TEST(after.absMomentum() < before.absMomentum());
35  BOOST_TEST(after.energy() < before.energy());
36  // energy loss creates no new particles
37  BOOST_TEST(outgoing.empty());
38 }
39 
41  seed) {
42  Generator gen(seed);
44  ActsFatras::Particle after = before;
45 
47  const auto outgoing = process(gen, Acts::Test::makeUnitSlab(), after);
48  // energy loss changes momentum and energy
49  BOOST_TEST(after.absMomentum() < before.absMomentum());
50  BOOST_TEST(after.energy() < before.energy());
51  // energy loss creates no new particles
52  BOOST_TEST(outgoing.empty());
53 }
54 
55 BOOST_AUTO_TEST_SUITE_END()