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