9#include "GaudiKernel/ISvcLocator.h"
10#include "GaudiKernel/Bootstrap.h"
11#include "GaudiKernel/MsgStream.h"
12#include "GaudiKernel/IMessageSvc.h"
31 SmartIF<IMessageSvc> msgSvc{Gaudi::svcLocator()->service(
"MessageSvc")};
33 throw std::runtime_error(
"Cannot locate MessageSvc");
35 MsgStream log( msgSvc,
"CaloTTOnAttrIdMap");
37 log<<MSG::DEBUG<<
" CaloTTOnAttrId size = "<<m.size() <<
endmsg;
39 SmartIF<StoreGateSvc> detStore{Gaudi::svcLocator()->service(
"DetectorStore")};
41 log << MSG::ERROR <<
"Cannot locate DetectorStore" <<
endmsg;
45 if(detStore->retrieve(online_id).isFailure()){
46 log << MSG::ERROR <<
"Cannot retrieve online_id" <<
endmsg;
49 CaloTTOnAttrId::const_iterator it = m.begin();
50 CaloTTOnAttrId::const_iterator it_e = m.end();
53 for (; it!=it_e; ++it) {
58 if (log.level()<=MSG::VERBOSE) {
61 <<
" crate="<<t.crate<<
" module="<<t.module
62 <<
" submodule="<<t.submodule
63 <<
" channel="<<t.channel
64 <<
" em_had="<<t.em_had
65 <<
" pos_neg="<<t.pos_neg
66 <<
" barrel_endcap_fcal"<<t.barrel_endcap_fcal
69 log<<MSG::VERBOSE<<
" onl id = " << sid <<
endmsg;
73 attrStruct.
em_had = t.em_had;
80 if (log.level()<=MSG::DEBUG) {
81 log<<MSG::DEBUG<<
" CaloTTOnAttrIdMap::set : number of Ids="<<
m_on2attrIdMap.size()<<std::endl;
84 log<<MSG::ERROR<<
" Failed in CaloTTOnAttrIdMap::set " <<
endmsg;
85 log<<MSG::ERROR<< (std::string) except <<
endmsg ;
91 std::map<HWIdentifier,AttrStruct>::const_iterator it=
m_on2attrIdMap.find(channelId);
94 return ((*it).second).em_had;
99 "Online ID not found, channelId = " << channelId.get_compact() <<
endmsg;
104 std::map<HWIdentifier,AttrStruct>::const_iterator it=
m_on2attrIdMap.find(channelId);
107 return ((*it).second).pos_neg;
112 "Online ID not found, channelId = " << channelId.get_compact() <<
endmsg;
117 std::map<HWIdentifier,AttrStruct>::const_iterator it=
m_on2attrIdMap.find(channelId);
120 return ((*it).second).barrel_endcap_fcal;
125 "Online ID not found, channelId = " << channelId.get_compact() <<
endmsg;
130 std::map<HWIdentifier,AttrStruct>::const_iterator it=
m_on2attrIdMap.find(channelId);
133 return ((*it).second).module_type;
138 "Online ID not found, channelId = " << channelId.get_compact() <<
endmsg;
148 CaloTTOnAttrId::const_iterator it = d.begin();
149 CaloTTOnAttrId::const_iterator it_e = d.end();
151 for ( ;it!=it_e;++it){
156 t2.module = t.module;
157 t2.submodule= t.submodule;
158 t2.channel = t.channel;
160 t2.em_had = t.em_had;
161 t2.pos_neg = t.pos_neg;
162 t2.barrel_endcap_fcal = t.barrel_endcap_fcal;
163 t2.module_type = t.module_type;
172 std::vector<CaloTTOnAttrId_P::__t>::const_iterator it = p.m_v.begin();
173 std::vector<CaloTTOnAttrId_P::__t>::const_iterator it_e = p.m_v.end();
176 for ( ;it!=it_e;++it){
181 t2.module = t.module;
182 t2.submodule= t.submodule;
183 t2.channel = t.channel;
185 t2.em_had = t.em_had;
186 t2.pos_neg = t.pos_neg;
187 t2.barrel_endcap_fcal = t.barrel_endcap_fcal;
188 t2.module_type = t.module_type;
std::vector< CaloTTOnAttrId_t > CaloTTOnAttrId
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.
unsigned int pos_neg(HWIdentifier channelId) const
return 0 for z<0 channels and 1 for z>0 channels
void convert_to_P(const CaloTTOnAttrId &t)
CaloTTOnAttrId_P * getP()
return the persistified map
std::map< HWIdentifier, AttrStruct > m_on2attrIdMap
void set(const PDATA &t)
initialize from Nova
unsigned int barrel_endcap_fcal(HWIdentifier channelId) const
To know if a channel belongs to the barrel, end cap or fcal parts.
unsigned int module_type(HWIdentifier channelId) const
To get the type of the module connected to the channel:
void convert_to_D(const CaloTTOnAttrId_P &t, CaloTTOnAttrId &d)
CaloTTOnAttrId_P m_persData
unsigned int em_had(HWIdentifier channelId) const
return the corresponding sampling of channelId:
This is a database object holding the TT online-attribute map.
Helper class for Calo TT online identifiers.
HWIdentifier channelId(int crate, int module, int submodule, int channel) const
(1) create towerId from fields
This is a StoreGate object holding the TT online-attribute map.
unsigned int barrel_endcap_fcal
Structure definition of the LArTTOnAttrIdMap.