ATLAS Offline Software
Loading...
Searching...
No Matches
LArBadChannelDBAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7// AttributeList
8#include "CoralBase/Attribute.h"
9#include "CoralBase/Blob.h"
10#include "CoralBase/AttributeListSpecification.h"
13
15
17
18LArBadChannelDBAlg::LArBadChannelDBAlg(const std::string& name, ISvcLocator* pSvcLocator) :
19 AthAlgorithm( name, pSvcLocator), m_BCKey("LArBadChannel"), m_BFKey("LArBadFeb"), m_isSC(false)
20{
21 declareProperty("BadChanKey",m_BCKey);
22 declareProperty("MissingFEBKey",m_BFKey);
23 declareProperty("DBFolder",m_dbFolder="/LAR/BadChannels/BadChannels");
24 declareProperty("FEBFolder",m_dbFebFolder="/LAR/BadChannels/MissingFEBs");
25 declareProperty("WritingMode",m_mode=0,"selects information written to DB: 0 for bad channels, 1 for missing febs");
26 declareProperty("SuperCell",m_isSC);
27}
28
30
31
33
34 ATH_MSG_INFO ( "initialize()" );
35
36 ATH_CHECK (m_BCKey.initialize(m_mode==0) );
37 ATH_CHECK (m_BFKey.initialize(m_mode==1) );
38
39 return StatusCode::SUCCESS;
40}
41
43{return StatusCode::SUCCESS;}
44
46 const LArOnlineID *onlineID=nullptr;
47 if(!m_isSC) {
48 ATH_CHECK( detStore()->retrieve(onlineID, "LArOnlineID") );
49 if(!onlineID) {
50 ATH_MSG_ERROR("Failed to retrieve LArOnlineID");
51 return StatusCode::FAILURE;
52 }
53 }
54 if (m_mode == 0) {
56 const LArBadChannelCont *bcCont {*readHandle};
57 if ( bcCont == nullptr) {
58 ATH_MSG_ERROR("Failed to retrieve BadChanCont with key "<<m_BCKey.key() );
59 return StatusCode::FAILURE;
60 }
61 ATH_MSG_INFO ( "Creating AttrListCollection in folder " << m_dbFolder );
62 LArBadChannelState bcState;
64 for (const auto& entry : bcCont->fullCont()) {
65 const HWIdentifier hid=HWIdentifier(entry.first);
67 else {
68 if (onlineID->isEMBchannel(hid)) {
69 if (onlineID->pos_neg(hid))
71 else
73 } else if (onlineID->isEMECchannel(hid)) {
74 if (onlineID->pos_neg(hid))
76 else
78 } else if (onlineID->isHECchannel(hid)) {
79 if (onlineID->pos_neg(hid))
81 else
83 } else if (onlineID->isFCALchannel(hid)) {
84 if (onlineID->pos_neg(hid))
86 else
88 } else {
89 ATH_MSG_WARNING ( "Wrong bad channel Id" << hid );
90 continue;
91 }
92 }
93 bcState.add(LArBadChannelDBTools::BadChanEntry(hid,entry.second),coolchan);
94 }
95
96 CondAttrListCollection* attrListColl =
98
99 ATH_CHECK( detStore()->record( attrListColl, m_dbFolder) );
100 }
101
102 if (m_mode == 1) {
103 ATH_MSG_INFO ( "Creating AthenaAttributeList in folder " << m_dbFebFolder );
104
106 const LArBadFebCont *bfCont {*readHandle};
107 if ( bfCont == nullptr) {
108 ATH_MSG_ERROR("Failed to retrieve BadFebCont with key "<<m_BFKey.key() );
109 return StatusCode::FAILURE;
110 }
112 for (const auto& entry : bfCont->fullCont()) {
113 const HWIdentifier hid=HWIdentifier(entry.first);
114 febs.emplace_back(LArBadChannelDBTools::BadFebEntry(hid,entry.second));
115 }
116 if (!febs.empty()) {
118
119 ATH_CHECK( detStore()->record( attrList, m_dbFebFolder) );
120 }
121 ATH_MSG_INFO ( "exiting finalize successfully " << m_dbFebFolder );
122 }
123
124 return StatusCode::SUCCESS;
125}
126
127
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
LArBadXCont< LArBadFeb > LArBadFebCont
LArBadXCont< LArBadChannel > LArBadChannelCont
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
const ServiceHandle< StoreGateSvc > & detStore() const
An AttributeList represents a logical row of attributes in a metadata table.
This class is a collection of AttributeLists where each one is associated with a channel number.
SG::ReadCondHandleKey< LArBadChannelCont > m_BCKey
LArBadChannelDBAlg(const std::string &name, ISvcLocator *pSvcLocator)
SG::ReadCondHandleKey< LArBadFebCont > m_BFKey
void add(const BadChanEntry &entry, CoolChannelEnum chan)
Add a bad channel entry to a specified cool channel data.
const BadChanVec & fullCont() const
bool isEMBchannel(const HWIdentifier id) const
int pos_neg(const HWIdentifier id) const
Return the side of a hardware cell identifier pos_neg = [0,1] positive-side or negative-side Barrel...
bool isFCALchannel(const HWIdentifier id) const
bool isHECchannel(const HWIdentifier id) const override final
bool isEMECchannel(const HWIdentifier id) const override final
std::pair< HWIdentifier, LArBadFeb > BadFebEntry
std::pair< HWIdentifier, LArBadChannel > BadChanEntry
std::vector< BadFebEntry > BadFebVec
CondAttrListCollection * createCoolCollection(const LArBadChannelState &bcState)
AthenaAttributeList * createFebPayload(const BadFebVec &data)