ATLAS Offline Software
RPCRXRODDecode.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 
7 #include <math.h>
8 
9 #include <iostream>
10 
11 //----------------------------------------------------------------------------//
13  // std::cout<<" This is the constructor of RPCRXRODDecode "<<std::endl;
14  //
15  // define RPC data word indentifiers
16  //
17  m_field = 0xf000; // field map of word identifier
18  // reserved3 = 0xd000; // reserved
19  m_reserved4 = 0xe000; // reserved
20  // reserved5 = 0xf000; // reserved
21  //
22  // ROD Data Address
23  //
25  //
26  m_noRecord16 = 9999; // no record content for 16bit words
27  m_noRecord32 = 0xdeadcafe; // no record content for 32bit words
28  //
29  // the ROD header
30  //
43  //
44  // the RPC identifiers
45  //
49  //
50  // m_previousRecord initialization
51  //
53  //
54  // the structure control flags
55  //
57  m_CMFlag = 0;
58  m_PADFlag = 0;
59  m_RXFlag = 0;
60  m_isSLBody = false;
61  m_enablePrintOut = false;
62  m_slFound = false;
63 } // end-of-RPCRXRODDecode::RPCRXRODDecode
64 //----------------------------------------------------------------------------//
66 //----------------------------------------------------------------------------//
67 void RPCRXRODDecode::enablePrintOut() { m_enablePrintOut = true; } // RPCRXRODDecode::enablePrintOut
68 //----------------------------------------------------------------------------//
69 void RPCRXRODDecode::disablePrintOut() { m_enablePrintOut = false; } // dRPCRXRODDecode::disablePrintOut
70 //----------------------------------------------------------------------------//
71 int RPCRXRODDecode::pushWord(const RODword inword, ubit16 j, uint NOBXS) {
72  //
73  // select the less significant 16 bits (j=0) or the
74  // highest significant 16 bits (j=1) of the 32 bits word inword
75  // and push this 16 bit word selected to the method pushWord
76  // for decoding
77  //
78  RODword mask1[2];
79  RODword shift[2];
80  mask1[0] = 0x0000ffff;
81  mask1[1] = 0xffff0000;
82  shift[0] = 0;
83  shift[1] = 16;
84  return pushWord((inword & mask1[j]) >> shift[j], NOBXS);
85 }
86 //----------------------------------------------------------------------------//
87 int RPCRXRODDecode::pushWord(const ubit16 inword, uint NOBXS) {
88  //
89  // analyze the current inword ReadOutDriver (ROD) data word:
90  // 1st) identify the type of word and
91  // 2nd) fill the MatrixReadOut object when CM hits are present;
92  // 3rd) close the MatrixReadOut fragment when the CM footer is ecountered;
93  // 4th) at this point the MatrixReadOut object can deliver the RPC hits
94  //
95  //
96  //
97  // analysis of patological cases and related actions:
98  //
99  // store in a flag, typePrevRec, the type of record of previous dataword:
100  //
101  // 0 == no CMA Record; "0"
102  // 1 == CMA Header; "H"
103  // 2 == CMA SubHeader; "S"
104  // 3 == CMA Body; "B"
105  // 3 == CMA Footer; "F"
106  //
107  //
108  // all cases should be accompained by error messages, except cases reported as
109  // "regular sequence: no problem at all"
110  //
111  // -Current record-|-Previous record-----------------Action---------------------
112  // type type
113  //
114  // 0 H close "CMRO": CMRO.writeRecord(inword,true);
115  // 0 S close "CMRO": CMRO.writeRecord(inword,true);
116  // 0 B close "CMRO": CMRO.writeRecord(inword,true);
117  // 0 F no action needed
118  //
119  // H 0 no action; no error message
120  // H H header overwriting;
121  // H S no action
122  // H B close "CMRO": CMRO.writeRecord(inword,true);
123  // H F no action needed
124  //
125  // S 0 no action
126  // S H regular sequence: no problem at all
127  // S S subheader overwriting;
128  // S B close "CMRO": CMRO.writeRecord(inword,true);
129  // S F no action needed
130  //
131  // B 0 no action
132  // B H no action needed;
133  // B S regular sequence: no problem at all
134  // B B regular sequence: no problem at all
135  // B F no action needed
136  //
137  // F 0 no action
138  // F H no action needed
139  // F S no action needed
140  // F B regular sequence: no problem at all
141  // F F no action needed
142  //
143  //
144  bool thereIsACM = false; // true if the data word is a CM footer
145  // that closes the CM fragment.
146  bool thereIsASL = false; // true if the data word is a SL footer
147  // that closes the SL fragment.
148  char recField; // record field
149  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode; inword= " << std::hex << inword << std::dec << std::endl; }
150  //
151  // recognize first the current word
152  //
153  CMROS.decodeFragment(inword, recField);
154  PDROS.decodeFragment(inword, recField);
155  RXROS.decodeFragment(inword, recField);
156  SLROS.decodeFragment(inword, recField);
157  //
158  // Identify the current 16bit word and check it...
159  //
160 
161  if (SLROS.isHeader()) {
162  //
163  // SL Header
164  //
165  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode: SectorLogic Header " << std::endl; }
166  m_isSLBody = false;
167  SLRO.reset();
168  SLRO.writeRecord(inword, false);
169  thereIsASL = false;
170  m_slFound = true;
171 
172  } else if (SLROS.isSubHeader() && m_slFound) {
173  //
174  // SL Header
175  //
176  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode: SectorLogic SubHeader " << std::endl; }
177  m_isSLBody = true;
178  SLRO.writeRecord(inword, false);
179 
180  } else if (SLROS.isFooter() && m_slFound) {
181  //
182  // SL Footer
183  //
184  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode: SectorLogic Footer " << std::endl; }
185  m_isSLBody = false;
186  thereIsASL = true;
187  SLRO.writeRecord(inword, true);
188 
189  m_slFound = false;
190 
191  } else if (m_isSLBody && m_slFound) {
192  //
193  // SL Body
194  //
195  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode: SectorLogic Body " << std::endl; }
196  SLRO.writeRecord(inword, false);
197  thereIsASL = false;
198 
199  } else if (RXROS.isHeader()) {
200  //
201  // RX header
202  //
203  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode: RX Header " << std::endl; }
204  m_RXFlag++;
205  RXROS.decodeFragment(inword, recField);
206  if (recField == 'H') { SectorID = RXROS.RXid(); }
207  thereIsACM = false;
208  if (m_enablePrintOut) { std::cout << " Sector ID = " << SectorID << std::endl; }
209 
210  switch (m_previousRecord) {
211  case Empty: break;
212  case CMHead:
213  if (m_enablePrintOut) {
214  std::cout << " RPCRXRODDecode Fragment problem: CM SubHeader expected and RX Header found" << std::endl;
215  }
216  thereIsACM = true; // close this matrix fragment
217  CMRO.writeRecord(inword, true);
218  // gimeCMROData();
219  break;
220  case CMSub:
221  if (m_enablePrintOut) {
222  std::cout << " RPCRXRODDecode Fragment problem: CM Body expected and and RX Header found" << std::endl;
223  }
224  thereIsACM = true; // close this matrix fragment
225  CMRO.writeRecord(inword, true);
226  // gimeCMROData();
227  break;
228  case CMBod:
229  if (m_enablePrintOut) {
230  std::cout << " RPCRXRODDecode Fragment problem: CM Body or Footer expected and RX Header found" << std::endl;
231  }
232  thereIsACM = true; // close this matrix fragment
233  CMRO.writeRecord(inword, true);
234  // gimeCMROData();
235  break;
236  case CMFoot:
237  if (m_enablePrintOut) {
238  std::cout << " RPCRXRODDecode Fragment problem: CM Header or Pad Footer expected and RX Header found" << std::endl;
239  }
240  break;
241  case PadHead:
242  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: PadSubHeader expected" << std::endl; }
243  break;
244  case PadPre:
245  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: CMA fragment expected" << std::endl; }
246  break;
247  case PadSub:
248  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: CMA Footer expected" << std::endl; }
249  break;
250  case PadFoot:
251  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: Pad PreFooter expected" << std::endl; }
252  break;
253  default:
254  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode ERROR in previousRecord " << std::endl; }
255  } // end-of-switch
257 
258  } else if (RXROS.isFooter()) {
259  //
260  // RX footer
261  //
262  if (m_enablePrintOut) { std::cout << " RX footer " << std::endl; }
263  m_RXFlag--;
264  RXROS.decodeFragment(inword, recField);
265  if (recField == 'F') {}
266  thereIsACM = false;
267  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode: Footer of Sector with ID = " << SectorID << std::endl; }
268 
269  switch (m_previousRecord) {
270  case Empty: break;
271  case CMHead:
272  if (m_enablePrintOut) {
273  std::cout << " RPCRXRODDecode Fragment problem: CM SubHeader expected and RX Footer found" << std::endl;
274  }
275  thereIsACM = true; // close this matrix fragment
276  CMRO.writeRecord(inword, true);
277  // gimeCMROData();
278  break;
279  case CMSub:
280  if (m_enablePrintOut) {
281  std::cout << " RPCRXRODDecode Fragment problem: CM Body expected and RX Footer found" << std::endl;
282  }
283  thereIsACM = true; // close this matrix fragment
284  CMRO.writeRecord(inword, true);
285  // gimeCMROData();
286  break;
287  case CMBod:
288  if (m_enablePrintOut) {
289  std::cout << " RPCRXRODDecode Fragment problem: CM Body or Footer expected and and RX Footer found" << std::endl;
290  }
291  thereIsACM = true; // close this matrix fragment
292  CMRO.writeRecord(inword, true);
293  // gimeCMROData();
294  break;
295  case CMFoot:
296  if (m_enablePrintOut) {
297  std::cout << " RPCRXRODDecode Fragment problem: CM Header or Pad Footer expected and RX Footer found" << std::endl;
298  }
299  break;
300  case PadHead:
301  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: PadSubHeader expected" << std::endl; }
302  break;
303  case PadPre:
304  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: CMA fragment expected" << std::endl; }
305  break;
306  case PadSub:
307  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: CMA Footer expected" << std::endl; }
308  break;
309  case PadFoot:
310  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: Pad PreFooter expected" << std::endl; }
311  break;
312  default:
313  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode ERROR in previousRecord " << std::endl; }
314  } // end-of-switch
316 
317  } else if (PDROS.isHeader()) {
318  //
319  // Pad header
320  //
321  if (m_enablePrintOut) { std::cout << " PAD Header " << std::hex << inword << std::dec << std::endl; }
322  m_PADFlag++;
323  PDROS.decodeFragment(inword, recField);
324  if (recField == 'H') { PadID = PDROS.padid(); }
325  thereIsACM = false;
326  if (m_enablePrintOut) {
327  std::cout << " PAD " << PadID << " LVL1 " << std::hex << ((inword & 0x0e00) >> 8) << std::dec << std::endl;
328  }
329 
330  switch (m_previousRecord) {
331  case Empty: break;
332  case CMHead:
333  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: CM SubHeader expected and not found" << std::endl; }
334  thereIsACM = true; // close this matrix fragment
335  CMRO.writeRecord(inword, true);
336  // gimeCMROData();
337  break;
338  case CMSub:
339  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: CM Body expected and not found" << std::endl; }
340  thereIsACM = true; // close this matrix fragment
341  CMRO.writeRecord(inword, true);
342  // gimeCMROData();
343  break;
344  case CMBod:
345  if (m_enablePrintOut) {
346  std::cout << " RPCRXRODDecode Fragment problem: CM Body or Footer expected and not found" << std::endl;
347  }
348  thereIsACM = true; // close this matrix fragment
349  CMRO.writeRecord(inword, true);
350  // gimeCMROData();
351  break;
352  case CMFoot: break;
353  case PadHead:
354  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: PadSubHeader expected" << std::endl; }
355  break;
356  case PadPre:
357  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: CMA fragment expected" << std::endl; }
358  break;
359  case PadSub:
360  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: CMA Footer expected" << std::endl; }
361  break;
362  case PadFoot:
363  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: Pad PreFooter expected" << std::endl; }
364  break;
365  default:
366  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode ERROR in previousRecord " << std::endl; }
367  } // end-of-switch
369 
370  } else if (PDROS.isSubHeader()) {
371  //
372  // Pad Subheader
373  //
374  if (m_enablePrintOut) { std::cout << " BCID " << std::hex << (inword & 0x0fff) << std::dec << std::endl; }
375  switch (m_previousRecord) {
376  case Empty: break;
377  case CMHead:
378  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: CM SubHeader expected and not found" << std::endl; }
379  thereIsACM = true; // close this matrix fragment
380  CMRO.writeRecord(inword, true);
381  // gimeCMROData();
382  break;
383  case CMSub:
384  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: CM Body expected and not found" << std::endl; }
385  thereIsACM = true; // close this matrix fragment
386  CMRO.writeRecord(inword, true);
387  // gimeCMROData();
388  break;
389  case CMBod:
390  if (m_enablePrintOut) {
391  std::cout << " RPCRXRODDecode Fragment problem: CM Body or Footer expected and not found" << std::endl;
392  }
393  thereIsACM = true; // close this matrix fragment
394  CMRO.writeRecord(inword, true);
395  // gimeCMROData();
396  break;
397  case CMFoot:
398  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: Pad Header expected and not found" << std::endl; }
399  break;
400  case PadHead:
401  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: PadSubHeader expected" << std::endl; }
402  break;
403  case PadPre:
404  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: CMA fragment expected" << std::endl; }
405  break;
406  case PadSub:
407  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: CMA Footer expected" << std::endl; }
408  break;
409  case PadFoot:
410  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: Pad PreFooter expected" << std::endl; }
411  break;
412  default:
413  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode ERROR in previousRecord " << std::endl; }
414  } // end-of-switch
416 
417  } else if (PDROS.isPreFooter()) {
418  //
419  // Pad PreFooter
420  //
421  if (m_enablePrintOut) { std::cout << " STATUS ERROR " << std::hex << (inword & 0x000f) << std::dec << std::endl; }
422  switch (m_previousRecord) {
423  case Empty: break;
424  case CMHead:
425  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: CM SubHeader expected and not found" << std::endl; }
426  thereIsACM = true; // close this matrix fragment
427  CMRO.writeRecord(inword, true);
428  // gimeCMROData();
429  break;
430  case CMSub:
431  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: CM Body expected and not found" << std::endl; }
432  thereIsACM = true; // close this matrix fragment
433  CMRO.writeRecord(inword, true);
434  // gimeCMROData();
435  break;
436  case CMBod:
437  if (m_enablePrintOut) {
438  std::cout << " RPCRXRODDecode Fragment problem: CM Body or Footer expected and not found" << std::endl;
439  }
440  thereIsACM = true; // close this matrix fragment
441  CMRO.writeRecord(inword, true);
442  // gimeCMROData();
443  break;
444  case CMFoot: break;
445  case PadHead:
446  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: PadSubHeader expected" << std::endl; }
447  break;
448  case PadPre:
449  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: CMA fragment expected" << std::endl; }
450  break;
451  case PadSub:
452  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: CMA Footer expected" << std::endl; }
453  break;
454  case PadFoot:
455  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: Pad PreFooter expected" << std::endl; }
456  break;
457  default:
458  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode ERROR in previousRecord " << std::endl; }
459  } // end-of-switch
461 
462  } else if (PDROS.isFooter()) {
463  //
464  // Pad footer
465  //
466  if (m_enablePrintOut) {
467  std::cout << " PAD Footer " << std::hex << inword << std::dec << " ERROR FLAG " << std::hex << (inword & 0x0fff) << std::dec
468  << std::endl;
469  }
470  m_PADFlag--;
471  PDROS.decodeFragment(inword, recField);
472  if (recField == 'F') {}
473  thereIsACM = false;
474  if (m_enablePrintOut) { std::cout << " Footer of Pad with ID = " << PadID << std::endl; }
475 
476  switch (m_previousRecord) {
477  case Empty: break;
478  case CMHead:
479  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: CM SubHeader expected and not found" << std::endl; }
480  thereIsACM = true; // close this matrix fragment
481  CMRO.writeRecord(inword, true);
482  // gimeCMROData();
483  break;
484  case CMSub:
485  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: CM Body expected and not found" << std::endl; }
486  thereIsACM = true; // close this matrix fragment
487  CMRO.writeRecord(inword, true);
488  // gimeCMROData();
489  break;
490  case CMBod:
491  if (m_enablePrintOut) {
492  std::cout << " RPCRXRODDecode Fragment problem: CM Body or Footer expected and not found" << std::endl;
493  }
494  thereIsACM = true; // close this matrix fragment
495  CMRO.writeRecord(inword, true);
496  // gimeCMROData();
497  break;
498  case CMFoot:
499  if (m_enablePrintOut) {
500  std::cout << " RPCRXRODDecode Fragment problem: Pad PreFooter expected and not found" << std::endl;
501  }
502  break;
503  case PadHead:
504  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: PadSubHeader expected" << std::endl; }
505  break;
506  case PadPre: break;
507  case PadSub:
508  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: CMA Footer expected" << std::endl; }
509  break;
510  case PadFoot:
511  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: Pad PreFooter expected" << std::endl; }
512  break;
513  default:
514  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode ERROR in previousRecord " << std::endl; }
515  } // end-of-switch
517 
518  } else if (CMROS.isHeader()) {
519  //
520  // CM Header: reset MatrixReadOut and load the word
521  //
522  m_CMFlag++;
523  CMRO.reset(NOBXS);
524  CMRO.writeRecord(inword, false);
525  thereIsACM = false;
526 
527  switch (m_previousRecord) {
528  case Empty: break;
529  case CMHead:
530  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode warning: CM SubHeader expected and CM Header found" << std::endl; }
531  break;
532  case CMSub: break;
533  case CMBod:
534  if (m_enablePrintOut) {
535  std::cout << " RPCRXRODDecode warning: CM Body or CM Footer expected and CM Header found" << std::endl;
536  }
537  break;
538  case CMFoot: break;
539  case PadHead:
540  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: PadSubHeader expected" << std::endl; }
541  break;
542  case PadPre:
543  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: CMA fragment expected" << std::endl; }
544  break;
545  case PadSub:
546  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: CMA Footer expected" << std::endl; }
547  break;
548  case PadFoot:
549  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: Pad PreFooter expected" << std::endl; }
550  break;
551  default:
552  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode ERROR in previousRecord " << std::endl; }
553  } // end-of-switch
555 
556  } else if (CMROS.isSubHeader()) {
557  //
558  // CM Subheader
559  //
560  m_CMFlag++;
561  CMRO.writeRecord(inword, false);
562  thereIsACM = false;
563 
564  switch (m_previousRecord) {
565  case Empty:
566  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode warning: previous record was not a CM Header" << std::endl; }
567  break;
568  case CMHead: break;
569  case CMSub:
570  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode warning: CM Body expected and CM SubHeader found" << std::endl; }
571  break;
572  case CMBod:
573  if (m_enablePrintOut) {
574  std::cout << " RPCRXRODDecode warning: CM Body or CM Footer expected; CM SubHeader found" << std::endl;
575  }
576  break;
577  case CMFoot:
578  if (m_enablePrintOut) {
579  std::cout << " RPCRXRODDecode warning: CM Header or Pad Footer expected; CM SubHeader found" << std::endl;
580  }
581  break;
582  case PadHead:
583  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: PadSubHeader expected" << std::endl; }
584  break;
585  case PadPre:
586  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: CMA fragment expected" << std::endl; }
587  break;
588  case PadSub:
589  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: CMA Footer expected" << std::endl; }
590  break;
591  case PadFoot:
592  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: Pad PreFooter expected" << std::endl; }
593  break;
594  default:
595  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode ERROR in previousRecord " << std::endl; }
596  } // end-of-switch
598 
599  } else if (CMROS.isBody()) {
600  //
601  // CM hit
602  //
603  if (m_CMFlag) CMRO.writeRecord(inword, false);
604  thereIsACM = false;
605 
606  switch (m_previousRecord) {
607  case Empty:
608  if (m_enablePrintOut) {
609  std::cout << " RPCRXRODDecode (CMBody1) warning: previous record was not a CM subHeader"
610  << " or CM Body Record " << std::endl;
611  }
612  break;
613  case CMHead:
614  if (m_enablePrintOut) {
615  std::cout << " RPCRXRODDecode (CMBody2) warning: previous record was not a CM subHeader"
616  << " or CM Body Record " << std::endl;
617  }
618  break;
619  case CMSub: break;
620  case CMBod: break;
621  case CMFoot:
622  if (m_enablePrintOut) {
623  std::cout << " RPCRXRODDecode (CMBody3) warning: previous record was not a CM subHeader"
624  << " or CM Body Record " << std::endl;
625  }
626  break;
627  case PadHead:
628  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: PadSubHeader expected" << std::endl; }
629  break;
630  case PadPre:
631  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: CMA fragment expected" << std::endl; }
632  break;
633  case PadSub:
634  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: CMA Footer expected" << std::endl; }
635  break;
636  case PadFoot:
637  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: Pad PreFooter expected" << std::endl; }
638  break;
639  default:
640  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode ERROR in previousRecord=" << std::endl; }
641  } // end-of-switch
643 
644  } else if (CMROS.isFooter()) {
645  //
646  // CM footer
647  //
648  thereIsACM = true;
649  m_CMFlag--;
650  m_CMFlag--;
651  CMRO.writeRecord(inword, true);
653 
654  switch (m_previousRecord) {
655  case Empty:
656  if (m_enablePrintOut) {
657  std::cout << " RPCRXRODDecode (CMFooter1) warning: previous record was not a Body record " << std::endl;
658  }
659  break;
660  case CMHead:
661  if (m_enablePrintOut) {
662  std::cout << " RPCRXRODDecode (CMFooter2) warning: previous record was not a Body record" << std::endl;
663  }
664  break;
665  case CMSub:
666  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode warning: previous record was not a Body record" << std::endl; }
667  break;
668  case CMBod: break;
669  case CMFoot:
670  if (m_enablePrintOut) {
671  std::cout << " RPCRXRODDecode (CMFooter3) warning: previous record was not a Body record" << std::endl;
672  }
673  break;
674  case PadHead:
675  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: PadSubHeader expected" << std::endl; }
676  break;
677  case PadPre:
678  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: CMA fragment expected" << std::endl; }
679  break;
680  case PadSub:
681  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: CMA Footer expected" << std::endl; }
682  break;
683  case PadFoot:
684  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: Pad PreFooter expected" << std::endl; }
685  break;
686  default:
687  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode ERROR in previousRecord" << std::endl; }
688  } // end-of-switch
690 
691  // gimeCMROData();
692 
693  //} else if(((inword & m_field)==reserved3) || ((inword & m_field)==m_reserved4)) {
694  } else if ((inword & m_field) == m_reserved4) {
695  //
696  // reserved word
697  //
698  thereIsACM = false;
699  if (m_enablePrintOut) { std::cout << " (reserved) " << std::endl; }
700 
701  switch (m_previousRecord) {
702  case Empty: break;
703  case CMHead:
704  if (m_enablePrintOut) {
705  std::cout << " RPCRXRODDecode Fragment problem: CM SubHeader expected and (reserved) found" << std::endl;
706  }
707  thereIsACM = true; // close this matrix fragment
708  CMRO.writeRecord(inword, true);
709  // gimeCMROData();
710  break;
711  case CMSub:
712  if (m_enablePrintOut) {
713  std::cout << " RPCRXRODDecode Fragment problem: CM Body expected and (reserved) found" << std::endl;
714  }
715  thereIsACM = true; // close this matrix fragment
716  CMRO.writeRecord(inword, true);
717  // gimeCMROData();
718  break;
719  case CMBod:
720  if (m_enablePrintOut) {
721  std::cout << " RPCRXRODDecode Fragment problem: CM Body or Footer expected and (reserved) found" << std::endl;
722  }
723  thereIsACM = true; // close this matrix fragment
724  CMRO.writeRecord(inword, true);
725  // gimeCMROData();
726  break;
727  case CMFoot:
728  if (m_enablePrintOut) {
729  std::cout << " RPCRXRODDecode Fragment problem: CM Header or Pad Footer expected and (reserved) found" << std::endl;
730  }
731  break;
732  case PadHead:
733  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: PadSubHeader expected" << std::endl; }
734  break;
735  case PadPre:
736  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: CMA fragment expected" << std::endl; }
737  break;
738  case PadSub:
739  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: CMA Footer expected" << std::endl; }
740  break;
741  case PadFoot:
742  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode Fragment problem: Pad PreFooter expected" << std::endl; }
743  break;
744  default:
745  if (m_enablePrintOut) { std::cout << " RPCRXRODDecode ERROR in previousRecord " << std::endl; }
746  } // end-of-switch
748 
749  } // end-of-if
750  int answer = 0;
751  if (thereIsACM) answer = 1;
752  if (thereIsASL) answer = 2;
753  return answer;
754 }
755 //----------------------------------------------------------------------------//
758  ubit16 nCMROData = CMRO.numberOfBodyWords();
759 
760  if (m_enablePrintOut) {
761  std::cout << " number of Body Words in this CM Fragment " << nCMROData << std::endl;
762 
763  //
764  // get header data
765  //
766  CMROS = CMRO.getHeader();
767 
768  std::cout << " gimeCMROData, CMID: " << CMROS.cmid() << std::endl
769  << " gimeCMROData, FEL1ID: " << CMROS.fel1id() << std::endl
770  << " isLowPt = " << CMROS.isLowPt() << std::endl
771  << " isEtaProj= " << CMROS.isEtaProj() << std::endl
772  << " is0LocAdd= " << CMROS.is0LocAdd() << std::endl;
773 
774  //
775  // get subheader data
776  //
777  CMROS = CMRO.getSubHeader();
778 
779  std::cout << " gimeCMROData, FEBCID: " << CMROS.febcid() << std::endl;
780 
781  //
782  // get Body data
783  //
784  for (ubit16 i = 0; i < nCMROData; i++) {
785  CMROS = CMRO.getCMAHit(i);
786  ubit16 ijk = CMROS.ijk();
787  if (ijk < 6) {
788  std::cout << " gimeCMROData, hit chan: " << CMROS.channel() << " gimeCMROData, hit stri: " << CMROS.global_channel()
789  << " hit BCID: " << CMROS.bcid() << std::endl;
790  } else if (ijk == 6) {
791  std::cout << " gimeCMROData, trg chan: " << CMROS.channel() << " hit BCID: " << CMROS.bcid() << std::endl;
792  } else if (ijk == 7) {
793  std::cout << " gimeCMROData, trg thr: " << CMROS.threshold() << " trg ovl: " << CMROS.overlap() << std::endl;
794  } else {
795  std::cout << " this value of ijk=" << ijk << " is NOT ALLOWED " << std::endl;
796  } // end-of-if
797  std::cout << std::endl;
798  } // end-of-for
799  } // end-of-if(m_enablePrintOut
800 } // end-of-gimeCMROData
801 //---------------------------------------------------------------------------//
802 void RPCRXRODDecode::RODHeader(const RODword *RODData) {
803  //
804  // decode the ROD header
805  //
806  headerSize = *(RODData + 1);
807  for (ubit16 i = 0; i < headerSize; i++) {
808  if (i == 0) {
809  headerMarker = *(RODData + i);
810  } else if (i == 2) {
811  formatVersion = *(RODData + i);
812  } else if (i == 3) {
813  sourceIdentifier = *(RODData + i);
814  RPCRODStructure RPCRODS;
816  SourceModuleID = RPCRODS.getSourceIDRODID();
820  } else if (i == 4) {
821  Level1ID = *(RODData + i);
822  } else if (i == 5) {
823  BunchXingID = *(RODData + i);
824  } else if (i == 6) {
825  Level1Type = *(RODData + i);
826  } else if (i == 7) {
827  DetectorEventType = *(RODData + i);
828  } // end-of-if
829  } // end-of-for
830 } // end-of-RODHeader
831 //----------------------------------------------------------------------------//
832 // void RPCRXRODDecode::ROBAddresses(const RODword *ROBData) {
836 // ROBTotalSize = *(ROBData + locROBTotalFragSize-1);
837 // RODDataSize = *(ROBData + ROBTotalSize-1 + locRODNumberOfDataElements);
838 // RODStatusSize = *(ROBData + ROBTotalSize-1 + locRODNumberOfStatusElements);
839 // RODStatusPosition = *(ROBData + ROBTotalSize-1 + locRODStatusBlockPosition);
840 // RODBlockSize = RODDataSize + RODStatusSize;
841 // if(RODStatusPosition) {
842 // m_RODDataAddress = ROBTotalSize-(RODBlockSize+RODTrailerSize-1);
843 //} else {
844 // m_RODDataAddress = ROBTotalSize-(RODDataSize+RODTrailerSize-1);
845 //}
846 //
847 // cout<<" Object ROB Total Size "<<ROBTotalSize<<endl;
848 // cout<<" Object ROD Data Size "<<RODDataSize<<endl;
849 // cout<<" Object ROD Status Size "<<RODStatusSize<<endl;
850 // cout<<" Object ROD Data Address "<<m_RODDataAddress<<endl;
851 //}//end-of-ROBAddresses
852 //----------------------------------------------------------------------------//
853 void RPCRXRODDecode::RODAddresses(const RODword *RODData, const sbit32 numberOfStatusElements, const sbit32 statusBlockPosition) {
854  RODHeader(RODData);
855  std::cout << " status block position " << statusBlockPosition << std::endl;
856  std::cout << " number of Status Elements " << numberOfStatusElements << std::endl;
857  if (statusBlockPosition) {
859  } else {
860  m_RODDataAddress = headerSize + numberOfStatusElements;
861  }
862 } // end-of-RPCRXRODDecode::RODAddresses
863 //----------------------------------------------------------------------------//
865  if (m_enablePrintOut) {
866  std::cout << "*****************************************************" << std::endl
867  << "****** R O D H E A D E R *******" << std::endl
868  << "*****************************************************" << std::endl
869  << " ROD Header marker: " << std::hex << headerMarker << std::dec << std::endl
870  << " ROD Header size: " << headerSize << std::endl
871  << " ROD Format version number: " << formatVersion << std::endl
872  << " ROD Source Identifier: " << sourceIdentifier << std::endl
873  << " ROD Source Module ID: " << SourceModuleID << std::endl
874  << " ROD Source SubDectID: " << SourceSubDetectorID << std::endl
875  << " ROD Source Module Ty: " << SourceModuleType << std::endl
876  << " ROD Source Reserved : " << SourceReserved << std::endl
877  << " ROD Level1 ID: " << Level1ID << std::endl
878  << " ROD BuncgXingID: " << BunchXingID << std::endl
879  << " ROD Level1 Type: " << Level1Type << std::endl
880  << " ROD Detector Ev. Type: " << DetectorEventType << std::endl
881  << "*****************************************************" << std::endl;
882  } // end-of-if(m_enablePrintOut
883 } // end-of-RODHeaderDisplay
MatrixReadOut::reset
void reset(uint NOBXS)
Definition: MatrixReadOut.cxx:240
MatrixReadOutStructure::febcid
ubit16 febcid()
Definition: MatrixReadOutStructure.h:32
RPCRXRODDecode::headerSize
RODword headerSize
Definition: RPCRXRODDecode.h:43
MatrixReadOutStructure::channel
ubit16 channel()
Definition: MatrixReadOutStructure.h:36
MatrixReadOutStructure::ijk
ubit16 ijk()
Definition: MatrixReadOutStructure.h:35
SectorLogicRXReadOutStructure::isFooter
bool isFooter()
Definition: SectorLogicRXReadOutStructure.cxx:154
MatrixReadOutStructure::decodeFragment
ubit16 decodeFragment(ubit16 inputWord, char &field)
Definition: MatrixReadOutStructure.cxx:111
RPCRXRODDecode::PadID
ubit16 PadID
Definition: RPCRXRODDecode.h:58
RPCRXRODDecode::m_enablePrintOut
bool m_enablePrintOut
Definition: RPCRXRODDecode.h:102
MatrixReadOutStructure::isBody
bool isBody()
Definition: MatrixReadOutStructure.cxx:180
RPCRXRODDecode::PadFoot
@ PadFoot
Definition: RPCRXRODDecode.h:80
MatrixReadOutStructure::global_channel
ubit16 global_channel()
Definition: MatrixReadOutStructure.cxx:198
SectorLogicRXReadOut::reset
void reset()
Definition: SectorLogicRXReadOut.cxx:66
RPCRXRODDecode::m_field
ubit16 m_field
Definition: RPCRXRODDecode.h:85
RPCRXRODDecode::Empty
@ Empty
Definition: RPCRXRODDecode.h:80
RODword
uint32_t RODword
Definition: Lvl1Def.h:18
SectorLogicRXReadOutStructure::isHeader
bool isHeader()
Definition: SectorLogicRXReadOutStructure.cxx:110
RPCRXRODDecode::SLROS
SectorLogicRXReadOutStructure SLROS
Definition: RPCRXRODDecode.h:68
MatrixReadOut::getHeader
MatrixReadOutStructure getHeader()
Definition: MatrixReadOut.cxx:948
MatrixReadOutStructure::isEtaProj
bool isEtaProj()
Definition: MatrixReadOutStructure.cxx:226
RPCRXRODDecode.h
RPCRXRODDecode::CMFragCheck
ubit16 CMFragCheck
Definition: RPCRXRODDecode.h:60
SectorLogicRXReadOutStructure::isSubHeader
bool isSubHeader()
Definition: SectorLogicRXReadOutStructure.cxx:117
RPCRXRODDecode::sourceIdentifier
RODword sourceIdentifier
Definition: RPCRXRODDecode.h:45
RPCRXRODDecode::RPCRXRODDecode
RPCRXRODDecode()
Definition: RPCRXRODDecode.cxx:12
PadReadOutStructure::isPreFooter
bool isPreFooter()
Definition: PadReadOutStructure.cxx:182
MatrixReadOutStructure::isHeader
bool isHeader()
Definition: MatrixReadOutStructure.cxx:166
MatrixReadOut::getSubHeader
MatrixReadOutStructure getSubHeader()
Definition: MatrixReadOut.cxx:953
MatrixReadOutStructure::overlap
ubit16 overlap()
Definition: MatrixReadOutStructure.h:38
RPCRXRODDecode::Level1ID
RODword Level1ID
Definition: RPCRXRODDecode.h:46
RPCRXRODDecode::CMRO
MatrixReadOut CMRO
Definition: RPCRXRODDecode.h:67
RPCRXRODDecode::DetectorEventType
RODword DetectorEventType
Definition: RPCRXRODDecode.h:49
MatrixReadOutStructure::fel1id
ubit16 fel1id()
Definition: MatrixReadOutStructure.h:31
MatrixReadOutStructure::cmid
ubit16 cmid()
Definition: MatrixReadOutStructure.h:30
RPCRXRODDecode::CMBod
@ CMBod
Definition: RPCRXRODDecode.h:80
MatrixReadOutStructure::is0LocAdd
bool is0LocAdd()
Definition: MatrixReadOutStructure.cxx:234
MatrixReadOut::checkFragment
ubit16 checkFragment()
Definition: MatrixReadOut.cxx:807
sbit32
int32_t sbit32
Definition: Lvl1Def.h:19
RPCRXRODDecode::CMSub
@ CMSub
Definition: RPCRXRODDecode.h:80
RPCRXRODDecode::PadPre
@ PadPre
Definition: RPCRXRODDecode.h:80
SectorLogicRXReadOut::writeRecord
void writeRecord(ubit16 thisRecord, bool last)
Definition: SectorLogicRXReadOut.cxx:76
uint
unsigned int uint
Definition: LArOFPhaseFill.cxx:20
RPCRXRODDecode::~RPCRXRODDecode
~RPCRXRODDecode()
Definition: RPCRXRODDecode.cxx:65
RPCRXRODDecode::RODAddresses
void RODAddresses(const RODword *RODData, const sbit32 numberOfStatusElements, const sbit32 statusBlockPosition)
Definition: RPCRXRODDecode.cxx:853
RPCRXRODDecode::RXROS
RXReadOutStructure RXROS
Definition: RPCRXRODDecode.h:64
RPCRXRODDecode::CMFoot
@ CMFoot
Definition: RPCRXRODDecode.h:80
RPCRODStructure::getSourceIDSubdetectorID
ubit16 getSourceIDSubdetectorID()
Definition: RPCRODStructure.h:24
RPCRXRODDecode::BunchXingID
RODword BunchXingID
Definition: RPCRXRODDecode.h:47
PadReadOutStructure::decodeFragment
ubit16 decodeFragment(ubit16 inputWord, char &field)
Definition: PadReadOutStructure.cxx:118
lumiFormat.i
int i
Definition: lumiFormat.py:85
RPCRXRODDecode::Level1Type
RODword Level1Type
Definition: RPCRXRODDecode.h:48
MatrixReadOutStructure::isFooter
bool isFooter()
Definition: MatrixReadOutStructure.cxx:187
RPCRXRODDecode::m_CMFlag
ubit16 m_CMFlag
Definition: RPCRXRODDecode.h:96
PadReadOutStructure::isHeader
bool isHeader()
Definition: PadReadOutStructure.cxx:166
RPCRXRODDecode::CMID
ubit16 CMID
Definition: RPCRXRODDecode.h:59
RPCRXRODDecode::SLRO
SectorLogicRXReadOut SLRO
Definition: RPCRXRODDecode.h:69
RPCRXRODDecode::SourceReserved
ubit16 SourceReserved
Definition: RPCRXRODDecode.h:50
RPCRXRODDecode::enablePrintOut
void enablePrintOut()
Definition: RPCRXRODDecode.cxx:67
RPCRODStructure::getSourceIDReserved
ubit16 getSourceIDReserved()
Definition: RPCRODStructure.h:22
RPCRXRODDecode::m_previousRecord
recType m_previousRecord
Definition: RPCRXRODDecode.h:81
RXReadOutStructure::decodeFragment
ubit16 decodeFragment(ubit16 inputWord, char &field)
Definition: RXReadOutStructure.cxx:78
RPCRXRODDecode::m_RODDataAddress
sbit32 m_RODDataAddress
Definition: RPCRXRODDecode.h:76
RPCRODStructure
Definition: RPCRODStructure.h:16
Hardware
@ Hardware
Definition: BaseObject.h:11
RPCRXRODDecode::RODHeader
void RODHeader(const RODword *ROBData)
Definition: RPCRXRODDecode.cxx:802
RPCRXRODDecode::disablePrintOut
void disablePrintOut()
Definition: RPCRXRODDecode.cxx:69
RPCRXRODDecode::m_reserved4
ubit16 m_reserved4
Definition: RPCRXRODDecode.h:91
MatrixReadOut::getCMAHit
MatrixReadOutStructure getCMAHit(int index)
Definition: MatrixReadOut.cxx:699
BaseObject
Definition: BaseObject.h:13
RPCRXRODDecode::gimeCMROData
void gimeCMROData()
Definition: RPCRXRODDecode.cxx:756
MatrixReadOutStructure
Definition: MatrixReadOutStructure.h:13
RPCRXRODDecode::SourceSubDetectorID
ubit16 SourceSubDetectorID
Definition: RPCRXRODDecode.h:52
MatrixReadOut::numberOfBodyWords
ubit16 numberOfBodyWords()
Definition: MatrixReadOut.h:49
RPCRODStructure::getSourceIDModuleType
ubit16 getSourceIDModuleType()
Definition: RPCRODStructure.h:23
MatrixReadOutStructure::isSubHeader
bool isSubHeader()
Definition: MatrixReadOutStructure.cxx:173
RPCRXRODDecode::m_RXFlag
ubit16 m_RXFlag
Definition: RPCRXRODDecode.h:98
RPCRXRODDecode::CMROS
MatrixReadOutStructure CMROS
Definition: RPCRXRODDecode.h:66
RPCRODStructure::getSourceIDRODID
ubit16 getSourceIDRODID()
Definition: RPCRODStructure.h:25
RPCRXRODDecode::m_noRecord16
ubit16 m_noRecord16
Definition: RPCRXRODDecode.h:86
RPCRXRODDecode::PadHead
@ PadHead
Definition: RPCRXRODDecode.h:80
MatrixReadOutStructure::isLowPt
bool isLowPt()
Definition: MatrixReadOutStructure.cxx:218
RPCRXRODDecode::formatVersion
RODword formatVersion
Definition: RPCRXRODDecode.h:44
PadReadOutStructure::padid
ubit16 padid() const
Definition: PadReadOutStructure.h:32
PadReadOutStructure::isSubHeader
bool isSubHeader()
Definition: PadReadOutStructure.cxx:174
RPCRXRODDecode::pushWord
int pushWord(const ubit16 inword, uint NOBXS)
Definition: RPCRXRODDecode.cxx:87
RPCRODStructure::decodeSourceID
void decodeSourceID(RODword sourceID)
Definition: RPCRODStructure.cxx:49
RPCRXRODDecode::headerMarker
RODword headerMarker
Definition: RPCRXRODDecode.h:37
RXReadOutStructure::isFooter
bool isFooter()
Definition: RXReadOutStructure.cxx:71
MatrixReadOut::writeRecord
void writeRecord(ubit16 thisRecord, bool last)
Definition: MatrixReadOut.cxx:183
MatrixReadOutStructure::threshold
ubit16 threshold()
Definition: MatrixReadOutStructure.h:37
SectorLogicRXReadOutStructure::decodeFragment
ubit16 decodeFragment(ubit16 inputWord, char &field)
Definition: SectorLogicRXReadOutStructure.cxx:39
RXReadOutStructure::RXid
ubit16 RXid()
Definition: RXReadOutStructure.h:33
PadReadOutStructure::isFooter
bool isFooter()
Definition: PadReadOutStructure.cxx:190
RPCRXRODDecode::SourceModuleType
ubit16 SourceModuleType
Definition: RPCRXRODDecode.h:51
RPCRXRODDecode::CMHead
@ CMHead
Definition: RPCRXRODDecode.h:80
ubit16
unsigned short int ubit16
Definition: RpcByteStreamEncoder.h:20
RPCRXRODDecode::PadSub
@ PadSub
Definition: RPCRXRODDecode.h:80
RPCRXRODDecode::m_slFound
bool m_slFound
Definition: RPCRXRODDecode.h:105
RPCRXRODDecode::m_noRecord32
RODword m_noRecord32
Definition: RPCRXRODDecode.h:87
RPCRXRODDecode::RODHeaderDisplay
void RODHeaderDisplay()
Definition: RPCRXRODDecode.cxx:864
RPCRXRODDecode::m_isSLBody
bool m_isSLBody
Definition: RPCRXRODDecode.h:72
RPCRXRODDecode::m_PADFlag
ubit16 m_PADFlag
Definition: RPCRXRODDecode.h:97
RPCRXRODDecode::SectorID
ubit16 SectorID
Definition: RPCRXRODDecode.h:57
RPCRXRODDecode::SourceModuleID
ubit16 SourceModuleID
Definition: RPCRXRODDecode.h:53
MatrixReadOutStructure::bcid
ubit16 bcid()
Definition: MatrixReadOutStructure.h:33
RXReadOutStructure::isHeader
bool isHeader()
Definition: RXReadOutStructure.cxx:64
RPCRXRODDecode::PDROS
PadReadOutStructure PDROS
Definition: RPCRXRODDecode.h:65