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