CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/src/FastSimulation/MaterialEffects/src/EnergyLossSimulator.cc

Go to the documentation of this file.
00001 #include "FastSimulation/MaterialEffects/interface/EnergyLossSimulator.h"
00002 //#include "FastSimulation/Utilities/interface/RandomEngine.h"
00003 #include "FastSimulation/Utilities/interface/LandauFluctuationGenerator.h"
00004 
00005 #include <cmath>
00006 
00007 EnergyLossSimulator::EnergyLossSimulator(const RandomEngine* engine,
00008                                          double A, double Z, double density, double radLen) :
00009     MaterialEffectsSimulator(engine,A,Z,density,radLen) 
00010 {
00011 
00012   theGenerator = new LandauFluctuationGenerator(engine);
00013 
00014 }
00015 
00016 EnergyLossSimulator::~EnergyLossSimulator() {
00017 
00018   delete theGenerator;
00019 
00020 }
00021 
00022 void 
00023 EnergyLossSimulator::compute(ParticlePropagator &Particle)
00024 {
00025 
00026   //  FamosHistos* myHistos = FamosHistos::instance();
00027 
00028   // double gamma_e = 0.577215664901532861;  // Euler constant
00029   
00030   // The thickness in cm
00031   double thick = radLengths * radLenIncm();
00032   
00033   // This is a simple version (a la PDG) of a dE/dx generator.
00034   // It replaces the buggy GEANT3 -> C++ former version.
00035   // Author : Patrick Janot - 8-Jan-2004
00036 
00037   double p2  = Particle.Vect().Mag2();
00038   double verySmallP2 = 0.0001;
00039   if (p2<=verySmallP2) {
00040     deltaP.SetXYZT(0.,0.,0.,0.);
00041     return;
00042   }
00043   double m2  = Particle.mass() * Particle.mass();
00044   double e2  = p2+m2;
00045 
00046   double beta2 = p2/e2;
00047   double gama2 = e2/m2;
00048   
00049   double charge2 = Particle.charge() * Particle.charge();
00050   
00051   // Energy loss spread in GeV
00052   double eSpread  = 0.1536E-3*charge2*(theZ()/theA())*rho()*thick/beta2;
00053  
00054   // Most probable energy loss (from the integrated Bethe-Bloch equation)
00055   mostProbableLoss = eSpread * ( log ( 2.*eMass()*beta2*gama2*eSpread
00056                                      / (excitE()*excitE()) )
00057                                  - beta2 + 0.200 );
00058 
00059   // This one can be needed on output (but is not used internally)
00060   // meanEnergyLoss = 2.*eSpread * ( log ( 2.*eMass()*beta2*gama2 /excitE() ) - beta2 );
00061 
00062   // Generate the energy loss with Landau fluctuations
00063   double dedx = mostProbableLoss + eSpread * theGenerator->landau();
00064 
00065   // Compute the new energy and momentum
00066   double aBitAboveMass = Particle.mass()*1.0001;
00067   double newE = std::max(aBitAboveMass,Particle.e()-dedx);
00068   //  double newE = std::max(Particle.mass(),Particle.e()-dedx);
00069   double fac  = std::sqrt((newE*newE-m2)/p2);
00070 
00071   
00072   // Update the momentum
00073   deltaP.SetXYZT(Particle.Px()*(1.-fac),Particle.Py()*(1.-fac),
00074                  Particle.Pz()*(1.-fac),Particle.E()-newE);
00075   Particle.SetXYZT(Particle.Px()*fac,Particle.Py()*fac, 
00076                    Particle.Pz()*fac,newE);
00077   
00078 }
00079