ATLAS Offline Software
Loading...
Searching...
No Matches
CaloTTOnOffIdMap Class Reference

This is a StoreGate object holding the TT offline-online map. More...

#include <CaloTTOnOffIdMap.h>

Collaboration diagram for CaloTTOnOffIdMap:

Public Types

typedef CaloTTOnOffId PDATA

Public Member Functions

 CaloTTOnOffIdMap ()
 ~CaloTTOnOffIdMap ()
void set (const PDATA &t)
 initialize from Nova
HWIdentifier createSignalChannelID (const Identifier &id, bool bQuiet=false) const
 return the corresponfing online Id of an offline one
Identifier cnvToIdentifier (const HWIdentifier &sid, bool bQuiet=false) const
 return the corresponfing offline Id of an online one
CaloTTOnOffId_PgetP ()
 return the persistified map
void set (const CaloTTOnOffId_P &t)
 initialize from POOL

Private Member Functions

void convert_to_P (const CaloTTOnOffId &t)
void convert_to_D (const CaloTTOnOffId_P &t, CaloTTOnOffId &d)

Private Attributes

std::map< Identifier, HWIdentifierm_off2onIdMap
std::map< HWIdentifier, Identifierm_on2offIdMap
CaloTTOnOffId_P m_persData

Detailed Description

This is a StoreGate object holding the TT offline-online map.

Its persistifiable version is the CaloTTOnOffId_P class

Author
Damien Prieur
maintained by Damien Prieur

Definition at line 25 of file CaloTTOnOffIdMap.h.

Member Typedef Documentation

◆ PDATA

Definition at line 29 of file CaloTTOnOffIdMap.h.

Constructor & Destructor Documentation

◆ CaloTTOnOffIdMap()

CaloTTOnOffIdMap::CaloTTOnOffIdMap ( )

Definition at line 20 of file CaloTTOnOffIdMap.cxx.

20 {
21}

◆ ~CaloTTOnOffIdMap()

CaloTTOnOffIdMap::~CaloTTOnOffIdMap ( )

Definition at line 24 of file CaloTTOnOffIdMap.cxx.

24 {
25}

Member Function Documentation

◆ cnvToIdentifier()

Identifier CaloTTOnOffIdMap::cnvToIdentifier ( const HWIdentifier & sid,
bool bQuiet = false ) const

return the corresponfing offline Id of an online one

Definition at line 117 of file CaloTTOnOffIdMap.cxx.

117 {
118
119 std::map<HWIdentifier,Identifier>::const_iterator it=m_on2offIdMap.find(sid);
120
121 if(it!=m_on2offIdMap.end()){
122 return (*it).second;
123 }
124
125 if(bQuiet) {
126 return Identifier(0);
127
128 } else {
129
130 // ERROR, can not find the channelId.
131 REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "CaloTTOnOffIdMap") <<
132 "Online ID not found, id = " <<sid.get_compact()<< endmsg;
133
134 return Identifier(0) ;
135 }
136}
#define endmsg
#define REPORT_MESSAGE_WITH_CONTEXT(LVL, CONTEXT_NAME)
Report a message, with an explicitly specified context name.
std::map< HWIdentifier, Identifier > m_on2offIdMap
value_type get_compact() const
Get the compact id.

◆ convert_to_D()

void CaloTTOnOffIdMap::convert_to_D ( const CaloTTOnOffId_P & t,
CaloTTOnOffId & d )
private

Definition at line 168 of file CaloTTOnOffIdMap.cxx.

168 {
169
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();
172
173 d.clear();
174 for ( ;it!=it_e;++it){
175 const CaloTTOnOffId_P::__t& t = *it;
176 CaloTTOnOffId_t t2 ;
177
178 t2.pn = t.pn;
179 t2.sampling = t.sampling;
180 t2.region = t.region;
181 t2.eta = t.eta;
182 t2.phi = t.phi;
183 t2.layer = t.layer;
184
185 t2.crate = t.crate ;
186 t2.module = t.module;
187 t2.submodule= t.submodule;
188 t2.channel = t.channel;
189
190 d.push_back(t2);
191 }
192}
CaloTTOnOffId_P_t __t
std::vector< ALFA_RawDataContainer_p1 > t2

◆ convert_to_P()

void CaloTTOnOffIdMap::convert_to_P ( const CaloTTOnOffId & t)
private

Definition at line 142 of file CaloTTOnOffIdMap.cxx.

142 {
143
144 CaloTTOnOffId::const_iterator it = d.begin();
145 CaloTTOnOffId::const_iterator it_e = d.end();
146
147 for ( ;it!=it_e;++it){
148 const CaloTTOnOffId_t& t = *it;
150
151 t2.pn = t.pn;
152 t2.sampling = t.sampling;
153 t2.region = t.region;
154 t2.eta = t.eta;
155 t2.phi = t.phi;
156 t2.layer = t.layer;
157
158 t2.crate = t.crate ;
159 t2.module = t.module;
160 t2.submodule= t.submodule;
161 t2.channel = t.channel;
162
163 m_persData.m_v.push_back(t2);
164 }
165}
CaloTTOnOffId_P m_persData

◆ createSignalChannelID()

HWIdentifier CaloTTOnOffIdMap::createSignalChannelID ( const Identifier & id,
bool bQuiet = false ) const

return the corresponfing online Id of an offline one

Definition at line 95 of file CaloTTOnOffIdMap.cxx.

95 {
96
97 std::map<Identifier,HWIdentifier>::const_iterator it =m_off2onIdMap.find(id);
98
99 if(it!=m_off2onIdMap.end()){
100 return (*it).second;
101 }
102
103 if(bQuiet) {
104 return HWIdentifier(0);
105
106 } else {
107
108 REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "CaloTTOnOffIdMap") <<
109 "Offline ID not found "<< id <<endmsg;
110
111 return HWIdentifier(0);
112 }
113}
std::map< Identifier, HWIdentifier > m_off2onIdMap

◆ getP()

CaloTTOnOffId_P * CaloTTOnOffIdMap::getP ( )

return the persistified map

Definition at line 138 of file CaloTTOnOffIdMap.cxx.

138 {
139 return &m_persData;
140}

◆ set() [1/2]

void CaloTTOnOffIdMap::set ( const CaloTTOnOffId_P & t)

initialize from POOL

Definition at line 194 of file CaloTTOnOffIdMap.cxx.

194 {
195
197 convert_to_D(p,d);
198 set(d);
199 m_persData.m_version = p.m_version;
200 return;
201}
std::vector< CaloTTOnOffId_t > CaloTTOnOffId
void convert_to_D(const CaloTTOnOffId_P &t, CaloTTOnOffId &d)
void set(const PDATA &t)
initialize from Nova

◆ set() [2/2]

void CaloTTOnOffIdMap::set ( const PDATA & t)

initialize from Nova

Definition at line 28 of file CaloTTOnOffIdMap.cxx.

28 {
29
30 convert_to_P(m);
31
32 SmartIF<IMessageSvc> msgSvc{Gaudi::svcLocator()->service("MessageSvc")};
33 if(!msgSvc){
34 throw std::runtime_error("Cannot locate MessageSvc");
35 }
36 MsgStream log( msgSvc, "CaloTTOnOffIdMap");
37
38 log<<MSG::DEBUG<<" CaloTTOnOffId size = "<<m.size() <<endmsg;
39
40 SmartIF<StoreGateSvc> detStore{Gaudi::svcLocator()->service("DetectorStore")};
41 if(!detStore){
42 log << MSG::ERROR << "Cannot locate DetectorStore" << endmsg;
43 }
44
45 const TTOnlineID* online_id = nullptr;
46 const CaloLVL1_ID* offline_id = nullptr;
47
48 StatusCode status=detStore->retrieve(online_id);
49 if(status.isFailure()){
50 log << MSG::ERROR << "Cannot retrieve online_id" << endmsg;
51 }
52 status=detStore->retrieve(offline_id);
53 if(status.isFailure()){
54 log << MSG::ERROR << "Cannot retrieve offline_id" << endmsg;
55 }
56
57 CaloTTOnOffId::const_iterator it = m.begin();
58 CaloTTOnOffId::const_iterator it_e = m.end();
59
60 try {
61 for (; it!=it_e; ++it) {
62 const CaloTTOnOffId_t& t = *it;
63
64 Identifier id = offline_id->tower_id(t.pn, t.sampling, t.region, t.eta, t.phi);
65 HWIdentifier sid = online_id->channelId(t.crate, t.module, t.submodule, t.channel);
66
67 if (log.level()<=MSG::VERBOSE) {
68 log<<MSG::VERBOSE
69 << " db struct= "
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
76 << endmsg;
77
78 log<<MSG::VERBOSE<< " onl id = " << sid<<" offline id ="<<id<<endmsg;
79 }
80
81 m_off2onIdMap[id] = sid;
82 m_on2offIdMap[sid] = id;
83 }
84 if (log.level()<=MSG::DEBUG) {
85 log<<MSG::DEBUG<<" CaloTTOnOffIdMap::set : number of Ids="<<m_on2offIdMap.size()<<std::endl;
86 }
87 } catch (CaloID_Exception& except) {
88 log<<MSG::ERROR<<" Failed in CaloTTOnOffIdMap::set " << endmsg;
89 log<<MSG::ERROR<< (std::string) except << endmsg ;
90 }
91 return;
92}
Identifier tower_id(int pos_neg_z, int sampling, int region, int eta, int phi) const
build a tower identifier
void convert_to_P(const CaloTTOnOffId &t)
HWIdentifier channelId(int crate, int module, int submodule, int channel) const
(1) create towerId from fields
Definition TTOnlineID.h:390
::StatusCode StatusCode
StatusCode definition for legacy code.
msgSvc
Provide convenience handles for various services.
Definition StdJOSetup.py:36
status
Definition merge.py:16

Member Data Documentation

◆ m_off2onIdMap

std::map<Identifier,HWIdentifier> CaloTTOnOffIdMap::m_off2onIdMap
private

Definition at line 60 of file CaloTTOnOffIdMap.h.

◆ m_on2offIdMap

std::map<HWIdentifier,Identifier> CaloTTOnOffIdMap::m_on2offIdMap
private

Definition at line 61 of file CaloTTOnOffIdMap.h.

◆ m_persData

CaloTTOnOffId_P CaloTTOnOffIdMap::m_persData
private

Definition at line 63 of file CaloTTOnOffIdMap.h.


The documentation for this class was generated from the following files: