ATLAS Offline Software
Loading...
Searching...
No Matches
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
15
16/*---------------------------------------------------------*/
17LArHVCorrectionMonAlg::LArHVCorrectionMonAlg(const std::string& name, ISvcLocator* pSvcLocator)
18 : AthMonitorAlgorithm(name, pSvcLocator),
21{ }
22
23/*---------------------------------------------------------*/
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 " );
44}
45
46/*---------------------------------------------------------*/
47StatusCode LArHVCorrectionMonAlg::fillHistograms(const EventContext& ctx) const
48{
49 ATH_MSG_DEBUG( "in fillHists()" );
50
51
52
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
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
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
const ServiceHandle< StoreGateSvc > & detStore() const
virtual StatusCode initialize() override
initialize
AthMonitorAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Helper class for offline cell identifiers.
Definition CaloCell_ID.h:34
This class groups all DetDescr information related to a CaloCell.
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
This class provides the client interface for accessing the detector description information common to...
static double fix(double phi)
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
virtual StatusCode initialize() override final
Overwrite dummy method from AlgTool.
const LArOnlineID * m_LArOnlineIDHelper
LArHVCorrectionMonAlg(const std::string &name, ISvcLocator *pSvcLocator)
Gaudi::Property< std::string > m_MonGroupName
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
const CaloIdManager * m_caloIdMgr
SG::ReadCondHandleKey< ILArHVScaleCorr > m_onlineScaleCorrKey
virtual StatusCode fillHistograms(const EventContext &ctx) const override final
Called each event.
Gaudi::Property< float > m_threshold
SG::ReadCondHandleKey< ILArHVScaleCorr > m_scaleCorrKey
Declare a monitored scalar variable.
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.
-diff