ATLAS Offline Software
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
CaloTTOnAttrIdMap Class Reference

#include <CaloTTOnAttrIdMap.h>

Collaboration diagram for CaloTTOnAttrIdMap:

Public Types

typedef CaloTTOnAttrId PDATA
 

Public Member Functions

 CaloTTOnAttrIdMap ()
 
 ~CaloTTOnAttrIdMap ()
 
void set (const PDATA &t)
 initialize from Nova More...
 
unsigned int em_had (HWIdentifier channelId) const
 return the corresponding sampling of channelId: More...
 
unsigned int pos_neg (HWIdentifier channelId) const
 return 0 for z<0 channels and 1 for z>0 channels More...
 
unsigned int barrel_endcap_fcal (HWIdentifier channelId) const
 To know if a channel belongs to the barrel, end cap or fcal parts. More...
 
unsigned int module_type (HWIdentifier channelId) const
 To get the type of the module connected to the channel: More...
 
CaloTTOnAttrId_PgetP ()
 return the persistified map More...
 
void set (const CaloTTOnAttrId_P &t)
 initialize from POOL More...
 

Private Member Functions

void convert_to_P (const CaloTTOnAttrId &t)
 
void convert_to_D (const CaloTTOnAttrId_P &t, CaloTTOnAttrId &d)
 

Private Attributes

std::map< HWIdentifier, AttrStructm_on2attrIdMap
 
CaloTTOnAttrId_P m_persData
 

Detailed Description

Definition at line 32 of file CaloTTOnAttrIdMap.h.

Member Typedef Documentation

◆ PDATA

Definition at line 36 of file CaloTTOnAttrIdMap.h.

Constructor & Destructor Documentation

◆ CaloTTOnAttrIdMap()

CaloTTOnAttrIdMap::CaloTTOnAttrIdMap ( )

Definition at line 18 of file CaloTTOnAttrIdMap.cxx.

18  {
19 }

◆ ~CaloTTOnAttrIdMap()

CaloTTOnAttrIdMap::~CaloTTOnAttrIdMap ( )

Definition at line 22 of file CaloTTOnAttrIdMap.cxx.

22  {
23 }

Member Function Documentation

◆ barrel_endcap_fcal()

unsigned int CaloTTOnAttrIdMap::barrel_endcap_fcal ( HWIdentifier  channelId) const

To know if a channel belongs to the barrel, end cap or fcal parts.

Returns
0: barrel
1: end cap
2: fcal
999: error

Definition at line 131 of file CaloTTOnAttrIdMap.cxx.

131  {
132  std::map<HWIdentifier,AttrStruct>::const_iterator it=m_on2attrIdMap.find(channelId);
133 
134  if(it!=m_on2attrIdMap.end()){
135  return ((*it).second).barrel_endcap_fcal;
136  }
137 
138  // ERROR, can not find the channelId.
139  IMessageSvc *msgSvc;
140  StatusCode status =Gaudi::svcLocator()->service("MessageSvc",msgSvc);
141  if(status.isFailure()){
142  std::cout << "Cannot locate MessageSvc" << std::endl;
143  }
144 
145  MsgStream log( msgSvc, "CaloTTOnAttrIdMap");
146  log<<MSG::ERROR<<" Online ID not found, channelId = " <<channelId.get_compact()<< endmsg;
147  return 0;
148 }

◆ convert_to_D()

void CaloTTOnAttrIdMap::convert_to_D ( const CaloTTOnAttrId_P t,
CaloTTOnAttrId d 
)
private

Definition at line 197 of file CaloTTOnAttrIdMap.cxx.

197  {
198 
199  std::vector<CaloTTOnAttrId_P::__t>::const_iterator it = p.m_v.begin();
200  std::vector<CaloTTOnAttrId_P::__t>::const_iterator it_e = p.m_v.end();
201 
202  d.clear();
203  for ( ;it!=it_e;++it){
204  const CaloTTOnAttrId_P::__t& t = *it;
206 
207  t2.crate = t.crate ;
208  t2.module = t.module;
209  t2.submodule= t.submodule;
210  t2.channel = t.channel;
211 
212  t2.em_had = t.em_had;
213  t2.pos_neg = t.pos_neg;
214  t2.barrel_endcap_fcal = t.barrel_endcap_fcal;
215  t2.module_type = t.module_type;
216 
217  d.push_back(t2);
218  }
219 }

◆ convert_to_P()

void CaloTTOnAttrIdMap::convert_to_P ( const CaloTTOnAttrId t)
private

Definition at line 173 of file CaloTTOnAttrIdMap.cxx.

173  {
174 
175  CaloTTOnAttrId::const_iterator it = d.begin();
176  CaloTTOnAttrId::const_iterator it_e = d.end();
177 
178  for ( ;it!=it_e;++it){
179  const CaloTTOnAttrId_t& t = *it;
181 
182  t2.crate = t.crate ;
183  t2.module = t.module;
184  t2.submodule= t.submodule;
185  t2.channel = t.channel;
186 
187  t2.em_had = t.em_had;
188  t2.pos_neg = t.pos_neg;
189  t2.barrel_endcap_fcal = t.barrel_endcap_fcal;
190  t2.module_type = t.module_type;
191 
192  m_persData.m_v.push_back(t2);
193  }
194 }

◆ em_had()

unsigned int CaloTTOnAttrIdMap::em_had ( HWIdentifier  channelId) const

return the corresponding sampling of channelId:

Returns
0: for EM calorimeter
1: for HAD calorimeter
999: error

Definition at line 94 of file CaloTTOnAttrIdMap.cxx.

94  {
95  std::map<HWIdentifier,AttrStruct>::const_iterator it=m_on2attrIdMap.find(channelId);
96 
97  if(it!=m_on2attrIdMap.end()){
98  return ((*it).second).em_had;
99  }
100 
101  // ERROR, can not find the channelId.
102  IMessageSvc *msgSvc;
103  StatusCode status =Gaudi::svcLocator()->service("MessageSvc",msgSvc);
104  if(status.isFailure()){
105  std::cout << "Cannot locate MessageSvc" << std::endl;
106  }
107 
108  MsgStream log( msgSvc, "CaloTTOnAttrIdMap");
109  log<<MSG::ERROR<<" Online ID not found, channelId = " <<channelId.get_compact()<< endmsg;
110  return 0;
111 }

◆ getP()

CaloTTOnAttrId_P * CaloTTOnAttrIdMap::getP ( )

return the persistified map

Definition at line 169 of file CaloTTOnAttrIdMap.cxx.

169  {
170  return &m_persData;
171 }

◆ module_type()

unsigned int CaloTTOnAttrIdMap::module_type ( HWIdentifier  channelId) const

To get the type of the module connected to the channel:

Returns
1: PPM
2: CPM
3: JEM
999: error

Definition at line 150 of file CaloTTOnAttrIdMap.cxx.

150  {
151  std::map<HWIdentifier,AttrStruct>::const_iterator it=m_on2attrIdMap.find(channelId);
152 
153  if(it!=m_on2attrIdMap.end()){
154  return ((*it).second).module_type;
155  }
156 
157  // ERROR, can not find the channelId.
158  IMessageSvc *msgSvc;
159  StatusCode status =Gaudi::svcLocator()->service("MessageSvc",msgSvc);
160  if(status.isFailure()){
161  std::cout << "Cannot locate MessageSvc" << std::endl;
162  }
163 
164  MsgStream log( msgSvc, "CaloTTOnAttrIdMap");
165  log<<MSG::ERROR<<" Online ID not found, channelId = " <<channelId.get_compact()<< endmsg;
166  return 0;
167 }

◆ pos_neg()

unsigned int CaloTTOnAttrIdMap::pos_neg ( HWIdentifier  channelId) const

return 0 for z<0 channels and 1 for z>0 channels

Definition at line 112 of file CaloTTOnAttrIdMap.cxx.

112  {
113  std::map<HWIdentifier,AttrStruct>::const_iterator it=m_on2attrIdMap.find(channelId);
114 
115  if(it!=m_on2attrIdMap.end()){
116  return ((*it).second).pos_neg;
117  }
118 
119  // ERROR, can not find the channelId.
120  IMessageSvc *msgSvc;
121  StatusCode status =Gaudi::svcLocator()->service("MessageSvc",msgSvc);
122  if(status.isFailure()){
123  std::cout << "Cannot locate MessageSvc" << std::endl;
124  }
125 
126  MsgStream log( msgSvc, "CaloTTOnAttrIdMap");
127  log<<MSG::ERROR<<" Online ID not found, channelId = " <<channelId.get_compact()<< endmsg;
128  return 0;
129 }

◆ set() [1/2]

void CaloTTOnAttrIdMap::set ( const CaloTTOnAttrId_P t)

initialize from POOL

Definition at line 221 of file CaloTTOnAttrIdMap.cxx.

221  {
222 
224  convert_to_D(p,d);
225  set(d);
226  m_persData.m_version = p.m_version;
227  return;
228 }

◆ set() [2/2]

void CaloTTOnAttrIdMap::set ( const PDATA t)

initialize from Nova

Definition at line 26 of file CaloTTOnAttrIdMap.cxx.

26  {
27 
28  convert_to_P(m);
29 
30  IMessageSvc *msgSvc;
31  StatusCode status =Gaudi::svcLocator()->service("MessageSvc",msgSvc);
32  if(status.isFailure()){
33  std::cout << "Cannot locate MessageSvc" << std::endl;
34  }
35  MsgStream log( msgSvc, "CaloTTOnAttrIdMap");
36  bool dump=false;
37  if (log.level()<=MSG::VERBOSE) dump=true;
38  bool dump2=false;
39  if (log.level()<=MSG::DEBUG) dump2=true;
40 
41  log<<MSG::DEBUG<<" CaloTTOnAttrId size = "<<m.size() <<endmsg;
43  status = Gaudi::svcLocator()->service("DetectorStore",detStore);
44  if(status.isFailure()){
45  log << MSG::ERROR << "Cannot locate DetectorStore" << endmsg;
46  }
47 
48  const TTOnlineID* online_id = nullptr;
49 
50  status=detStore->retrieve(online_id);
51  if(status.isFailure()){
52  log << MSG::ERROR << "Cannot retrieve online_id" << endmsg;
53  }
54 
55  CaloTTOnAttrId::const_iterator it = m.begin();
56  CaloTTOnAttrId::const_iterator it_e = m.end();
57 
58  try {
59  for (; it!=it_e; ++it) {
60  const CaloTTOnAttrId_t& t = *it;
61 
62  HWIdentifier sid = online_id->channelId(t.crate, t.module, t.submodule, t.channel);
63 
64  if (dump) {
66  << " db struct= "
67  <<" crate="<<t.crate<<" module="<<t.module
68  <<" submodule="<<t.submodule
69  <<" channel="<<t.channel
70  <<" em_had="<<t.em_had
71  <<" pos_neg="<<t.pos_neg
72  <<" barrel_endcap_fcal"<<t.barrel_endcap_fcal
73  << endmsg;
74 
75  log<<MSG::VERBOSE<< " onl id = " << sid <<endmsg;
76  }
77 
78  AttrStruct attrStruct;
79  attrStruct.em_had = t.em_had;
80  attrStruct.pos_neg = t.pos_neg;
81  attrStruct.barrel_endcap_fcal = t.barrel_endcap_fcal;
82  attrStruct.module_type = t.module_type;
83 
84  m_on2attrIdMap[sid] = attrStruct;
85  }
86  if (dump2) log<<MSG::DEBUG<<" CaloTTOnAttrIdMap::set : number of Ids="<<m_on2attrIdMap.size()<<std::endl;
87  } catch (CaloID_Exception& except) {
88  log<<MSG::ERROR<<" Failed in CaloTTOnAttrIdMap::set " << endmsg;
89  log<<MSG::ERROR<< (std::string) except << endmsg ;
90  }
91  return;
92 }

Member Data Documentation

◆ m_on2attrIdMap

std::map<HWIdentifier,AttrStruct> CaloTTOnAttrIdMap::m_on2attrIdMap
private

Definition at line 87 of file CaloTTOnAttrIdMap.h.

◆ m_persData

CaloTTOnAttrId_P CaloTTOnAttrIdMap::m_persData
private

Definition at line 89 of file CaloTTOnAttrIdMap.h.


The documentation for this class was generated from the following files:
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
CaloTTOnAttrId_t
Structure definition of the LArTTOnAttrIdMap.
Definition: CaloTTOnAttrId.h:15
CaloID_Exception
Exception class for Calo Identifiers.
Definition: CaloID_Exception.h:20
AttrStruct::module_type
unsigned int module_type
Definition: CaloTTOnAttrIdMap.h:29
hist_file_dump.d
d
Definition: hist_file_dump.py:137
TTOnlineID
Helper class for Calo TT online identifiers.
Definition: TTOnlineID.h:37
skel.it
it
Definition: skel.GENtoEVGEN.py:423
CaloTTOnAttrId
std::vector< CaloTTOnAttrId_t > CaloTTOnAttrId
Definition: CaloTTOnAttrId.h:27
AttrStruct::pos_neg
unsigned int pos_neg
Definition: CaloTTOnAttrIdMap.h:27
CaloTTOnAttrId_P::CaloTTOnAttrId_P_t
Structure of the map.
Definition: CaloTTOnAttrId_P.h:27
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
HWIdentifier
Definition: HWIdentifier.h:13
CaloTTOnAttrIdMap::convert_to_P
void convert_to_P(const CaloTTOnAttrId &t)
Definition: CaloTTOnAttrIdMap.cxx:173
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:128
AttrStruct
This is a StoreGate object holding the TT online-attribute map.
Definition: CaloTTOnAttrIdMap.h:25
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
CaloTTOnAttrIdMap::convert_to_D
void convert_to_D(const CaloTTOnAttrId_P &t, CaloTTOnAttrId &d)
Definition: CaloTTOnAttrIdMap.cxx:197
python.ChapPy.dump
def dump(buf, stdout=sys.stdout)
Definition: ChapPy.py:25
CaloCondBlobAlgs_fillNoiseFromASCII.channelId
channelId
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:122
CaloTTOnAttrIdMap::m_persData
CaloTTOnAttrId_P m_persData
Definition: CaloTTOnAttrIdMap.h:89
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
CaloTTOnAttrIdMap::m_on2attrIdMap
std::map< HWIdentifier, AttrStruct > m_on2attrIdMap
Definition: CaloTTOnAttrIdMap.h:87
CaloTTOnAttrId_P::m_version
int m_version
Definition: CaloTTOnAttrId_P.h:47
ALFA_EventTPCnv_Dict::t2
std::vector< ALFA_RawDataContainer_p1 > t2
Definition: ALFA_EventTPCnvDict.h:44
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
TTOnlineID::channelId
HWIdentifier channelId(int crate, int module, int submodule, int channel) const
(1) create towerId from fields
Definition: TTOnlineID.h:398
merge.status
status
Definition: merge.py:17
AttrStruct::barrel_endcap_fcal
unsigned int barrel_endcap_fcal
Definition: CaloTTOnAttrIdMap.h:28
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14
CaloTTOnAttrId_P::m_v
std::vector< __t > m_v
Definition: CaloTTOnAttrId_P.h:45
CaloTTOnAttrIdMap::set
void set(const PDATA &t)
initialize from Nova
Definition: CaloTTOnAttrIdMap.cxx:26
AttrStruct::em_had
unsigned int em_had
Definition: CaloTTOnAttrIdMap.h:26