ATLAS Offline Software
Loading...
Searching...
No Matches
LArHVPathologyDbAlg Class Reference

#include <LArHVPathologyDbAlg.h>

Inheritance diagram for LArHVPathologyDbAlg:

Public Member Functions

 ~LArHVPathologyDbAlg ()=default
virtual StatusCode initialize () override
virtual StatusCode execute (const EventContext &ctx) override
 Execute method.
 AthAlgorithm (const std::string &name, ISvcLocator *pSvcLocator)
 Constructor.
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual bool isClonable () const override
 Specify if the algorithm is clonable.
virtual StatusCode sysExecute (const EventContext &ctx) override
 Execute an algorithm.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
virtual bool filterPassed (const EventContext &ctx) const
 Get filter decision:
virtual void setFilterPassed (bool state, const EventContext &ctx) const
 Set filter decision:
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

virtual bool isReEntrant () const override final
 Legacy algorithms are not thread-safe.
void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

std::optional< LArHVPathologiesDbcreateCondObjects (const EventContext &ctx, const CaloDetDescrManager *calodetdescrmgr) const
StatusCode printCondObjects (const EventContext &ctx, const CaloDetDescrManager *calodetdescrmgr, const std::vector< LArHVPathologiesDb::LArHVElectPathologyDb > *path=nullptr) const
std::vector< unsigned int > getElectInd (const LArHVIdMapping &hvIdMapping, const Identifier &id, unsigned int module, unsigned int line, const CaloDetDescrManager *calodetdescrmgr) const
int getHVline (const LArHVIdMapping &hvIdMapping, const Identifier &id, short unsigned int ElectInd, const CaloDetDescrManager *calodetdescrmgr) const
std::unique_ptr< AthenaAttributeListhvPathology2AttrList (const LArHVPathologiesDb &pathologyContainer) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

BooleanProperty m_writeCondObjs {this,"WriteCondObjs",false}
StringProperty m_inpFile {this,"InpFile",{}}
StringProperty m_outFile {this,"OutFile",{}}
StringProperty m_folder {this,"Folder","/LAR/HVPathologiesOfl/Pathologies"}
IntegerProperty m_mode {this,"Mode",0,"Mode to read file (0=offlineID/elecID, 1=online ID fields + HV module/line, 2=type is HV value to overwrite)"}
const CaloIdManagerm_caloIdMgr {nullptr}
const LArEM_IDm_larem_id {nullptr}
const LArHEC_IDm_larhec_id {nullptr}
const LArFCAL_IDm_larfcal_id {nullptr}
const LArOnlineIDm_laronline_id {nullptr}
SG::ReadCondHandleKey< LArHVIdMappingm_hvCablingKey {this, "LArHVIdMapping", "LArHVIdMap", "SG key for HV ID mapping"}
SG::ReadCondHandleKey< LArOnOffIdMappingm_cablingKey {this, "OnOffMap", "LArOnOffIdMap", "SG key for mapping object"}
SG::ReadCondHandleKey< CaloDetDescrManagerm_caloMgrKey {this, "CaloDetDescrManager", "CaloDetDescrManager", "SG Key for CaloDetDescrManager in the Condition Store" }
SG::ReadCondHandleKey< LArHVPathologym_hvPathologyKey {this, "HVPAthologyKey", "LArHVPathology", "Key for HV pathologies in Cond. store"}
DataObjIDColl m_extendedExtraObjects
 Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default).
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default).
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 33 of file LArHVPathologyDbAlg.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ ~LArHVPathologyDbAlg()

LArHVPathologyDbAlg::~LArHVPathologyDbAlg ( )
default

Member Function Documentation

◆ AthAlgorithm()

AthAlgorithm::AthAlgorithm ( const std::string & name,
ISvcLocator * pSvcLocator )

Constructor.

Definition at line 31 of file AthAlgorithm.cxx.

11 :
12 AthCommonAlgorithm<Gaudi::Algorithm>( name, pSvcLocator )
13{
14 // default cardinality for non-reentrant algorithms
15 setProperty( "Cardinality", 1 ).orThrow("Unable to set property 'Cardinality'", name);
16}
void setProperty(columnar::PythonToolHandle &self, const std::string &key, nb::object value)
AthCommonAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)

◆ createCondObjects()

std::optional< LArHVPathologiesDb > LArHVPathologyDbAlg::createCondObjects ( const EventContext & ctx,
const CaloDetDescrManager * calodetdescrmgr ) const
private

Definition at line 112 of file LArHVPathologyDbAlg.cxx.

113{
114 ATH_MSG_INFO(" in createCondObjects() ");
115
116 SG::ReadCondHandle<LArHVIdMapping> hvIdMapping (m_hvCablingKey, ctx);
117
118 SG::ReadCondHandle<LArOnOffIdMapping> cabHdl (m_cablingKey, ctx);
119 const LArOnOffIdMapping *cabling = *cabHdl;
120 if(!cabling) {
121 ATH_MSG_ERROR("Do not have cabling object with key " << m_cablingKey.key());
122 return std::nullopt;
123 }
124 // Read input file and construct LArHVPathologiesDb for given folder
125 std::ifstream infile;
126 infile.open(m_inpFile.value().c_str());
127
128 if(!infile.is_open()) {
129 ATH_MSG_ERROR("Unable to open " << m_inpFile << " for reading");
130 return std::nullopt;
131 }
132
133 char checkChar;
134 char commentSign('#');
135 std::string commentLine(""), foldername("");
136 unsigned int cellID;
137 unsigned short electInd, pathologyType;
138
139 // Look for the folder name in the file
140 while(!infile.eof()) {
142 if(foldername==m_folder.value())
143 break;
144 }
145
146 if(foldername!=m_folder.value()) {
147 ATH_MSG_ERROR("Unable to find data for the folder " << m_folder.value()
148 << " in the input file");
149 return std::nullopt;
150 }
151 else
152 ATH_MSG_INFO("Found folder " << foldername << " in the input file");
153
154 // Get data corresponding to the folder and put it into LArHVPathologiesDb object
155 LArHVPathologiesDb pathologies;
156
157 ATH_MSG_INFO(" start reading input file ");
158 while(!infile.eof()) {
159 // Number or string?
160 checkChar = static_cast<char> (infile.get());
161 if(checkChar=='\n')
162 continue;
163 if((checkChar >= '0') && (checkChar <= '9')) {
164 // Number - read three values
165 infile.unget();
166 std::vector<unsigned int> elecList;
167 elecList.reserve(2);
168 if (m_mode==0) {
169 infile >> cellID >> electInd >> pathologyType;
170 elecList.push_back(electInd);
171 } else {
172 unsigned int bec,pos_neg,FT,slot,channel,hvModule,hvLine;
173 infile >> bec >> pos_neg >> FT >> slot >> channel >> hvModule >> hvLine >> pathologyType;
174 ATH_MSG_INFO(" read " << bec << " " << pos_neg << " " << FT << " " << slot << " " << channel << " " << hvModule << " " << hvLine << " " << pathologyType);
175 HWIdentifier hwid = m_laronline_id->channel_Id(bec,pos_neg,FT,slot,channel);
176 Identifier id = cabling->cnvToIdentifier( hwid);
177 cellID = (unsigned int)(id.get_identifier32().get_compact());
178 elecList=getElectInd(**hvIdMapping, id,hvModule,hvLine,calodetdescrmgr);
179 ATH_MSG_INFO(" cellId , elecList size " << cellID << " " << elecList.size());
180 }
181 for (unsigned int i=0;i<elecList.size();i++) {
182 LArHVPathologiesDb::LArHVElectPathologyDb electPath{};
183 electPath.cellID = cellID;
184 electPath.electInd = elecList[i];
185 if(m_mode==2) electPath.pathologyType = ((pathologyType&0x0FFF)<<4);
186 else electPath.pathologyType = pathologyType;
187 pathologies.m_v.push_back(electPath);
188 ATH_MSG_INFO("Created electrode pathology (" << cellID
189 << "," << elecList[i]
190 << "," << pathologyType << ")");
191 }
192 }
193 else if(checkChar==commentSign) {
194 // Skip the comment
195 std::getline(infile,commentLine);
196 }
197 else {
198 // We found another folder. Stop parsing
199 break;
200 }
201 }
202
203 infile.close();
204 ATH_MSG_INFO("Finished parsing input file");
205 return std::make_optional<LArHVPathologiesDb>(pathologies);
206}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
std::vector< LArHVElectPathologyDb > m_v
SG::ReadCondHandleKey< LArHVIdMapping > m_hvCablingKey
std::vector< unsigned int > getElectInd(const LArHVIdMapping &hvIdMapping, const Identifier &id, unsigned int module, unsigned int line, const CaloDetDescrManager *calodetdescrmgr) const
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
const LArOnlineID * m_laronline_id

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode LArHVPathologyDbAlg::execute ( const EventContext & ctx)
overridevirtual

Execute method.

Implements AthAlgorithm.

Definition at line 68 of file LArHVPathologyDbAlg.cxx.

69{
70 ATH_MSG_INFO(" in execute()");
71
72
73 int nevt = ctx.eventID().event_number();
74 if (nevt!=1) return StatusCode::SUCCESS;
75
76
77 SG::ReadCondHandle<CaloDetDescrManager> caloMgrHandle{m_caloMgrKey, ctx};
78 ATH_CHECK(caloMgrHandle.isValid());
79 const CaloDetDescrManager* calodetdescrmgr = *caloMgrHandle;
80
81
82 const std::vector<LArHVPathologiesDb::LArHVElectPathologyDb>* pathologyContainer=nullptr;
83 if(m_writeCondObjs) {
84 ATH_MSG_INFO("Creating conditions objects");
85
86 // Create cond objects
87 auto pathologies=createCondObjects(ctx,calodetdescrmgr);
88 if(!pathologies) {
89 ATH_MSG_ERROR("Could not create cond objects ");
90 m_writeCondObjs = false;
91 return StatusCode::FAILURE;
92 }
93 pathologyContainer=&(pathologies->m_v);
94 std::unique_ptr<AthenaAttributeList> attrlist = hvPathology2AttrList(*pathologies);
95 ATH_MSG_INFO("Created Attribute List");
96 coral::Blob& blob=(*attrlist)["Constants"].data<coral::Blob>();
97 ATH_MSG_DEBUG("Blob size=" << blob.size());
98 StatusCode sc = detStore()->record(std::move(attrlist),m_folder.value());
99 if(!sc.isSuccess()) {
100 ATH_MSG_ERROR("Could not record " << m_folder.value());
101 return sc;
102 }
103 else
104 ATH_MSG_INFO("Recorded " << m_folder.value());
105 }
106 // Dump cond objects
107 ATH_CHECK(printCondObjects (ctx,calodetdescrmgr,pathologyContainer));
108 return StatusCode::SUCCESS;
109}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
static Double_t sc
const ServiceHandle< StoreGateSvc > & detStore() const
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
std::unique_ptr< AthenaAttributeList > hvPathology2AttrList(const LArHVPathologiesDb &pathologyContainer) const
StatusCode printCondObjects(const EventContext &ctx, const CaloDetDescrManager *calodetdescrmgr, const std::vector< LArHVPathologiesDb::LArHVElectPathologyDb > *path=nullptr) const
std::optional< LArHVPathologiesDb > createCondObjects(const EventContext &ctx, const CaloDetDescrManager *calodetdescrmgr) const
BooleanProperty m_writeCondObjs
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthCommonAlgorithm< Gaudi::Algorithm >::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 89 of file AthCommonAlgorithm.cxx.

54{
55 // If we didn't find any symlinks to add, just return the collection
56 // from the base class. Otherwise, return the extended collection.
57 if (!m_extendedExtraObjects.empty()) {
59 }
61}
Common base class for algorithms.

◆ filterPassed()

virtual bool AthCommonAlgorithm< Gaudi::Algorithm >::filterPassed ( const EventContext & ctx) const
inlinevirtualinherited

Get filter decision:

Definition at line 93 of file AthCommonAlgorithm.h.

93 {
94 return execState( ctx ).filterPassed();
95 }
virtual bool filterPassed(const EventContext &ctx) const
Get filter decision:

◆ getElectInd()

std::vector< unsigned int > LArHVPathologyDbAlg::getElectInd ( const LArHVIdMapping & hvIdMapping,
const Identifier & id,
unsigned int module,
unsigned int line,
const CaloDetDescrManager * calodetdescrmgr ) const
private

Definition at line 273 of file LArHVPathologyDbAlg.cxx.

278{
279
280 std::vector<unsigned int> list;
281 int HVline = 1000*module + line;
282// EM calo
283 if (m_larem_id->is_lar_em(id)) {
284// LAr EMB
285 if (abs(m_larem_id->barrel_ec(id))==1 && m_larem_id->sampling(id) > 0) {
286 if (const EMBDetectorElement* embElement = dynamic_cast<const EMBDetectorElement*>(calodetdescrmgr->get_element(id))) {
287 const EMBCellConstLink cell = embElement->getEMBCell();
288 unsigned int nelec = cell->getNumElectrodes();
289 for (unsigned int i=0;i<nelec;i++) {
290 const EMBHVElectrode& electrode = cell->getElectrode(i);
291 for (unsigned int igap=0;igap<2;igap++) {
292 if (electrode.hvLineNo(igap, &hvIdMapping)==HVline) {
293 list.push_back(2*i+igap);
294 }
295 }
296 }
297 }
298 }
299// LAr EMEC
300 if (abs(m_larem_id->barrel_ec(id))>1 && m_larem_id->sampling(id) > 0) {
301 if (const EMECDetectorElement* emecElement = dynamic_cast<const EMECDetectorElement*>(calodetdescrmgr->get_element(id))) {
302 const EMECCellConstLink cell = emecElement->getEMECCell();
303 unsigned int nelec = cell->getNumElectrodes();
304 for (unsigned int i=0;i<nelec;i++) {
305 const EMECHVElectrode& electrode = cell->getElectrode(i);
306 for (unsigned int igap=0;igap<2;igap++) {
307 if (electrode.hvLineNo(igap, &hvIdMapping)==HVline) {
308 list.push_back(2*i+igap);
309 }
310 }
311 }
312 }
313 }
314// EMBPS
315 if (abs(m_larem_id->barrel_ec(id))==1 && m_larem_id->sampling(id)==0) {
316 if (const EMBDetectorElement* embElement = dynamic_cast<const EMBDetectorElement*>(calodetdescrmgr->get_element(id))) {
317 const EMBCellConstLink cell = embElement->getEMBCell();
318 const EMBPresamplerHVModule& hvmodule = cell->getPresamplerHVModule ();
319 for (unsigned int igap=0;igap<2;igap++) {
320 if (hvmodule.hvLineNo(igap, &hvIdMapping)==HVline) {
321 list.push_back(igap);
322 }
323 }
324 }
325 }
326// EMECPS
327 if (abs(m_larem_id->barrel_ec(id))>1 && m_larem_id->sampling(id)==0) {
328 if (const EMECDetectorElement* emecElement = dynamic_cast<const EMECDetectorElement*>(calodetdescrmgr->get_element(id))) {
329 const EMECCellConstLink cell = emecElement->getEMECCell();
330 const EMECPresamplerHVModule& hvmodule = cell->getPresamplerHVModule ();
331 for (unsigned int igap=0;igap<2;igap++) {
332 if (hvmodule.hvLineNo(igap, &hvIdMapping)==HVline) {
333 list.push_back(igap);
334 }
335 }
336 }
337 }
338 }
339//HEC
340 if (m_larhec_id->is_lar_hec(id)) {
341 if (const HECDetectorElement* hecElement = dynamic_cast<const HECDetectorElement*>(calodetdescrmgr->get_element(id))) {
342 const HECCellConstLink cell = hecElement->getHECCell();
343 unsigned int nsubgaps = cell->getNumSubgaps();
344 for (unsigned int i=0;i<nsubgaps;i++) {
345 const HECHVSubgap& subgap = cell->getSubgap(i);
346 if (subgap.hvLineNo(&hvIdMapping)==HVline) {
347 list.push_back(i);
348 }
349 }
350 }
351 }
352//FCAL
353 if (m_larfcal_id->is_lar_fcal(id)) {
354 if (const FCALDetectorElement* fcalElement = dynamic_cast<const FCALDetectorElement*>(calodetdescrmgr->get_element(id))) {
355 const FCALTile* tile = fcalElement->getFCALTile();
356 unsigned int nlines = FCALTile::getNumHVLines();
357 for (unsigned int i=0;i<nlines;i++) {
358 const FCALHVLine* line2 = tile->getHVLine(i);
359 if(line2) {
360 if (line2->hvLineNo(&hvIdMapping)==HVline) {
361 list.push_back(i);
362 }
363 }
364 }
365 }
366 }
367
368 return list;
369
370}
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
int hvLineNo(int iGap, const LArHVIdMapping *hvIdMapping) const
int hvLineNo(int iGap, const LArHVIdMapping *hvIdMapping) const
int hvLineNo(int iGap, const LArHVIdMapping *hvIdMapping) const
int hvLineNo(int iGap, const LArHVIdMapping *hvIdMapping) const
static unsigned int getNumHVLines()
Get num hvlines.
Definition FCALTile.cxx:81
int hvLineNo(const LArHVIdMapping *hvIdMapping) const
const LArHEC_ID * m_larhec_id
const LArFCAL_ID * m_larfcal_id
const LArEM_ID * m_larem_id
list(name, path='/')
Definition histSizes.py:38

◆ getHVline()

int LArHVPathologyDbAlg::getHVline ( const LArHVIdMapping & hvIdMapping,
const Identifier & id,
short unsigned int ElectInd,
const CaloDetDescrManager * calodetdescrmgr ) const
private

Definition at line 372 of file LArHVPathologyDbAlg.cxx.

376{
377
378 unsigned int igap, ielec;
379// EM calo
380 if (m_larem_id->is_lar_em(id)) {
381// LAr EMB
382 if (abs(m_larem_id->barrel_ec(id))==1 && m_larem_id->sampling(id) > 0) {
383 if (const EMBDetectorElement* embElement = dynamic_cast<const EMBDetectorElement*>(calodetdescrmgr->get_element(id))) {
384 const EMBCellConstLink cell = embElement->getEMBCell();
385 unsigned int nelec = cell->getNumElectrodes();
386 igap = ElectInd % 2;
387 ielec = std::div(ElectInd - igap, 2).quot;
388 if (ielec > nelec) {
389 ATH_MSG_ERROR("Wrong electrode number " << ielec << " for cell "<< id.get_identifier32().get_compact());
390 return -1;
391 } else {
392 return cell->getElectrode(ielec).hvLineNo(igap, &hvIdMapping);
393 }
394 }
395 }
396// LAr EMEC
397 if (abs(m_larem_id->barrel_ec(id))>1 && m_larem_id->sampling(id) > 0) {
398 if (const EMECDetectorElement* emecElement = dynamic_cast<const EMECDetectorElement*>(calodetdescrmgr->get_element(id))) {
399 const EMECCellConstLink cell = emecElement->getEMECCell();
400 unsigned int nelec = cell->getNumElectrodes();
401 igap = ElectInd % 2;
402 ielec = std::div(ElectInd - igap, 2).quot;
403 if (ielec > nelec) {
404 ATH_MSG_ERROR("Wrong electrode number " << ielec << " for cell "<< id.get_identifier32().get_compact());
405 return -1;
406 } else {
407 return cell->getElectrode(ielec).hvLineNo(igap, &hvIdMapping);
408 }
409 }
410 }
411// EMBPS
412 if (abs(m_larem_id->barrel_ec(id))==1 && m_larem_id->sampling(id)==0) {
413 if (const EMBDetectorElement* embElement = dynamic_cast<const EMBDetectorElement*>(calodetdescrmgr->get_element(id))) {
414 const EMBCellConstLink cell = embElement->getEMBCell();
415 const EMBPresamplerHVModule& hvmodule = cell->getPresamplerHVModule ();
416 if(ElectInd >= 2) {
417 ATH_MSG_ERROR("Wrong igap "<<ElectInd<<" for EMBPS cell "<<id.get_identifier32().get_compact());
418 return -1;
419 } else {
420 return hvmodule.hvLineNo(ElectInd, &hvIdMapping);
421 }
422 }
423 }
424// EMECPS
425 if (abs(m_larem_id->barrel_ec(id))>1 && m_larem_id->sampling(id)==0) {
426 if (const EMECDetectorElement* emecElement = dynamic_cast<const EMECDetectorElement*>(calodetdescrmgr->get_element(id))) {
427 const EMECCellConstLink cell = emecElement->getEMECCell();
428 const EMECPresamplerHVModule& hvmodule = cell->getPresamplerHVModule ();
429 if(ElectInd >= 2) {
430 ATH_MSG_ERROR("Wrong igap "<<ElectInd<<" for EMECPS cell "<<id.get_identifier32().get_compact());
431 return -1;
432 } else {
433 return hvmodule.hvLineNo(ElectInd, &hvIdMapping);
434 }
435 }
436 }
437 }
438//HEC
439 if (m_larhec_id->is_lar_hec(id)) {
440 if (const HECDetectorElement* hecElement = dynamic_cast<const HECDetectorElement*>(calodetdescrmgr->get_element(id))) {
441 const HECCellConstLink cell = hecElement->getHECCell();
442 unsigned int nsubgaps = cell->getNumSubgaps();
443 if( ElectInd >= nsubgaps) {
444 ATH_MSG_ERROR("Wrong igap "<<ElectInd<<" for HEC cell "<<id.get_identifier32().get_compact());
445 return -1;
446 } else {
447 return cell->getSubgap(ElectInd).hvLineNo(&hvIdMapping);
448 }
449 }
450 }
451//FCAL
452 if (m_larfcal_id->is_lar_fcal(id)) {
453 if (const FCALDetectorElement* fcalElement = dynamic_cast<const FCALDetectorElement*>(calodetdescrmgr->get_element(id))) {
454 const FCALTile* tile = fcalElement->getFCALTile();
455 unsigned int nlines = FCALTile::getNumHVLines();
456 if( ElectInd >= nlines) {
457 ATH_MSG_ERROR("Wrong line "<<ElectInd<<" for FCAL cell "<<id.get_identifier32().get_compact());
458 return -1;
459 } else {
460 const FCALHVLine* line2 = tile->getHVLine(ElectInd);
461 if(line2) {
462 return line2->hvLineNo(&hvIdMapping);
463 } else {
464 ATH_MSG_ERROR("Do not have HVLine for "<<ElectInd<<" for FCAL cell "<<id.get_identifier32().get_compact());
465 return -1;
466 }
467 }
468 }
469 }
470
471 // should not get up to this point....
472 return -1;
473
474}

◆ hvPathology2AttrList()

std::unique_ptr< AthenaAttributeList > LArHVPathologyDbAlg::hvPathology2AttrList ( const LArHVPathologiesDb & pathologyContainer) const
private

Definition at line 476 of file LArHVPathologyDbAlg.cxx.

476 {
477
478 coral::AttributeListSpecification* spec = new coral::AttributeListSpecification();
479 spec->extend("blobVersion",
480 "unsigned int"); // Should allow schema evolution if needed
481 spec->extend("Constants", "blob"); // Holds the container
482
483 std::unique_ptr<AthenaAttributeList> attrList = std::make_unique<AthenaAttributeList>(*spec);
484
485 (*attrList)["blobVersion"].data<unsigned int>() = (unsigned int)0;
486 coral::Blob& blob = (*attrList)["Constants"].data<coral::Blob>();
487
488 TClass* klass = TClass::GetClass("LArHVPathologiesDb");
489 if (klass == nullptr) {
490 ATH_MSG_ERROR("Can't find TClass LArHVPathologiesDb");
491 return nullptr;
492 } else
493 ATH_MSG_DEBUG("Got TClass LArHVPathologiesDb");
494
495 TBufferFile buf(TBuffer::kWrite);
496
497 if (buf.WriteObjectAny(&pathologyContainer, klass) != 1) {
498 ATH_MSG_ERROR("Failed to stream LArHVPathologiesDb");
499 return nullptr;
500 }
501
502 blob.resize(buf.Length());
503 void* adr = blob.startingAddress();
504 memcpy(adr, buf.Buffer(), buf.Length());
505 return attrList;
506}

◆ initialize()

StatusCode LArHVPathologyDbAlg::initialize ( )
overridevirtual

Definition at line 39 of file LArHVPathologyDbAlg.cxx.

40{
41 ATH_MSG_INFO(" in initialize()");
42
43 if(m_writeCondObjs && m_folder.value().empty()) {
44 ATH_MSG_ERROR("Folder property not set. Exiting ... ");
45 return StatusCode::FAILURE;
46 }
47
48 // Get HVPathology tool
49 //ATH_CHECK(m_pathologyTool.retrieve());
50
51 // retrieve LArEM id helpers
52 ATH_CHECK(detStore()->retrieve(m_caloIdMgr));
53
54 m_larem_id = m_caloIdMgr->getEM_ID();
55 m_larhec_id = m_caloIdMgr->getHEC_ID();
56 m_larfcal_id = m_caloIdMgr->getFCAL_ID();
57
58 ATH_CHECK(detStore()->retrieve(m_laronline_id,"LArOnlineID"));
59
60 ATH_CHECK( m_hvCablingKey.initialize() );
61 ATH_CHECK( m_cablingKey.initialize() );
62 ATH_CHECK( m_caloMgrKey.initialize() );
64
65 return StatusCode::SUCCESS;
66}
const CaloIdManager * m_caloIdMgr
SG::ReadCondHandleKey< LArHVPathology > m_hvPathologyKey

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ isClonable()

virtual bool AthCommonAlgorithm< Gaudi::Algorithm >::isClonable ( ) const
inlineoverridevirtualinherited

Specify if the algorithm is clonable.

Only relevant for non-reentrant algorithms. Actual number of clones needs to be set via the "Cardinality" property.

Reimplemented in AFP_DigiTop, AlgB, AlgT, BCM_Digitization, CscDigitBuilder, CscDigitToCscRDO, G4AtlasAlg, G4RunAlg, HGTD_Digitization, HiveAlgBase, InDet::GNNSeedingTrackMaker, InDet::SCT_Clusterization, InDet::SiSPGNNTrackMaker, InDet::SiSPSeededTrackFinder, InDet::SiTrackerSpacePointFinder, ISF::SimKernelMT, ITk::StripDigitization, ITkPixelCablingAlg, ITkStripCablingAlg, LArHitEMapMaker, LArTTL1Maker, LUCID_DigiTop, LVL1::L1TopoSimulation, MergeCalibHits, MergeGenericMuonSimHitColl, MergeHijingPars, MergeMcEventCollection, MergeTrackRecordCollection, MergeTruthJets, MergeTruthParticles, MuonDigitizer, PileUpMTAlg, PixelDigitization, RoIBResultToxAOD, SCT_ByteStreamErrorsTestAlg, SCT_CablingCondAlgFromCoraCool, SCT_CablingCondAlgFromText, SCT_ConditionsParameterTestAlg, SCT_ConditionsSummaryTestAlg, SCT_ConfigurationConditionsTestAlg, SCT_Digitization, SCT_FlaggedConditionTestAlg, SCT_LinkMaskingTestAlg, SCT_MajorityConditionsTestAlg, SCT_ModuleVetoTestAlg, SCT_MonitorConditionsTestAlg, SCT_PrepDataToxAOD, SCT_RawDataToxAOD, SCT_ReadCalibChipDataTestAlg, SCT_ReadCalibDataTestAlg, SCT_RODVetoTestAlg, SCT_SensorsTestAlg, SCT_SiliconConditionsTestAlg, SCT_StripVetoTestAlg, SCT_TdaqEnabledTestAlg, SCT_TestCablingAlg, SCTEventFlagWriter, SCTRawDataProvider, SCTSiLorentzAngleTestAlg, SCTSiPropertiesTestAlg, SGInputLoader, Simulation::BeamEffectsAlg, TileHitVecToCnt, TileMuonFitter, TilePulseForTileMuonReceiver, TileRawChannelMaker, TRTDigitization, and ZDC_DigiTop.

Definition at line 68 of file AthCommonAlgorithm.h.

68 {
69 return true;
70 }

◆ isReEntrant()

virtual bool AthAlgorithm::isReEntrant ( ) const
inlinefinaloverrideprotectedvirtualinherited

Legacy algorithms are not thread-safe.

Definition at line 47 of file AthAlgorithm.h.

47{ return false; }

◆ msg()

MsgStream & AthCommonMsg< Gaudi::Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Gaudi::Algorithm >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ printCondObjects()

StatusCode LArHVPathologyDbAlg::printCondObjects ( const EventContext & ctx,
const CaloDetDescrManager * calodetdescrmgr,
const std::vector< LArHVPathologiesDb::LArHVElectPathologyDb > * path = nullptr ) const
private

Definition at line 208 of file LArHVPathologyDbAlg.cxx.

210{
211 ATH_MSG_INFO(" in printCondObjects() ");
212
213 SG::ReadCondHandle<LArHVIdMapping> hvIdMapping (m_hvCablingKey, ctx);
214 SG::ReadCondHandle<LArOnOffIdMapping> cabHdl (m_cablingKey, ctx);
215 const LArOnOffIdMapping *cabling = *cabHdl;
216 if(!cabling) {
217 ATH_MSG_ERROR("Do not have cabling object with key " << m_cablingKey.key());
218 return StatusCode::FAILURE;
219 }
220
221 std::ofstream *fout=nullptr;
222 if (!m_hvPathologyKey.empty() && pathologyContainer==nullptr) {
223 SG::ReadCondHandle<LArHVPathology> pathHdl(m_hvPathologyKey,ctx);
224 pathologyContainer=&(pathHdl->getPathology());
225 }
226 if (!pathologyContainer) {
227 ATH_MSG_WARNING("No input data ");
228
229 return StatusCode::SUCCESS;
230 }
231
232 else {
233 if(!m_outFile.value().empty()) {
234 fout = new std::ofstream(m_outFile.value().c_str());
235 if((!fout) || (fout && !(fout->good()))) {
236 ATH_MSG_WARNING("Could not open output file: " << m_outFile.value());
237 fout=nullptr;
238 }
239 if(fout) *fout<<m_folder.value()<<std::endl;
240 }
241 for (const LArHVPathologiesDb::LArHVElectPathologyDb& electPath : *pathologyContainer) {
242 if(m_mode==0) {
243 ATH_MSG_INFO("Got pathology for cell ID: " << electPath.cellID
244 << "(" << electPath.electInd
245 << "," << electPath.pathologyType << ") ");
246 if(fout) *fout<<electPath.cellID<<"\t"<<electPath.electInd<<"\t"<<electPath.pathologyType<<std::endl;
247 } else {
248 ATH_MSG_INFO("Got pathology for cell ID: " << electPath.cellID);
249 HWIdentifier hwid = cabling->createSignalChannelID(Identifier32(electPath.cellID));
250 int HVLine=getHVline(**hvIdMapping,Identifier(electPath.cellID),electPath.electInd,calodetdescrmgr);
251 if(HVLine<0) {
252 ATH_MSG_ERROR("No HVline for cell "<<electPath.cellID);
253 } else {
254 int hvmodule=HVLine/1000;
255 int hvline=HVLine%1000;
256 if(m_mode==1) {
257 ATH_MSG_INFO(m_laronline_id->barrel_ec(hwid) << " " << m_laronline_id->pos_neg(hwid) << " " << m_laronline_id->feedthrough(hwid) << " " << m_laronline_id->slot(hwid) << " " << m_laronline_id->channel(hwid) << " " << hvmodule << " " << hvline << " " << electPath.pathologyType);
258 if(fout) *fout << m_laronline_id->barrel_ec(hwid) << " " << m_laronline_id->pos_neg(hwid) << " " << m_laronline_id->feedthrough(hwid) << " " << m_laronline_id->slot(hwid) << " " << m_laronline_id->channel(hwid) << " " << hvmodule << " " << hvline << " " << electPath.pathologyType << std::endl;
259 } else if (m_mode==2){
260 ATH_MSG_INFO(m_laronline_id->barrel_ec(hwid) << " " << m_laronline_id->pos_neg(hwid) << " " << m_laronline_id->feedthrough(hwid) << " " << m_laronline_id->slot(hwid) << " " << m_laronline_id->channel(hwid) << " " << hvmodule << " " << hvline << " " << ((electPath.pathologyType&0xFF0)>>4));
261 if(fout) *fout << m_laronline_id->barrel_ec(hwid) << " " << m_laronline_id->pos_neg(hwid) << " " << m_laronline_id->feedthrough(hwid) << " " << m_laronline_id->slot(hwid) << " " << m_laronline_id->channel(hwid) << " " << hvmodule << " " << hvline << " " << ((electPath.pathologyType&0xFFF0)>>4) << std::endl;
262
263 }
264 }
265 }
266 }
267 }
268 if(fout) fout->close();
269 return StatusCode::SUCCESS;
270}
#define ATH_MSG_WARNING(x)
int getHVline(const LArHVIdMapping &hvIdMapping, const Identifier &id, short unsigned int ElectInd, const CaloDetDescrManager *calodetdescrmgr) const
static TFile * fout
Definition listroot.cxx:40

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ setFilterPassed()

virtual void AthCommonAlgorithm< Gaudi::Algorithm >::setFilterPassed ( bool state,
const EventContext & ctx ) const
inlinevirtualinherited

Set filter decision:

Reimplemented in AthFilterAlgorithm.

Definition at line 99 of file AthCommonAlgorithm.h.

99 {
101 }
virtual void setFilterPassed(bool state, const EventContext &ctx) const
Set filter decision:

◆ sysExecute()

StatusCode AthCommonAlgorithm< Gaudi::Algorithm >::sysExecute ( const EventContext & ctx)
overridevirtualinherited

Execute an algorithm.

We override this in order to work around an issue with the Algorithm base class storing the event context in a member variable that can cause crashes in MT jobs.

Reimplemented in AthAnalysisAlgorithm.

Definition at line 80 of file AthCommonAlgorithm.cxx.

41{
42 return BaseAlg::sysExecute (ctx);
43}

◆ sysInitialize()

StatusCode AthCommonAlgorithm< Gaudi::Algorithm >::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, AthHistogramAlgorithm, HypoBase, InputMakerBase, and PyAthena::Alg.

Definition at line 60 of file AthCommonAlgorithm.cxx.

71 {
73
74 if (sc.isFailure()) {
75 return sc;
76 }
77
78 ServiceHandle<ICondSvc> cs("CondSvc",name());
79 for (auto h : outputHandles()) {
80 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
81 // do this inside the loop so we don't create the CondSvc until needed
82 if ( cs.retrieve().isFailure() ) {
83 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
85 }
86 if (cs->regHandle(this,*h).isFailure()) {
88 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
89 << " with CondSvc");
90 }
91 }
92 }
93 return sc;
94}
virtual StatusCode sysInitialize() override
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }

Member Data Documentation

◆ m_cablingKey

SG::ReadCondHandleKey<LArOnOffIdMapping> LArHVPathologyDbAlg::m_cablingKey {this, "OnOffMap", "LArOnOffIdMap", "SG key for mapping object"}
private

Definition at line 72 of file LArHVPathologyDbAlg.h.

73{this, "OnOffMap", "LArOnOffIdMap", "SG key for mapping object"};

◆ m_caloIdMgr

const CaloIdManager* LArHVPathologyDbAlg::m_caloIdMgr {nullptr}
private

Definition at line 64 of file LArHVPathologyDbAlg.h.

64{nullptr};

◆ m_caloMgrKey

SG::ReadCondHandleKey<CaloDetDescrManager> LArHVPathologyDbAlg::m_caloMgrKey {this, "CaloDetDescrManager", "CaloDetDescrManager", "SG Key for CaloDetDescrManager in the Condition Store" }
private

Definition at line 74 of file LArHVPathologyDbAlg.h.

75{this, "CaloDetDescrManager", "CaloDetDescrManager", "SG Key for CaloDetDescrManager in the Condition Store" };

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default).

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default).

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthCommonAlgorithm< Gaudi::Algorithm >::m_extendedExtraObjects
privateinherited

Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.

Empty if no symlinks were found.

Definition at line 108 of file AthCommonAlgorithm.h.

◆ m_folder

StringProperty LArHVPathologyDbAlg::m_folder {this,"Folder","/LAR/HVPathologiesOfl/Pathologies"}
private

Definition at line 61 of file LArHVPathologyDbAlg.h.

61{this,"Folder","/LAR/HVPathologiesOfl/Pathologies"};

◆ m_hvCablingKey

SG::ReadCondHandleKey<LArHVIdMapping> LArHVPathologyDbAlg::m_hvCablingKey {this, "LArHVIdMapping", "LArHVIdMap", "SG key for HV ID mapping"}
private

Definition at line 70 of file LArHVPathologyDbAlg.h.

71{this, "LArHVIdMapping", "LArHVIdMap", "SG key for HV ID mapping"};

◆ m_hvPathologyKey

SG::ReadCondHandleKey<LArHVPathology> LArHVPathologyDbAlg::m_hvPathologyKey {this, "HVPAthologyKey", "LArHVPathology", "Key for HV pathologies in Cond. store"}
private

Definition at line 77 of file LArHVPathologyDbAlg.h.

78{this, "HVPAthologyKey", "LArHVPathology", "Key for HV pathologies in Cond. store"};

◆ m_inpFile

StringProperty LArHVPathologyDbAlg::m_inpFile {this,"InpFile",{}}
private

Definition at line 59 of file LArHVPathologyDbAlg.h.

59{this,"InpFile",{}};

◆ m_larem_id

const LArEM_ID* LArHVPathologyDbAlg::m_larem_id {nullptr}
private

Definition at line 65 of file LArHVPathologyDbAlg.h.

65{nullptr};

◆ m_larfcal_id

const LArFCAL_ID* LArHVPathologyDbAlg::m_larfcal_id {nullptr}
private

Definition at line 67 of file LArHVPathologyDbAlg.h.

67{nullptr};

◆ m_larhec_id

const LArHEC_ID* LArHVPathologyDbAlg::m_larhec_id {nullptr}
private

Definition at line 66 of file LArHVPathologyDbAlg.h.

66{nullptr};

◆ m_laronline_id

const LArOnlineID* LArHVPathologyDbAlg::m_laronline_id {nullptr}
private

Definition at line 68 of file LArHVPathologyDbAlg.h.

68{nullptr};

◆ m_mode

IntegerProperty LArHVPathologyDbAlg::m_mode {this,"Mode",0,"Mode to read file (0=offlineID/elecID, 1=online ID fields + HV module/line, 2=type is HV value to overwrite)"}
private

Definition at line 62 of file LArHVPathologyDbAlg.h.

62{this,"Mode",0,"Mode to read file (0=offlineID/elecID, 1=online ID fields + HV module/line, 2=type is HV value to overwrite)"};

◆ m_outFile

StringProperty LArHVPathologyDbAlg::m_outFile {this,"OutFile",{}}
private

Definition at line 60 of file LArHVPathologyDbAlg.h.

60{this,"OutFile",{}};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.

◆ m_writeCondObjs

BooleanProperty LArHVPathologyDbAlg::m_writeCondObjs {this,"WriteCondObjs",false}
private

Definition at line 58 of file LArHVPathologyDbAlg.h.

58{this,"WriteCondObjs",false};

The documentation for this class was generated from the following files: