CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
PairProductionSimulator Class Reference

#include <PairProductionSimulator.h>

Inheritance diagram for PairProductionSimulator:
MaterialEffectsSimulator

Public Member Functions

 PairProductionSimulator (double photonEnergyCut)
 Constructor. More...
 
 ~PairProductionSimulator ()
 Default Destructor. More...
 
- Public Member Functions inherited from MaterialEffectsSimulator
RHEP_const_iter beginDaughters () const
 Returns const iterator to the beginning of the daughters list. More...
 
int closestDaughterId ()
 The id of the closest charged daughter (filled for nuclear interactions only) More...
 
double eMass () const
 Electron mass in GeV/c2. More...
 
RHEP_const_iter endDaughters () const
 Returns const iterator to the end of the daughters list. More...
 
double excitE () const
 Mean excitation energy (in GeV) More...
 
 MaterialEffectsSimulator (double A=28.0855, double Z=14.0000, double density=2.329, double radLen=9.360)
 
unsigned nDaughters () const
 Returns the number of daughters. More...
 
XYZVector orthogonal (const XYZVector &) const
 A vector orthogonal to another one (because it's not in XYZTLorentzVector) More...
 
double radLenIncm () const
 One radiation length in cm. More...
 
double rho () const
 Density in g/cm3. More...
 
virtual void save ()
 Used by NuclearInteractionSimulator to save last sampled event. More...
 
void setNormalVector (const GlobalVector &normal)
 Sets the vector normal to the surface traversed. More...
 
double theA () const
 A. More...
 
double theZ () const
 Z. More...
 
void updateState (ParticlePropagator &myTrack, double radlen, RandomEngineAndDistribution const *)
 Compute the material effect (calls the sub class) More...
 
virtual ~MaterialEffectsSimulator ()
 

Private Member Functions

void compute (ParticlePropagator &Particle, RandomEngineAndDistribution const *)
 Generate an e+e- pair according to the probability that it happens. More...
 
double gbteth (double ener, double partm, double efrac, RandomEngineAndDistribution const *)
 A universal angular distribution - still from GEANT. More...
 

Private Attributes

double photonEnergy
 The minimal photon energy for possible conversion. More...
 

Additional Inherited Members

- Public Types inherited from MaterialEffectsSimulator
typedef std::vector
< RawParticle >
::const_iterator 
RHEP_const_iter
 
- Protected Attributes inherited from MaterialEffectsSimulator
std::vector< RawParticle_theUpdatedState
 
double A
 
double density
 
double radLen
 
double radLengths
 
int theClosestChargedDaughterId
 
GlobalVector theNormalVector
 
double Z
 

Detailed Description

Definition at line 24 of file PairProductionSimulator.h.

Constructor & Destructor Documentation

PairProductionSimulator::PairProductionSimulator ( double  photonEnergyCut)

Constructor.

Definition at line 6 of file PairProductionSimulator.cc.

References bookConverter::max, and photonEnergy.

7 {
8  // Set the minimal photon energy for possible conversion
9  photonEnergy = std::max(0.100,photonEnergyCut);
10 }
double photonEnergy
The minimal photon energy for possible conversion.
PairProductionSimulator::~PairProductionSimulator ( )
inline

Default Destructor.

Definition at line 32 of file PairProductionSimulator.h.

32 {}

Member Function Documentation

void PairProductionSimulator::compute ( ParticlePropagator Particle,
RandomEngineAndDistribution const *  random 
)
privatevirtual

Generate an e+e- pair according to the probability that it happens.

Implements MaterialEffectsSimulator.

Definition at line 13 of file PairProductionSimulator.cc.

References MaterialEffectsSimulator::_theUpdatedState, funct::cos(), MaterialEffectsSimulator::eMass(), RandomEngineAndDistribution::flatShoot(), gbteth(), cmsBatch::log, M_PI, bookConverter::max, phi, photonEnergy, MaterialEffectsSimulator::radLengths, funct::sin(), mathSSE::sqrt(), and puppiForMET_cff::weight.

14 {
15 
16  double eGamma = Particle.e();
17 
18  // The photon has enough energy to create a pair
19  if ( eGamma>=photonEnergy ) {
20 
21  // This is a simple version (a la PDG) of a photon conversion generator.
22  // It replaces the buggy GEANT3 -> C++ former version.
23  // Author : Patrick Janot - 7-Jan-2004
24 
25  // Probability to convert is 7/9*(dx/X0)
26  if ( -std::log(random->flatShoot()) <= (7./9.)*radLengths ) {
27 
28  double xe=0;
29  double xm=eMass()/eGamma;
30  double weight = 0.;
31 
32  // Generate electron energy between emass and eGamma-emass
33  do {
34  xe = random->flatShoot()*(1.-2.*xm) + xm;
35  weight = 1. - 4./3.*xe*(1.-xe);
36  } while ( weight < random->flatShoot() );
37 
38  double eElectron = xe * eGamma;
39  double tElectron = eElectron-eMass();
40  double pElectron = std::sqrt(std::max((eElectron+eMass())*tElectron,0.));
41 
42  double ePositron = eGamma-eElectron;
43  double tPositron = ePositron-eMass();
44  double pPositron = std::sqrt((ePositron+eMass())*tPositron);
45 
46  // Generate angles
47  double phi = random->flatShoot()*2.*M_PI;
48  double sphi = std::sin(phi);
49  double cphi = std::cos(phi);
50 
51  double stheta1, stheta2, ctheta1, ctheta2;
52 
53  if ( eElectron > ePositron ) {
54  double theta1 = gbteth(eElectron,eMass(),xe,random)*eMass()/eElectron;
55  stheta1 = std::sin(theta1);
56  ctheta1 = std::cos(theta1);
57  stheta2 = stheta1*pElectron/pPositron;
58  ctheta2 = std::sqrt(std::max(0.,1.0-(stheta2*stheta2)));
59  } else {
60  double theta2 = gbteth(ePositron,eMass(),xe,random)*eMass()/ePositron;
61  stheta2 = std::sin(theta2);
62  ctheta2 = std::cos(theta2);
63  stheta1 = stheta2*pPositron/pElectron;
64  ctheta1 = std::sqrt(std::max(0.,1.0-(stheta1*stheta1)));
65  }
66 
67 
68  double chi = Particle.theta();
69  double psi = Particle.phi();
70  RawParticle::RotationZ rotZ(psi);
71  RawParticle::RotationY rotY(chi);
72 
73  _theUpdatedState.resize(2,RawParticle());
74 
75  // The eletron
76  _theUpdatedState[0].SetXYZT(pElectron*stheta1*cphi,
77  pElectron*stheta1*sphi,
78  pElectron*ctheta1,
79  eElectron);
80  _theUpdatedState[0].setID(+11);
81  _theUpdatedState[0].rotate(rotY);
82  _theUpdatedState[0].rotate(rotZ);
83 
84  // The positron
85  _theUpdatedState[1].SetXYZT(-pPositron*stheta2*cphi,
86  -pPositron*stheta2*sphi,
87  pPositron*ctheta2,
88  ePositron);
89  _theUpdatedState[1].setID(-11);
90  _theUpdatedState[1].rotate(rotY);
91  _theUpdatedState[1].rotate(rotZ);
92 
93  }
94  }
95 }
double photonEnergy
The minimal photon energy for possible conversion.
double gbteth(double ener, double partm, double efrac, RandomEngineAndDistribution const *)
A universal angular distribution - still from GEANT.
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
TRandom random
Definition: MVATrainer.cc:138
ROOT::Math::RotationZ RotationZ
Definition: RawParticle.h:39
std::map< std::string, int, std::less< std::string > > psi
T sqrt(T t)
Definition: SSEVec.h:48
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
ROOT::Math::RotationY RotationY
Definition: RawParticle.h:38
double eMass() const
Electron mass in GeV/c2.
#define M_PI
std::vector< RawParticle > _theUpdatedState
tuple log
Definition: cmsBatch.py:341
double PairProductionSimulator::gbteth ( double  ener,
double  partm,
double  efrac,
RandomEngineAndDistribution const *  random 
)
private

A universal angular distribution - still from GEANT.

Definition at line 98 of file PairProductionSimulator.cc.

References beta, ztail::d, RandomEngineAndDistribution::flatShoot(), cmsBatch::log, M_PI, and MaterialEffectsSimulator::theZ().

Referenced by compute().

99 {
100  const double alfa = 0.625;
101 
102  double d = 0.13*(0.8+1.3/theZ())*(100.0+(1.0/ener))*(1.0+efrac);
103  double w1 = 9.0/(9.0+d);
104  double umax = ener*M_PI/partm;
105  double u;
106 
107  do {
108  double beta;
109  if (random->flatShoot()<=w1) beta = alfa;
110  else beta = 3.0*alfa;
111  u = -(std::log(random->flatShoot()*random->flatShoot()))/beta;
112  } while (u>=umax);
113 
114  return u;
115 }
const double beta
TRandom random
Definition: MVATrainer.cc:138
tuple d
Definition: ztail.py:151
#define M_PI
tuple log
Definition: cmsBatch.py:341

Member Data Documentation

double PairProductionSimulator::photonEnergy
private

The minimal photon energy for possible conversion.

Definition at line 37 of file PairProductionSimulator.h.

Referenced by compute(), and PairProductionSimulator().