File indexing completed on 2024-04-06 12:11:16
0001 #include "FastSimulation/MaterialEffects/interface/EnergyLossSimulator.h"
0002
0003 #include "FastSimulation/Utilities/interface/LandauFluctuationGenerator.h"
0004
0005 #include <cmath>
0006
0007 EnergyLossSimulator::EnergyLossSimulator(double A, double Z, double density, double radLen)
0008 : MaterialEffectsSimulator(A, Z, density, radLen) {
0009 theGenerator = new LandauFluctuationGenerator();
0010 }
0011
0012 EnergyLossSimulator::~EnergyLossSimulator() { delete theGenerator; }
0013
0014 void EnergyLossSimulator::compute(ParticlePropagator& Particle, RandomEngineAndDistribution const* random) {
0015
0016
0017
0018
0019
0020 double thick = radLengths * radLenIncm();
0021
0022
0023
0024
0025
0026 double p2 = Particle.particle().Vect().Mag2();
0027 double verySmallP2 = 0.0001;
0028 if (p2 <= verySmallP2) {
0029 deltaP.SetXYZT(0., 0., 0., 0.);
0030 return;
0031 }
0032 double m2 = Particle.particle().mass() * Particle.particle().mass();
0033 double e2 = p2 + m2;
0034
0035 double beta2 = p2 / e2;
0036 double gama2 = e2 / m2;
0037
0038 double charge2 = Particle.particle().charge() * Particle.particle().charge();
0039
0040
0041 double eSpread = 0.1536E-3 * charge2 * (theZ() / theA()) * rho() * thick / beta2;
0042
0043
0044 mostProbableLoss = eSpread * (log(2. * eMass() * beta2 * gama2 * eSpread / (excitE() * excitE())) - beta2 + 0.200);
0045
0046
0047
0048
0049
0050 double dedx = mostProbableLoss + eSpread * theGenerator->landau(random);
0051
0052
0053 double aBitAboveMass = Particle.particle().mass() * 1.0001;
0054 double newE = std::max(aBitAboveMass, Particle.particle().e() - dedx);
0055
0056 double fac = std::sqrt((newE * newE - m2) / p2);
0057
0058
0059 deltaP.SetXYZT(Particle.particle().Px() * (1. - fac),
0060 Particle.particle().Py() * (1. - fac),
0061 Particle.particle().Pz() * (1. - fac),
0062 Particle.particle().E() - newE);
0063 Particle.particle().setMomentum(
0064 Particle.particle().Px() * fac, Particle.particle().Py() * fac, Particle.particle().Pz() * fac, newE);
0065 }