#include <FastSimulation/MaterialEffects/interface/BremsstrahlungSimulator.h>
Public Member Functions | |
BremsstrahlungSimulator (double photonEnergyCut, double photonFractECut, const RandomEngine *engine) | |
Constructor. | |
~BremsstrahlungSimulator () | |
Default destructor. | |
Private Member Functions | |
XYZTLorentzVector | brem (ParticlePropagator &p) const |
Compute Brem photon energy and angles, if any. | |
void | compute (ParticlePropagator &Particle) |
Generate Bremsstrahlung photons. | |
double | gbteth (const double ener, const double partm, const double efrac) const |
A universal angular distribution - still from GEANT. | |
unsigned int | poisson (double ymu) |
Generate numbers according to a Poisson distribution of mean ymu. | |
Private Attributes | |
double | photonEnergy |
The minimum photon energy to be radiated, in GeV. | |
double | photonFractE |
The minimum photon fractional energy (wrt that of the electron). | |
double | xmin |
The fractional photon energy cut (determined from the above two). |
Definition at line 26 of file BremsstrahlungSimulator.h.
BremsstrahlungSimulator::BremsstrahlungSimulator | ( | double | photonEnergyCut, | |
double | photonFractECut, | |||
const RandomEngine * | engine | |||
) |
Constructor.
Definition at line 7 of file BremsstrahlungSimulator.cc.
References photonEnergy, and photonFractE.
00009 : 00010 MaterialEffectsSimulator(engine) 00011 { 00012 00013 // Set the minimal photon energy for a Brem from e+/- 00014 photonEnergy = photonEnergyCut; 00015 photonFractE = photonFractECut; 00016 00017 }
BremsstrahlungSimulator::~BremsstrahlungSimulator | ( | ) | [inline] |
XYZTLorentzVector BremsstrahlungSimulator::brem | ( | ParticlePropagator & | p | ) | const [private] |
Compute Brem photon energy and angles, if any.
Definition at line 71 of file BremsstrahlungSimulator.cc.
References funct::cos(), funct::exp(), RandomEngine::flatShoot(), gbteth(), funct::log(), phi, MaterialEffectsSimulator::random, funct::sin(), theta, weight, and xmin.
Referenced by compute().
00071 { 00072 00073 // This is a simple version (a la PDG) of a Brem generator. 00074 // It replaces the buggy GEANT3 -> C++ former version. 00075 // Author : Patrick Janot - 25-Dec-2003 00076 double emass = 0.0005109990615; 00077 double xp=0; 00078 double weight = 0.; 00079 00080 do { 00081 xp = xmin * std::exp ( -std::log(xmin) * random->flatShoot() ); 00082 weight = 1. - xp + 3./4.*xp*xp; 00083 } while ( weight < random->flatShoot() ); 00084 00085 00086 // Have photon energy. Now generate angles with respect to the z axis 00087 // defined by the incoming particle's momentum. 00088 00089 // Isotropic in phi 00090 const double phi = random->flatShoot()*2*M_PI; 00091 // theta from universal distribution 00092 const double theta = gbteth(pp.e(),emass,xp)*emass/pp.e(); 00093 00094 // Make momentum components 00095 double stheta = std::sin(theta); 00096 double ctheta = std::cos(theta); 00097 double sphi = std::sin(phi); 00098 double cphi = std::cos(phi); 00099 00100 return xp * pp.e() * XYZTLorentzVector(stheta*cphi,stheta*sphi,ctheta,1.); 00101 00102 }
void BremsstrahlungSimulator::compute | ( | ParticlePropagator & | Particle | ) | [private, virtual] |
Generate Bremsstrahlung photons.
Implements MaterialEffectsSimulator.
Definition at line 21 of file BremsstrahlungSimulator.cc.
References MaterialEffectsSimulator::_theUpdatedState, brem(), i, funct::log(), max, RawParticle::momentum(), photonEnergy, photonFractE, poisson(), MaterialEffectsSimulator::radLengths, RawParticle::rotate(), and xmin.
00022 { 00023 00024 // Protection : Just stop the electron if more than 1 radiation lengths. 00025 // This case corresponds to an electron entering the layer parallel to 00026 // the layer axis - no reliable simulation can be done in that case... 00027 // 08/02/06 - pv: increase protection from 1 to 4 X0 for eta>4.8 region 00028 // if ( radLengths > 1. ) Particle.SetXYZT(0.,0.,0.,0.); 00029 if ( radLengths > 4. ) Particle.SetXYZT(0.,0.,0.,0.); 00030 00031 // Hard brem probability with a photon Energy above photonEnergy. 00032 xmin = std::max(photonEnergy/Particle.e(),photonFractE); 00033 if ( xmin >=1. || xmin <=0. ) return; 00034 00035 double bremProba = radLengths * ( 4./3. * std::log(1./xmin) 00036 - 4./3. * (1.-xmin) 00037 + 1./2. * (1.-xmin*xmin) ); 00038 00039 00040 // Number of photons to be radiated. 00041 unsigned int nPhotons = poisson(bremProba); 00042 _theUpdatedState.reserve(nPhotons); 00043 00044 if ( !nPhotons ) return; 00045 00046 //Rotate to the lab frame 00047 double chi = Particle.theta(); 00048 double psi = Particle.phi(); 00049 RawParticle::RotationZ rotZ(psi); 00050 RawParticle::RotationY rotY(chi); 00051 00052 // Energy of these photons 00053 for ( unsigned int i=0; i<nPhotons; ++i ) { 00054 00055 // Check that there is enough energy left. 00056 if ( Particle.e() < photonEnergy ) break; 00057 00058 // Add a photon 00059 RawParticle thePhoton(22,brem(Particle)); 00060 thePhoton.rotate(rotY); 00061 thePhoton.rotate(rotZ); 00062 _theUpdatedState.push_back(thePhoton); 00063 00064 // Update the original e+/- 00065 Particle -= thePhoton.momentum(); 00066 00067 } 00068 }
double BremsstrahlungSimulator::gbteth | ( | const double | ener, | |
const double | partm, | |||
const double | efrac | |||
) | const [private] |
A universal angular distribution - still from GEANT.
Definition at line 105 of file BremsstrahlungSimulator.cc.
References DeDxTools::beta(), d, RandomEngine::flatShoot(), funct::log(), MaterialEffectsSimulator::random, MaterialEffectsSimulator::theZ(), and w1.
Referenced by brem().
00107 { 00108 const double alfa = 0.625; 00109 00110 const double d = 0.13*(0.8+1.3/theZ())*(100.0+(1.0/ener))*(1.0+efrac); 00111 const double w1 = 9.0/(9.0+d); 00112 const double umax = ener*M_PI/partm; 00113 double u; 00114 00115 do { 00116 double beta = (random->flatShoot()<=w1) ? alfa : 3.0*alfa; 00117 u = -std::log(random->flatShoot()*random->flatShoot())/beta; 00118 } while (u>=umax); 00119 00120 return u; 00121 }
unsigned int BremsstrahlungSimulator::poisson | ( | double | ymu | ) | [private] |
Generate numbers according to a Poisson distribution of mean ymu.
Definition at line 125 of file BremsstrahlungSimulator.cc.
References funct::exp(), RandomEngine::flatShoot(), n, MaterialEffectsSimulator::random, and x.
Referenced by compute().
00125 { 00126 00127 unsigned int n = 0; 00128 double prob = std::exp(-ymu); 00129 double proba = prob; 00130 double x = random->flatShoot(); 00131 00132 while ( proba <= x ) { 00133 prob *= ymu / double(++n); 00134 proba += prob; 00135 } 00136 00137 return n; 00138 00139 }
double BremsstrahlungSimulator::photonEnergy [private] |
The minimum photon energy to be radiated, in GeV.
Definition at line 41 of file BremsstrahlungSimulator.h.
Referenced by BremsstrahlungSimulator(), and compute().
double BremsstrahlungSimulator::photonFractE [private] |
The minimum photon fractional energy (wrt that of the electron).
Definition at line 44 of file BremsstrahlungSimulator.h.
Referenced by BremsstrahlungSimulator(), and compute().
double BremsstrahlungSimulator::xmin [private] |
The fractional photon energy cut (determined from the above two).
Definition at line 47 of file BremsstrahlungSimulator.h.