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