CMS 3D CMS Logo

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 () override
 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 *) override
 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 7 of file PairProductionSimulator.cc.

References SiStripPI::max, and photonEnergy.

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

Default Destructor.

Definition at line 32 of file PairProductionSimulator.h.

32 {}

Member Function Documentation

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

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

Implements MaterialEffectsSimulator.

Definition at line 14 of file PairProductionSimulator.cc.

References MaterialEffectsSimulator::_theUpdatedState, funct::cos(), RawParticle::e(), MaterialEffectsSimulator::eMass(), RandomEngineAndDistribution::flatShoot(), gbteth(), cmsBatch::log, M_PI, makeParticle(), SiStripPI::max, BaseParticlePropagator::particle(), ParticlePropagator::particleDataTable(), phi, RawParticle::phi(), photonEnergy, MaterialEffectsSimulator::radLengths, funct::sin(), mathSSE::sqrt(), and RawParticle::theta().

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

A universal angular distribution - still from GEANT.

Definition at line 102 of file PairProductionSimulator.cc.

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

Referenced by compute().

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

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(), PairProductionSimulator(), and Jet.Jet::photonEnergyFraction().