ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Calorimeter
CaloClusterCorrection
src
CaloSwDeadOTX_ps.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_ps.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 lost in front
14
when the PS is missing
15
Calibration constants derived by D. Banfi
16
base class: CaloClusterCorrectionCommon
17
Uses ToolWithConstants to get correction constants
18
19
********************************************************************/
20
21
#include "
CaloSwDeadOTX_ps.h
"
22
#include "CLHEP/Units/SystemOfUnits.h"
23
24
using
xAOD::CaloCluster
;
25
using
CLHEP::TeV;
26
27
28
StatusCode
CaloSwDeadOTX_ps::initialize
()
29
{
30
CHECK
(
CaloClusterCorrectionCommon::initialize
() );
31
32
// Need the explicit std::string here to avoid matching
33
// the template in AlgTool.
34
// CHECK( setProperty ("isDummy", std::string("1")) );
35
36
ATH_CHECK
(
m_affKey
.initialize());
37
38
ATH_MSG_DEBUG
(
" --------------->>>>> CaloSwDeadOTX_ps :: retrieving affectedTool"
<<
endmsg
);
39
40
if
(
m_affectedTool
.retrieve().isFailure()){
41
ATH_MSG_DEBUG
(
" --------------->>>>> CaloSwDeadOTX_ps :: failure retrieving affectedTool !! "
<<
endmsg
);
42
return
StatusCode::FAILURE;
43
}
44
45
ATH_MSG_DEBUG
(
" --------------->>>>> CaloSwDeadOTX_ps :: affectedTool successfully retrieved"
<<
endmsg
);
46
47
return
StatusCode::SUCCESS;
48
}
49
50
void
CaloSwDeadOTX_ps::makeTheCorrection
51
(
const
Context& myctx,
52
CaloCluster
* cluster,
53
const
CaloDetDescrElement
*
/*elt*/
,
54
float
eta
,
55
float
adj_eta,
56
float
/*phi*/
,
57
float
/*adj_phi*/
,
58
CaloSampling::CaloSample
/*samp*/
)
const
59
{
60
// ??? In principle, we should use adj_eta for the interpolation
61
// and range checks. However, the v2 corrections were derived
62
// using regular eta instead.
63
64
//Get affected info for this event
65
SG::ReadCondHandle<CaloAffectedRegionInfoVec>
affHdl{
m_affKey
, myctx.ctx()};
66
const
CaloAffectedRegionInfoVec
* affCont=*affHdl;
67
if
(!affCont) {
68
ATH_MSG_WARNING
(
"Do not have affected regions info, is this expected ?"
);
69
}
70
71
float
the_aeta;
72
if
(
m_use_raw_eta
(myctx))
73
the_aeta = std::abs (adj_eta);
74
else
75
the_aeta = std::abs (
eta
);
76
77
const
float
etamax =
m_etamax
(myctx);
78
if
(the_aeta >= etamax)
return
;
79
80
int
si;
81
if
(the_aeta <
m_eta_start_crack
(myctx))
82
si = 0;
83
else
if
(the_aeta >
m_eta_end_crack
(myctx))
84
si = 1;
85
else
{
86
// No corrections are applied for the crack region.
87
return
;
88
}
89
90
const
CxxUtils::Array<3>
correction =
m_correction
(myctx);
91
92
ATH_MSG_DEBUG
(
"************************************************************************************************"
<<
endmsg
);
93
ATH_MSG_DEBUG
(
" USING CALIBHITS CALIBRATION : apply correction for dead OTX in the presampler"
<<
endmsg
);
94
ATH_MSG_DEBUG
(
" Tool Name "
<< name() <<
endmsg
);
95
ATH_MSG_DEBUG
(
"************************************************************************************************"
<<
endmsg
);
96
97
// -------------------------------------------------------------
98
// check if the cluster is in an affected region
99
// -------------------------------------------------------------
100
101
static
const
CaloSampling::CaloSample
samps[2][4] = {
102
{ CaloSampling::PreSamplerB,
103
CaloSampling::EMB1,
104
CaloSampling::EMB2,
105
CaloSampling::EMB3 },
106
{ CaloSampling::PreSamplerE,
107
CaloSampling::EME1,
108
CaloSampling::EME2,
109
CaloSampling::EME3 }
110
};
111
112
// Keep memory of the energy in front from the standard correction
113
114
float
enePSold = cluster->
eSample
(samps[si][0]) ;
115
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 ;
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 PS 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][0], 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>
froffset = correction[0][ibin];
144
CaloRec::Array<1>
frslope = correction[1][ibin];
145
CaloRec::Array<1>
sec = correction[2][ibin];
146
147
// -------------------------------------------------------------
148
// Compute longitudinal barycenter: this is a very old and approximate
149
// parametrization that needs to be updated.
150
// -------------------------------------------------------------
151
152
double
raw_energy =0;
153
double
shower_lbary_raw =0;
154
for
(
int
nl = 0 ; nl< 4 ; nl++){
155
raw_energy += cluster->
eSample
(samps[si][nl]);
156
shower_lbary_raw += (
m_sampling_depth
(myctx)[ibin][nl+1] * cluster->
eSample
(samps[si][nl])) ;
157
}
158
159
if
(raw_energy == 0)
return
;
160
double
shower_lbary = shower_lbary_raw / raw_energy;
161
162
ATH_MSG_DEBUG
(
"Shower longitudinal barycenter ---->> "
<< shower_lbary <<
endmsg
);
163
164
double
depth_max = 20. + raw_energy*(3./
TeV
);
165
166
if
( shower_lbary > depth_max || shower_lbary<0.) {
167
shower_lbary = 15.;
168
ATH_MSG_DEBUG
(
" replace pathological depth by 15 X0 "
169
<<
endmsg
);
170
}
171
172
raw_energy = raw_energy * 1e-3;
173
174
// -------------------------------------------------------------
175
// Estimate the total energy lost in front of the accordion using the
176
// longitudinal barycenter
177
// -------------------------------------------------------------
178
179
double
p1 = froffset[1] + froffset[2] * raw_energy + froffset[3] * raw_energy * raw_energy ;
180
double
p2 = frslope[1] + frslope[2] * raw_energy + frslope[3] * raw_energy * raw_energy ;
181
double
p3 = sec[1] + sec[2] * raw_energy + sec[3] * raw_energy * raw_energy ;
182
183
ATH_MSG_DEBUG
(
"p1 "
<< froffset[1] <<
" "
<< froffset[2] <<
" "
<< froffset[3] <<
endmsg
);
184
ATH_MSG_DEBUG
(
"p2 "
<< frslope[1] <<
" "
<< frslope[2] <<
" "
<< frslope[3] <<
endmsg
);
185
ATH_MSG_DEBUG
(
"p3 "
<< sec[1] <<
" "
<< sec[2] <<
" "
<< sec[3] <<
endmsg
);
186
187
double
e_front_reco= (p1 + p2 * shower_lbary + p3 * shower_lbary * shower_lbary);
188
189
// If something goes wrong keep the old energy
190
if
(e_front_reco<0.) {
191
e_front_reco= enePSold;
192
ATH_MSG_DEBUG
(
"CaloSwDeadOTX_ps:: new E front is negative, no correction!"
<<
endmsg
);
193
}
194
// -------------------------------------------------------------
195
// Now set the energies of the cluster
196
// -------------------------------------------------------------
197
198
// set the energy of the presampler
199
cluster->setEnergy (samps[si][0], e_front_reco );
200
201
// take the cluster energy, subtract the old PS energy and add the new one
202
203
ATH_MSG_DEBUG
(
"CaloSwDeadOTX_ps:: cluster energy before correction --> "
<< cluster->
e
() <<
endmsg
);
204
ATH_MSG_DEBUG
(
"CaloSwDeadOTX_ps:: subtracting PS energy --> "
<< enePSold <<
endmsg
);
205
ATH_MSG_DEBUG
(
"CaloSwDeadOTX_ps:: adding new PS energy -->> "
<< e_front_reco <<
endmsg
);
206
207
float
e_temp = cluster->
e
() - enePSold + e_front_reco ;
208
209
// set the energy of the cluster
210
cluster->
setE
(e_temp);
211
212
ATH_MSG_DEBUG
(
"CaloSwDeadOTX_ps::Energy after correction --> "
<< cluster->
e
() <<
endmsg
);
213
214
}
215
eta
Scalar eta() const
pseudorapidity method
Definition
AmgMatrixBasePlugin.h:83
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:61
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
CaloAffectedRegionInfoVec
std::vector< CaloAffectedRegionInfo > CaloAffectedRegionInfoVec
Definition
CaloAffectedRegionInfoVec.h:11
CaloSwDeadOTX_ps.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_ps::m_eta_start_crack
Constant< float > m_eta_start_crack
Definition
CaloSwDeadOTX_ps.h:67
CaloSwDeadOTX_ps::m_eta_end_crack
Constant< float > m_eta_end_crack
Definition
CaloSwDeadOTX_ps.h:68
CaloSwDeadOTX_ps::m_affKey
SG::ReadCondHandleKey< CaloAffectedRegionInfoVec > m_affKey
Definition
CaloSwDeadOTX_ps.h:60
CaloSwDeadOTX_ps::m_sampling_depth
Constant< CxxUtils::Array< 2 > > m_sampling_depth
Definition
CaloSwDeadOTX_ps.h:66
CaloSwDeadOTX_ps::m_affectedTool
ToolHandle< ICaloAffectedTool > m_affectedTool
Definition
CaloSwDeadOTX_ps.h:62
CaloSwDeadOTX_ps::m_use_raw_eta
Constant< bool > m_use_raw_eta
Definition
CaloSwDeadOTX_ps.h:70
CaloSwDeadOTX_ps::initialize
virtual StatusCode initialize() override
Definition
CaloSwDeadOTX_ps.cxx:28
CaloSwDeadOTX_ps::m_etamax
Constant< float > m_etamax
Definition
CaloSwDeadOTX_ps.h:69
CaloSwDeadOTX_ps::makeTheCorrection
virtual void makeTheCorrection(const Context &myctx, 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_ps.cxx:51
CxxUtils::Array
Read-only multidimensional array.
Definition
Control/CxxUtils/CxxUtils/Array.h:135
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
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