ATLAS Offline Software
Loading...
Searching...
No Matches
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
7
8
9LArFEBConfigCondAlg::LArFEBConfigCondAlg(const std::string& name, ISvcLocator* pSvcLocator) :
10 AthCondAlgorithm(name,pSvcLocator),m_onlineID(nullptr) {}
11
12
14
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
35StatusCode LArFEBConfigCondAlg::execute(const EventContext& ctx) const {
36 ATH_MSG_DEBUG("executing");
37
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) {
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){
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
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
const ServiceHandle< StoreGateSvc > & detStore() const
Base class for conditions algorithms.
This class is a collection of AttributeLists where each one is associated with a channel number.
const_iterator end() const
const_iterator begin() const
Access to Chan/AttributeList pairs via iterators.
ChanAttrListMap::const_iterator const_iterator
value_type get_compact() const
Get the compact id.
SG::ReadCondHandleKeyArray< CondAttrListCollection > m_listOfFolders
LArFEBConfigCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode execute(const EventContext &ctx) const override
SG::WriteCondHandleKey< LArFebConfig > m_configKey
const LArOnlineID * m_onlineID
virtual StatusCode initialize() override
void add(HWIdentifier febid, const coral::AttributeList *attrList)
const std::string & key() const
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