ATLAS Offline Software
Loading...
Searching...
No Matches
LArBadFebCondAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
10
12
13 // Read Handles
15 ATH_CHECK( m_BCOutputKey.initialize() );
16
17 return StatusCode::SUCCESS;
18}
19
20
21StatusCode LArBadFebCondAlg::execute(const EventContext& ctx) const {
22
24
25 if (writeHandle.isValid()) {
26 msg(MSG::DEBUG) << "Found valid write handle" << endmsg;
27 return StatusCode::SUCCESS;
28 }
29
30 std::unique_ptr<LArBadFebCont> badFebCont=std::make_unique<LArBadFebCont>();
31
32
33 if(!m_BCInputKey.key().empty()) {
34
36 const AthenaAttributeList* attrList{*readHandle};
37 if (attrList==nullptr) {
38 msg(MSG::ERROR) << "Failed to retrieve CondAttributeListCollection with key " << m_BCInputKey.key() << endmsg;
39 return StatusCode::FAILURE;
40 }
41 writeHandle.addDependency(readHandle);
42
43 const coral::Blob& blob = (*attrList)["Blob"].data<coral::Blob>();
44 unsigned int chanSize = (*attrList)["ChannelSize"].data<unsigned int>();
45 unsigned int stateSize = (*attrList)["StatusWordSize"].data<unsigned int>();
46 unsigned int endian = (*attrList)["Endianness"].data<unsigned int>();
47 unsigned int version = (*attrList)["Version"].data<unsigned int>();
48
49 std::vector<std::pair<HWIdentifier,LArBadFeb> > bcVec =
50 LArBadChanBlobUtils::decodeBlob<LArBadFeb>( &blob, chanSize, stateSize, endian,
51 version, msg());
52
53 for (auto& idBC : bcVec) {
54 badFebCont->add(idBC.first,idBC.second);
55 }
56 }
57 else {
58 //No input data from DB, set infinte range
60 }
61
62 if (m_inputFileName.size()) {//Read supplemental data from ASCII file (if required)
63
64 const LArOnlineID* onlineID;
65 ATH_CHECK(detStore()->retrieve(onlineID,"LArOnlineID"));
66 LArBadChannelDecoder decoder(&(*onlineID));
67 std::vector<std::pair<HWIdentifier,LArBadFeb> > bcVec = decoder.readFebASCII(m_inputFileName, msg());
68 for (auto& idBC : bcVec) {
69 badFebCont->add(idBC.first,idBC.second);
70 }
71 } //end if have ASCII filename
72
73
74
75 size_t nChanBeforeMege=badFebCont->size();
76 badFebCont->sort(); //Sorts vector of bad febs and merges duplicate entries
77
78 ATH_MSG_INFO("Read a total of " << badFebCont->size() << " problematic febs from database");
79 if (nChanBeforeMege!=badFebCont->size()) {
80 ATH_MSG_INFO("Merged " << nChanBeforeMege-badFebCont->size() << " duplicate entries");
81 }
82
83 if(writeHandle.record(std::move(badFebCont)).isFailure()) {
84 ATH_MSG_ERROR("Could not record LArBadFebCont object with "
85 << writeHandle.key()
86 << " with EventRange " << writeHandle.getRange()
87 << " into Conditions Store");
88 return StatusCode::FAILURE;
89 }
90 ATH_MSG_INFO("Recorded LArBadFebCont object with "
91 << writeHandle.key()
92 << " with EventRange " << writeHandle.getRange()
93 << " into Conditions Store");
94
95
96 return StatusCode::SUCCESS;
97}
#define endmsg
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
const ServiceHandle< StoreGateSvc > & detStore() const
An AttributeList represents a logical row of attributes in a metadata table.
static EventIDRange infiniteRunLB()
Produces an EventIDRange that is infinite in RunLumi and invalid in Time.
SG::ReadCondHandleKey< AthenaAttributeList > m_BCInputKey
virtual StatusCode execute(const EventContext &ctx) const override final
SG::WriteCondHandleKey< LArBadFebCont > m_BCOutputKey
Gaudi::Property< std::string > m_inputFileName
virtual StatusCode initialize() override final
const std::string & key() const
void addDependency(const EventIDRange &range)
const EventIDRange & getRange() const
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
std::vector< std::pair< HWIdentifier, T > > decodeBlob(const coral::Blob *blobp, std::size_t chanSize, std::size_t stateSize, int endian, int version, MsgStream &log)
Checks BLOB for differences in endian-ness and size of data types with respect to the architecture on...