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, const RandomEngine *engine)
 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 (const RandomEngine *engine, 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...
 
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)
 Compute the material effect (calls the sub class) More...
 
virtual ~MaterialEffectsSimulator ()
 

Private Member Functions

void compute (ParticlePropagator &Particle)
 Generate an e+e- pair according to the probability that it happens. More...
 
double gbteth (double ener, double partm, double efrac)
 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
 
const RandomEnginerandom
 
int theClosestChargedDaughterId
 
GlobalVector theNormalVector
 
double Z
 

Detailed Description

Definition at line 24 of file PairProductionSimulator.h.

Constructor & Destructor Documentation

PairProductionSimulator::PairProductionSimulator ( double  photonEnergyCut,
const RandomEngine engine 
)

Constructor.

Definition at line 6 of file PairProductionSimulator.cc.

References max(), and photonEnergy.

7  :
9 {
10 
11  // Set the minimal photon energy for possible conversion
12  photonEnergy = std::max(0.100,photonEnergyCut);
13 
14 }
double photonEnergy
The minimal photon energy for possible conversion.
const T & max(const T &a, const T &b)
MaterialEffectsSimulator(const RandomEngine *engine, double A=28.0855, double Z=14.0000, double density=2.329, double radLen=9.360)
PairProductionSimulator::~PairProductionSimulator ( )
inline

Default Destructor.

Definition at line 33 of file PairProductionSimulator.h.

33 {}

Member Function Documentation

void PairProductionSimulator::compute ( ParticlePropagator Particle)
privatevirtual

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

Implements MaterialEffectsSimulator.

Definition at line 18 of file PairProductionSimulator.cc.

References MaterialEffectsSimulator::_theUpdatedState, funct::cos(), MaterialEffectsSimulator::eMass(), RandomEngine::flatShoot(), gbteth(), funct::log(), M_PI, max(), phi, photonEnergy, MaterialEffectsSimulator::radLengths, MaterialEffectsSimulator::random, funct::sin(), mathSSE::sqrt(), and CommonMethods::weight().

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

A universal angular distribution - still from GEANT.

Definition at line 103 of file PairProductionSimulator.cc.

References beta, RandomEngine::flatShoot(), funct::log(), M_PI, MaterialEffectsSimulator::random, and MaterialEffectsSimulator::theZ().

Referenced by compute().

104 {
105  const double alfa = 0.625;
106 
107  double d = 0.13*(0.8+1.3/theZ())*(100.0+(1.0/ener))*(1.0+efrac);
108  double w1 = 9.0/(9.0+d);
109  double umax = ener*M_PI/partm;
110  double u;
111 
112  do {
113  double beta;
114  if (random->flatShoot()<=w1) beta = alfa;
115  else beta = 3.0*alfa;
117  } while (u>=umax);
118 
119  return u;
120 }
const double beta
#define M_PI
Definition: BFit3D.cc:3
Log< T >::type log(const T &t)
Definition: Log.h:22
double flatShoot(double xmin=0.0, double xmax=1.0) const
Definition: RandomEngine.h:30

Member Data Documentation

double PairProductionSimulator::photonEnergy
private

The minimal photon energy for possible conversion.

Definition at line 38 of file PairProductionSimulator.h.

Referenced by compute(), and PairProductionSimulator().