forked from sPHENIX-Collaboration/acts
/
EnergyLossTests.cpp
56 lines (45 loc) · 1.93 KB
/
EnergyLossTests.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// This file is part of the Acts project.
//
// Copyright (C) 2018-2020 CERN for the benefit of the Acts project
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <boost/test/data/test_case.hpp>
#include <boost/test/unit_test.hpp>
#include "Acts/Material/MaterialSlab.hpp"
#include "Acts/Tests/CommonHelpers/PredefinedMaterials.hpp"
#include "ActsFatras/EventData/Particle.hpp"
#include "ActsFatras/Physics/EnergyLoss/BetheBloch.hpp"
#include "ActsFatras/Physics/EnergyLoss/BetheHeitler.hpp"
#include <random>
#include "Dataset.hpp"
using Generator = std::ranlux48;
BOOST_AUTO_TEST_SUITE(FatrasEnergyLoss)
BOOST_DATA_TEST_CASE(BetheBloch, Dataset::parameters, pdg, phi, lambda, p,
seed) {
Generator gen(seed);
ActsFatras::Particle before = Dataset::makeParticle(pdg, phi, lambda, p);
ActsFatras::Particle after = before;
ActsFatras::BetheBloch process;
const auto outgoing = process(gen, Acts::Test::makeUnitSlab(), after);
// energy loss changes momentum and energy
BOOST_CHECK_LT(after.absMomentum(), before.absMomentum());
BOOST_CHECK_LT(after.energy(), before.energy());
// energy loss creates no new particles
BOOST_CHECK(outgoing.empty());
}
BOOST_DATA_TEST_CASE(BetheHeitler, Dataset::parameters, pdg, phi, lambda, p,
seed) {
Generator gen(seed);
ActsFatras::Particle before = Dataset::makeParticle(pdg, phi, lambda, p);
ActsFatras::Particle after = before;
ActsFatras::BetheHeitler process;
const auto outgoing = process(gen, Acts::Test::makeUnitSlab(), after);
// energy loss changes momentum and energy
BOOST_CHECK_LT(after.absMomentum(), before.absMomentum());
BOOST_CHECK_LT(after.energy(), before.energy());
// energy loss creates no new particles
BOOST_CHECK(outgoing.empty());
}
BOOST_AUTO_TEST_SUITE_END()