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 
7 EnergyLossSimulator::EnergyLossSimulator(double A, double Z, double density, double radLen) :
8  MaterialEffectsSimulator(A,Z,density,radLen)
9 {
11 }
12 
14 
15  delete theGenerator;
16 
17 }
18 
19 void
21 {
22 
23  // FamosHistos* myHistos = FamosHistos::instance();
24 
25  // double gamma_e = 0.577215664901532861; // Euler constant
26 
27  // The thickness in cm
28  double thick = radLengths * radLenIncm();
29 
30  // This is a simple version (a la PDG) of a dE/dx generator.
31  // It replaces the buggy GEANT3 -> C++ former version.
32  // Author : Patrick Janot - 8-Jan-2004
33 
34  double p2 = Particle.Vect().Mag2();
35  double verySmallP2 = 0.0001;
36  if (p2<=verySmallP2) {
37  deltaP.SetXYZT(0.,0.,0.,0.);
38  return;
39  }
40  double m2 = Particle.mass() * Particle.mass();
41  double e2 = p2+m2;
42 
43  double beta2 = p2/e2;
44  double gama2 = e2/m2;
45 
46  double charge2 = Particle.charge() * Particle.charge();
47 
48  // Energy loss spread in GeV
49  double eSpread = 0.1536E-3*charge2*(theZ()/theA())*rho()*thick/beta2;
50 
51  // Most probable energy loss (from the integrated Bethe-Bloch equation)
52  mostProbableLoss = eSpread * ( log ( 2.*eMass()*beta2*gama2*eSpread
53  / (excitE()*excitE()) )
54  - beta2 + 0.200 );
55 
56  // This one can be needed on output (but is not used internally)
57  // meanEnergyLoss = 2.*eSpread * ( log ( 2.*eMass()*beta2*gama2 /excitE() ) - beta2 );
58 
59  // Generate the energy loss with Landau fluctuations
60  double dedx = mostProbableLoss + eSpread * theGenerator->landau(random);
61 
62  // Compute the new energy and momentum
63  double aBitAboveMass = Particle.mass()*1.0001;
64  double newE = std::max(aBitAboveMass,Particle.e()-dedx);
65  // double newE = std::max(Particle.mass(),Particle.e()-dedx);
66  double fac = std::sqrt((newE*newE-m2)/p2);
67 
68 
69  // Update the momentum
70  deltaP.SetXYZT(Particle.Px()*(1.-fac),Particle.Py()*(1.-fac),
71  Particle.Pz()*(1.-fac),Particle.E()-newE);
72  Particle.SetXYZT(Particle.Px()*fac,Particle.Py()*fac,
73  Particle.Pz()*fac,newE);
74 
75 }
76 
const double Z[kNumberCalorimeter]
static std::vector< std::string > checklist log
double rho() const
Density in g/cm3.
TRandom random
Definition: MVATrainer.cc:138
double mass() const
get the MEASURED mass
Definition: RawParticle.h:283
double mostProbableLoss
The most probable enery loss.
T sqrt(T t)
Definition: SSEVec.h:48
void compute(ParticlePropagator &Particle, RandomEngineAndDistribution const *)
The real dE/dx generation and particle update.
double eMass() const
Electron mass in GeV/c2.
double charge() const
get the MEASURED charge
Definition: RawParticle.h:282
double p2[4]
Definition: TauolaWrapper.h:90
~EnergyLossSimulator()
Default Destructor.
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.
double excitE() const
Mean excitation energy (in GeV)
double radLenIncm() const
One radiation length in cm.
XYZTLorentzVector deltaP
The actual energy loss.