Go to the documentation of this file.00001 #include "FastSimulation/MaterialEffects/interface/PairProductionSimulator.h"
00002 #include "FastSimulation/Utilities/interface/RandomEngine.h"
00003
00004 #include <cmath>
00005
00006 PairProductionSimulator::PairProductionSimulator(double photonEnergyCut,
00007 const RandomEngine* engine) :
00008 MaterialEffectsSimulator(engine)
00009 {
00010
00011
00012 photonEnergy = std::max(0.100,photonEnergyCut);
00013
00014 }
00015
00016
00017 void
00018 PairProductionSimulator::compute(ParticlePropagator& Particle)
00019 {
00020
00021 double eGamma = Particle.e();
00022
00023
00024 if ( eGamma>=photonEnergy ) {
00025
00026
00027
00028
00029
00030
00031 if ( -std::log(random->flatShoot()) <= (7./9.)*radLengths ) {
00032
00033 double xe=0;
00034 double xm=eMass()/eGamma;
00035 double weight = 0.;
00036
00037
00038 do {
00039 xe = random->flatShoot()*(1.-2.*xm) + xm;
00040 weight = 1. - 4./3.*xe*(1.-xe);
00041 } while ( weight < random->flatShoot() );
00042
00043 double eElectron = xe * eGamma;
00044 double tElectron = eElectron-eMass();
00045 double pElectron = std::sqrt(std::max((eElectron+eMass())*tElectron,0.));
00046
00047 double ePositron = eGamma-eElectron;
00048 double tPositron = ePositron-eMass();
00049 double pPositron = std::sqrt((ePositron+eMass())*tPositron);
00050
00051
00052 double phi = random->flatShoot()*2.*M_PI;
00053 double sphi = std::sin(phi);
00054 double cphi = std::cos(phi);
00055
00056 double stheta1, stheta2, ctheta1, ctheta2;
00057
00058 if ( eElectron > ePositron ) {
00059 double theta1 = gbteth(eElectron,eMass(),xe)*eMass()/eElectron;
00060 stheta1 = std::sin(theta1);
00061 ctheta1 = std::cos(theta1);
00062 stheta2 = stheta1*pElectron/pPositron;
00063 ctheta2 = std::sqrt(std::max(0.,1.0-(stheta2*stheta2)));
00064 } else {
00065 double theta2 = gbteth(ePositron,eMass(),xe)*eMass()/ePositron;
00066 stheta2 = std::sin(theta2);
00067 ctheta2 = std::cos(theta2);
00068 stheta1 = stheta2*pPositron/pElectron;
00069 ctheta1 = std::sqrt(std::max(0.,1.0-(stheta1*stheta1)));
00070 }
00071
00072
00073 double chi = Particle.theta();
00074 double psi = Particle.phi();
00075 RawParticle::RotationZ rotZ(psi);
00076 RawParticle::RotationY rotY(chi);
00077
00078 _theUpdatedState.resize(2,RawParticle());
00079
00080
00081 _theUpdatedState[0].SetXYZT(pElectron*stheta1*cphi,
00082 pElectron*stheta1*sphi,
00083 pElectron*ctheta1,
00084 eElectron);
00085 _theUpdatedState[0].setID(+11);
00086 _theUpdatedState[0].rotate(rotY);
00087 _theUpdatedState[0].rotate(rotZ);
00088
00089
00090 _theUpdatedState[1].SetXYZT(-pPositron*stheta2*cphi,
00091 -pPositron*stheta2*sphi,
00092 pPositron*ctheta2,
00093 ePositron);
00094 _theUpdatedState[1].setID(-11);
00095 _theUpdatedState[1].rotate(rotY);
00096 _theUpdatedState[1].rotate(rotZ);
00097
00098 }
00099 }
00100 }
00101
00102 double
00103 PairProductionSimulator::gbteth(double ener,double partm,double efrac)
00104 {
00105 const double alfa = 0.625;
00106
00107 double d = 0.13*(0.8+1.3/theZ())*(100.0+(1.0/ener))*(1.0+efrac);
00108 double w1 = 9.0/(9.0+d);
00109 double umax = ener*M_PI/partm;
00110 double u;
00111
00112 do {
00113 double beta;
00114 if (random->flatShoot()<=w1) beta = alfa;
00115 else beta = 3.0*alfa;
00116 u = -(std::log(random->flatShoot()*random->flatShoot()))/beta;
00117 } while (u>=umax);
00118
00119 return u;
00120 }