CMS 3D CMS Logo

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 m2  = Particle.mass() * Particle.mass();
00039   double e2  = p2+m2;
00040 
00041   double beta2 = p2/e2;
00042   double gama2 = e2/m2;
00043   
00044   double charge2 = Particle.charge() * Particle.charge();
00045   
00046   // Energy loss spread in GeV
00047   double eSpread  = 0.1536E-3*charge2*(theZ()/theA())*rho()*thick/beta2;
00048  
00049   // Most probable energy loss (from the integrated Bethe-Bloch equation)
00050   mostProbableLoss = eSpread * ( log ( 2.*eMass()*beta2*gama2*eSpread
00051                                      / (excitE()*excitE()) )
00052                                  - beta2 + 0.200 );
00053 
00054   // This one can be needed on output (but is not used internally)
00055   // meanEnergyLoss = 2.*eSpread * ( log ( 2.*eMass()*beta2*gama2 /excitE() ) - beta2 );
00056 
00057   // Generate the energy loss with Landau fluctuations
00058   double dedx = mostProbableLoss + eSpread * theGenerator->landau();
00059 
00060   // Compute the new energy and momentum
00061   double newE = std::max(Particle.mass(),Particle.e()-dedx);
00062   double fac  = std::sqrt((newE*newE-m2)/p2);
00063 
00064   
00065   // Update the momentum
00066   deltaP.SetXYZT(Particle.Px()*(1.-fac),Particle.Py()*(1.-fac),
00067                  Particle.Pz()*(1.-fac),Particle.E()-newE);
00068   Particle.SetXYZT(Particle.Px()*fac,Particle.Py()*fac, 
00069                    Particle.Pz()*fac,newE);
00070   
00071 }
00072 

Generated on Tue Jun 9 17:35:09 2009 for CMSSW by  doxygen 1.5.4