ATLAS Offline Software
Loading...
Searching...
No Matches
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
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
16 m_lookup[id]=m_size;
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
30 m_lookup[id]=m_size;
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)
63
64 // if invalid index
65 return INVALID_ID;
66}
67
68
70uint16_t TgcRdoIdHash::rodId(int index) const
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
81int 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}
std::vector< ID > m_int2id
reverse lookup
uint16_t rodId(int i) const
reverse conversion : ROD ID
std::vector< uint16_t > m_int2subDetectorId
reverse lookup for SubDetectorID and ROD ID
std::map< ID, int > m_lookup
lookup table
uint16_t ID
std::vector< uint16_t > m_int2rodId
int operator()(const ID &id) const
Convert ID to int.
int m_size
total number of IDs
uint16_t subDetectorId(int i) const
reverse conversion for SubDetectorID and ROD ID
ID identifier(int i) const
reverse conversion
Definition index.py:1