CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1MuGMTReadoutRecord.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
10 //
11 // $Date: 2010/07/12 08:38:50 $
12 // $Revision: 1.8 $
13 //
14 // Author :
15 // H. Sakulin HEPHY Vienna
16 //
17 // Migrated to CMSSW:
18 // I. Mikulec
19 //
20 //--------------------------------------------------
21 
22 //-----------------------
23 // This Class's Header --
24 //-----------------------
25 
27 
28 //---------------
29 // C++ Headers --
30 //---------------
31 
32 #include <iostream>
33 #include <iomanip>
34 #include <cmath>
35 #include <algorithm>
36 
37 //-------------------------------
38 // Collaborating Class Headers --
39 //-------------------------------
40 
41 using namespace std;
42 
43 //--------------------------------------
44 // class L1MuGMTReadoutRecord
45 //--------------------------------------
46 
47 //----------------
48 // Constructors --
49 //----------------
50 
52  m_BarrelCands(4), m_ForwardCands(4), m_GMTCands(4) {
53  reset();
54 }
55 
56 L1MuGMTReadoutRecord::L1MuGMTReadoutRecord(int bxie) : m_InputCands(16),
57  m_BarrelCands(4), m_ForwardCands(4), m_GMTCands(4) {
58  reset();
59  m_BxInEvent = bxie;
60 }
61 
62 //--------------
63 // Destructor --
64 //--------------
66 }
67 
68 //--------------
69 // Operations --
70 //--------------
71 
74 
75  m_BxNr = 0;
76  m_BxInEvent = 0;
77  m_EvNr = 0;
78  m_BCERR = 0;
79 
80  std::vector<L1MuRegionalCand>::iterator itr;
81  for(itr = m_InputCands.begin(); itr != m_InputCands.end(); itr++) (*itr).reset();
82 
83  std::vector<L1MuGMTExtendedCand>::iterator itg;
84  for(itg = m_BarrelCands.begin(); itg != m_BarrelCands.end(); itg++) (*itg).reset();
85  for(itg = m_ForwardCands.begin(); itg != m_ForwardCands.end(); itg++) (*itg).reset();
86  for(itg = m_GMTCands.begin(); itg != m_GMTCands.end(); itg++) (*itg).reset();
87  for(int i=0;i<8;i++) {
88  m_MIPbits[i]=0;
89  m_Quietbits[i]=0;
90  }
91 }
92 
94 vector<L1MuGMTExtendedCand> L1MuGMTReadoutRecord::getGMTCands() const {
95 
96  vector<L1MuGMTExtendedCand> cands;
97 
98  std::vector<L1MuGMTExtendedCand>::const_iterator it;
99  for(it = m_BarrelCands.begin(); it != m_BarrelCands.end(); it++) {
100  if((*it).getDataWord()!=0) cands.push_back(*it);
101  }
102  for(it = m_ForwardCands.begin(); it != m_ForwardCands.end(); it++) {
103  if((*it).getDataWord()!=0) cands.push_back(*it);
104  }
105 
106  // sort by rank
107  stable_sort( cands.begin(), cands.end(), L1MuGMTExtendedCand::RankRef() );
108 
109 
110  return cands;
111 }
112 
114 vector<L1MuGMTExtendedCand>& L1MuGMTReadoutRecord::getGMTCandsData() {
115 
116  return m_GMTCands;
117 
118 }
119 
121 vector<L1MuGMTExtendedCand> L1MuGMTReadoutRecord::getGMTBrlCands() const {
122 
123  vector<L1MuGMTExtendedCand> cands;
124  std::vector<L1MuGMTExtendedCand>::const_iterator it;
125  for(it = m_BarrelCands.begin(); it != m_BarrelCands.end(); it++) {
126  if((*it).getDataWord()!=0) cands.push_back(*it);
127  }
128 
129  return cands;
130 
131 }
132 
134 vector<L1MuGMTExtendedCand> L1MuGMTReadoutRecord::getGMTFwdCands() const {
135 
136  vector<L1MuGMTExtendedCand> cands;
137  std::vector<L1MuGMTExtendedCand>::const_iterator it;
138  for(it = m_ForwardCands.begin(); it != m_ForwardCands.end(); it++) {
139  if((*it).getDataWord()!=0) cands.push_back(*it);
140  }
141 
142  return cands;
143 
144 }
145 
147 vector<L1MuRegionalCand> L1MuGMTReadoutRecord::getDTBXCands() const {
148 
149  vector<L1MuRegionalCand> cands;
150 
151  for (int i=0; i<4; i++)
152  if(m_InputCands[i].getDataWord() != 0)
153  cands.push_back( m_InputCands[i] );
154 
155 
156  return cands;
157 }
158 
159 
161 vector<L1MuRegionalCand> L1MuGMTReadoutRecord::getCSCCands() const {
162 
163  vector<L1MuRegionalCand> cands;
164 
165  for (int i=0; i<4; i++)
166  if(m_InputCands[i+8].getDataWord() != 0)
167  cands.push_back( m_InputCands[i+8] );
168 
169  return cands;
170 }
171 
173 vector<L1MuRegionalCand> L1MuGMTReadoutRecord::getBrlRPCCands() const {
174 
175  vector<L1MuRegionalCand> cands;
176 
177  for (int i=0; i<4; i++)
178  if(m_InputCands[i+4].getDataWord() != 0)
179  cands.push_back( m_InputCands[i+4] );
180 
181  return cands;
182 }
183 
185 vector<L1MuRegionalCand> L1MuGMTReadoutRecord::getFwdRPCCands() const {
186 
187  vector<L1MuRegionalCand> cands;
188 
189  for (int i=0; i<4; i++)
190  if(m_InputCands[i+12].getDataWord() != 0)
191  cands.push_back( m_InputCands[i+12] );
192 
193  return cands;
194 }
195 
197 unsigned L1MuGMTReadoutRecord::getMIPbit(int eta, int phi) const {
198 
199  if (phi<0 || phi > 17 || eta < 0 || eta > 13) return 0;
200 
201  int idx = eta * 18 + phi;
202  int idx_word = idx / 32;
203  int idx_bit = idx % 32;
204 
205  unsigned mask = 1 << (idx_bit-1);
206 
207  return( m_MIPbits[idx_word] & mask) ? 1 : 0;
208 
209 }
210 
211 
213 unsigned L1MuGMTReadoutRecord::getQuietbit(int eta, int phi) const {
214 
215  if (phi<0 || phi > 17 || eta < 0 || eta > 13) return 0;
216 
217  int idx = eta * 18 + phi;
218  int idx_word = idx / 32;
219  int idx_bit = idx % 32;
220 
221  unsigned mask = 1 << (idx_bit-1);
222 
223  return( m_Quietbits[idx_word] & mask) ? 1 : 0;
224 
225 }
226 
227 
228 
229 //
230 // Setters
231 //
232 
235  if (nr>=0 && nr < 16) {
236  m_InputCands[nr] = cand;
237  }
238 }
239 
241 void L1MuGMTReadoutRecord::setInputCand(int nr, unsigned data) {
242  if (nr>=0 && nr < 16) {
244  }
245 }
246 
249  if (nr>=0 && nr<4) {
250  m_BarrelCands[nr] = cand;
251  }
252 }
253 
255 void L1MuGMTReadoutRecord::setGMTBrlCand(int nr, unsigned data, unsigned rank) {
256  if (nr>=0 && nr<4) {
258  }
259 }
260 
263  if (nr>=0 && nr<4) {
264  m_ForwardCands[nr] = cand;
265  }
266 }
267 
269 void L1MuGMTReadoutRecord::setGMTFwdCand(int nr, unsigned data, unsigned rank) {
270  if (nr>=0 && nr<4) {
272  }
273 }
274 
277  if (nr>=0 && nr<4) {
278  m_GMTCands[nr] = cand;
279  }
280 }
281 
283 void L1MuGMTReadoutRecord::setGMTCand(int nr, unsigned data) {
284  if (nr>=0 && nr<4) {
286  }
287 }
288 
289 
290 
292 unsigned L1MuGMTReadoutRecord::getBrlRank(int i) const {
293 
294  return m_BarrelCands[i].rank();
295 
296 }
297 
298 
300 unsigned L1MuGMTReadoutRecord::getFwdRank(int i) const {
301 
302  return m_ForwardCands[i].rank();
303 
304 }
305 
308 
309  if (i>=0 && i<4) {
310  m_BarrelCands[i].setRank(value);
311  }
312 
313 }
314 
315 
318 
319  if (i>=0 && i<4) {
320  m_ForwardCands[i].setRank(value);
321  }
322 
323 }
324 
327 
328  if (phi<0 || phi > 17 || eta < 0 || eta > 13) return;
329 
330  int idx = eta * 18 + phi;
331  int idx_word = idx / 32;
332  int idx_bit = idx % 32;
333 
334  unsigned mask = 1 << (idx_bit-1);
335 
336  m_MIPbits[idx_word] |= mask;
337 
338 }
339 
340 
343 
344  if (phi<0 || phi > 17 || eta < 0 || eta > 13) return;
345 
346  int idx = eta * 18 + phi;
347  int idx_word = idx / 32;
348  int idx_bit = idx % 32;
349 
350  unsigned mask = 1 << (idx_bit-1);
351 
352  m_Quietbits[idx_word] |= mask;
353 
354 }
355 
356 
357 
358 
359 
360 
361 
362 
363 
364 
365 
366 
367 
368 
369 
370 
371 
372 
373 
374 
std::vector< L1MuGMTExtendedCand > & getGMTCandsData()
get GMT candidates vector as stored in data (no rank info)
int i
Definition: DBlmapReader.cc:9
std::vector< L1MuGMTExtendedCand > getGMTCands() const
get GMT candidates vector
std::vector< L1MuRegionalCand > m_InputCands
void setFwdRank(int i, unsigned value)
set rank of fwd cand i
L1MuGMTReadoutRecord()
constructors
void setBrlRank(int i, unsigned value)
set rank of brl cand i
void setGMTBrlCand(int nr, L1MuGMTExtendedCand const &cand)
set GMT barrel candidate
std::vector< L1MuGMTExtendedCand > m_BarrelCands
define a rank for muon candidates
void setGMTFwdCand(int nr, L1MuGMTExtendedCand const &cand)
set GMT forward candidate
void setInputCand(int nr, unsigned data)
set Input muon
unsigned getQuietbit(int eta, int phi) const
get Quiet bit
T eta() const
std::vector< L1MuRegionalCand > getBrlRPCCands() const
get barrel RPC candidates vector
void setQuietbit(int eta, int phi)
set Quiet bit
void reset()
reset the record
std::vector< L1MuRegionalCand > getFwdRPCCands() const
get forward RPC candidates vector
void setMIPbit(int eta, int phi)
set MIP bit
std::vector< L1MuRegionalCand > getCSCCands() const
get CSC candidates vector
std::vector< L1MuGMTExtendedCand > getGMTBrlCands() const
get GMT barrel candidates vector
std::vector< L1MuRegionalCand > getDTBXCands() const
get DT candidates vector
unsigned getMIPbit(int eta, int phi) const
get MIP bit
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
std::vector< L1MuGMTExtendedCand > getGMTFwdCands() const
get GMT forward candidates vector
void setGMTCand(int nr, L1MuGMTExtendedCand const &cand)
set GMT candidate (does not store rank)
std::vector< L1MuGMTExtendedCand > m_GMTCands
virtual ~L1MuGMTReadoutRecord()
destructor
std::vector< L1MuGMTExtendedCand > m_ForwardCands
unsigned getFwdRank(int i) const
get rank of fwd cand i
unsigned getBrlRank(int i) const
get rank of brl cand i
Definition: DDAxes.h:10