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-2022 CERN for the benefit of the ATLAS collaboration
4*/
5
10
11#ifndef LARHVCONDALG_H
12#define LARHVCONDALG_H
13
14
16#include "StoreGate/DataHandle.h"
17#include "Identifier/Identifier.h"
21
23
30
34
35#include "LArHVScaleCorrTool.h"
36
37#include <atomic>
38#include <functional>
39
40// forward declaration
43class CaloCell_ID;
44class LArEM_ID;
45class LArHEC_ID;
46class LArFCAL_ID;
48class Identifier;
49class LArElectrodeID;
50class LArHVLineID;
51class HWIdentifier;
52class LArOnlineID;
53
55{
56
57 public:
58
59 using AthCondAlgorithm::AthCondAlgorithm;
60
61 virtual ~LArHVCondAlg() = default;
62
63 virtual StatusCode initialize() override;
64 StatusCode execute(const EventContext& ctx) const override;
65
66
67private:
68
69 // Conditions keys read:
70 SG::ReadCondHandleKey<LArHVPathology> m_pathologiesKey { this, "HVPathologies", "LArHVPathology", "Key for HV pathologies in Cond. store"};
71 SG::ReadCondHandleKeyArray<CondAttrListCollection> m_DCSFolderKeys { this, "DCSFolderNames", {"/LAR/DCS/HV/BARREl/I16", "/LAR/DCS/HV/BARREL/I8"},
72 "DCS folders with HV values"};
73 SG::ReadCondHandleKey<LArBadFebCont> m_BFKey{this, "MissingFEBKey", "LArBadFeb", "SG key for missing FEB object"};
74 SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKey{this, "OnOffMap", "LArOnOffIdMap", "SG key for mapping object"};
75 SG::ReadCondHandleKey<LArHVIdMapping> m_hvMappingKey {this, "HVMappingKey", "LArHVIdMap", "Key for mapping object" };
76 SG::ReadCondHandleKey<AthenaAttributeList> m_hvRKey{this, "RvaluesKey", "/LAR/HVPathologiesOfl/Rvalues", "Cool folder with HV R values"};
77
78 SG::ReadCondHandleKey<CaloDetDescrManager> m_caloMgrKey{this,"CaloDetDescrManager", "CaloDetDescrManager"};
79
80 // Conditions keys write:
81 SG::WriteCondHandleKey<CaloAffectedRegionInfoVec> m_affectedKey{this, "OutputKey", "LArAffectedRegionInfo", "SG key for output"};
82
83 SG::ReadCondHandleKey<ILArHVScaleCorr> m_onlineHVScaleCorrKey{this, "keyOnlineHVCorr", "LArHVScaleCorr",
84 "Input key for HVScaleCorr from conditions database (used online)"};
85
86 SG::WriteCondHandleKey<LArHVCorr> m_outputHVScaleCorrKey{this, "keyOutputCorr", "LArHVScaleCorrRecomputed","Output key for LArHVScaleCorr"};
87
88 //Other properties:
89 Gaudi::Property<bool> m_doHV{this,"doHV",true,"create HV Scale Correction"};
90 Gaudi::Property<bool> m_doRProp{this,"doR",true,"Use R values with current to improve HV"};
91 Gaudi::Property<bool> m_undoOnlineHVCorr{this,"UndoOnlineHVCorr",true,"Undo the HVCorr done online"};
92 Gaudi::Property<bool> m_useCurrentEMB{this,"UseCurrentsInHVEM",false,"Use currents in EMB as well"};
93 Gaudi::Property<bool> m_useCurrentFCAL1{this,"UseCurrentsInHVFCAL1",false,"Use currents in FCAL1 as well"};
94 Gaudi::Property<bool> m_useCurrentOthers{this,"UseCurrentsInHVOthers", false, "Use currents in other partitions as well"};
95 bool m_doR = true; //will be set depending on the above properties
96
97 Gaudi::Property<bool> m_doAffected{this,"doAffected",true,"create affected region info"};
98 Gaudi::Property<bool> m_doAffectedHV{this,"doAffectedHV",true,"include HV non nominal regions info"};
99
100 Gaudi::Property<std::vector<std::string> > m_fixHVStrings{this,"fixHVCorr"};
101
102 // other members:
103 const CaloCell_ID* m_calocellID=nullptr;
104 const LArEM_ID* m_larem_id=nullptr;
105 const LArHEC_ID* m_larhec_id=nullptr;
106 const LArFCAL_ID* m_larfcal_id=nullptr;
108 const LArHVLineID* m_hvLineID=nullptr;
109 const LArOnlineID* m_onlineID=nullptr;
110
111 std::unique_ptr<const LArHVScaleCorrTool> m_scaleTool;
112
113 //Internal representation of voltage & current per HV-Line (read for DCS)
114 struct DCS_t {
115 DCS_t(float ihv, float icurr) : hv(ihv),curr(icurr) {};
116 DCS_t() = delete;
117 float hv;
118 float curr;
119 };
120 typedef std::unordered_map<unsigned,DCS_t> voltagePerLine_t;
121
122 // Internal representation of voltage & current per cell,
123 // definded in LArHVScaleCorrTool
124 // struct HV_t {
125 // HV_t(float ihv, float iweight) : hv(ihv), weight(iweight) {};
126 // float hv; //voltage, potentially current*R corrected
127 // float weight;
128 // };
129 // typedef std::vector<HV_t> voltageCell_t;
130
133
134 typedef std::vector<voltageCell_t> voltagePerCell_t;
135
137 typedef std::vector<std::vector<unsigned short> > pathVec;
138
139 StatusCode makeHVScaleCorr (const EventContext& ctx,
140 voltagePerLine_t& voltagePerLine) const;
141 StatusCode makeAffectedRegionInfo (const EventContext& ctx,
142 voltagePerLine_t& voltagePerLine) const;
143
144 using addDepFcn_t = std::function<const EventIDRange& (SG::ReadCondHandle<CondAttrListCollection>& h)>;
145 StatusCode getVoltagePerLine (const EventContext& ctx,
146 voltagePerLine_t& voltagePerLine,
147 const addDepFcn_t& addDep) const;
148
150 void addHV(voltageCell_t& v, float hv, float weight) const;
151
153 StatusCode dcs2LineVoltage(voltagePerLine_t& result, const std::vector<const CondAttrListCollection* >& fldvec) const;
154
156 StatusCode fillPathAndCellHV(const CaloDetDescrManager* calodetdescrmgr
157 , voltagePerCell_t& hvdata
158 , const LArHVIdMapping* hvCabling
159 , const voltagePerLine_t& voltage
160 , const LArHVPathology& pathologies
161 , pathVec& hasPathologyEM
162 , pathVec& hasPathologyHEC
163 , pathVec& hasPathologyFCAL
164 , const float* rValues) const;
165
166
167 std::vector<unsigned int> getElecList(const Identifier& id, const LArHVPathology& pathologies) const;
168
169
170
171
172
173 // for the LArAffectedRegions construction
174 void extendPhiRegion(float phi, float & phi_min, float & phi_max) const;
175
176 StatusCode updateMethod(const EventContext& ctx,
177 CaloAffectedRegionInfoVec *vAffected,
178 const LArBadFebCont* bfCont, const LArOnOffIdMapping* cabling) const;
179
181 , const LArHVIdMapping* hvCabling
182 , const voltagePerLine_t& voltage) const;
183
185 , const LArHVIdMapping* hvCabling
186 , const voltagePerLine_t& voltage) const;
187
189 , const LArHVIdMapping* hvCabling
190 , const voltagePerLine_t& voltage) const;
191
193 , const LArHVIdMapping* hvCabling
194 , const voltagePerLine_t& voltage) const;
195
196
198 , const LArHVIdMapping* hvCabling
199 , const voltagePerLine_t& voltage) const;
200
201 float HV_nominal(const char *identification,const float eta) const;
202 std::vector<int> returnProblem(const float eta, const float phi, const float delta_eta, const float delta_phi);
203
204
205 mutable std::atomic<unsigned> m_nPathologies{0};
206
207};
208
209
210#endif
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
Base class for conditions algorithms.
std::vector< CaloAffectedRegionInfo > CaloAffectedRegionInfoVec
Definition of CaloDetDescrManager.
defines an "iterator" over instances of a given type in StoreGateSvc
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
StatusCode searchNonNominalHV_EMEC_INNER(CaloAffectedRegionInfoVec *vAffected, const LArHVIdMapping *hvCabling, const voltagePerLine_t &voltage) const
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
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
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
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)