ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArRecUtils
src
LArFEBConfigCondAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
LArFEBConfigCondAlg.h
"
6
#include "
LArIdentifier/LArOnlineID.h
"
7
8
9
LArFEBConfigCondAlg::LArFEBConfigCondAlg
(
const
std::string& name, ISvcLocator* pSvcLocator) :
10
AthCondAlgorithm
(name,pSvcLocator),
m_onlineID
(nullptr) {}
11
12
13
LArFEBConfigCondAlg::~LArFEBConfigCondAlg
() {}
14
15
StatusCode
LArFEBConfigCondAlg::initialize
() {
16
17
ATH_MSG_DEBUG
(
" trying initialize"
);
18
19
ATH_CHECK
(
detStore
()->retrieve(
m_onlineID
,
"LArOnlineID"
));
20
21
if
(
m_listOfFolders
.empty()) {
22
ATH_MSG_WARNING
(
"List of folders is emtpy, do nothing"
);
23
return
StatusCode::SUCCESS;
24
}
25
26
ATH_CHECK
(
m_listOfFolders
.initialize());
27
ATH_CHECK
(
m_configKey
.initialize());
28
29
ATH_MSG_DEBUG
(
"Successfully initialized LArFEBConfigCondAlg"
);
30
return
StatusCode::SUCCESS;
31
}
32
33
34
35
StatusCode
LArFEBConfigCondAlg::execute
(
const
EventContext& ctx)
const
{
36
ATH_MSG_DEBUG
(
"executing"
);
37
38
SG::WriteCondHandle<LArFebConfig>
writeHandle{
m_configKey
, ctx};
39
if
(writeHandle.
isValid
()) {
40
ATH_MSG_DEBUG
(
"Found valid write LArFebConfig handle"
);
41
return
StatusCode::SUCCESS;
42
}
43
44
45
std::vector<const CondAttrListCollection*> attrvec;
46
47
for
(
const
auto
& fldkey:
m_listOfFolders
) {
48
SG::ReadCondHandle<CondAttrListCollection>
cHdl(fldkey, ctx);
49
const
CondAttrListCollection
* cattr = *cHdl;
50
if
(cattr) {
51
ATH_MSG_DEBUG
(
"Folder: "
<<cHdl.
key
()<<
" has size: "
<<std::distance(cattr->
begin
(),cattr->
end
()));
52
attrvec.push_back(cattr);
53
writeHandle.
addDependency
(cHdl);
54
}
else
{
55
ATH_MSG_WARNING
(
"Why do not have FEB config folder "
<< fldkey.fullKey());
56
}
57
}
58
59
// Fill LArFebConfig
60
std::unique_ptr<LArFebConfig> febConfig=std::make_unique<LArFebConfig>(
m_onlineID
);
61
LArFebConfig
* p_febConfig = febConfig.get();
62
63
unsigned
nFebs=0;
64
for
(
const
auto
*dh: attrvec){
65
CondAttrListCollection::const_iterator
chanit=dh->begin();
66
CondAttrListCollection::const_iterator
chanit_e=dh->end();
67
for
(;chanit!=chanit_e;++chanit) {
68
if
(chanit->first==0) {
69
ATH_MSG_DEBUG
(
"Invalid channel number 0, ignoring..."
);
70
continue
;
71
}
72
const
HWIdentifier
fid(chanit->first);
//COOL channel number == FEB identifier
73
//const coral::AttributeList& attr = chanit->second;
74
ATH_MSG_VERBOSE
(
"Working on FEB 0x"
<< std::hex << fid.
get_compact
() << std::dec <<
" "
<<
m_onlineID
->channel_name(fid));
75
p_febConfig->
add
(fid, &chanit->second);
76
++nFebs;
77
}
//End loop over COOL channels
78
}
79
ATH_MSG_INFO
(
"Read gain thresholds for "
<< nFebs <<
" Febs from "
<<
m_listOfFolders
.size() <<
" database folders."
);
80
81
// Record output
82
if
(writeHandle.
record
(std::move(febConfig)).isFailure()) {
83
ATH_MSG_ERROR
(
"Could not record LArFebConfig object with "
<< writeHandle.
key
()
84
<<
" with EventRange "
<< writeHandle.
getRange
() <<
" into Conditions Store"
);
85
return
StatusCode::FAILURE;
86
}
87
88
ATH_MSG_INFO
(
"recorded new "
<< writeHandle.
key
() <<
" with range "
<< writeHandle.
getRange
() <<
" into Conditions Store"
);
89
90
return
StatusCode::SUCCESS;
91
}
92
93
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
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
LArFEBConfigCondAlg.h
LArOnlineID.h
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
AthCondAlgorithm
Base class for conditions algorithms.
Definition
AthCondAlgorithm.h:22
CondAttrListCollection
This class is a collection of AttributeLists where each one is associated with a channel number.
Definition
CondAttrListCollection.h:51
CondAttrListCollection::end
const_iterator end() const
Definition
CondAttrListCollection.h:314
CondAttrListCollection::begin
const_iterator begin() const
Access to Chan/AttributeList pairs via iterators.
Definition
CondAttrListCollection.h:308
CondAttrListCollection::const_iterator
ChanAttrListMap::const_iterator const_iterator
Definition
CondAttrListCollection.h:62
HWIdentifier
Definition
HWIdentifier.h:13
Identifier::get_compact
value_type get_compact() const
Get the compact id.
LArFEBConfigCondAlg::m_listOfFolders
SG::ReadCondHandleKeyArray< CondAttrListCollection > m_listOfFolders
Definition
LArFEBConfigCondAlg.h:30
LArFEBConfigCondAlg::LArFEBConfigCondAlg
LArFEBConfigCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
LArFEBConfigCondAlg.cxx:9
LArFEBConfigCondAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
LArFEBConfigCondAlg.cxx:35
LArFEBConfigCondAlg::m_configKey
SG::WriteCondHandleKey< LArFebConfig > m_configKey
Definition
LArFEBConfigCondAlg.h:31
LArFEBConfigCondAlg::m_onlineID
const LArOnlineID * m_onlineID
Definition
LArFEBConfigCondAlg.h:29
LArFEBConfigCondAlg::initialize
virtual StatusCode initialize() override
Definition
LArFEBConfigCondAlg.cxx:15
LArFEBConfigCondAlg::~LArFEBConfigCondAlg
virtual ~LArFEBConfigCondAlg()
Definition
LArFEBConfigCondAlg.cxx:13
LArFebConfig
Definition
LArFebConfig.h:16
LArFebConfig::add
void add(HWIdentifier febid, const coral::AttributeList *attrList)
Definition
LArFebConfig.cxx:21
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
SG::ReadCondHandle::key
const std::string & key() const
Definition
ReadCondHandle.h:59
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
Generated on
for ATLAS Offline Software by
1.17.0