EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BetheHeitler.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file BetheHeitler.hpp
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 #pragma once
10 
13 
14 #include <array>
15 #include <random>
16 
17 namespace ActsFatras {
18 
24 struct BetheHeitler {
26  double scaleFactor = 1.;
27 
36  template <typename generator_t>
37  std::array<Particle, 0> operator()(generator_t &generator,
38  const Acts::MaterialSlab &slab,
39  Particle &particle) const {
40  // Take a random gamma-distributed value - depending on t/X0
41  std::gamma_distribution<double> gDist(slab.thicknessInX0() / std::log(2.0),
42  1.0);
43 
44  const auto u = gDist(generator);
45  const auto z = std::exp(-u);
46  const auto sampledEnergyLoss =
47  std::abs(scaleFactor * particle.energy() * (z - 1.));
48 
49  // apply the energy loss
50  particle.correctEnergy(-sampledEnergyLoss);
51 
52  // TODO return the lost energy as a photon
53  return {};
54  }
55 };
56 
57 } // namespace ActsFatras