CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
EnergyLossSimulator Class Reference

#include <EnergyLossSimulator.h>

Inheritance diagram for EnergyLossSimulator:
MaterialEffectsSimulator

Public Member Functions

const XYZTLorentzVectordeltaMom () const
 Returns the actual energy lost. More...
 
 EnergyLossSimulator (double A, double Z, double density, double radLen)
 Constructor. More...
 
double mostLikelyLoss () const
 Return most probable energy loss. More...
 
 ~EnergyLossSimulator () 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
 The real dE/dx generation and particle update. More...
 

Private Attributes

XYZTLorentzVector deltaP
 The actual energy loss. More...
 
double mostProbableLoss
 The most probable enery loss. More...
 
LandauFluctuationGeneratortheGenerator
 The Landau Fluctuation generator. 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 25 of file EnergyLossSimulator.h.

Constructor & Destructor Documentation

◆ EnergyLossSimulator()

EnergyLossSimulator::EnergyLossSimulator ( double  A,
double  Z,
double  density,
double  radLen 
)

Constructor.

Definition at line 7 of file EnergyLossSimulator.cc.

References theGenerator.

◆ ~EnergyLossSimulator()

EnergyLossSimulator::~EnergyLossSimulator ( )
override

Default Destructor.

Definition at line 12 of file EnergyLossSimulator.cc.

12 { delete theGenerator; }

References theGenerator.

Member Function Documentation

◆ compute()

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

The real dE/dx generation and particle update.

Implements MaterialEffectsSimulator.

Definition at line 14 of file EnergyLossSimulator.cc.

14  {
15  // FamosHistos* myHistos = FamosHistos::instance();
16 
17  // double gamma_e = 0.577215664901532861; // Euler constant
18 
19  // The thickness in cm
20  double thick = radLengths * radLenIncm();
21 
22  // This is a simple version (a la PDG) of a dE/dx generator.
23  // It replaces the buggy GEANT3 -> C++ former version.
24  // Author : Patrick Janot - 8-Jan-2004
25 
26  double p2 = Particle.particle().Vect().Mag2();
27  double verySmallP2 = 0.0001;
28  if (p2 <= verySmallP2) {
29  deltaP.SetXYZT(0., 0., 0., 0.);
30  return;
31  }
32  double m2 = Particle.particle().mass() * Particle.particle().mass();
33  double e2 = p2 + m2;
34 
35  double beta2 = p2 / e2;
36  double gama2 = e2 / m2;
37 
38  double charge2 = Particle.particle().charge() * Particle.particle().charge();
39 
40  // Energy loss spread in GeV
41  double eSpread = 0.1536E-3 * charge2 * (theZ() / theA()) * rho() * thick / beta2;
42 
43  // Most probable energy loss (from the integrated Bethe-Bloch equation)
44  mostProbableLoss = eSpread * (log(2. * eMass() * beta2 * gama2 * eSpread / (excitE() * excitE())) - beta2 + 0.200);
45 
46  // This one can be needed on output (but is not used internally)
47  // meanEnergyLoss = 2.*eSpread * ( log ( 2.*eMass()*beta2*gama2 /excitE() ) - beta2 );
48 
49  // Generate the energy loss with Landau fluctuations
50  double dedx = mostProbableLoss + eSpread * theGenerator->landau(random);
51 
52  // Compute the new energy and momentum
53  double aBitAboveMass = Particle.particle().mass() * 1.0001;
54  double newE = std::max(aBitAboveMass, Particle.particle().e() - dedx);
55  // double newE = std::max(Particle.particle().mass(),Particle.particle().e()-dedx);
56  double fac = std::sqrt((newE * newE - m2) / p2);
57 
58  // Update the momentum
59  deltaP.SetXYZT(Particle.particle().Px() * (1. - fac),
60  Particle.particle().Py() * (1. - fac),
61  Particle.particle().Pz() * (1. - fac),
62  Particle.particle().E() - newE);
63  Particle.particle().setMomentum(
64  Particle.particle().Px() * fac, Particle.particle().Py() * fac, Particle.particle().Pz() * fac, newE);
65 }

References deltaP, MaterialEffectsSimulator::eMass(), MaterialEffectsSimulator::excitE(), LandauFluctuationGenerator::landau(), dqm-mbProfile::log, callgraph::m2, SiStripPI::max, mostProbableLoss, p2, MaterialEffectsSimulator::radLengths, MaterialEffectsSimulator::radLenIncm(), MaterialEffectsSimulator::rho(), mathSSE::sqrt(), MaterialEffectsSimulator::theA(), theGenerator, and MaterialEffectsSimulator::theZ().

◆ deltaMom()

const XYZTLorentzVector& EnergyLossSimulator::deltaMom ( ) const
inline

Returns the actual energy lost.

Definition at line 37 of file EnergyLossSimulator.h.

37 { return deltaP; }

References deltaP.

Referenced by CalorimetryManager::MuonMipSimulation().

◆ mostLikelyLoss()

double EnergyLossSimulator::mostLikelyLoss ( ) const
inline

Return most probable energy loss.

Definition at line 34 of file EnergyLossSimulator.h.

34 { return mostProbableLoss; }

References mostProbableLoss.

Member Data Documentation

◆ deltaP

XYZTLorentzVector EnergyLossSimulator::deltaP
private

The actual energy loss.

Definition at line 50 of file EnergyLossSimulator.h.

Referenced by compute(), and deltaMom().

◆ mostProbableLoss

double EnergyLossSimulator::mostProbableLoss
private

The most probable enery loss.

Definition at line 47 of file EnergyLossSimulator.h.

Referenced by compute(), and mostLikelyLoss().

◆ theGenerator

LandauFluctuationGenerator* EnergyLossSimulator::theGenerator
private

The Landau Fluctuation generator.

Definition at line 41 of file EnergyLossSimulator.h.

Referenced by compute(), EnergyLossSimulator(), and ~EnergyLossSimulator().

EnergyLossSimulator::mostProbableLoss
double mostProbableLoss
The most probable enery loss.
Definition: EnergyLossSimulator.h:47
MaterialEffectsSimulator::rho
double rho() const
Density in g/cm3.
Definition: MaterialEffectsSimulator.h:42
EnergyLossSimulator::deltaP
XYZTLorentzVector deltaP
The actual energy loss.
Definition: EnergyLossSimulator.h:50
MaterialEffectsSimulator::theZ
double theZ() const
Z.
Definition: MaterialEffectsSimulator.h:40
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
MaterialEffectsSimulator::Z
double Z
Definition: MaterialEffectsSimulator.h:88
p2
double p2[4]
Definition: TauolaWrapper.h:90
MaterialEffectsSimulator::MaterialEffectsSimulator
MaterialEffectsSimulator(double A=28.0855, double Z=14.0000, double density=2.329, double radLen=9.360)
Definition: MaterialEffectsSimulator.cc:9
MaterialEffectsSimulator::radLengths
double radLengths
Definition: MaterialEffectsSimulator.h:84
MaterialEffectsSimulator::excitE
double excitE() const
Mean excitation energy (in GeV)
Definition: MaterialEffectsSimulator.h:46
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
MaterialEffectsSimulator::theA
double theA() const
A.
Definition: MaterialEffectsSimulator.h:38
MaterialEffectsSimulator::density
double density
Definition: MaterialEffectsSimulator.h:89
A
LandauFluctuationGenerator::landau
double landau(RandomEngineAndDistribution const *random) const
Random generator of the dE/dX spread (Landau function)
Definition: LandauFluctuationGenerator.h:29
MaterialEffectsSimulator::eMass
double eMass() const
Electron mass in GeV/c2.
Definition: MaterialEffectsSimulator.h:48
callgraph.m2
m2
Definition: callgraph.py:38
MaterialEffectsSimulator::radLen
double radLen
Definition: MaterialEffectsSimulator.h:90
Particle
Definition: Particle.py:1
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
EnergyLossSimulator::theGenerator
LandauFluctuationGenerator * theGenerator
The Landau Fluctuation generator.
Definition: EnergyLossSimulator.h:41
LandauFluctuationGenerator
Definition: LandauFluctuationGenerator.h:20
MaterialEffectsSimulator::radLenIncm
double radLenIncm() const
One radiation length in cm.
Definition: MaterialEffectsSimulator.h:44