ATLAS Offline Software
Loading...
Searching...
No Matches
TgcSlbData.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "TgcSlbData.h"
6
8 : m_bcId(0),
9 m_l1Id(0),
10 m_sswId(999),
11 m_slbId(999),
12 m_sbLoc(999),
13 m_error(0),
15 // init bit array
16 for (int i = 0; i < BITMAP_SIZE; ++i) {
17 m_bitArray_C[i] = false;
18 m_bitArray_P[i] = false;
19 m_bitArray_N[i] = false;
20 }
21}
22
23Muon::TgcSlbData::TgcSlbData(uint16_t bcId, uint32_t l1Id, uint16_t sswId,
24 uint16_t slbId)
25 : m_bcId(bcId),
26 m_l1Id(l1Id),
27 m_sswId(sswId),
28 m_slbId(slbId),
29 m_sbLoc(999),
30 m_error(0),
32 // init bit array
33 for (int i = 0; i < BITMAP_SIZE; ++i) {
34 m_bitArray_C[i] = false;
35 m_bitArray_P[i] = false;
36 m_bitArray_N[i] = false;
37 }
38}
39
41
42bool Muon::TgcSlbData::equal(uint16_t /* bcId */, uint32_t l1Id, uint16_t sswId,
43 uint16_t slbId) const {
44 return ((m_l1Id == l1Id) && (m_sswId == sswId) && (m_slbId == slbId));
45}
46
47const bool* Muon::TgcSlbData::getBitArray(const uint16_t bcTag) const {
48 const bool* bitArray = nullptr;
49 switch (bcTag) {
50 case BC_CENTRAL:
51 bitArray = m_bitArray_C;
52 break;
53 case BC_PREVIOUS:
54 bitArray = m_bitArray_P;
55 break;
56 case BC_NEXT:
57 bitArray = m_bitArray_N;
58 break;
59 case BC_UNDEFINED:
60 bitArray = m_bitArray_C; // for backward compatibility
61 break;
62 default:
63 bitArray = nullptr;
64 break;
65 }
66 return bitArray;
67}
68
69// This function avoids using const cast internally
70bool* Muon::TgcSlbData::getBitArray(const uint16_t bcTag) {
71 bool* bitArray = nullptr;
72 switch (bcTag) {
73 case BC_CENTRAL:
74 bitArray = m_bitArray_C;
75 break;
76 case BC_PREVIOUS:
77 bitArray = m_bitArray_P;
78 break;
79 case BC_NEXT:
80 bitArray = m_bitArray_N;
81 break;
82 case BC_UNDEFINED:
83 bitArray = m_bitArray_C; // for backward compatibility
84 break;
85 default:
86 bitArray = nullptr;
87 break;
88 }
89 return bitArray;
90}
91
92// store bitmap
93void Muon::TgcSlbData::setBitmap(const uint16_t bcTag, const uint32_t cellAddr,
94 const uint32_t cellData) {
95 // Padding Word for 32-bit alignment
96 if (cellAddr == PADDING_WORD) {
97 return;
98 }
99
100 // get bit array
101 bool* bitArray = getBitArray(bcTag);
102
103 // assign
104 int indexMap = BITMAP_SIZE - CELL_SIZE * (cellAddr + 1);
105 if (indexMap < 0) {
106 return;
107 }
108
109 for (int iBit = 0; iBit < CELL_SIZE; ++iBit) {
110 // index check
111 if (indexMap + iBit >= BITMAP_SIZE) {
112 break;
113 }
114
115 if (cellData & (1 << iBit)) {
116 *(bitArray + indexMap + iBit) = true;
117 }
118 }
119}
120
121// set a bit
122void Muon::TgcSlbData::setBit(const uint16_t bcTag, uint32_t iBit)
123// set a bit
124{
125 if (iBit >= BITMAP_SIZE) {
126 return;
127 }
128
129 // get bit array
130 bool* bitArray = getBitArray(bcTag);
131 *(bitArray + iBit) = true;
132}
133
135 return m_type;
136}
137
139 m_type = vType;
140}
141
143 return (m_type != SLB_HIT);
144}
145
147 return ((m_type >= SLB_LPT_D_W) && (m_type <= SLB_LPT_I_S));
148}
149
151 return ((m_type == SLB_SL_E) || (m_type == SLB_SL_F));
152}
153
155 return ((m_type == SLB_SL_E) || (m_type == SLB_SL_F));
156}
157
159 return ((m_type == SLB_LPT_I_W) || (m_type == SLB_LPT_I_S));
160}
161
163 m_bcId = bcId;
164}
165
166void Muon::TgcSlbData::setL1Id(uint32_t l1Id) {
167 m_l1Id = l1Id;
168}
169
170void Muon::TgcSlbData::setSswId(uint16_t sswId) {
171 m_sswId = sswId;
172}
173
174void Muon::TgcSlbData::setSlbId(uint16_t slbId) {
175 m_slbId = slbId;
176}
177
178void Muon::TgcSlbData::setSbLoc(uint16_t sbLoc) {
179 m_sbLoc = sbLoc;
180}
181
183 m_error = error;
184}
185
187 return m_bcId;
188}
189
191 return m_l1Id;
192}
193
195 return m_sswId;
196}
197
199 return m_slbId;
200}
201
203 return m_sbLoc;
204}
205
207 return m_error;
208}
uint16_t bcId(uint32_t data)
unsigned bcTag(unsigned bcBitMap)
uint32_t getL1Id() const
Get l1Id.
int m_type
SLB type.
Definition TgcSlbData.h:137
void setSlbId(uint16_t slbId)
Set slbId.
void setBit(const uint16_t bcTag, uint32_t iBit)
Set a bit.
uint16_t getBcId() const
Get bcId.
uint16_t getSswId() const
Get sswId.
bool isLowPt() const
Check if the SLB type is LowPt.
void setBitmap(const uint16_t bcTag, const uint32_t cellAddr, const uint32_t cellData)
Store bitmap.
void setType(int vType)
Set SLB type.
bool isHighPt() const
Check if the SLB type is HighPt.
bool equal(uint16_t bcId, uint32_t l1Id, uint16_t sswId, uint16_t slbId) const
Check input IDs and held IDs are equal or not.
void setL1Id(uint32_t l1Id)
Set l1Id.
bool isCoincidence() const
Check if the SLB type is coincidence.
void setError(uint16_t error)
Set Error.
bool m_bitArray_N[BITMAP_SIZE]
Bit array at next bunch.
Definition TgcSlbData.h:134
bool m_bitArray_C[BITMAP_SIZE]
Bit array at central bunch.
Definition TgcSlbData.h:130
bool m_bitArray_P[BITMAP_SIZE]
Bit array at previous bunch.
Definition TgcSlbData.h:132
int getType() const
Get SLB type.
uint16_t getSbLoc() const
Get sbLoc.
TgcSlbData()
Costructor.
Definition TgcSlbData.cxx:7
void setBcId(uint16_t bcId)
Set bcId.
virtual ~TgcSlbData()
Destructor.
void setSswId(uint16_t sswId)
Set sswId.
bool isInner() const
Check if the SLB type is inner LowPt.
void setSbLoc(uint16_t sbLoc)
Set sbLoc.
bool isSL() const
Check if the SLB type is SL.
const bool * getBitArray(const uint16_t bcTag) const
Get bitArray for a BC tag.
uint16_t getSlbId() const
Get slbId.
uint16_t getError() const
Get error.