ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Simulation
ISF
ISF_FastCaloSim
ISF_FastCaloSimEvent
src
TFCSLateralShapeParametrizationHitNumberFromE.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "CLHEP/Random/RandPoisson.h"
6
7
#include "
ISF_FastCaloSimEvent/TFCSLateralShapeParametrizationHitNumberFromE.h
"
8
#include "
ISF_FastCaloSimEvent/TFCSSimulationState.h
"
9
10
#include "TMath.h"
11
#include <TClass.h>
12
13
//=============================================
14
//======= TFCSHistoLateralShapeParametrization =========
15
//=============================================
16
17
TFCSLateralShapeParametrizationHitNumberFromE::
18
TFCSLateralShapeParametrizationHitNumberFromE
(
const
char
*name,
19
const
char
*title,
20
double
stochastic,
21
double
constant)
22
:
TFCSLateralShapeParametrizationHitBase
(name, title),
23
m_stochastic
(stochastic),
m_stochastic_hadron
(0.0),
m_constant
(constant) {
24
set_match_all_pdgid
();
25
}
26
27
TFCSLateralShapeParametrizationHitNumberFromE::
28
TFCSLateralShapeParametrizationHitNumberFromE
(
const
char
*name,
29
const
char
*title,
30
double
stochastic,
31
double
stochastic_hadron,
32
double
constant)
33
:
TFCSLateralShapeParametrizationHitBase
(name, title),
34
m_stochastic
(stochastic),
m_stochastic_hadron
(stochastic_hadron),
35
m_constant
(constant) {
36
set_match_all_pdgid
();
37
}
38
39
double
TFCSLateralShapeParametrizationHitNumberFromE::get_sigma2_fluctuation
(
40
TFCSSimulationState
&simulstate,
const
TFCSTruthState
*
/*truth*/
,
41
const
TFCSExtrapolationState
*
/*extrapol*/
)
const
{
42
int
cs =
calosample
();
43
float
energy = simulstate.
E
(cs);
44
45
if
(energy < 0) {
46
return
1;
47
}
48
49
if
(TMath::IsNaN(energy)) {
50
ATH_MSG_DEBUG
(
"Energy is NaN"
);
51
return
1;
52
}
53
54
double
sqrtE = sqrt(energy / 1000.0);
55
double
sigma_stochastic =
m_stochastic
/ sqrtE;
56
double
sigma_stochastic_hadron =
m_stochastic_hadron
/ sqrtE;
57
58
// Attention: linear sum of "hadron" stochastic term and constant term as
59
// emulation of fluctuations in EM component
60
double
sigma_hadron =
m_constant
+ sigma_stochastic_hadron;
61
62
// Usual quadratic sum of "hardon" component and normal stochastic term
63
double
sigma2 =
64
sigma_stochastic * sigma_stochastic + sigma_hadron * sigma_hadron;
65
66
ATH_MSG_DEBUG
(
"sigma^2 fluctuation="
<< sigma2);
67
68
return
sigma2;
69
}
70
71
int
TFCSLateralShapeParametrizationHitNumberFromE::get_number_of_hits
(
72
TFCSSimulationState
&simulstate,
const
TFCSTruthState
*truth,
73
const
TFCSExtrapolationState
*extrapol)
const
{
74
if
(!simulstate.
randomEngine
()) {
75
return
-1;
76
}
77
78
float
sigma2 =
get_sigma2_fluctuation
(simulstate, truth, extrapol);
79
int
hits = CLHEP::RandPoisson::shoot(simulstate.
randomEngine
(), 1.0 / sigma2);
80
81
ATH_MSG_DEBUG
(
"#hits="
<< hits);
82
83
return
hits;
84
}
85
86
bool
TFCSLateralShapeParametrizationHitNumberFromE::operator==
(
87
const
TFCSParametrizationBase
&
ref
)
const
{
88
if
(
TFCSParametrizationBase::compare
(
ref
))
89
return
true
;
90
if
(!
TFCSParametrization::compare
(
ref
))
91
return
false
;
92
if
(!
TFCSLateralShapeParametrization::compare
(
ref
))
93
return
false
;
94
if
(!
TFCSLateralShapeParametrizationHitNumberFromE::compare
(
ref
))
95
return
false
;
96
return
true
;
97
}
98
99
bool
TFCSLateralShapeParametrizationHitNumberFromE::compare
(
100
const
TFCSParametrizationBase
&
ref
)
const
{
101
if
(
IsA
() !=
ref
.IsA()) {
102
ATH_MSG_DEBUG
(
"compare(): different class types "
103
<<
IsA
()->GetName() <<
" != "
<<
ref
.IsA()->GetName());
104
return
false
;
105
}
106
const
TFCSLateralShapeParametrizationHitNumberFromE
&ref_typed =
107
static_cast<
const
TFCSLateralShapeParametrizationHitNumberFromE
&
>
(
ref
);
108
if
(
m_stochastic
!= ref_typed.
m_stochastic
||
109
m_stochastic_hadron
!= ref_typed.
m_stochastic_hadron
||
110
m_constant
!= ref_typed.
m_constant
) {
111
ATH_MSG_DEBUG
(
"operator==(): different fluctuation model sigma^2=["
112
<<
m_stochastic
<<
"/sqrt(E/GeV)]^2 + ["
<<
m_constant
113
<<
" + "
<<
m_stochastic_hadron
114
<<
"/sqrt(E/GeV)]^2 != sigma^2=["
<< ref_typed.
m_stochastic
115
<<
"/sqrt(E/GeV)]^2 + ["
<< ref_typed.
m_constant
<<
" + "
116
<< ref_typed.
m_stochastic_hadron
<<
"/sqrt(E/GeV)]^2"
);
117
return
false
;
118
}
119
120
return
true
;
121
}
122
123
void
TFCSLateralShapeParametrizationHitNumberFromE::Print
(
124
Option_t *option)
const
{
125
TString opt(option);
126
bool
shortprint = opt.Index(
"short"
) >= 0;
127
bool
longprint =
msgLvl
(MSG::DEBUG) || (
msgLvl
(MSG::INFO) && !shortprint);
128
TString optprint = opt;
129
optprint.ReplaceAll(
"short"
,
""
);
130
TFCSLateralShapeParametrizationHitBase::Print
(option);
131
132
if
(longprint)
133
ATH_MSG_INFO
(optprint <<
" sigma^2=["
<<
m_stochastic
134
<<
"/sqrt(E/GeV)]^2 + ["
<<
m_constant
<<
" + "
135
<<
m_stochastic_hadron
<<
"/sqrt(E/GeV)]^2"
);
136
}
ref
const std::regex ref(r_ef)
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
TFCSLateralShapeParametrizationHitNumberFromE.h
TFCSSimulationState.h
ISF_FCS::MLogging::msgLvl
bool msgLvl(const MSG::Level lvl) const
Check whether the logging system is active at the provided verbosity level.
Definition
MLogging.h:222
TFCSExtrapolationState
Definition
TFCSExtrapolationState.h:13
TFCSLateralShapeParametrizationHitBase::TFCSLateralShapeParametrizationHitBase
TFCSLateralShapeParametrizationHitBase(const char *name=nullptr, const char *title=nullptr)
Definition
TFCSLateralShapeParametrizationHitBase.cxx:15
TFCSLateralShapeParametrizationHitNumberFromE::m_constant
double m_constant
Definition
TFCSLateralShapeParametrizationHitNumberFromE.h:63
TFCSLateralShapeParametrizationHitNumberFromE::operator==
virtual bool operator==(const TFCSParametrizationBase &ref) const override
The == operator compares the content of instances.
Definition
TFCSLateralShapeParametrizationHitNumberFromE.cxx:86
TFCSLateralShapeParametrizationHitNumberFromE::get_number_of_hits
int get_number_of_hits(TFCSSimulationState &simulstate, const TFCSTruthState *truth, const TFCSExtrapolationState *extrapol) const override
Call get_number_of_hits() only once per shower simulation, as it could be calculated with random numb...
Definition
TFCSLateralShapeParametrizationHitNumberFromE.cxx:71
TFCSLateralShapeParametrizationHitNumberFromE::get_sigma2_fluctuation
double get_sigma2_fluctuation(TFCSSimulationState &simulstate, const TFCSTruthState *truth, const TFCSExtrapolationState *extrapol) const override
Give the effective size sigma^2 of the fluctuations from the stochastic and constant term.
Definition
TFCSLateralShapeParametrizationHitNumberFromE.cxx:39
TFCSLateralShapeParametrizationHitNumberFromE::Print
void Print(Option_t *option="") const override
Definition
TFCSLateralShapeParametrizationHitNumberFromE.cxx:123
TFCSLateralShapeParametrizationHitNumberFromE::m_stochastic
double m_stochastic
Definition
TFCSLateralShapeParametrizationHitNumberFromE.h:61
TFCSLateralShapeParametrizationHitNumberFromE::TFCSLateralShapeParametrizationHitNumberFromE
TFCSLateralShapeParametrizationHitNumberFromE(const char *name=nullptr, const char *title=nullptr, double stochastic=0.1, double constant=0)
LAr: 10.1%/sqrt(E) stochastic=0.101; constant=0.002; HadEC: 21.4%/sqrt(E) stochastic=0....
Definition
TFCSLateralShapeParametrizationHitNumberFromE.cxx:18
TFCSLateralShapeParametrizationHitNumberFromE::m_stochastic_hadron
double m_stochastic_hadron
Definition
TFCSLateralShapeParametrizationHitNumberFromE.h:62
TFCSLateralShapeParametrizationHitNumberFromE::compare
bool compare(const TFCSParametrizationBase &ref) const
Definition
TFCSLateralShapeParametrizationHitNumberFromE.cxx:99
TFCSLateralShapeParametrization::Print
void Print(Option_t *option="") const override
Definition
TFCSLateralShapeParametrization.cxx:53
TFCSLateralShapeParametrization::calosample
int calosample() const
Definition
TFCSLateralShapeParametrization.h:34
TFCSLateralShapeParametrization::compare
bool compare(const TFCSParametrizationBase &ref) const
Definition
TFCSLateralShapeParametrization.cxx:32
TFCSParametrizationBase
Definition
TFCSParametrizationBase.h:46
TFCSParametrizationBase::set_match_all_pdgid
virtual void set_match_all_pdgid()
Definition
TFCSParametrizationBase.h:83
TFCSParametrizationBase::compare
bool compare(const TFCSParametrizationBase &ref) const
Do not persistify!
Definition
TFCSParametrizationBase.cxx:42
TFCSParametrization::compare
bool compare(const TFCSParametrizationBase &ref) const
Definition
TFCSParametrization.cxx:78
TFCSSimulationState
Definition
TFCSSimulationState.h:32
TFCSSimulationState::randomEngine
CLHEP::HepRandomEngine * randomEngine()
Definition
TFCSSimulationState.h:36
TFCSSimulationState::E
double E() const
Definition
TFCSSimulationState.h:42
TFCSTruthState
Definition
TFCSTruthState.h:13
IsA
#define IsA
Declare the TObject style functions.
Definition
xAODTEventBranch.h:59
Generated on
for ATLAS Offline Software by
1.17.0