File indexing completed on 2025-02-22 09:55:27
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
0015 #include <array>
0016 #include <cmath>
0017 #include <random>
0018
0019 namespace ActsFatras {
0020
0021
0022
0023
0024
0025
0026 struct BetheHeitler {
0027 using Scalar = Particle::Scalar;
0028 using Vector3 = Particle::Vector3;
0029
0030
0031 double scaleFactor = 1.;
0032
0033
0034 bool uniformHertzDipoleAngle = false;
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044 Particle bremPhoton(const Particle &particle, Scalar gammaE, Scalar rndPsi,
0045 Scalar rndTheta1, Scalar rndTheta2,
0046 Scalar rndTheta3) const;
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056 template <typename generator_t>
0057 std::array<Particle, 1> operator()(generator_t &generator,
0058 const Acts::MaterialSlab &slab,
0059 Particle &particle) const {
0060
0061 std::gamma_distribution<double> gDist(slab.thicknessInX0() / std::log(2.0),
0062 1.0);
0063
0064 const auto u = gDist(generator);
0065 const auto z = std::exp(-u);
0066 const auto sampledEnergyLoss =
0067 std::abs(scaleFactor * particle.energy() * (z - 1.));
0068
0069 std::uniform_real_distribution<Scalar> uDist(0., 1.);
0070
0071 Particle photon =
0072 bremPhoton(particle, sampledEnergyLoss, uDist(generator),
0073 uDist(generator), uDist(generator), uDist(generator));
0074
0075 particle.setDirection(particle.direction() * particle.absoluteMomentum() -
0076 photon.energy() * photon.direction());
0077
0078
0079 particle.correctEnergy(-sampledEnergyLoss);
0080
0081 return {photon};
0082 }
0083 };
0084
0085 }