CMS 3D CMS Logo

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