ATLAS Offline Software
Loading...
Searching...
No Matches
LArHVCondAlg.h
Go to the documentation of this file.
1//Dear emacs, this is -*-c++-*-
2/*
3 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
4*/
5
10
11#ifndef LARHVCONDALG_H
12#define LARHVCONDALG_H
13
14
16#include "Identifier/Identifier.h"
20
22
29
33
34#include "LArHVScaleCorrTool.h"
35
36#include <atomic>
37#include <functional>
38
39// forward declaration
42class CaloCell_ID;
43class LArEM_ID;
44class LArHEC_ID;
45class LArFCAL_ID;
47class Identifier;
48class LArElectrodeID;
49class LArHVLineID;
50class HWIdentifier;
51class LArOnlineID;
52
54{
55
56 public:
57
58 using AthCondAlgorithm::AthCondAlgorithm;
59
60 virtual ~LArHVCondAlg() = default;
61
62 virtual StatusCode initialize() override;
63 StatusCode execute(const EventContext& ctx) const override;
64
65
66private:
67
68 // Conditions keys read:
69 SG::ReadCondHandleKey<LArHVPathology> m_pathologiesKey { this, "HVPathologies", "LArHVPathology", "Key for HV pathologies in Cond. store"};
70 SG::ReadCondHandleKeyArray<CondAttrListCollection> m_DCSFolderKeys { this, "DCSFolderNames", {"/LAR/DCS/HV/BARREl/I16", "/LAR/DCS/HV/BARREL/I8"},
71 "DCS folders with HV values"};
72 SG::ReadCondHandleKey<LArBadFebCont> m_BFKey{this, "MissingFEBKey", "LArBadFeb", "SG key for missing FEB object"};
73 SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKey{this, "OnOffMap", "LArOnOffIdMap", "SG key for mapping object"};
74 SG::ReadCondHandleKey<LArHVIdMapping> m_hvMappingKey {this, "HVMappingKey", "LArHVIdMap", "Key for mapping object" };
75 SG::ReadCondHandleKey<AthenaAttributeList> m_hvRKey{this, "RvaluesKey", "/LAR/HVPathologiesOfl/Rvalues", "Cool folder with HV R values"};
76
77 SG::ReadCondHandleKey<CaloDetDescrManager> m_caloMgrKey{this,"CaloDetDescrManager", "CaloDetDescrManager"};
78
79 // Conditions keys write:
80 SG::WriteCondHandleKey<CaloAffectedRegionInfoVec> m_affectedKey{this, "OutputKey", "LArAffectedRegionInfo", "SG key for output"};
81
82 SG::ReadCondHandleKey<ILArHVScaleCorr> m_onlineHVScaleCorrKey{this, "keyOnlineHVCorr", "LArHVScaleCorr",
83 "Input key for HVScaleCorr from conditions database (used online)"};
84
85 SG::WriteCondHandleKey<LArHVCorr> m_outputHVScaleCorrKey{this, "keyOutputCorr", "LArHVScaleCorrRecomputed","Output key for LArHVScaleCorr"};
86
87 //Other properties:
88 Gaudi::Property<bool> m_doHV{this,"doHV",true,"create HV Scale Correction"};
89 Gaudi::Property<bool> m_doRProp{this,"doR",true,"Use R values with current to improve HV"};
90 Gaudi::Property<bool> m_undoOnlineHVCorr{this,"UndoOnlineHVCorr",true,"Undo the HVCorr done online"};
91 Gaudi::Property<bool> m_useCurrentEMB{this,"UseCurrentsInHVEM",false,"Use currents in EMB as well"};
92 Gaudi::Property<bool> m_useCurrentFCAL1{this,"UseCurrentsInHVFCAL1",false,"Use currents in FCAL1 as well"};
93 Gaudi::Property<bool> m_useCurrentOthers{this,"UseCurrentsInHVOthers", false, "Use currents in other partitions as well"};
94 bool m_doR = true; //will be set depending on the above properties
95
96 Gaudi::Property<bool> m_doAffected{this,"doAffected",true,"create affected region info"};
97 Gaudi::Property<bool> m_doAffectedHV{this,"doAffectedHV",true,"include HV non nominal regions info"};
98
99 Gaudi::Property<std::vector<std::string> > m_fixHVCorrStrings{this,"fixHVCorr"};
100 Gaudi::Property<std::vector<std::string>> m_fixHVStrings{this,"fixHV"};
101 Gaudi::Property<std::vector<std::string>> m_fixCurrentStrings{this,"fixCurrent"};
102
103 // other members:
104 const CaloCell_ID* m_calocellID=nullptr;
105 std::unordered_map<unsigned, float> m_fixCurrentPerLine{};
106 std::unordered_map<unsigned, float> m_fixVoltagePerLine{};
107 const LArEM_ID* m_larem_id=nullptr;
108 const LArHEC_ID* m_larhec_id=nullptr;
109 const LArFCAL_ID* m_larfcal_id=nullptr;
111 const LArHVLineID* m_hvLineID=nullptr;
112 const LArOnlineID* m_onlineID=nullptr;
113
114 std::unique_ptr<const LArHVScaleCorrTool> m_scaleTool;
115
116 //Internal representation of voltage & current per HV-Line (read for DCS)
117 struct DCS_t {
118 DCS_t(float ihv, float icurr) : hv(ihv),curr(icurr) {};
119 DCS_t() = delete;
120 float hv;
121 float curr;
122 };
123 typedef std::unordered_map<unsigned,DCS_t> voltagePerLine_t;
124
125 // Internal representation of voltage & current per cell,
126 // definded in LArHVScaleCorrTool
127 // struct HV_t {
128 // HV_t(float ihv, float iweight) : hv(ihv), weight(iweight) {};
129 // float hv; //voltage, potentially current*R corrected
130 // float weight;
131 // };
132 // typedef std::vector<HV_t> voltageCell_t;
133
136
137 typedef std::vector<voltageCell_t> voltagePerCell_t;
138
140 typedef std::vector<std::vector<unsigned short> > pathVec;
141
142 StatusCode fixVoltageAndCurrent();
143
144 StatusCode makeHVScaleCorr (const EventContext& ctx,
145 voltagePerLine_t& voltagePerLine) const;
146 StatusCode makeAffectedRegionInfo (const EventContext& ctx,
147 voltagePerLine_t& voltagePerLine) const;
148
149 using addDepFcn_t = std::function<const EventIDRange& (SG::ReadCondHandle<CondAttrListCollection>& h)>;
150 StatusCode getVoltagePerLine (const EventContext& ctx,
151 voltagePerLine_t& voltagePerLine,
152 const addDepFcn_t& addDep) const;
153
155 void addHV(voltageCell_t& v, float hv, float weight) const;
156
158 StatusCode dcs2LineVoltage(voltagePerLine_t& result, const std::vector<const CondAttrListCollection* >& fldvec) const;
159
161 StatusCode fillPathAndCellHV(const CaloDetDescrManager* calodetdescrmgr
162 , voltagePerCell_t& hvdata
163 , const LArHVIdMapping* hvCabling
164 , const voltagePerLine_t& voltage
165 , const LArHVPathology& pathologies
166 , pathVec& hasPathologyEM
167 , pathVec& hasPathologyHEC
168 , pathVec& hasPathologyFCAL
169 , const float* rValues) const;
170
171
172 std::vector<unsigned int> getElecList(const Identifier& id, const LArHVPathology& pathologies) const;
173
174
175
176
177
178 // for the LArAffectedRegions construction
179 void extendPhiRegion(float phi, float & phi_min, float & phi_max) const;
180
181 StatusCode updateMethod(const EventContext& ctx,
182 CaloAffectedRegionInfoVec *vAffected,
183 const LArBadFebCont* bfCont, const LArOnOffIdMapping* cabling) const;
184
186 , const LArHVIdMapping* hvCabling
187 , const voltagePerLine_t& voltage) const;
188
190 , const LArHVIdMapping* hvCabling
191 , const voltagePerLine_t& voltage) const;
192
194 , const LArHVIdMapping* hvCabling
195 , const voltagePerLine_t& voltage) const;
196
198 , const LArHVIdMapping* hvCabling
199 , const voltagePerLine_t& voltage) const;
200
201
203 , const LArHVIdMapping* hvCabling
204 , const voltagePerLine_t& voltage) const;
205
206 float HV_nominal(const char *identification,const float eta) const;
207 std::vector<int> returnProblem(const float eta, const float phi, const float delta_eta, const float delta_phi);
208
209
210 mutable std::atomic<unsigned> m_nPathologies{0};
211
212};
213
214
215#endif
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
Base class for conditions algorithms.
std::vector< CaloAffectedRegionInfo > CaloAffectedRegionInfoVec
Definition of CaloDetDescrManager.
LArBadXCont< LArBadFeb > LArBadFebCont
Base class for conditions algorithms.
Header file for AthHistogramAlgorithm.
An AttributeList represents a logical row of attributes in a metadata table.
Helper class for offline cell identifiers.
Definition CaloCell_ID.h:34
This class provides the client interface for accessing the detector description information common to...
This class is a collection of AttributeLists where each one is associated with a channel number.
Helper class for LArEM offline identifiers.
Definition LArEM_ID.h:111
Helper for the Liquid Argon Calorimeter cell at the electrode level.
Helper class for LArFCAL offline identifiers.
Definition LArFCAL_ID.h:49
Helper class for LArHEC offline identifiers.
Definition LArHEC_ID.h:76
void extendPhiRegion(float phi, float &phi_min, float &phi_max) const
Gaudi::Property< bool > m_doHV
virtual ~LArHVCondAlg()=default
StatusCode execute(const EventContext &ctx) const override
const LArHVLineID * m_hvLineID
SG::ReadCondHandleKey< ILArHVScaleCorr > m_onlineHVScaleCorrKey
const CaloCell_ID * m_calocellID
SG::ReadCondHandleKey< AthenaAttributeList > m_hvRKey
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
void addHV(voltageCell_t &v, float hv, float weight) const
Add voltage/weight for a sub-gap of a cell.
Gaudi::Property< bool > m_useCurrentFCAL1
Gaudi::Property< bool > m_useCurrentEMB
SG::ReadCondHandleKey< LArHVPathology > m_pathologiesKey
Gaudi::Property< bool > m_undoOnlineHVCorr
Gaudi::Property< std::vector< std::string > > m_fixHVCorrStrings
StatusCode searchNonNominalHV_EMEC_INNER(CaloAffectedRegionInfoVec *vAffected, const LArHVIdMapping *hvCabling, const voltagePerLine_t &voltage) const
StatusCode fixVoltageAndCurrent()
StatusCode searchNonNominalHV_HEC(CaloAffectedRegionInfoVec *vAffected, const LArHVIdMapping *hvCabling, const voltagePerLine_t &voltage) const
StatusCode searchNonNominalHV_FCAL(CaloAffectedRegionInfoVec *vAffected, const LArHVIdMapping *hvCabling, const voltagePerLine_t &voltage) const
SG::ReadCondHandleKeyArray< CondAttrListCollection > m_DCSFolderKeys
std::vector< int > returnProblem(const float eta, const float phi, const float delta_eta, const float delta_phi)
std::unordered_map< unsigned, DCS_t > voltagePerLine_t
SG::WriteCondHandleKey< LArHVCorr > m_outputHVScaleCorrKey
std::function< const EventIDRange &(SG::ReadCondHandle< CondAttrListCollection > &h)> addDepFcn_t
std::unordered_map< unsigned, float > m_fixCurrentPerLine
SG::WriteCondHandleKey< CaloAffectedRegionInfoVec > m_affectedKey
std::vector< unsigned int > getElecList(const Identifier &id, const LArHVPathology &pathologies) const
StatusCode updateMethod(const EventContext &ctx, CaloAffectedRegionInfoVec *vAffected, const LArBadFebCont *bfCont, const LArOnOffIdMapping *cabling) const
std::unique_ptr< const LArHVScaleCorrTool > m_scaleTool
StatusCode searchNonNominalHV_EMB(CaloAffectedRegionInfoVec *vAffected, const LArHVIdMapping *hvCabling, const voltagePerLine_t &voltage) const
StatusCode makeAffectedRegionInfo(const EventContext &ctx, voltagePerLine_t &voltagePerLine) const
LArHVScaleCorrTool::voltageCell_t voltageCell_t
const LArElectrodeID * m_electrodeID
StatusCode getVoltagePerLine(const EventContext &ctx, voltagePerLine_t &voltagePerLine, const addDepFcn_t &addDep) const
std::vector< voltageCell_t > voltagePerCell_t
const LArHEC_ID * m_larhec_id
SG::ReadCondHandleKey< LArBadFebCont > m_BFKey
std::unordered_map< unsigned, float > m_fixVoltagePerLine
Gaudi::Property< std::vector< std::string > > m_fixHVStrings
std::atomic< unsigned > m_nPathologies
StatusCode makeHVScaleCorr(const EventContext &ctx, voltagePerLine_t &voltagePerLine) const
virtual StatusCode initialize() override
const LArOnlineID * m_onlineID
Gaudi::Property< bool > m_doRProp
LArHVScaleCorrTool::HV_t HV_t
StatusCode fillPathAndCellHV(const CaloDetDescrManager *calodetdescrmgr, voltagePerCell_t &hvdata, const LArHVIdMapping *hvCabling, const voltagePerLine_t &voltage, const LArHVPathology &pathologies, pathVec &hasPathologyEM, pathVec &hasPathologyHEC, pathVec &hasPathologyFCAL, const float *rValues) const
Read the voltage per HV line and store it in structure per readout-cell (resolve the many-HV-lines-to...
Gaudi::Property< bool > m_doAffected
StatusCode searchNonNominalHV_EMEC_OUTER(CaloAffectedRegionInfoVec *vAffected, const LArHVIdMapping *hvCabling, const voltagePerLine_t &voltage) const
const LArEM_ID * m_larem_id
Gaudi::Property< bool > m_doAffectedHV
Gaudi::Property< std::vector< std::string > > m_fixCurrentStrings
StatusCode dcs2LineVoltage(voltagePerLine_t &result, const std::vector< const CondAttrListCollection * > &fldvec) const
Read HV from DCS, store them in internal data structure per HV-line (Step 1).
const LArFCAL_ID * m_larfcal_id
SG::ReadCondHandleKey< LArHVIdMapping > m_hvMappingKey
Gaudi::Property< bool > m_useCurrentOthers
std::vector< std::vector< unsigned short > > pathVec
Internal structure for HV pathologies.
float HV_nominal(const char *identification, const float eta) const
Helper for the Liquid Argon Calorimeter High-Voltage identifiers.
Definition LArHVLineID.h:43
std::vector< HV_t > voltageCell_t
HandleKeyArray< ReadCondHandle< T >, CondHandleDefault::Key< ReadCondHandleKey< T > >, Gaudi::DataHandle::Reader > ReadCondHandleKeyArray
DCS_t(float ihv, float icurr)