ATLAS Offline Software
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 
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
43 class CaloCell_ID;
44 class LArEM_ID;
45 class LArHEC_ID;
46 class LArFCAL_ID;
48 class Identifier;
49 class LArElectrodeID;
50 class LArHVLineID;
51 class HWIdentifier;
52 class LArOnlineID;
53 
55 {
56 
57  public:
58 
60 
61  virtual ~LArHVCondAlg() = default;
62 
63  virtual StatusCode initialize() override;
64  StatusCode execute() override;
65 
66 
67 private:
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
CaloAffectedRegionInfoVec.h
LArHVCondAlg::m_doRProp
Gaudi::Property< bool > m_doRProp
Definition: LArHVCondAlg.h:90
CaloAffectedRegionInfoVec
std::vector< CaloAffectedRegionInfo > CaloAffectedRegionInfoVec
Definition: CaloAffectedRegionInfoVec.h:11
LArHVCondAlg::m_hvLineID
const LArHVLineID * m_hvLineID
Definition: LArHVCondAlg.h:108
LArHVCondAlg::dcs2LineVoltage
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)
Definition: LArHVCondAlg.cxx:754
LArHVCondAlg
Definition: LArHVCondAlg.h:55
LArHVCondAlg::m_hvRKey
SG::ReadCondHandleKey< AthenaAttributeList > m_hvRKey
Definition: LArHVCondAlg.h:76
LArHVCondAlg::DCS_t::DCS_t
DCS_t(float ihv, float icurr)
Definition: LArHVCondAlg.h:115
LArHVCondAlg::DCS_t::hv
float hv
Definition: LArHVCondAlg.h:117
LArHVCondAlg::m_pathologiesKey
SG::ReadCondHandleKey< LArHVPathology > m_pathologiesKey
Definition: LArHVCondAlg.h:70
LArHVCondAlg::m_onlineHVScaleCorrKey
SG::ReadCondHandleKey< ILArHVScaleCorr > m_onlineHVScaleCorrKey
Definition: LArHVCondAlg.h:83
LArHVCondAlg::voltagePerLine_t
std::unordered_map< unsigned, DCS_t > voltagePerLine_t
Definition: LArHVCondAlg.h:120
LArHVPathology.h
get_generator_info.result
result
Definition: get_generator_info.py:21
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
LArHVCondAlg::execute
StatusCode execute() override
Definition: LArHVCondAlg.cxx:89
LArHVCondAlg::searchNonNominalHV_EMEC_INNER
StatusCode searchNonNominalHV_EMEC_INNER(CaloAffectedRegionInfoVec *vAffected, const LArHVIdMapping *hvCabling, const voltagePerLine_t &voltage) const
Definition: LArHVCondAlg.cxx:1108
LArHVCondAlg::searchNonNominalHV_HEC
StatusCode searchNonNominalHV_HEC(CaloAffectedRegionInfoVec *vAffected, const LArHVIdMapping *hvCabling, const voltagePerLine_t &voltage) const
Definition: LArHVCondAlg.cxx:1230
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
LArElectrodeID
Helper for the Liquid Argon Calorimeter cell at the electrode level.
Definition: LArElectrodeID.h:101
LArBadXCont
Conditions-Data class holding LAr Bad Channel or Bad Feb information.
Definition: LArBadChannelCont.h:28
LArHVCondAlg::m_doAffected
Gaudi::Property< bool > m_doAffected
Definition: LArHVCondAlg.h:97
LArHVCondAlg::m_useCurrentEMB
Gaudi::Property< bool > m_useCurrentEMB
Definition: LArHVCondAlg.h:92
ReadCellNoiseFromCool.cabling
cabling
Definition: ReadCellNoiseFromCool.py:154
LArHVCondAlg::returnProblem
std::vector< int > returnProblem(const float eta, const float phi, const float delta_eta, const float delta_phi)
LArHVCondAlg::DCS_t::DCS_t
DCS_t()=delete
WriteCondHandleKey.h
LArHVCondAlg::makeHVScaleCorr
StatusCode makeHVScaleCorr(const EventContext &ctx, voltagePerLine_t &voltagePerLine) const
Definition: LArHVCondAlg.cxx:105
LArHEC_ID
Helper class for LArHEC offline identifiers.
Definition: LArHEC_ID.h:85
SG::HandleKeyArray
Definition: StoreGate/StoreGate/HandleKeyArray.h:38
LArHVCondAlg::extendPhiRegion
void extendPhiRegion(float phi, float &phi_min, float &phi_max) const
Definition: LArHVCondAlg.cxx:1516
LArHVCondAlg::pathVec
std::vector< std::vector< unsigned short > > pathVec
Internal structure for HV pathologies.
Definition: LArHVCondAlg.h:137
LArHVCorr.h
HWIdentifier
Definition: HWIdentifier.h:13
CondAttrListCollection
This class is a collection of AttributeLists where each one is associated with a channel number....
Definition: CondAttrListCollection.h:52
DataHandle.h
CaloDetDescrManager.h
Definition of CaloDetDescrManager.
LArHVCondAlg::m_useCurrentFCAL1
Gaudi::Property< bool > m_useCurrentFCAL1
Definition: LArHVCondAlg.h:93
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:189
LArHVCondAlg::makeAffectedRegionInfo
StatusCode makeAffectedRegionInfo(const EventContext &ctx, voltagePerLine_t &voltagePerLine) const
Definition: LArHVCondAlg.cxx:283
LArHVCondAlg::getElecList
std::vector< unsigned int > getElecList(const Identifier &id, const LArHVPathology &pathologies) const
Definition: LArHVCondAlg.cxx:738
AthAlgorithm.h
LArBadChannelCont.h
LArHVCondAlg::DCS_t
Definition: LArHVCondAlg.h:114
LArHVScaleCorrTool::voltageCell_t
std::vector< HV_t > voltageCell_t
Definition: LArHVScaleCorrTool.h:30
LArHVCondAlg::m_DCSFolderKeys
SG::ReadCondHandleKeyArray< CondAttrListCollection > m_DCSFolderKeys
Definition: LArHVCondAlg.h:71
LArOnOffIdMapping.h
LArHVCondAlg::HV_nominal
float HV_nominal(const char *identification, const float eta) const
Definition: LArHVCondAlg.cxx:1473
LArHVCondAlg::initialize
virtual StatusCode initialize() override
Definition: LArHVCondAlg.cxx:46
LArHVData.h
LArHVCondAlg::voltagePerCell_t
std::vector< voltageCell_t > voltagePerCell_t
Definition: LArHVCondAlg.h:134
LArHVCondAlg::m_electrodeID
const LArElectrodeID * m_electrodeID
Definition: LArHVCondAlg.h:107
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
extractSporadic.h
list h
Definition: extractSporadic.py:97
LArHVIdMapping.h
LArHVCondAlg::searchNonNominalHV_EMB
StatusCode searchNonNominalHV_EMB(CaloAffectedRegionInfoVec *vAffected, const LArHVIdMapping *hvCabling, const voltagePerLine_t &voltage) const
Definition: LArHVCondAlg.cxx:784
LArHVCondAlg::~LArHVCondAlg
virtual ~LArHVCondAlg()=default
AthAlgTool.h
LArHVCondAlg::m_fixHVStrings
Gaudi::Property< std::vector< std::string > > m_fixHVStrings
Definition: LArHVCondAlg.h:100
LArHVCondAlg::m_calocellID
const CaloCell_ID * m_calocellID
Definition: LArHVCondAlg.h:103
LArHVCondAlg::m_BFKey
SG::ReadCondHandleKey< LArBadFebCont > m_BFKey
Definition: LArHVCondAlg.h:73
AthenaAttributeList
An AttributeList represents a logical row of attributes in a metadata table. The name and type of eac...
Definition: PersistentDataModel/PersistentDataModel/AthenaAttributeList.h:45
CaloCell_ID
Helper class for offline cell identifiers.
Definition: CaloCell_ID.h:34
LArHVCondAlg::m_doHV
Gaudi::Property< bool > m_doHV
Definition: LArHVCondAlg.h:89
LArHVCondAlg::m_larem_id
const LArEM_ID * m_larem_id
Definition: LArHVCondAlg.h:104
LArHVCondAlg::m_larfcal_id
const LArFCAL_ID * m_larfcal_id
Definition: LArHVCondAlg.h:106
LArHVCondAlg::m_doR
bool m_doR
Definition: LArHVCondAlg.h:95
LArHVCondAlg::fillPathAndCellHV
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...
Definition: LArHVCondAlg.cxx:360
CondHandleKeyArray.h
LArHVCondAlg::m_larhec_id
const LArHEC_ID * m_larhec_id
Definition: LArHVCondAlg.h:105
AthAlgorithm
Definition: AthAlgorithm.h:47
ReadCondHandleKey.h
LArHVCondAlg::addDepFcn_t
std::function< const EventIDRange &(SG::ReadCondHandle< CondAttrListCollection > &h)> addDepFcn_t
Definition: LArHVCondAlg.h:144
LArHVCondAlg::updateMethod
StatusCode updateMethod(const EventContext &ctx, CaloAffectedRegionInfoVec *vAffected, const LArBadFebCont *bfCont, const LArOnOffIdMapping *cabling) const
Definition: LArHVCondAlg.cxx:1383
LArHVCondAlg::searchNonNominalHV_FCAL
StatusCode searchNonNominalHV_FCAL(CaloAffectedRegionInfoVec *vAffected, const LArHVIdMapping *hvCabling, const voltagePerLine_t &voltage) const
Definition: LArHVCondAlg.cxx:1308
LArOnlineID
Definition: LArOnlineID.h:20
LArHVCondAlg::m_nPathologies
std::atomic< unsigned > m_nPathologies
Definition: LArHVCondAlg.h:205
LArHVScaleCorrComplete.h
LArHVCondAlg::m_undoOnlineHVCorr
Gaudi::Property< bool > m_undoOnlineHVCorr
Definition: LArHVCondAlg.h:91
LArHVCondAlg::m_onlineID
const LArOnlineID * m_onlineID
Definition: LArHVCondAlg.h:109
LArHVCondAlg::m_outputHVScaleCorrKey
SG::WriteCondHandleKey< LArHVCorr > m_outputHVScaleCorrKey
Definition: LArHVCondAlg.h:86
SG::ReadCondHandleKey< LArHVPathology >
python.PyAthena.v
v
Definition: PyAthena.py:154
LArHVCondAlg::m_caloMgrKey
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
Definition: LArHVCondAlg.h:78
LArHVScaleCorrTool::HV_t
Definition: LArHVScaleCorrTool.h:24
LArHVCondAlg::m_cablingKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
Definition: LArHVCondAlg.h:74
LArHVCondAlg::HV_t
LArHVScaleCorrTool::HV_t HV_t
Definition: LArHVCondAlg.h:131
LArHVIdMapping
Definition: LArHVIdMapping.h:21
CaloDetDescrManager
This class provides the client interface for accessing the detector description information common to...
Definition: CaloDetDescrManager.h:473
LArHVCondAlg::m_useCurrentOthers
Gaudi::Property< bool > m_useCurrentOthers
Definition: LArHVCondAlg.h:94
LArHVCondAlg::m_doAffectedHV
Gaudi::Property< bool > m_doAffectedHV
Definition: LArHVCondAlg.h:98
eFEXNTuple.delta_phi
def delta_phi(phi1, phi2)
Definition: eFEXNTuple.py:15
LArHVCondAlg::m_scaleTool
std::unique_ptr< const LArHVScaleCorrTool > m_scaleTool
Definition: LArHVCondAlg.h:111
LArHVCondAlg::searchNonNominalHV_EMEC_OUTER
StatusCode searchNonNominalHV_EMEC_OUTER(CaloAffectedRegionInfoVec *vAffected, const LArHVIdMapping *hvCabling, const voltagePerLine_t &voltage) const
Definition: LArHVCondAlg.cxx:942
LArHVCondAlg::getVoltagePerLine
StatusCode getVoltagePerLine(const EventContext &ctx, voltagePerLine_t &voltagePerLine, const addDepFcn_t &addDep) const
Definition: LArHVCondAlg.cxx:330
LArHVPathology
Definition: LArHVPathology.h:15
SG::WriteCondHandleKey< CaloAffectedRegionInfoVec >
AthAlgorithm::AthAlgorithm
AthAlgorithm()
Default constructor:
LArEM_ID
Helper class for LArEM offline identifiers.
Definition: LArEM_ID.h:118
LArFCAL_ID
Helper class for LArFCAL offline identifiers.
Definition: LArFCAL_ID.h:60
LArHVCondAlg::voltageCell_t
LArHVScaleCorrTool::voltageCell_t voltageCell_t
Definition: LArHVCondAlg.h:132
LArHVScaleCorrTool.h
LArHVCondAlg::DCS_t::curr
float curr
Definition: LArHVCondAlg.h:118
LArHVCondAlg::m_hvMappingKey
SG::ReadCondHandleKey< LArHVIdMapping > m_hvMappingKey
Definition: LArHVCondAlg.h:75
LArHVCondAlg::m_affectedKey
SG::WriteCondHandleKey< CaloAffectedRegionInfoVec > m_affectedKey
Definition: LArHVCondAlg.h:81
LArHVCondAlg::addHV
void addHV(voltageCell_t &v, float hv, float weight) const
Add voltage/weight for a sub-gap of a cell.
Definition: LArHVCondAlg.cxx:723
LArOnOffIdMapping
Definition: LArOnOffIdMapping.h:20
Identifier
Definition: IdentifierFieldParser.cxx:14
LArHVLineID
Helper for the Liquid Argon Calorimeter High-Voltage identifiers.
Definition: LArHVLineID.h:48