ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Simulation
ISF
ISF_Fatras
ISF_FatrasTools
src
McEnergyLossUpdator.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// class header
6
#include "
McEnergyLossUpdator.h
"
7
8
// Trk
9
#include "
TrkGeometry/MaterialProperties.h
"
10
#include "
TrkMaterialOnTrack/EnergyLoss.h
"
11
12
#include "CLHEP/Random/RandLandau.h"
13
#include "CLHEP/Random/RandGaussZiggurat.h"
14
#include "
TrkEventPrimitives/ParticleHypothesis.h
"
15
16
17
18
iFatras::McEnergyLossUpdator::McEnergyLossUpdator
(
const
std::string&
type
,
const
std::string& name,
const
IInterface* parent )
19
:
20
base_class(
type
, name, parent )
21
{
22
}
23
24
25
StatusCode
iFatras::McEnergyLossUpdator::initialize
()
26
{
27
ATH_MSG_VERBOSE
(
"initialize()"
);
28
29
// Retrieve the energy loss updator tool
30
ATH_CHECK
(
m_energyLossUpdator
.retrieve() );
31
32
// get the random generator serice
33
ATH_CHECK
(
m_rndGenSvc
.retrieve() );
34
35
//Get own engine with own seeds:
36
m_randomEngine
=
m_rndGenSvc
->GetEngine(
m_randomEngineName
);
37
if
(!
m_randomEngine
) {
38
ATH_MSG_FATAL
(
"Could not get random engine '"
<<
m_randomEngineName
<<
"'"
);
39
return
StatusCode::FAILURE;
40
}
41
42
return
StatusCode::SUCCESS;
43
}
44
45
46
double
iFatras::McEnergyLossUpdator::dEdX
(
const
Trk::MaterialProperties
& materialProperties,
47
double
momentum,
48
Trk::ParticleHypothesis
particleHypothesis )
const
49
{
50
// simply forward the dEdX from the standard energy loss updator
51
return
m_energyLossUpdator
->dEdX( materialProperties, momentum, particleHypothesis );
52
}
53
54
Trk::EnergyLoss
55
iFatras::McEnergyLossUpdator::energyLoss
(
56
const
Trk::MaterialProperties
& materialProperties,
57
double
momentum,
58
double
pathCorrection,
59
Trk::PropDirection
direction,
60
Trk::ParticleHypothesis
particleHypothesis,
61
bool
)
const
62
{
63
64
65
// get the number of the material effects distribution
66
Trk::EnergyLoss
sampledEloss =
67
m_energyLossUpdator
->energyLoss(materialProperties,
68
momentum,
69
pathCorrection,
70
direction,
71
particleHypothesis,
72
m_usePDGformula
);
73
74
75
// smear according to preselected distribution
76
switch
(
m_energyLossDistribution
) {
77
// no straggling
78
case
0 : { }
break
;
79
// gaussian smearing
80
case
1 : {
81
float
deIoni = sampledEloss.
sigmaIoni
() * CLHEP::RandGaussZiggurat::shoot(
m_randomEngine
);
82
float
deRad = sampledEloss.
sigmaRad
() * CLHEP::RandGaussZiggurat::shoot(
m_randomEngine
);
83
sampledEloss.
update
(deIoni,0.,deRad,0.,
false
);
84
}
break
;
85
case
2 : {
86
float
deIoni = -sampledEloss.
sigmaIoni
() * CLHEP::RandLandau::shoot(
m_randomEngine
);
// TODO :check sign
87
sampledEloss.
update
(deIoni,0.,0.,0.,
false
);
88
}
break
;
89
// landau smearing
90
default : {
91
float
deIoni = -sampledEloss.
sigmaIoni
() * CLHEP::RandLandau::shoot(
m_randomEngine
);
// TODO :check sign
92
float
deRad = -sampledEloss.
sigmaRad
() * CLHEP::RandLandau::shoot(
m_randomEngine
);
// TODO :check sign
93
sampledEloss.
update
(deIoni,0.,deRad,0.,
false
);
94
}
break
;
95
}
96
97
// protection due to straggling - maximum energy loss is E-m
98
double
m =
Trk::ParticleMasses::mass
[particleHypothesis];
99
double
E = sqrt(momentum*momentum+m*m);
100
101
if
(sampledEloss.
deltaE
()+E<m ) {
// particle stopping - rest energy
102
float
dRad_rest = m-E-sampledEloss.
deltaE
();
103
sampledEloss.
update
(0.,0.,dRad_rest,0.,
false
);
104
}
105
106
return
sampledEloss;
107
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x,...)
Definition
AthMsgStreamMacros.h:42
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x,...)
Definition
AthMsgStreamMacros.h:48
EnergyLoss.h
MaterialProperties.h
McEnergyLossUpdator.h
ParticleHypothesis.h
Trk::EnergyLoss
This class describes energy loss material effects in the ATLAS tracking EDM.
Definition
EnergyLoss.h:34
Trk::EnergyLoss::update
void update(double ioni, double sigi, double rad, double sigr, bool mpv=false)
Trk::EnergyLoss::sigmaIoni
double sigmaIoni() const
Trk::EnergyLoss::sigmaRad
double sigmaRad() const
Trk::EnergyLoss::deltaE
double deltaE() const
returns the
Trk::MaterialProperties
Material with information about thickness of material.
Definition
MaterialProperties.h:40
iFatras::McEnergyLossUpdator::m_usePDGformula
BooleanProperty m_usePDGformula
Definition
McEnergyLossUpdator.h:84
iFatras::McEnergyLossUpdator::m_randomEngine
CLHEP::HepRandomEngine * m_randomEngine
Random engine.
Definition
McEnergyLossUpdator.h:82
iFatras::McEnergyLossUpdator::dEdX
virtual double dEdX(const Trk::MaterialProperties &materialProperties, double momentum, Trk::ParticleHypothesis particleHypothesis=Trk::pion) const override
IEnergyLossUpdator public method to compute dEdX.
Definition
McEnergyLossUpdator.cxx:46
iFatras::McEnergyLossUpdator::McEnergyLossUpdator
McEnergyLossUpdator(const std::string &, const std::string &, const IInterface *)
Constructor with AlgTool parameters.
Definition
McEnergyLossUpdator.cxx:18
iFatras::McEnergyLossUpdator::m_energyLossUpdator
PublicToolHandle< IEnergyLossUpdator > m_energyLossUpdator
Dummy methods end here.
Definition
McEnergyLossUpdator.h:76
iFatras::McEnergyLossUpdator::initialize
virtual StatusCode initialize() override
AlgTool initialise method.
Definition
McEnergyLossUpdator.cxx:25
iFatras::McEnergyLossUpdator::energyLoss
virtual Trk::EnergyLoss energyLoss(const Trk::MaterialProperties &materialProperties, double momentum, double pathCorrection, Trk::PropDirection direction=Trk::alongMomentum, Trk::ParticleHypothesis particleHypothesis=Trk::pion, bool usePDGformula=false) const override
IEnergyLossUpdator public method to compute the mean and variance of the energy loss.
Definition
McEnergyLossUpdator.cxx:55
iFatras::McEnergyLossUpdator::m_energyLossDistribution
IntegerProperty m_energyLossDistribution
include energy loss straggling or not ( 0 == none, 1 == gauss, 2 == landau)
Definition
McEnergyLossUpdator.h:77
iFatras::McEnergyLossUpdator::m_rndGenSvc
ServiceHandle< IAtRndmGenSvc > m_rndGenSvc
Random Generator service - not thread-safe.
Definition
McEnergyLossUpdator.h:80
iFatras::McEnergyLossUpdator::m_randomEngineName
StringProperty m_randomEngineName
Name of the random number stream.
Definition
McEnergyLossUpdator.h:83
Trk::ParticleMasses::mass
constexpr double mass[PARTICLEHYPOTHESES]
the array of masses
Definition
ParticleHypothesis.h:56
Trk::PropDirection
PropDirection
PropDirection, enum for direction of the propagation.
Definition
PropDirection.h:19
Trk::ParticleHypothesis
ParticleHypothesis
Enumeration for Particle hypothesis respecting the interaction with material.
Definition
ParticleHypothesis.h:28
type
Generated on
for ATLAS Offline Software by
1.17.0