CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
EnergyLossSimulator.cc
Go to the documentation of this file.
2 //#include "FastSimulation/Utilities/interface/RandomEngine.h"
4 
5 #include <cmath>
6 
7 EnergyLossSimulator::EnergyLossSimulator(double A, double Z, double density, double radLen)
8  : MaterialEffectsSimulator(A, Z, density, radLen) {
10 }
11 
13 
15  // FamosHistos* myHistos = FamosHistos::instance();
16 
17  // double gamma_e = 0.577215664901532861; // Euler constant
18 
19  // The thickness in cm
20  double thick = radLengths * radLenIncm();
21 
22  // This is a simple version (a la PDG) of a dE/dx generator.
23  // It replaces the buggy GEANT3 -> C++ former version.
24  // Author : Patrick Janot - 8-Jan-2004
25 
26  double p2 = Particle.particle().Vect().Mag2();
27  double verySmallP2 = 0.0001;
28  if (p2 <= verySmallP2) {
29  deltaP.SetXYZT(0., 0., 0., 0.);
30  return;
31  }
32  double m2 = Particle.particle().mass() * Particle.particle().mass();
33  double e2 = p2 + m2;
34 
35  double beta2 = p2 / e2;
36  double gama2 = e2 / m2;
37 
38  double charge2 = Particle.particle().charge() * Particle.particle().charge();
39 
40  // Energy loss spread in GeV
41  double eSpread = 0.1536E-3 * charge2 * (theZ() / theA()) * rho() * thick / beta2;
42 
43  // Most probable energy loss (from the integrated Bethe-Bloch equation)
44  mostProbableLoss = eSpread * (log(2. * eMass() * beta2 * gama2 * eSpread / (excitE() * excitE())) - beta2 + 0.200);
45 
46  // This one can be needed on output (but is not used internally)
47  // meanEnergyLoss = 2.*eSpread * ( log ( 2.*eMass()*beta2*gama2 /excitE() ) - beta2 );
48 
49  // Generate the energy loss with Landau fluctuations
50  double dedx = mostProbableLoss + eSpread * theGenerator->landau(random);
51 
52  // Compute the new energy and momentum
53  double aBitAboveMass = Particle.particle().mass() * 1.0001;
54  double newE = std::max(aBitAboveMass, Particle.particle().e() - dedx);
55  // double newE = std::max(Particle.particle().mass(),Particle.particle().e()-dedx);
56  double fac = std::sqrt((newE * newE - m2) / p2);
57 
58  // Update the momentum
59  deltaP.SetXYZT(Particle.particle().Px() * (1. - fac),
60  Particle.particle().Py() * (1. - fac),
61  Particle.particle().Pz() * (1. - fac),
62  Particle.particle().E() - newE);
63  Particle.particle().setMomentum(
64  Particle.particle().Px() * fac, Particle.particle().Py() * fac, Particle.particle().Pz() * fac, newE);
65 }
void setMomentum(const XYZTLorentzVector &vtx)
set the momentum
Definition: RawParticle.h:328
XYZVector Vect() const
the momentum threevector
Definition: RawParticle.h:323
static std::vector< std::string > checklist log
~EnergyLossSimulator() override
Default Destructor.
const TString p2
Definition: fwPaths.cc:13
double rho() const
Density in g/cm3.
RawParticle const & particle() const
The particle being propagated.
double mass() const
get the MEASURED mass
Definition: RawParticle.h:295
double mostProbableLoss
The most probable enery loss.
tuple m2
Definition: callgraph.py:57
double e() const
energy of the momentum
Definition: RawParticle.h:305
T sqrt(T t)
Definition: SSEVec.h:19
double Py() const
y of the momentum
Definition: RawParticle.h:300
double eMass() const
Electron mass in GeV/c2.
double Pz() const
z of the momentum
Definition: RawParticle.h:303
double charge() const
get the MEASURED charge
Definition: RawParticle.h:294
LandauFluctuationGenerator * theGenerator
The Landau Fluctuation generator.
double landau(RandomEngineAndDistribution const *random) const
Random generator of the dE/dX spread (Landau function)
EnergyLossSimulator(double A, double Z, double density, double radLen)
Constructor.
void compute(ParticlePropagator &Particle, RandomEngineAndDistribution const *) override
The real dE/dx generation and particle update.
double excitE() const
Mean excitation energy (in GeV)
double Px() const
x of the momentum
Definition: RawParticle.h:297
double radLenIncm() const
One radiation length in cm.
double E() const
energy of the momentum
Definition: RawParticle.h:306
XYZTLorentzVector deltaP
The actual energy loss.