ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArMonitoring
src
LArHVCorrectionMonAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// ********************************************************************
6
// NAME: LArHVCorrectionMonAlg.cxx
7
// PACKAGE: LArMonitoring
8
//
9
// AUTHOR: Pavol Strizenec, based on tool by Jessica Leveque
10
//
11
// Class for monitoring offline HV corrections based in DCS infos
12
// ********************************************************************
13
14
#include "
LArHVCorrectionMonAlg.h
"
15
16
/*---------------------------------------------------------*/
17
LArHVCorrectionMonAlg::LArHVCorrectionMonAlg
(
const
std::string& name, ISvcLocator* pSvcLocator)
18
:
AthMonitorAlgorithm
(name, pSvcLocator),
19
m_LArOnlineIDHelper
(0),
20
m_caloIdMgr
(0)
21
{ }
22
23
/*---------------------------------------------------------*/
24
StatusCode
LArHVCorrectionMonAlg::initialize
()
25
{
26
27
ATH_MSG_INFO
(
"Initialize LArHVCorrectionMonAlg"
);
28
29
ATH_CHECK
(
detStore
()->retrieve(
m_LArOnlineIDHelper
,
"LArOnlineID"
) );
30
31
// Retrieve ID helpers
32
const
CaloCell_ID
* idHelper =
nullptr
;
33
ATH_CHECK
(
detStore
()->retrieve( idHelper,
"CaloCell_ID"
) );
34
35
ATH_CHECK
(
m_cablingKey
.initialize() );
36
37
ATH_CHECK
(
m_scaleCorrKey
.initialize() );
38
ATH_CHECK
(
m_onlineScaleCorrKey
.initialize() );
39
40
ATH_CHECK
(
m_caloMgrKey
.initialize() );
41
42
ATH_MSG_DEBUG
(
"Successful Initialize LArHVCorrection "
);
43
return
AthMonitorAlgorithm::initialize
();
44
}
45
46
/*---------------------------------------------------------*/
47
StatusCode
LArHVCorrectionMonAlg::fillHistograms
(
const
EventContext& ctx)
const
48
{
49
ATH_MSG_DEBUG
(
"in fillHists()"
);
50
51
52
53
SG::ReadCondHandle<CaloDetDescrManager>
caloMgrHandle{
m_caloMgrKey
,ctx};
54
ATH_CHECK
(caloMgrHandle.
isValid
());
55
const
CaloDetDescrManager
* ddman = *caloMgrHandle;
56
57
// Retrieve event information
58
int
lumi_block = ctx.eventID().lumi_block();
59
60
// Counter for deviating channels in each partition
61
float
nonNominal[] = {0.,0.,0.,0.,0.,0.,0.,0.};
62
63
SG::ReadCondHandle<ILArHVScaleCorr>
scaleCorr (
m_scaleCorrKey
, ctx);
64
SG::ReadCondHandle<ILArHVScaleCorr>
onlineScaleCorr (
m_onlineScaleCorrKey
, ctx);
65
SG::ReadCondHandle<LArOnOffIdMapping>
larCabling (
m_cablingKey
, ctx);
66
67
std::vector<HWIdentifier>::const_iterator idptr =
m_LArOnlineIDHelper
->channel_begin();
68
std::vector<HWIdentifier>::const_iterator idEndptr =
m_LArOnlineIDHelper
->channel_end();
69
for
(;idptr != idEndptr; ++idptr) {
70
HWIdentifier
id
= *idptr;
71
Identifier
offlineID = larCabling->cnvToIdentifier(
id
);
72
73
// Skip disconnected channels
74
if
(!larCabling->isOnlineConnected(
id
))
continue
;
75
76
// Get Physical Coordinates
77
float
etaChan = 0;
float
phiChan = 0.;
78
const
CaloDetDescrElement
* caloDetElement = ddman->
get_element
(offlineID);
79
if
(caloDetElement == 0 ){
80
ATH_MSG_ERROR
(
"Cannot retrieve (eta,phi) coordinates for raw channels"
);
81
continue
;
82
}
else
{
83
etaChan = caloDetElement->
eta_raw
();
84
phiChan = caloDetElement->
phi_raw
();
85
}
86
87
// Fix phi range in HEC
88
if
(
m_LArOnlineIDHelper
->isHECchannel(
id
)) phiChan =
CaloPhiRange::fix
(phiChan);
89
90
// Retrieve HV correction info
91
float
hvdev = 0;
92
float
hvonline = onlineScaleCorr->HVScaleCorr(
id
);
93
if
(hvonline<=0)
continue
;
//No valid online correction
94
// Correction in scaleCorr has already been divided by hvonline.
95
float
hvcorr = scaleCorr->HVScaleCorr(
id
) * hvonline;
96
if
(hvcorr>hvonline) hvdev = hvonline-hvcorr;
//Monitor only channels that get a higher correction from DCS (eg are at a lower voltage).
97
98
if
(fabs(hvdev/hvonline)>
m_threshold
){
99
// A-Side
100
if
(etaChan >= 0){
101
if
(
m_LArOnlineIDHelper
->isEMBchannel(
id
)){
102
nonNominal[0]++;
103
ATH_MSG_VERBOSE
(
"hvdev EMBA"
<< hvdev );
104
auto
meta
=
Monitored::Scalar<float>
(
"etaEMBA"
,etaChan);
105
auto
mphi =
Monitored::Scalar<float>
(
"phiEMBA"
,phiChan);
106
auto
hvmon =
Monitored::Scalar<float>
(
"hvcorrEMBA"
,hvdev);
107
fill
(
m_MonGroupName
,
meta
,mphi,hvmon);
108
}
109
if
(
m_LArOnlineIDHelper
->isEMECchannel(
id
)){
110
nonNominal[1]++;
111
ATH_MSG_VERBOSE
(
"hvdev EMECA"
<< hvdev );
112
auto
meta
=
Monitored::Scalar<float>
(
"etaEMECA"
,etaChan);
113
auto
mphi =
Monitored::Scalar<float>
(
"phiEMECA"
,phiChan);
114
auto
hvmon =
Monitored::Scalar<float>
(
"hvcorrEMECA"
,hvdev);
115
fill
(
m_MonGroupName
,
meta
,mphi,hvmon);
116
}
117
if
(
m_LArOnlineIDHelper
->isHECchannel(
id
)){
118
nonNominal[2]++;
119
ATH_MSG_VERBOSE
(
"hvdev HECA"
<< hvdev );
120
auto
meta
=
Monitored::Scalar<float>
(
"etaHECA"
,etaChan);
121
auto
mphi =
Monitored::Scalar<float>
(
"phiHECA"
,phiChan);
122
auto
hvmon =
Monitored::Scalar<float>
(
"hvcorrHECA"
,hvdev);
123
fill
(
m_MonGroupName
,
meta
,mphi,hvmon);
124
}
125
if
(
m_LArOnlineIDHelper
->isFCALchannel(
id
)){
126
nonNominal[3]++;
127
ATH_MSG_VERBOSE
(
"hvdev FCALA"
<< hvdev );
128
auto
meta
=
Monitored::Scalar<float>
(
"etaFCALA"
,etaChan);
129
auto
mphi =
Monitored::Scalar<float>
(
"phiFCALA"
,phiChan);
130
auto
hvmon =
Monitored::Scalar<float>
(
"hvcorrFCALA"
,hvdev);
131
fill
(
m_MonGroupName
,
meta
,mphi,hvmon);
132
}
133
134
// C-side
135
}
else
{
136
if
(
m_LArOnlineIDHelper
->isEMBchannel(
id
)){
137
nonNominal[4]++;
138
ATH_MSG_VERBOSE
(
"hvdev EMBC"
<< hvdev );
139
auto
meta
=
Monitored::Scalar<float>
(
"etaEMBC"
,etaChan);
140
auto
mphi =
Monitored::Scalar<float>
(
"phiEMBC"
,phiChan);
141
auto
hvmon =
Monitored::Scalar<float>
(
"hvcorrEMBC"
,hvdev);
142
fill
(
m_MonGroupName
,
meta
,mphi,hvmon);
143
}
144
if
(
m_LArOnlineIDHelper
->isEMECchannel(
id
)){
145
nonNominal[5]++;
146
ATH_MSG_VERBOSE
(
"hvdev EMECC"
<< hvdev );
147
auto
meta
=
Monitored::Scalar<float>
(
"etaEMECC"
,etaChan);
148
auto
mphi =
Monitored::Scalar<float>
(
"phiEMECC"
,phiChan);
149
auto
hvmon =
Monitored::Scalar<float>
(
"hvcorrEMECC"
,hvdev);
150
fill
(
m_MonGroupName
,
meta
,mphi,hvmon);
151
}
152
if
(
m_LArOnlineIDHelper
->isHECchannel(
id
)){
153
nonNominal[6]++;
154
ATH_MSG_VERBOSE
(
"hvdev HECC"
<< hvdev );
155
auto
meta
=
Monitored::Scalar<float>
(
"etaHECC"
,etaChan);
156
auto
mphi =
Monitored::Scalar<float>
(
"phiHECC"
,phiChan);
157
auto
hvmon =
Monitored::Scalar<float>
(
"hvcorrHECC"
,hvdev);
158
fill
(
m_MonGroupName
,
meta
,mphi,hvmon);
159
}
160
if
(
m_LArOnlineIDHelper
->isFCALchannel(
id
)){
161
nonNominal[7]++;
162
ATH_MSG_VERBOSE
(
"hvdev FCALC"
<< hvdev );
163
auto
meta
=
Monitored::Scalar<float>
(
"etaFCALC"
,etaChan);
164
auto
mphi =
Monitored::Scalar<float>
(
"phiFCALC"
,phiChan);
165
auto
hvmon =
Monitored::Scalar<float>
(
"hvcorrFCALC"
,hvdev);
166
fill
(
m_MonGroupName
,
meta
,mphi,hvmon);
167
}
168
}
169
}
170
}
// end Channels Loop
171
172
// Fill number of problematic cell per LUMI_BLOCK
173
auto
monLB =
Monitored::Scalar<int>
(
"LB"
,lumi_block);
174
auto
nnEMBA =
Monitored::Scalar<int>
(
"nonnominalEMBA"
,nonNominal[0]);
175
auto
nnEMECA =
Monitored::Scalar<int>
(
"nonnominalEMECA"
,nonNominal[1]);
176
auto
nnHECA =
Monitored::Scalar<int>
(
"nonnominalHECA"
,nonNominal[2]);
177
auto
nnFCALA =
Monitored::Scalar<int>
(
"nonnominalFCALA"
,nonNominal[3]);
178
auto
nnEMBC =
Monitored::Scalar<int>
(
"nonnominalEMBC"
,nonNominal[4]);
179
auto
nnEMECC =
Monitored::Scalar<int>
(
"nonnominalEMECC"
,nonNominal[5]);
180
auto
nnHECC =
Monitored::Scalar<int>
(
"nonnominalHECC"
,nonNominal[6]);
181
auto
nnFCALC =
Monitored::Scalar<int>
(
"nonnominalFCALC"
,nonNominal[7]);
182
fill
(
m_MonGroupName
,monLB,nnEMBA,nnEMBC,nnEMECA,nnEMECC,nnHECA,nnFCALA,nnHECC,nnFCALC);
183
184
185
return
StatusCode::SUCCESS;
186
}
187
188
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
LArHVCorrectionMonAlg.h
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
AthMonitorAlgorithm::initialize
virtual StatusCode initialize() override
initialize
Definition
AthMonitorAlgorithm.cxx:22
AthMonitorAlgorithm::AthMonitorAlgorithm
AthMonitorAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthMonitorAlgorithm.cxx:8
CaloCell_ID
Helper class for offline cell identifiers.
Definition
CaloCell_ID.h:34
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell.
Definition
Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
CaloDetDescrElement::eta_raw
float eta_raw() const
cell eta_raw
Definition
Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:350
CaloDetDescrElement::phi_raw
float phi_raw() const
cell phi_raw
Definition
Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:352
CaloDetDescrManager_Base::get_element
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
Definition
CaloDetDescrManager.cxx:159
CaloDetDescrManager
This class provides the client interface for accessing the detector description information common to...
Definition
CaloDetDescrManager.h:469
CaloPhiRange::fix
static double fix(double phi)
Definition
CaloPhiRange.cxx:14
HWIdentifier
Definition
HWIdentifier.h:13
LArHVCorrectionMonAlg::m_caloMgrKey
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
Definition
LArHVCorrectionMonAlg.h:64
LArHVCorrectionMonAlg::initialize
virtual StatusCode initialize() override final
Overwrite dummy method from AlgTool.
Definition
LArHVCorrectionMonAlg.cxx:24
LArHVCorrectionMonAlg::m_LArOnlineIDHelper
const LArOnlineID * m_LArOnlineIDHelper
Definition
LArHVCorrectionMonAlg.h:70
LArHVCorrectionMonAlg::LArHVCorrectionMonAlg
LArHVCorrectionMonAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
LArHVCorrectionMonAlg.cxx:17
LArHVCorrectionMonAlg::m_MonGroupName
Gaudi::Property< std::string > m_MonGroupName
Definition
LArHVCorrectionMonAlg.h:55
LArHVCorrectionMonAlg::m_cablingKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
Definition
LArHVCorrectionMonAlg.h:61
LArHVCorrectionMonAlg::m_caloIdMgr
const CaloIdManager * m_caloIdMgr
Definition
LArHVCorrectionMonAlg.h:71
LArHVCorrectionMonAlg::m_onlineScaleCorrKey
SG::ReadCondHandleKey< ILArHVScaleCorr > m_onlineScaleCorrKey
Definition
LArHVCorrectionMonAlg.h:63
LArHVCorrectionMonAlg::fillHistograms
virtual StatusCode fillHistograms(const EventContext &ctx) const override final
Called each event.
Definition
LArHVCorrectionMonAlg.cxx:47
LArHVCorrectionMonAlg::m_threshold
Gaudi::Property< float > m_threshold
Definition
LArHVCorrectionMonAlg.h:56
LArHVCorrectionMonAlg::m_scaleCorrKey
SG::ReadCondHandleKey< ILArHVScaleCorr > m_scaleCorrKey
Definition
LArHVCorrectionMonAlg.h:62
Monitored::Scalar
Declare a monitored scalar variable.
Definition
MonitoredScalar.h:34
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
SG::ReadCondHandle::isValid
bool isValid()
Definition
ReadCondHandle.h:205
AthMonitorAlgorithm::fill
void fill(const ToolHandle< GenericMonitoringTool > &groupHandle, std::vector< std::reference_wrapper< Monitored::IMonitoredVariable > > &&variables) const
Fills a vector of variables to a group by reference.
Definition
AthMonitorAlgorithm.cxx:99
Identifier
Definition
IdentifierFieldParser.cxx:14
meta
-diff
Generated on
for ATLAS Offline Software by
1.17.0