File indexing completed on 2025-07-01 07:53:33
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Material/MaterialSlab.hpp"
0012 #include "Acts/Utilities/UnitVectors.hpp"
0013 #include "ActsFatras/EventData/Particle.hpp"
0014 #include "ActsFatras/Utilities/detail/FpeSafeGammaDistribution.hpp"
0015
0016 #include <array>
0017 #include <cmath>
0018 #include <numbers>
0019 #include <random>
0020
0021 namespace ActsFatras {
0022
0023
0024
0025
0026
0027
0028 struct BetheHeitler {
0029
0030 double scaleFactor = 1.;
0031
0032
0033 bool uniformHertzDipoleAngle = false;
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043 Particle bremPhoton(const Particle &particle, double gammaE, double rndPsi,
0044 double rndTheta1, double rndTheta2,
0045 double rndTheta3) const;
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055 template <typename generator_t>
0056 std::array<Particle, 1> operator()(generator_t &generator,
0057 const Acts::MaterialSlab &slab,
0058 Particle &particle) const {
0059
0060 detail::FpeSafeGammaDistribution gDist(
0061 slab.thicknessInX0() / std::numbers::ln2, 1.);
0062
0063 const auto u = gDist(generator);
0064 const auto z = std::exp(-u);
0065 const auto sampledEnergyLoss =
0066 std::abs(scaleFactor * particle.energy() * (z - 1.));
0067
0068 std::uniform_real_distribution<double> uDist(0., 1.);
0069
0070 Particle photon =
0071 bremPhoton(particle, sampledEnergyLoss, uDist(generator),
0072 uDist(generator), uDist(generator), uDist(generator));
0073
0074 particle.setDirection(particle.direction() * particle.absoluteMomentum() -
0075 photon.energy() * photon.direction());
0076
0077
0078 particle.correctEnergy(-sampledEnergyLoss);
0079
0080 return {photon};
0081 }
0082 };
0083
0084 }