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 () override
 AthAlgorithm (const std::string &name, ISvcLocator *pSvcLocator)
 Constructor with parameters:
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
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

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
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< 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 with parameters:

Definition at line 51 of file AthAlgorithm.cxx.

25 :
27{
28 // Set up to run AthAlgorithmDHUpdate in sysInitialize before
29 // merging dependency lists. This extends the output dependency
30 // list with any symlinks implied by inheritance relations.
31 m_updateDataHandles =
32 std::make_unique<AthenaBaseComps::AthAlgorithmDHUpdate>
34 std::move (m_updateDataHandles));
35}
DataObjIDColl m_extendedExtraObjects
AthCommonDataStore(const std::string &name, T... args)

◆ createCondObjects()

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

Definition at line 114 of file LArHVPathologyDbAlg.cxx.

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

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< 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< 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< 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< 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 ( )
overridevirtual

Definition at line 69 of file LArHVPathologyDbAlg.cxx.

70{
71 ATH_MSG_INFO(" in execute()");
72
73 const EventContext& ctx = Gaudi::Hive::currentContext();
74
75 int nevt = ctx.eventID().event_number();
76 if (nevt!=1) return StatusCode::SUCCESS;
77
78
79 SG::ReadCondHandle<CaloDetDescrManager> caloMgrHandle{m_caloMgrKey, ctx};
80 ATH_CHECK(caloMgrHandle.isValid());
81 const CaloDetDescrManager* calodetdescrmgr = *caloMgrHandle;
82
83
84 const std::vector<LArHVPathologiesDb::LArHVElectPathologyDb>* pathologyContainer=nullptr;
85 if(m_writeCondObjs) {
86 ATH_MSG_INFO("Creating conditions objects");
87
88 // Create cond objects
89 auto pathologies=createCondObjects(ctx,calodetdescrmgr);
90 if(!pathologies) {
91 ATH_MSG_ERROR("Could not create cond objects ");
92 m_writeCondObjs = false;
93 return StatusCode::FAILURE;
94 }
95 pathologyContainer=&(pathologies->m_v);
96 std::unique_ptr<AthenaAttributeList> attrlist = hvPathology2AttrList(*pathologies);
97 ATH_MSG_INFO("Created Attribute List");
98 coral::Blob& blob=(*attrlist)["Constants"].data<coral::Blob>();
99 ATH_MSG_DEBUG("Blob size=" << blob.size());
100 StatusCode sc = detStore()->record(std::move(attrlist),m_folder.value());
101 if(!sc.isSuccess()) {
102 ATH_MSG_ERROR("Could not record " << m_folder.value());
103 return sc;
104 }
105 else
106 ATH_MSG_INFO("Recorded " << m_folder.value());
107 }
108 // Dump cond objects
109 ATH_CHECK(printCondObjects (ctx,calodetdescrmgr,pathologyContainer));
110 return StatusCode::SUCCESS;
111}
#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< 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 & AthAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

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

Definition at line 50 of file AthAlgorithm.cxx.

51{
52 // If we didn't find any symlinks to add, just return the collection
53 // from the base class. Otherwise, return the extended collection.
54 if (!m_extendedExtraObjects.empty()) {
56 }
57 return Algorithm::extraOutputDeps();
58}

◆ 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 275 of file LArHVPathologyDbAlg.cxx.

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

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

◆ hvPathology2AttrList()

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

Definition at line 478 of file LArHVPathologyDbAlg.cxx.

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

◆ initialize()

StatusCode LArHVPathologyDbAlg::initialize ( )
overridevirtual

Definition at line 40 of file LArHVPathologyDbAlg.cxx.

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

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< 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.

◆ msg()

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msgLvl()

bool AthCommonMsg< 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< 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 210 of file LArHVPathologyDbAlg.cxx.

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

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

StatusCode AthAlgorithm::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< Algorithm > >.

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

Definition at line 66 of file AthAlgorithm.cxx.

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

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< 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< 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 }
std::vector< SG::VarHandleKeyArray * > m_vhka

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< 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< Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthAlgorithm::m_extendedExtraObjects
privateinherited

Definition at line 79 of file AthAlgorithm.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< Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< 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: