ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArBadChannelTool
src
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
5
#include "
LArBadChannelTool/LArBadFebCondAlg.h
"
6
#include "
LArBadChannelTool/LArBadChanBlobUtils.h
"
7
#include "
LArIdentifier/LArOnlineID.h
"
8
#include "
LArBadChannelTool/LArBadChannelDecoder.h
"
9
#include "
AthenaKernel/IOVInfiniteRange.h
"
10
11
StatusCode
LArBadFebCondAlg::initialize
() {
12
13
// Read Handles
14
ATH_CHECK
(
m_BCInputKey
.initialize(
SG::AllowEmpty
) );
15
ATH_CHECK
(
m_BCOutputKey
.initialize() );
16
17
return
StatusCode::SUCCESS;
18
}
19
20
21
StatusCode
LArBadFebCondAlg::execute
(
const
EventContext& ctx)
const
{
22
23
SG::WriteCondHandle<LArBadFebCont>
writeHandle{
m_BCOutputKey
,ctx};
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
35
SG::ReadCondHandle<AthenaAttributeList>
readHandle{
m_BCInputKey
,ctx};
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
59
writeHandle.
addDependency
(
IOVInfiniteRange::infiniteRunLB
());
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
}
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
IOVInfiniteRange.h
LArBadChanBlobUtils.h
LArBadChannelDecoder.h
LArBadFebCondAlg.h
LArOnlineID.h
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
AthCommonAlgorithm< Gaudi::Algorithm >::msg
MsgStream & msg() const
Definition
AthCommonMsg.h:24
AthenaAttributeList
An AttributeList represents a logical row of attributes in a metadata table.
Definition
PersistentDataModel/PersistentDataModel/AthenaAttributeList.h:46
IOVInfiniteRange::infiniteRunLB
static EventIDRange infiniteRunLB()
Produces an EventIDRange that is infinite in RunLumi and invalid in Time.
Definition
IOVInfiniteRange.h:39
LArBadChannelDecoder
Definition
LArBadChannelDecoder.h:21
LArBadFebCondAlg::m_BCInputKey
SG::ReadCondHandleKey< AthenaAttributeList > m_BCInputKey
Definition
LArBadFebCondAlg.h:27
LArBadFebCondAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override final
Definition
LArBadFebCondAlg.cxx:21
LArBadFebCondAlg::m_BCOutputKey
SG::WriteCondHandleKey< LArBadFebCont > m_BCOutputKey
Definition
LArBadFebCondAlg.h:29
LArBadFebCondAlg::m_inputFileName
Gaudi::Property< std::string > m_inputFileName
Definition
LArBadFebCondAlg.h:31
LArBadFebCondAlg::initialize
virtual StatusCode initialize() override final
Definition
LArBadFebCondAlg.cxx:11
LArOnlineID
Definition
LArOnlineID.h:21
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
SG::WriteCondHandle
Definition
WriteCondHandle.h:26
SG::WriteCondHandle::key
const std::string & key() const
Definition
WriteCondHandle.h:44
SG::WriteCondHandle::addDependency
void addDependency(const EventIDRange &range)
Definition
WriteCondHandle.h:279
SG::WriteCondHandle::getRange
const EventIDRange & getRange() const
Definition
WriteCondHandle.h:93
SG::WriteCondHandle::record
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
Definition
WriteCondHandle.h:161
SG::WriteCondHandle::isValid
bool isValid() const
Definition
WriteCondHandle.h:252
LArBadChanBlobUtils::decodeBlob
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...
SG::AllowEmpty
@ AllowEmpty
Definition
StoreGate/StoreGate/VarHandleKey.h:27
Generated on
for ATLAS Offline Software by
1.17.0