ATLAS Offline Software
Loading...
Searching...
No Matches
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
7
8// Trk
11
12#include "CLHEP/Random/RandLandau.h"
13#include "CLHEP/Random/RandGaussZiggurat.h"
15
16
17
18iFatras::McEnergyLossUpdator::McEnergyLossUpdator( const std::string& type, const std::string& name, const IInterface* parent )
19 :
20 base_class( type, name, parent )
21{
22}
23
24
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:
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
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
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,
73
74
75 // smear according to preselected distribution
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}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
#define ATH_MSG_VERBOSE(x)
This class describes energy loss material effects in the ATLAS tracking EDM.
Definition EnergyLoss.h:34
void update(double ioni, double sigi, double rad, double sigr, bool mpv=false)
double sigmaIoni() const
double sigmaRad() const
double deltaE() const
returns the
Material with information about thickness of material.
CLHEP::HepRandomEngine * m_randomEngine
Random engine.
virtual double dEdX(const Trk::MaterialProperties &materialProperties, double momentum, Trk::ParticleHypothesis particleHypothesis=Trk::pion) const override
IEnergyLossUpdator public method to compute dEdX.
McEnergyLossUpdator(const std::string &, const std::string &, const IInterface *)
Constructor with AlgTool parameters.
PublicToolHandle< IEnergyLossUpdator > m_energyLossUpdator
Dummy methods end here.
virtual StatusCode initialize() override
AlgTool initialise method.
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.
IntegerProperty m_energyLossDistribution
include energy loss straggling or not ( 0 == none, 1 == gauss, 2 == landau)
ServiceHandle< IAtRndmGenSvc > m_rndGenSvc
Random Generator service - not thread-safe.
StringProperty m_randomEngineName
Name of the random number stream.
constexpr double mass[PARTICLEHYPOTHESES]
the array of masses
PropDirection
PropDirection, enum for direction of the propagation.
ParticleHypothesis
Enumeration for Particle hypothesis respecting the interaction with material.