ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Calorimeter
CaloClusterCorrection
src
CaloSwDeadOTX_back.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
/********************************************************************
6
7
NAME: CaloSwDeadOTX_back.cxx
8
PACKAGE: offline/Calorimeter/CaloSwCalibHitsCalibration
9
10
AUTHORS: L. Carminati
11
CREATED: March 26, 2010
12
13
PURPOSE: Apply specif calibration for the energy in the back
14
compartment and longitudinal leakage when there's a
15
dead OTX
16
Calibration constants derived by D. Banfi
17
base class: CaloClusterCorrectionCommon
18
Uses ToolWithConstants to get correction constants
19
20
********************************************************************/
21
22
#include "
CaloSwDeadOTX_back.h
"
23
#include "CLHEP/Units/SystemOfUnits.h"
24
25
using
xAOD::CaloCluster
;
26
using
CLHEP::TeV;
27
28
29
StatusCode
CaloSwDeadOTX_back::initialize
()
30
{
31
CHECK
(
CaloClusterCorrectionCommon::initialize
() );
32
33
// Need the explicit std::string here to avoid matching
34
// the template in AlgTool.
35
// CHECK( setProperty ("isDummy", std::string("1")) );
36
37
ATH_CHECK
(
m_affKey
.initialize());
38
39
ATH_MSG_DEBUG
(
" --------------->>>>> CaloSwDeadOTX_back :: retrieving affectedTool"
<<
endmsg
);
40
41
if
(
m_affectedTool
.retrieve().isFailure()){
42
ATH_MSG_DEBUG
(
" --------------->>>>> CaloSwDeadOTX_back :: failure retrieving affectedTool !! "
<<
endmsg
);
43
return
StatusCode::FAILURE;
44
}
45
46
ATH_MSG_DEBUG
(
" --------------->>>>> CaloSwDeadOTX_back :: affectedTool successfully retrieved"
<<
endmsg
);
47
48
return
StatusCode::SUCCESS;
49
}
50
51
void
CaloSwDeadOTX_back::makeTheCorrection
52
(
const
Context& myctx,
53
CaloCluster
* cluster,
54
const
CaloDetDescrElement
*
/*elt*/
,
55
float
eta
,
56
float
adj_eta,
57
float
/*phi*/
,
58
float
/*adj_phi*/
,
59
CaloSampling::CaloSample
/*samp*/
)
const
60
{
61
// ??? In principle, we should use adj_eta for the interpolation
62
// and range checks. However, the v2 corrections were derived
63
// using regular eta instead.
64
//
65
//Get affected info for this event
66
SG::ReadCondHandle<CaloAffectedRegionInfoVec>
affHdl{
m_affKey
, myctx.ctx()};
67
const
CaloAffectedRegionInfoVec
* affCont=*affHdl;
68
if
(!affCont) {
69
ATH_MSG_WARNING
(
"Do not have affected regions info, is this expected ?"
);
70
}
71
72
float
the_aeta;
73
if
(
m_use_raw_eta
(myctx))
74
the_aeta = std::abs (adj_eta);
75
else
76
the_aeta = std::abs (
eta
);
77
78
const
float
etamax =
m_etamax
(myctx);
79
if
(the_aeta >= etamax)
return
;
80
81
int
si;
82
if
(the_aeta <
m_eta_start_crack
(myctx))
83
si = 0;
84
else
if
(the_aeta >
m_eta_end_crack
(myctx))
85
si = 1;
86
else
{
87
// No corrections are applied for the crack region.
88
return
;
89
}
90
91
const
CxxUtils::Array<3>
correction =
m_correction
(myctx);
92
93
ATH_MSG_DEBUG
(
"************************************************************************************************"
<<
endmsg
);
94
ATH_MSG_DEBUG
(
" USING CALIBHITS CALIBRATION : apply correction for dead OTX in the back"
<<
endmsg
);
95
ATH_MSG_DEBUG
(
" Tool Name "
<< name() <<
endmsg
);
96
ATH_MSG_DEBUG
(
"************************************************************************************************"
<<
endmsg
);
97
98
// -------------------------------------------------------------
99
// check if the cluster is in an affected region
100
// -------------------------------------------------------------
101
102
static
const
CaloSampling::CaloSample
samps[2][4] = {
103
{ CaloSampling::PreSamplerB,
104
CaloSampling::EMB1,
105
CaloSampling::EMB2,
106
CaloSampling::EMB3 },
107
{ CaloSampling::PreSamplerE,
108
CaloSampling::EME1,
109
CaloSampling::EME2,
110
CaloSampling::EME3 }
111
};
112
113
// Keep memory of the energy stored in the back
114
115
float
eneBackold = cluster->
eSample
(samps[si][3]) ;
116
117
// Set the safety margin around the dead region
118
float
deta = 0.025;
119
float
dphi = 0.025;
120
121
int
layer = si * 4 + 3 ;
122
bool
check =
m_affectedTool
->isAffected(cluster, affCont, deta , dphi ,layer,layer,0) ;
// check dead OTX in barrel PS
123
124
125
// if a cluster is in an affected region set the back energy to zero else return
126
127
if
(check) {
128
ATH_MSG_DEBUG
(
"The cluster is in an affected region, apply corrections"
<<
endmsg
);
129
cluster->setEnergy (samps[si][3], 0 );
130
}
else
{
131
ATH_MSG_DEBUG
(
"The cluster is NOT in an affected region, skip correction"
<<
endmsg
);
132
return
;
133
}
134
135
// -------------------------------------------------------------
136
// If the cluster is in an affected region load the corrections
137
// -------------------------------------------------------------
138
139
// Determine the eta bin for the correction
140
int
ibin = (
static_cast<
int
>
(the_aeta / etamax * 100)) ;
141
142
// Load the correction coefficients
143
CaloRec::Array<1>
lleak = correction[0][ibin];
144
145
// -------------------------------------------------------------
146
// Compute longitudinal barycenter: this is a very old and approximate
147
// parametrization that needs to be updated.
148
// -------------------------------------------------------------
149
150
double
raw_energy =0;
151
double
shower_lbary_raw =0;
152
for
(
int
nl = 0 ; nl< 4 ; nl++){
153
raw_energy += cluster->
eSample
(samps[si][nl]);
154
shower_lbary_raw += (
m_sampling_depth
(myctx)[ibin][nl+1] * cluster->
eSample
(samps[si][nl])) ;
155
}
156
157
if
(raw_energy == 0)
return
;
158
double
shower_lbary = shower_lbary_raw / raw_energy;
159
160
ATH_MSG_DEBUG
(
"Shower longitudinal barycenter ---->> "
<< shower_lbary <<
endmsg
);
161
162
double
depth_max = 20. + raw_energy*(3./
TeV
) ;
163
164
if
( shower_lbary > depth_max || shower_lbary < 0.) {
165
shower_lbary = 15.;
166
ATH_MSG_DEBUG
(
" replace pathological depth by 15 X0 "
167
<<
endmsg
);
168
}
169
170
171
raw_energy = raw_energy * 1e-3;
172
173
// -------------------------------------------------------------
174
// Estimate the energy deposited in the back sampling and the
175
// longitudinal leakage based on the longitudinal barycenter
176
// -------------------------------------------------------------
177
178
double
e_acc_reco = 0;
179
for
(
int
nl = 1 ; nl< 4 ; nl++){
180
e_acc_reco += cluster->
eSample
(samps[si][nl]);
181
}
182
183
ATH_MSG_DEBUG
(
"Leakage : "
<< lleak[0] <<
" "
<< lleak[1]
184
<<
" "
<< lleak[2] <<
" "
<< lleak[3] <<
endmsg
);
185
186
double
e_leak_perc = lleak[3] + lleak[1] * shower_lbary + lleak[2] * exp(shower_lbary);
187
188
ATH_MSG_DEBUG
(
"LongLeakage correction --> "
<< e_leak_perc <<
endmsg
);
189
190
if
(e_leak_perc < 0 ) e_leak_perc = 0.;
191
if
(e_leak_perc > 100.) e_leak_perc = 100.;
192
193
double
e_leak_reco = e_leak_perc * (e_acc_reco)*0.01;
194
195
// If something goes wrong keep the old energy
196
if
(e_leak_reco<0.) e_leak_reco= eneBackold;
197
198
// -------------------------------------------------------------
199
// Now set the energies of the cluster
200
// -------------------------------------------------------------
201
202
// set the energy of the presampler
203
cluster->setEnergy (samps[si][3], e_leak_reco );
204
205
// take the cluster energy, subtract the old PS energy and add the new one
206
207
ATH_MSG_DEBUG
(
"CaloSwDeadOTX_back:: cluster energy before correction --> "
<< cluster->
e
() <<
endmsg
);
208
ATH_MSG_DEBUG
(
"subtracting back energy -->> "
<< eneBackold <<
endmsg
);
209
ATH_MSG_DEBUG
(
"adding new back energy -->> "
<< e_leak_reco <<
endmsg
);
210
211
float
e_temp = cluster->
e
() - eneBackold + e_leak_reco ;
212
213
// set the energy of the cluster
214
cluster->
setE
(e_temp);
215
216
ATH_MSG_DEBUG
(
"CaloSwDeadOTX_back::Energy after correction --> "
<< cluster->
e
() <<
endmsg
);
217
218
}
219
eta
Scalar eta() const
pseudorapidity method
Definition
AmgMatrixBasePlugin.h:83
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x,...)
Definition
AthMsgStreamMacros.h:43
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x,...)
Definition
AthMsgStreamMacros.h:46
CaloAffectedRegionInfoVec
std::vector< CaloAffectedRegionInfo > CaloAffectedRegionInfoVec
Definition
CaloAffectedRegionInfoVec.h:11
CaloSwDeadOTX_back.h
m_correction
Constant< CxxUtils::Array< 2 > > m_correction
Calibration constant: tabulated arrays of function parameters.
Definition
CaloSwEtamod_v2.h:142
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
TeV
static const double TeV
Definition
HIEventSelectionToolRun3.cxx:74
CaloClusterCorrection::initialize
virtual StatusCode initialize() override
Definition
CaloClusterCorrection.cxx:46
CaloCluster
Principal data class for CaloCell clusters.
Definition
Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:79
CaloCluster::eSample
double eSample(sampling_type sampling) const
Retrieve energy in a given sampling.
Definition
Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:975
CaloCluster::e
virtual double e() const
Retrieve energy independent of signal state.
Definition
Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:753
CaloCluster::setE
virtual void setE(double e)
Set energy.
Definition
Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:767
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell.
Definition
Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
CaloSampling::CaloSample
CaloSample
Definition
Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
CaloSwDeadOTX_back::m_sampling_depth
Constant< CxxUtils::Array< 2 > > m_sampling_depth
Definition
CaloSwDeadOTX_back.h:66
CaloSwDeadOTX_back::m_use_raw_eta
Constant< bool > m_use_raw_eta
Definition
CaloSwDeadOTX_back.h:70
CaloSwDeadOTX_back::m_etamax
Constant< float > m_etamax
Definition
CaloSwDeadOTX_back.h:69
CaloSwDeadOTX_back::makeTheCorrection
virtual void makeTheCorrection(const Context &muctx, xAOD::CaloCluster *cluster, const CaloDetDescrElement *elt, float eta, float adj_eta, float phi, float adj_phi, CaloSampling::CaloSample samp) const override
Virtual function for the correction-specific code.
Definition
CaloSwDeadOTX_back.cxx:52
CaloSwDeadOTX_back::m_affectedTool
ToolHandle< ICaloAffectedTool > m_affectedTool
Definition
CaloSwDeadOTX_back.h:63
CaloSwDeadOTX_back::initialize
virtual StatusCode initialize() override
Definition
CaloSwDeadOTX_back.cxx:29
CaloSwDeadOTX_back::m_eta_end_crack
Constant< float > m_eta_end_crack
Definition
CaloSwDeadOTX_back.h:68
CaloSwDeadOTX_back::m_affKey
SG::ReadCondHandleKey< CaloAffectedRegionInfoVec > m_affKey
Definition
CaloSwDeadOTX_back.h:60
CaloSwDeadOTX_back::m_eta_start_crack
Constant< float > m_eta_start_crack
Definition
CaloSwDeadOTX_back.h:67
CxxUtils::Array
Read-only multidimensional array.
Definition
Control/CxxUtils/CxxUtils/Array.h:135
SG::ReadCondHandle
Definition
ReadCondHandle.h:39
xAOD::CaloCluster
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Definition
Event/xAOD/xAODCaloEvent/xAODCaloEvent/CaloCluster.h:19
Generated on
for ATLAS Offline Software by
1.17.0