ATLAS Offline Software
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),
12  m_type(SLB_NONE)
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 
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),
29  m_type(SLB_HIT)
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 
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 
50 const 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
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 
150 bool Muon::TgcSlbData::isLowPt(void) const
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 
160 bool 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 
175  m_l1Id = l1Id;
176 }
177 
179  m_sswId = sswId;
180 }
181 
183  m_slbId = slbId;
184 }
185 
187  m_sbLoc = sbLoc;
188 }
189 
191  m_error = error;
192 }
193 
195  return m_bcId;
196 }
197 
199  return m_l1Id;
200 }
201 
203  return m_sswId;
204 }
205 
207  return m_slbId;
208 }
209 
211  return m_sbLoc;
212 }
213 
215  return m_error;
216 }
Muon::TgcSlbData::getSbLoc
uint16_t getSbLoc() const
Get sbLoc.
Definition: TgcSlbData.cxx:210
Muon::TgcSlbData::getSswId
uint16_t getSswId() const
Get sswId.
Definition: TgcSlbData.cxx:202
Muon::TgcSlbData::isInner
bool isInner(void) const
Check if the SLB type is inner LowPt.
Definition: TgcSlbData.cxx:165
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
Muon::TgcSlbData::isSL
bool isSL(void) const
Check if the SLB type is SL.
Definition: TgcSlbData.cxx:160
TgcSlbData.h
Muon::TgcSlbData::BITMAP_SIZE
@ BITMAP_SIZE
Definition: TgcSlbData.h:31
Muon::nsw::Constants::CELL_SIZE
constexpr uint32_t CELL_SIZE
Definition: NSWPadTriggerL1a.h:134
Muon::TgcSlbData::setType
void setType(int vType)
Set SLB type.
Definition: TgcSlbData.cxx:140
Muon::TgcSlbData::setL1Id
void setL1Id(uint32_t l1Id)
Set l1Id.
Definition: TgcSlbData.cxx:174
Muon::TgcSlbData::getBcId
uint16_t getBcId() const
Get bcId.
Definition: TgcSlbData.cxx:194
WriteCellNoiseToCool.cellData
cellData
Definition: WriteCellNoiseToCool.py:336
Muon::TgcSlbData::m_bitArray_P
bool m_bitArray_P[BITMAP_SIZE]
Bit array at previous bunch.
Definition: TgcSlbData.h:141
Muon::TgcSlbData::isHighPt
bool isHighPt(void) const
Check if the SLB type is HighPt.
Definition: TgcSlbData.cxx:155
m_type
TokenType m_type
the type
Definition: TProperty.cxx:44
Muon::TgcSlbData::getError
uint16_t getError() const
Get error.
Definition: TgcSlbData.cxx:214
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
Muon::TgcSlbData::setBitmap
void setBitmap(const uint16_t bcTag, const uint32_t cellAddr, const uint32_t cellData)
Store bitmap.
Definition: TgcSlbData.cxx:100
lumiFormat.i
int i
Definition: lumiFormat.py:92
Muon::TgcSlbData::isLowPt
bool isLowPt(void) const
Check if the SLB type is LowPt.
Definition: TgcSlbData.cxx:150
Muon::TgcSlbData::equal
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.
Definition: TgcSlbData.cxx:42
Muon::TgcSlbData::getL1Id
uint32_t getL1Id() const
Get l1Id.
Definition: TgcSlbData.cxx:198
Muon::TgcSlbData::setSswId
void setSswId(uint16_t sswId)
Set sswId.
Definition: TgcSlbData.cxx:178
Muon::TgcSlbData::setSlbId
void setSlbId(uint16_t slbId)
Set slbId.
Definition: TgcSlbData.cxx:182
Muon::TgcSlbData::setBit
void setBit(const uint16_t bcTag, uint32_t iBit)
Set a bit.
Definition: TgcSlbData.cxx:124
Muon::TgcSlbData::setBcId
void setBcId(uint16_t bcId)
Set bcId.
Definition: TgcSlbData.cxx:170
Muon::TgcSlbData::isCoincidence
bool isCoincidence(void) const
Check if the SLB type is coincidence.
Definition: TgcSlbData.cxx:145
bcId
uint16_t bcId(uint32_t data)
Definition: TgcByteStreamData.h:329
Muon::TgcSlbData::getSlbId
uint16_t getSlbId() const
Get slbId.
Definition: TgcSlbData.cxx:206
Muon::TgcSlbData::~TgcSlbData
virtual ~TgcSlbData(void)
Destructor.
Muon::TgcSlbData::setSbLoc
void setSbLoc(uint16_t sbLoc)
Set sbLoc.
Definition: TgcSlbData.cxx:186
Muon::TgcSlbData::getType
int getType() const
Get SLB type.
Definition: TgcSlbData.cxx:135
bcTag
unsigned bcTag(unsigned bcBitMap)
Definition: TgcByteStreamData.h:367
Muon::TgcSlbData::setError
void setError(uint16_t error)
Set Error.
Definition: TgcSlbData.cxx:190
get_generator_info.error
error
Definition: get_generator_info.py:40
Muon::TgcSlbData::TgcSlbData
TgcSlbData(void)
Costructor.
Definition: TgcSlbData.cxx:7
error
Definition: IImpactPoint3dEstimator.h:70
Muon::TgcSlbData::m_bitArray_N
bool m_bitArray_N[BITMAP_SIZE]
Bit array at next bunch.
Definition: TgcSlbData.h:143
Muon::TgcSlbData::m_bitArray_C
bool m_bitArray_C[BITMAP_SIZE]
Bit array at central bunch.
Definition: TgcSlbData.h:139
Muon::TgcSlbData::getBitArray
const bool * getBitArray(const uint16_t bcTag) const
Get bitArray for a BC tag.
Definition: TgcSlbData.cxx:50