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::PairProductionSimulator ( double  photonEnergyCut)

Constructor.

Definition at line 7 of file PairProductionSimulator.cc.

References SiStripPI::max, photonEnergy, and fastSimProducer_cff::photonEnergyCut.

7  {
8  // Set the minimal photon energy for possible conversion
10 }
double photonEnergy
The minimal photon energy for possible conversion.

◆ ~PairProductionSimulator()

PairProductionSimulator::~PairProductionSimulator ( )
inlineoverride

Default Destructor.

Definition at line 30 of file PairProductionSimulator.h.

30 {}

Member Function Documentation

◆ compute()

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 12 of file PairProductionSimulator.cc.

References MaterialEffectsSimulator::_theUpdatedState, funct::cos(), MaterialEffectsSimulator::eMass(), RandomEngineAndDistribution::flatShoot(), gbteth(), dqm-mbProfile::log, M_PI, makeParticle(), SiStripPI::max, phi, photonEnergy, MaterialEffectsSimulator::radLengths, funct::sin(), and mathSSE::sqrt().

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

◆ gbteth()

double PairProductionSimulator::gbteth ( double  ener,
double  partm,
double  efrac,
RandomEngineAndDistribution const *  random 
)
private

A universal angular distribution - still from GEANT.

Definition at line 89 of file PairProductionSimulator.cc.

References HLT_2024v14_cff::beta, ztail::d, RandomEngineAndDistribution::flatShoot(), dqm-mbProfile::log, M_PI, and MaterialEffectsSimulator::theZ().

Referenced by compute().

92  {
93  const double alfa = 0.625;
94 
95  double d = 0.13 * (0.8 + 1.3 / theZ()) * (100.0 + (1.0 / ener)) * (1.0 + efrac);
96  double w1 = 9.0 / (9.0 + d);
97  double umax = ener * M_PI / partm;
98  double u;
99 
100  do {
101  double beta;
102  if (random->flatShoot() <= w1)
103  beta = alfa;
104  else
105  beta = 3.0 * alfa;
106  u = -(std::log(random->flatShoot() * random->flatShoot())) / beta;
107  } while (u >= umax);
108 
109  return u;
110 }
d
Definition: ztail.py:151
#define M_PI

Member Data Documentation

◆ photonEnergy

double PairProductionSimulator::photonEnergy
private

The minimal photon energy for possible conversion.

Definition at line 34 of file PairProductionSimulator.h.

Referenced by compute(), PairProductionSimulator(), and Jet.Jet::photonEnergyFraction().