Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BetheHeitlerTests.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file BetheHeitlerTests.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2018-2021 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 
19 
20 #include <array>
21 #include <random>
22 #include <utility>
23 
24 #include "Dataset.hpp"
25 
26 using Generator = std::ranlux48;
27 
29  FatrasBetheHeitler,
32  phi, lambda, p, seed) {
34  ActsFatras::Particle before =
36  ActsFatras::Particle after = before;
37 
39  const auto outgoing = process(gen, Acts::Test::makeUnitSlab(), after);
40  // energy loss changes momentum and energy
41  BOOST_CHECK_LT(after.absoluteMomentum(), before.absoluteMomentum());
42  BOOST_CHECK_LT(after.energy(), before.energy());
43  // energy loss creates no new particles
44  BOOST_CHECK_EQUAL(outgoing.size(), 1);
45  BOOST_CHECK_GT(outgoing[0].absoluteMomentum(), 0.);
46  BOOST_CHECK_EQUAL(outgoing[0].pathInX0(), 0.);
47  BOOST_CHECK_EQUAL(outgoing[0].pathInL0(), 0.);
48 
49  // Get the four momenta
50  Acts::Vector4 p0 = before.fourMomentum();
51  Acts::Vector4 p1 = after.fourMomentum();
52  Acts::Vector4 k = outgoing[0].fourMomentum();
53 
54  // Test for similar invariant masses
55  Acts::Vector4 sum = p1 + k;
56  double s = sum(Acts::eEnergy) * sum(Acts::eEnergy) -
57  sum.template segment<3>(Acts::eMom0).norm() *
58  sum.template segment<3>(Acts::eMom0).norm();
59  double s0 = p0(Acts::eEnergy) * p0(Acts::eEnergy) -
60  p0.template segment<3>(Acts::eMom0).norm() *
61  p0.template segment<3>(Acts::eMom0).norm();
62  CHECK_CLOSE_OR_SMALL(s, s0, 1e-2, 1e-2);
63 }