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

#include <TgcRdoIdHash.h>

Collaboration diagram for TgcRdoIdHash:

Public Types

enum  { INVALID_ID = 0xFFFF }
typedef uint16_t ID

Public Member Functions

 TgcRdoIdHash ()
virtual ~TgcRdoIdHash ()
int operator() (const ID &id) const
 Convert ID to int.
int max () const
 return maximum number of IDs
ID identifier (int i) const
 reverse conversion
uint16_t subDetectorId (int i) const
 reverse conversion for SubDetectorID and ROD ID
uint16_t rodId (int i) const
 reverse conversion : ROD ID

Private Attributes

int m_size
 total number of IDs
std::map< ID, int > m_lookup
 lookup table
std::vector< IDm_int2id
 reverse lookup
std::vector< uint16_t > m_int2subDetectorId
 reverse lookup for SubDetectorID and ROD ID
std::vector< uint16_t > m_int2rodId

Detailed Description

Definition at line 17 of file TgcRdoIdHash.h.

Member Typedef Documentation

◆ ID

typedef uint16_t TgcRdoIdHash::ID

Definition at line 21 of file TgcRdoIdHash.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
INVALID_ID 

Definition at line 40 of file TgcRdoIdHash.h.

40{INVALID_ID = 0xFFFF};

Constructor & Destructor Documentation

◆ TgcRdoIdHash()

TgcRdoIdHash::TgcRdoIdHash ( )

Definition at line 9 of file TgcRdoIdHash.cxx.

9 {
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}
std::vector< ID > m_int2id
reverse lookup
std::vector< uint16_t > m_int2subDetectorId
reverse lookup for SubDetectorID and ROD ID
std::map< ID, int > m_lookup
lookup table
std::vector< uint16_t > m_int2rodId
int m_size
total number of IDs

◆ ~TgcRdoIdHash()

virtual TgcRdoIdHash::~TgcRdoIdHash ( )
inlinevirtual

Definition at line 24 of file TgcRdoIdHash.h.

24{}

Member Function Documentation

◆ identifier()

TgcRdoIdHash::ID TgcRdoIdHash::identifier ( int i) const

reverse conversion

Definition at line 48 of file TgcRdoIdHash.cxx.

49{
50 if (index>=0 && index < m_size)
51 return m_int2id[index];
52
53 // if invalid index
54 return INVALID_ID;
55}
str index
Definition DeMoScan.py:362

◆ max()

int TgcRdoIdHash::max ( ) const
inline

return maximum number of IDs

Definition at line 30 of file TgcRdoIdHash.h.

30{return m_size;}

◆ operator()()

int TgcRdoIdHash::operator() ( const ID & id) const

Convert ID to int.

return INVALID_ID if invalid ID

return -1 if invalid ID

Definition at line 81 of file TgcRdoIdHash.cxx.

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}

◆ rodId()

uint16_t TgcRdoIdHash::rodId ( int i) const

reverse conversion : ROD ID

Definition at line 70 of file TgcRdoIdHash.cxx.

71{
72 if (index>=0 && index < m_size)
73 return m_int2rodId[index];
74
75 // if invalid index
76 return INVALID_ID;
77}

◆ subDetectorId()

uint16_t TgcRdoIdHash::subDetectorId ( int i) const

reverse conversion for SubDetectorID and ROD ID

reverse conversion : SubDetectorID

Definition at line 59 of file TgcRdoIdHash.cxx.

60{
61 if (index>=0 && index < m_size)
63
64 // if invalid index
65 return INVALID_ID;
66}

Member Data Documentation

◆ m_int2id

std::vector<ID> TgcRdoIdHash::m_int2id
private

reverse lookup

Definition at line 52 of file TgcRdoIdHash.h.

◆ m_int2rodId

std::vector<uint16_t> TgcRdoIdHash::m_int2rodId
private

Definition at line 57 of file TgcRdoIdHash.h.

◆ m_int2subDetectorId

std::vector<uint16_t> TgcRdoIdHash::m_int2subDetectorId
private

reverse lookup for SubDetectorID and ROD ID

Definition at line 56 of file TgcRdoIdHash.h.

◆ m_lookup

std::map<ID,int> TgcRdoIdHash::m_lookup
private

lookup table

Definition at line 48 of file TgcRdoIdHash.h.

◆ m_size

int TgcRdoIdHash::m_size
private

total number of IDs

Definition at line 44 of file TgcRdoIdHash.h.


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