ATLAS Offline Software
TgcRdoIdHash.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "MuonRDO/TgcRdoIdHash.h"
6 #include "MuonRDO/TgcRdo.h"
7 
8 // default contructor
10  m_size=0;
11 
12  // loop over all RODs
13  for (uint16_t id=0; id<30; ++id){
14  if (id < 24) {
15  // map
17  m_int2id.push_back(id);
18  ++m_size;
19 
20  // SubDetectorID
21  if (id < 12) // A-side
22  m_int2subDetectorId.push_back(0x67);
23  else
24  m_int2subDetectorId.push_back(0x68);
25 
26  // ROD ID
27  m_int2rodId.push_back( (id % 12) + 1);
28  } else { // SROD
29  // map
31  m_int2id.push_back(id);
32  ++m_size;
33 
34  // SubDetectorID
35  if (id < 27) // A-side
36  m_int2subDetectorId.push_back(0x67);
37  else
38  m_int2subDetectorId.push_back(0x68);
39 
40  // SROD ID
41  m_int2rodId.push_back( (id - 24) % 3 + 17 ); // 17-19
42  }
43  }
44 }
45 
46 
49 {
50  if (index>=0 && index < m_size)
51  return m_int2id[index];
52 
53  // if invalid index
54  return INVALID_ID;
55 }
56 
57 
60 {
61  if (index>=0 && index < m_size)
62  return m_int2subDetectorId[index];
63 
64  // if invalid index
65  return INVALID_ID;
66 }
67 
68 
71 {
72  if (index>=0 && index < m_size)
73  return m_int2rodId[index];
74 
75  // if invalid index
76  return INVALID_ID;
77 }
78 
79 
81 int TgcRdoIdHash::operator() (const ID& id) const
82 {
83  std::map<ID,int>::const_iterator it = m_lookup.find(id);
84  if(it!=m_lookup.end())
85  return (*it).second;
86 
87  // if invalid ID
88  return INVALID_ID;
89 }
TgcRdoIdHash::operator()
int operator()(const ID &id) const
Convert ID to int.
Definition: TgcRdoIdHash.cxx:81
TgcRdoIdHash::m_size
int m_size
total number of IDs
Definition: TgcRdoIdHash.h:44
TgcRdoIdHash::TgcRdoIdHash
TgcRdoIdHash()
Definition: TgcRdoIdHash.cxx:9
index
Definition: index.py:1
skel.it
it
Definition: skel.GENtoEVGEN.py:423
TgcRdoIdHash::m_int2subDetectorId
std::vector< uint16_t > m_int2subDetectorId
reverse lookup for SubDetectorID and ROD ID
Definition: TgcRdoIdHash.h:56
TgcRdoIdHash::INVALID_ID
@ INVALID_ID
Definition: TgcRdoIdHash.h:40
TgcRdoIdHash::subDetectorId
uint16_t subDetectorId(int i) const
reverse conversion for SubDetectorID and ROD ID
Definition: TgcRdoIdHash.cxx:59
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
TgcRdoIdHash::ID
uint16_t ID
Definition: TgcRdoIdHash.h:21
TgcRdo.h
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:191
TgcRdoIdHash::rodId
uint16_t rodId(int i) const
reverse conversion : ROD ID
Definition: TgcRdoIdHash.cxx:70
DeMoScan.index
string index
Definition: DeMoScan.py:362
TgcRdoIdHash::m_int2id
std::vector< ID > m_int2id
reverse lookup
Definition: TgcRdoIdHash.h:52
TgcRdoIdHash.h
TgcRdoIdHash::m_int2rodId
std::vector< uint16_t > m_int2rodId
Definition: TgcRdoIdHash.h:57
TgcRdoIdHash::m_lookup
std::map< ID, int > m_lookup
lookup table
Definition: TgcRdoIdHash.h:48
TgcRdoIdHash::identifier
ID identifier(int i) const
reverse conversion
Definition: TgcRdoIdHash.cxx:48