10#include "GaudiKernel/ISvcLocator.h"
11#include "GaudiKernel/Bootstrap.h"
12#include "GaudiKernel/MsgStream.h"
13#include "GaudiKernel/IMessageSvc.h"
32 SmartIF<IMessageSvc> msgSvc{Gaudi::svcLocator()->service(
"MessageSvc")};
34 throw std::runtime_error(
"Cannot locate MessageSvc");
36 MsgStream log( msgSvc,
"CaloTTOnOffIdMap");
38 log<<MSG::DEBUG<<
" CaloTTOnOffId size = "<<m.size() <<
endmsg;
40 SmartIF<StoreGateSvc> detStore{Gaudi::svcLocator()->service(
"DetectorStore")};
42 log << MSG::ERROR <<
"Cannot locate DetectorStore" <<
endmsg;
48 StatusCode status=detStore->retrieve(online_id);
49 if(status.isFailure()){
50 log << MSG::ERROR <<
"Cannot retrieve online_id" <<
endmsg;
52 status=detStore->retrieve(offline_id);
53 if(status.isFailure()){
54 log << MSG::ERROR <<
"Cannot retrieve offline_id" <<
endmsg;
57 CaloTTOnOffId::const_iterator it = m.begin();
58 CaloTTOnOffId::const_iterator it_e = m.end();
61 for (; it!=it_e; ++it) {
67 if (log.level()<=MSG::VERBOSE) {
70 <<
" pn="<<t.pn<<
" sampling="<<t.sampling
71 <<
" region="<<t.region
72 <<
" eta="<<t.eta<<
" phi="<<t.phi<<
" layer="<<t.layer<<
" | "
73 <<
" crate="<<t.crate<<
" module="<<t.module
74 <<
" submodule="<<t.submodule
75 <<
" channel="<<t.channel
78 log<<MSG::VERBOSE<<
" onl id = " << sid<<
" offline id ="<<
id<<
endmsg;
84 if (log.level()<=MSG::DEBUG) {
85 log<<MSG::DEBUG<<
" CaloTTOnOffIdMap::set : number of Ids="<<
m_on2offIdMap.size()<<std::endl;
88 log<<MSG::ERROR<<
" Failed in CaloTTOnOffIdMap::set " <<
endmsg;
89 log<<MSG::ERROR<< (std::string) except <<
endmsg ;
97 std::map<Identifier,HWIdentifier>::const_iterator it =
m_off2onIdMap.find(
id);
109 "Offline ID not found "<<
id <<
endmsg;
119 std::map<HWIdentifier,Identifier>::const_iterator it=
m_on2offIdMap.find(sid);
144 CaloTTOnOffId::const_iterator it = d.begin();
145 CaloTTOnOffId::const_iterator it_e = d.end();
147 for ( ;it!=it_e;++it){
152 t2.sampling = t.sampling;
153 t2.region = t.region;
159 t2.module = t.module;
160 t2.submodule= t.submodule;
161 t2.channel = t.channel;
170 std::vector<CaloTTOnOffId_P::__t>::const_iterator it = p.m_v.begin();
171 std::vector<CaloTTOnOffId_P::__t>::const_iterator it_e = p.m_v.end();
174 for ( ;it!=it_e;++it){
179 t2.sampling = t.sampling;
180 t2.region = t.region;
186 t2.module = t.module;
187 t2.submodule= t.submodule;
188 t2.channel = t.channel;
std::vector< CaloTTOnOffId_t > CaloTTOnOffId
Helpers for checking error return status codes and reporting errors.
#define REPORT_MESSAGE_WITH_CONTEXT(LVL, CONTEXT_NAME)
Report a message, with an explicitly specified context name.
Exception class for Calo Identifiers.
Helper class for offline TT identifiers.
Identifier tower_id(int pos_neg_z, int sampling, int region, int eta, int phi) const
build a tower identifier
CaloTTOnOffId_P * getP()
return the persistified map
std::map< Identifier, HWIdentifier > m_off2onIdMap
CaloTTOnOffId_P m_persData
void convert_to_D(const CaloTTOnOffId_P &t, CaloTTOnOffId &d)
void set(const PDATA &t)
initialize from Nova
std::map< HWIdentifier, Identifier > m_on2offIdMap
Identifier cnvToIdentifier(const HWIdentifier &sid, bool bQuiet=false) const
return the corresponfing offline Id of an online one
HWIdentifier createSignalChannelID(const Identifier &id, bool bQuiet=false) const
return the corresponfing online Id of an offline one
void convert_to_P(const CaloTTOnOffId &t)
This is a database object holding the TT online-offline map.
value_type get_compact() const
Get the compact id.
Helper class for Calo TT online identifiers.
HWIdentifier channelId(int crate, int module, int submodule, int channel) const
(1) create towerId from fields
Structure definition of the LArTTOnOffIdMap.