Main Page
Namespaces
Classes
Package Documentation
FastSimulation
MaterialEffects
src
EnergyLossSimulator.cc
Go to the documentation of this file.
1
#include "
FastSimulation/MaterialEffects/interface/EnergyLossSimulator.h
"
2
//#include "FastSimulation/Utilities/interface/RandomEngine.h"
3
#include "
FastSimulation/Utilities/interface/LandauFluctuationGenerator.h
"
4
5
#include <cmath>
6
7
EnergyLossSimulator::EnergyLossSimulator
(
double
A
,
double
Z
,
double
density,
double
radLen) :
8
MaterialEffectsSimulator
(A,Z,density,radLen)
9
{
10
theGenerator
=
new
LandauFluctuationGenerator
();
11
}
12
13
EnergyLossSimulator::~EnergyLossSimulator
() {
14
15
delete
theGenerator
;
16
17
}
18
19
void
20
EnergyLossSimulator::compute
(
ParticlePropagator
&
Particle
,
RandomEngineAndDistribution
const
*
random
)
21
{
22
23
// FamosHistos* myHistos = FamosHistos::instance();
24
25
// double gamma_e = 0.577215664901532861; // Euler constant
26
27
// The thickness in cm
28
double
thick =
radLengths
*
radLenIncm
();
29
30
// This is a simple version (a la PDG) of a dE/dx generator.
31
// It replaces the buggy GEANT3 -> C++ former version.
32
// Author : Patrick Janot - 8-Jan-2004
33
34
double
p2
= Particle.
particle
().
Vect
().Mag2();
35
double
verySmallP2 = 0.0001;
36
if
(p2<=verySmallP2) {
37
deltaP
.SetXYZT(0.,0.,0.,0.);
38
return
;
39
}
40
double
m2 = Particle.
particle
().
mass
() * Particle.
particle
().
mass
();
41
double
e2 = p2+m2;
42
43
double
beta2 = p2/e2;
44
double
gama2 = e2/m2;
45
46
double
charge2 = Particle.
particle
().
charge
() * Particle.
particle
().
charge
();
47
48
// Energy loss spread in GeV
49
double
eSpread = 0.1536E-3*charge2*(
theZ
()/
theA
())*
rho
()*thick/beta2;
50
51
// Most probable energy loss (from the integrated Bethe-Bloch equation)
52
mostProbableLoss
= eSpread * (
log
( 2.*
eMass
()*beta2*gama2*eSpread
53
/ (
excitE
()*
excitE
()) )
54
- beta2 + 0.200 );
55
56
// This one can be needed on output (but is not used internally)
57
// meanEnergyLoss = 2.*eSpread * ( log ( 2.*eMass()*beta2*gama2 /excitE() ) - beta2 );
58
59
// Generate the energy loss with Landau fluctuations
60
double
dedx =
mostProbableLoss
+ eSpread *
theGenerator
->
landau
(random);
61
62
// Compute the new energy and momentum
63
double
aBitAboveMass = Particle.
particle
().
mass
()*1.0001;
64
double
newE =
std::max
(aBitAboveMass,Particle.
particle
().
e
()-dedx);
65
// double newE = std::max(Particle.particle().mass(),Particle.particle().e()-dedx);
66
double
fac =
std::sqrt
((newE*newE-m2)/p2);
67
68
69
// Update the momentum
70
deltaP
.SetXYZT(Particle.
particle
().
Px
()*(1.-fac),Particle.
particle
().
Py
()*(1.-fac),
71
Particle.
particle
().
Pz
()*(1.-fac),Particle.
particle
().
E
()-newE);
72
Particle.
particle
().
setMomentum
(Particle.
particle
().
Px
()*fac,Particle.
particle
().
Py
()*fac,
73
Particle.
particle
().
Pz
()*fac,newE);
74
75
}
76
RawParticle::setMomentum
void setMomentum(const XYZTLorentzVector &vtx)
set the momentum
Definition:
RawParticle.h:347
LandauFluctuationGenerator.h
RawParticle::Vect
XYZVector Vect() const
the momentum threevector
Definition:
RawParticle.h:342
EnergyLossSimulator::~EnergyLossSimulator
~EnergyLossSimulator() override
Default Destructor.
Definition:
EnergyLossSimulator.cc:13
Particle
Definition:
Particle.py:1
MaterialEffectsSimulator::theZ
double theZ() const
Z.
Definition:
MaterialEffectsSimulator.h:45
MaterialEffectsSimulator::rho
double rho() const
Density in g/cm3.
Definition:
MaterialEffectsSimulator.h:47
random
TRandom random
Definition:
MVATrainer.cc:138
BaseParticlePropagator::particle
RawParticle const & particle() const
The particle being propagated.
Definition:
BaseParticlePropagator.h:169
RawParticle::mass
double mass() const
get the MEASURED mass
Definition:
RawParticle.h:314
EnergyLossSimulator::mostProbableLoss
double mostProbableLoss
The most probable enery loss.
Definition:
EnergyLossSimulator.h:50
ParticlePropagator
Definition:
ParticlePropagator.h:28
RawParticle::e
double e() const
energy of the momentum
Definition:
RawParticle.h:324
mathSSE::sqrt
T sqrt(T t)
Definition:
SSEVec.h:18
LandauFluctuationGenerator
Definition:
LandauFluctuationGenerator.h:20
RawParticle::Py
double Py() const
y of the momentum
Definition:
RawParticle.h:319
MaterialEffectsSimulator::eMass
double eMass() const
Electron mass in GeV/c2.
Definition:
MaterialEffectsSimulator.h:53
RawParticle::Pz
double Pz() const
z of the momentum
Definition:
RawParticle.h:322
RawParticle::charge
double charge() const
get the MEASURED charge
Definition:
RawParticle.h:313
SiStripPI::max
Definition:
SiStripPayloadInspectorHelper.h:178
p2
double p2[4]
Definition:
TauolaWrapper.h:90
EnergyLossSimulator.h
EnergyLossSimulator::theGenerator
LandauFluctuationGenerator * theGenerator
The Landau Fluctuation generator.
Definition:
EnergyLossSimulator.h:44
LandauFluctuationGenerator::landau
double landau(RandomEngineAndDistribution const *random) const
Random generator of the dE/dX spread (Landau function)
Definition:
LandauFluctuationGenerator.h:34
EnergyLossSimulator::EnergyLossSimulator
EnergyLossSimulator(double A, double Z, double density, double radLen)
Constructor.
Definition:
EnergyLossSimulator.cc:7
EnergyLossSimulator::compute
void compute(ParticlePropagator &Particle, RandomEngineAndDistribution const *) override
The real dE/dx generation and particle update.
Definition:
EnergyLossSimulator.cc:20
MaterialEffectsSimulator::excitE
double excitE() const
Mean excitation energy (in GeV)
Definition:
MaterialEffectsSimulator.h:51
cmsBatch.log
log
Definition:
cmsBatch.py:343
MaterialEffectsSimulator::radLengths
double radLengths
Definition:
MaterialEffectsSimulator.h:91
DOFs::Z
Definition:
AlignPCLThresholdsWriter.cc:40
RawParticle::Px
double Px() const
x of the momentum
Definition:
RawParticle.h:316
MaterialEffectsSimulator::radLenIncm
double radLenIncm() const
One radiation length in cm.
Definition:
MaterialEffectsSimulator.h:49
RawParticle::E
double E() const
energy of the momentum
Definition:
RawParticle.h:325
patCaloMETCorrections_cff.A
A
Definition:
patCaloMETCorrections_cff.py:43
EnergyLossSimulator::deltaP
XYZTLorentzVector deltaP
The actual energy loss.
Definition:
EnergyLossSimulator.h:53
MaterialEffectsSimulator::theA
double theA() const
A.
Definition:
MaterialEffectsSimulator.h:43
RandomEngineAndDistribution
Definition:
RandomEngineAndDistribution.h:18
MaterialEffectsSimulator
Definition:
MaterialEffectsSimulator.h:25
Generated for CMSSW Reference Manual by
1.8.11