CbmRoot
CbmMcbm2018UnpackerAlgoRich.cxx
Go to the documentation of this file.
1 
57 //TODO: Check that to 'real' actions are performed in the lines which are intended for debug output only.
58 // i.e. LOG(XXXX) << ...
59 
61 
62 // ROOT
63 #include <TCanvas.h>
64 #include <TList.h>
65 // FairLogger
66 #include <Logger.h>
67 
68 // CbmRoot
69 #include "CbmMcbm2018RichPar.h"
70 
71 #include <iostream>
72 
74  : CbmStar2019Algo()
75  , fbMonitorMode(kFALSE)
76  , fbDebugMonitorMode(kFALSE)
77  , fRawDataMode(kFALSE)
78  , fError(kFALSE)
79  , fTrbState(TrbNetState::IDLE)
80  , fErrorCorr(0)
81  , fbDoToTCorr(kTRUE)
82  , fSkipMs(kFALSE)
83  , fdTimeOffsetNs(0.0)
84  , fRICHcompIdx(6)
85  , //TODO experimentally obtained value
86  fUnpackPar(nullptr)
87  , fTScounter(0)
88  , fCurMSid(0)
89  , fGwordCnt(0)
90  , fInSubSubEvent(kFALSE)
91  , fCurEpochCounter(0)
92  , fSubSubEvId(0)
93  , fLastCTSch0_re_time(0.)
94  , fLastCTSch2_re_time(0.)
95  , fLastCTSch2_fe_time(0.)
96  , fPrevLastCTSch0_re_time(0.)
97  , fPrevLastCTSch2_re_time(0.)
98  , fPrevLastCTSch2_fe_time(0.)
99  , /*,
100  fhTDCch0re_minusCTSch0re(nullptr),
101  fhTDCch0re_minusCTSch2re(nullptr),
102  fhTDCch0re_minusCTSch2fe(nullptr),
103  fhTDCch0re_minusPrevCTSch0re(nullptr),
104  fhTDCch0re_minusPrevCTSch2re(nullptr),
105  fhTDCch0re_minusPrevCTSch2fe(nullptr)*/
106  fMapFEE()
107  , fhTotMap()
108  , fhTot2dMap() {
109  this->Init(); //TODO why this is not called by the framework?
110 }
111 
113  if (nullptr != fParCList) delete fParCList;
114  if (nullptr != fUnpackPar) delete fUnpackPar;
115 }
116 
118  LOG(info) << "Initializing mCBM RICH 2019 unpacker algo";
119  //fhDigisInChnl = new TH2D("fhDigisInChnl","fhDigisInChnl;channel;#Digis;" ,2304 , -0.5, 2303.5, 50, -0.5, 49.5);
120  //fhDigisInDiRICH = new TH2D("fhDigisInDiRICH","fhDigisInDiRICH;DiRICH;#Digis;",72 , -0.5, 71.5, 300, -0.5, 299.5);
121  return kTRUE;
122 }
123 
125 
127 
129  LOG(info) << "Init parameter containers for CbmMcbm2018UnpackerAlgoRich";
130  Bool_t initOK = ReInitContainers();
131 
132  return initOK;
133 }
134 
136  LOG(info) << "ReInit parameter containers for CbmMcbm2018UnpackerAlgoRich";
137 
138  fUnpackPar =
139  (CbmMcbm2018RichPar*) fParCList->FindObject("CbmMcbm2018RichPar");
140  if (fUnpackPar == nullptr) { return kFALSE; }
141 
142  Bool_t initOK = InitParameters();
143 
144  return initOK;
145 }
146 
148  if (fParCList == nullptr) { fParCList = new TList(); }
149  fUnpackPar = new CbmMcbm2018RichPar("CbmMcbm2018RichPar");
150  fParCList->Add(fUnpackPar);
151 
152  return fParCList;
153 }
154 
156  InitStorage();
157  return kTRUE;
158 }
159 
161  fLastCh0_re_time.Set(
162  fUnpackPar->GetNaddresses()); // Set the size of the array
164  fUnpackPar->GetNaddresses()); // Set the size of the array
165 }
166 
172  UShort_t usDetectorId) {
174  for (UInt_t uCompIdx = 0; uCompIdx < fvMsComponentsList.size(); ++uCompIdx) {
175  if (component == fvMsComponentsList[uCompIdx]) { return; }
176  }
177 
179  fvMsComponentsList.push_back(component);
180 
181  if (fvMsComponentsList.size() == 1) {
182  fRICHcompIdx = component;
183  } else {
184  LOG(WARN) << "fvMsComponentsList.size() > 1 for RICH. Unpacking may not "
185  "work due to implementation limitations.";
186  }
187 
188  LOG(info) << "CbmMcbm2018UnpackerAlgoRich::AddMsComponentToList => Component "
189  << component << " with detector ID 0x" << std::hex << usDetectorId
190  << std::dec << " added to list";
191 }
192 
193 Bool_t CbmMcbm2018UnpackerAlgoRich::ProcessTs(const fles::Timeslice& /*ts*/) {
194  LOG(debug2) << "CbmMcbm2018UnpackerAlgoRich::ProcessTs(ts)";
195  /*
196  //TODO: shortcut. We love shortcuts, right?
197  if (fvMsComponentsList.size() == 1) {
198  this->ProcessTs(ts, fvMsComponentsList.at(0));
199  }
200 
201  //TODO: implement case when multiple components have to be processed
202 */
203  return kTRUE;
204 }
205 
206 Bool_t CbmMcbm2018UnpackerAlgoRich::ProcessTs(const fles::Timeslice& ts,
207  size_t component) {
209  if (0 == ts.index()) { return kTRUE; } // if( 0 == ts.index() )
210 
211  LOG(debug2) << "CbmMcbm2018UnpackerAlgoRich::ProcessTs(ts, " << component
212  << ")";
213 
214  //TODO: skip if this method was called for a wrong component
215  //if (component != fRICHcompIdx) return kTRUE;
216  //FIXME: this is really nasty...
217  // component = fRICHcompIdx;
218  if (1 != fvMsComponentsList.size()) {
220  if (0 == fvMsComponentsList.size()) return kTRUE;
221 
223  TString sCompList = "";
224  for (UInt_t uMsCompIdx = 0; uMsCompIdx < fvMsComponentsList.size();
225  ++uMsCompIdx)
226  sCompList += Form(" %2lu ", fvMsComponentsList[uMsCompIdx]);
227  LOG(fatal) << "CbmMcbm2018UnpackerAlgoRich::ProcessTs => More than 1 "
228  "component in list, unpacking impossible! List is "
229  << sCompList;
230  } // if( 1 != fvMsComponentsList.size() )
231  component = fvMsComponentsList[0];
232 
233  LOG(debug) << "Components: " << ts.num_components();
234  LOG(debug) << "Microslices: " << ts.num_microslices(component);
235 
236  const uint64_t compSize = ts.size_component(component);
237  LOG(debug) << "Component " << component << " has size " << compSize;
238 
240  if (-1.0 == fdTsCoreSizeInNs) {
241  fuNbCoreMsPerTs = ts.num_core_microslices();
242  fuNbOverMsPerTs = ts.num_microslices(0) - ts.num_core_microslices();
245  LOG(info) << "Timeslice parameters: each TS has " << fuNbCoreMsPerTs
246  << " Core MS and " << fuNbOverMsPerTs
247  << " Overlap MS, for a core duration of " << fdTsCoreSizeInNs
248  << " ns and a full duration of " << fdTsFullSizeInNs << " ns";
249 
252  if (kFALSE == fbIgnoreOverlapMs) fuNbMsLoop += fuNbOverMsPerTs;
253  LOG(info) << "In each TS " << fuNbMsLoop << " MS will be looped over";
254  } // if( -1.0 == fdTsCoreSizeInNs )
255 
256  for (size_t iMS = 0; iMS < fuNbMsLoop; ++iMS) {
257  fCurMSid = iMS;
258  LOG(debug) << "=======================================================";
259  const fles::MicrosliceView mv = ts.get_microslice(component, iMS);
260  const fles::MicrosliceDescriptor& msDesc = mv.desc();
262  LOG(debug) << "msDesc.size=" << msDesc.size;
263  fCurMSidx = msDesc.idx;
264  LOG(debug) << "msDesc.idx=" << msDesc.idx;
268  //ProcessMs(ts, component, iMS);//
270 
271  if (!fRawDataMode) ProcessMs(ts, component, iMS);
272  if (fRawDataMode) DebugMs(ts, component, iMS);
273 
274  LOG(debug) << "=======================================================";
275  }
276 
278  FinalizeTs(); //
280 
281  if (0 == fTScounter % 1000) {
282  LOG(info) << "Processed " << fTScounter << " TS";
283  }
284 
285  fTScounter++;
286 
288  std::sort(fDigiVect.begin(),
289  fDigiVect.end(),
290  [](const CbmRichDigi& a, const CbmRichDigi& b) -> bool {
291  return a.GetTime() < b.GetTime();
292  });
293 
295  fhVectorSize->Fill(ts.index(), fDigiVect.size());
296  fhVectorCapacity->Fill(ts.index(), fDigiVect.capacity());
297  } // if( fbMonitorMode || fbDebugMonitorMode )
298 
299  if (fuTsMaxVectorSize < fDigiVect.size()) {
301  fDigiVect.shrink_to_fit();
302  fDigiVect.reserve(fuTsMaxVectorSize);
303  } // if( fuTsMaxVectorSize < fDigiVect.size() )
304 
305  return kTRUE;
306 }
307 
308 Bool_t CbmMcbm2018UnpackerAlgoRich::ProcessMs(const fles::Timeslice& ts,
309  size_t uMsCompIdx,
310  size_t uMsIdx) {
311  const fles::MicrosliceView mv = ts.get_microslice(uMsCompIdx, uMsIdx);
312  const fles::MicrosliceDescriptor& msDesc = mv.desc();
313  const uint8_t* ptr = mv.content();
314  const size_t size = msDesc.size;
315 
316  if (size == 0) return kTRUE;
317 
318  fGwordCnt = 0; //TODO check that this global word counter works properly
319 
320  Int_t offset; // offset in bytes
321  Int_t* dataPtr;
322 
323  offset = 0;
324  mRichSupport::SwapBytes(4, ptr + offset);
325  LOG(debug4) << "[" << fGwordCnt << "]\t"
326  << mRichSupport::GetWordHexRepr(ptr + offset) << "\t"
327  << "ok"
328  << "\t"
329  << "Reserved 0000 0000";
330  fGwordCnt++;
331 
332  offset = 4;
333  mRichSupport::SwapBytes(4, ptr + offset);
334  dataPtr = (Int_t*) (ptr + offset);
335  Int_t mbsNumber = (Int_t)(dataPtr[0] & 0xffffff);
336  uint8_t mts_error_msg = (uint8_t)((dataPtr[0] >> 24) & 0xff);
337  ErrorMsg(static_cast<uint16_t>(mts_error_msg), RichErrorType::mtsError);
338  LOG(debug4) << "[" << fGwordCnt << "]\t"
339  << mRichSupport::GetWordHexRepr(ptr + offset) << "\t"
340  << "ok"
341  << "\t"
342  << "mbsNumber = " << mbsNumber;
343  fGwordCnt++;
344 
345  // We suppose that the first word is
346  // "HadesTransportUnitQueue - Length"
347  offset = 0 + 8;
348  mRichSupport::SwapBytes(4, ptr + offset);
349  dataPtr = (Int_t*) (ptr + offset);
350  Int_t TRBeventSize1 = (Int_t)(dataPtr[0]);
351  LOG(debug4) << "[" << fGwordCnt << "]\t"
352  << mRichSupport::GetWordHexRepr(ptr + offset) << "\t"
353  << "ok"
354  << "\t"
355  << "HadesTransportUnitQueue - Length = " << TRBeventSize1;
356  fGwordCnt++;
357 
358  if (*dataPtr > 0 && UInt_t(*dataPtr) == 0x80030000) {
359  LOG(info) << "dataPtr == 0x80030000";
360  exit(EXIT_FAILURE);
361  }
362 
363  // We suppose that the second word is
364  // "HadesTransportUnitQueue - Decoder (Seems to be allways the same)"
365  offset = 4 + 8;
366  mRichSupport::SwapBytes(4, ptr + offset);
367  dataPtr = (Int_t*) (ptr + offset);
368  Int_t dcdr = (Int_t)(dataPtr[0]);
369  if (dcdr == 0x00030062) {
370  LOG(debug4) << "[" << fGwordCnt << "]\t"
371  << mRichSupport::GetWordHexRepr(ptr + offset) << "\t"
372  << "ok"
373  << "\t"
374  << "HadesTransportUnitQueue - Decoder = " << dcdr;
375  fGwordCnt++;
376  } else {
377  LOG(warning) << "[" << fGwordCnt << "]\t"
378  << mRichSupport::GetWordHexRepr(ptr + offset) << "\t"
379  << "er"
380  << "\t"
381  << "HadesTransportUnitQueue - Decoder = " << dcdr
382  << " is not 0x00030062 (196706) => 0x" << std::hex << dcdr
383  << std::dec;
384  fGwordCnt++;
385 
387  fSkipMs = kTRUE;
388  return kFALSE;
389  }
390 
391  // We suppose that the third word is
392  // TRB event length (in bytes)
393  // It should be 8 less than the size specified two words ago
394  offset = 8 + 8;
395  mRichSupport::SwapBytes(4, ptr + offset);
396  dataPtr = (Int_t*) (ptr + offset);
397  Int_t TRBeventSize2 = (Int_t)(dataPtr[0]);
398  if (TRBeventSize2 == TRBeventSize1 - 8) {
399  LOG(debug4) << "[" << fGwordCnt << "]\t"
400  << mRichSupport::GetWordHexRepr(ptr + offset) << "\t"
401  << "ok"
402  << "\t"
403  << "TRB event - Length = " << TRBeventSize2
404  << " == " << TRBeventSize1 << "-8";
405  fGwordCnt++;
406  } else {
407  LOG(debug) << "[" << fGwordCnt << "]\t"
408  << mRichSupport::GetWordHexRepr(ptr + offset) << "\t"
409  << "er"
410  << "\t"
411  << "TRB event - Length = " << TRBeventSize2
412  << " != " << TRBeventSize1 << "-8=" << TRBeventSize1 - 8;
413  fGwordCnt++;
414  }
415 
417  ProcessTRBevent(TRBeventSize2, ptr + offset); //
419 
420  // Bytes in a TrbEvent
421  if (fbDebugMonitorMode) fhEventSize->Fill(TRBeventSize2);
422 
423 
424  if (fSkipMs == kTRUE) {
425  // problem in data; delete vectors.
426  fDigiVect.clear();
427  fSkipMs = kFALSE;
428  }
429 
430 
431  return kTRUE;
432 }
433 
435  uint8_t const* const ptr) {
436  Int_t offset; // offset in bytes
437  Int_t* dataPtr;
438 
439  // We assume that the TRB event header is 4 words and
440  // the first word is already processed outside of this method
441 
443  ProcessTRBeventHeader(4 * 4, ptr); //
445 
446  offset = 16; // start from after the TRB event header
447 
448  // 1. Search for the CTS subevent and extract reference time
449 
450  while (static_cast<size_t>(offset) < size) {
452  if (fSkipMs == kTRUE) break;
453 
454  // Duplicate the header word in order to avoid corrupting (by bytes swapping)
455  // the original data
456  dataPtr = (Int_t*) (ptr + offset);
457  Int_t headerCopy = *dataPtr;
458  mRichSupport::SwapBytes(4, (uint8_t*) &headerCopy);
459  dataPtr = &headerCopy;
460 
461  Int_t SubEvSize = (Int_t)((dataPtr[0] >> 16) & 0xffff);
462  Int_t HubId = (Int_t)((dataPtr[0]) & 0xffff);
463 
464  // Process only CTS subevent
465  //FIXME change from 0xc001 to 0xc000 at some point // ?
466  if ((HubId == 0xc001) || (HubId == 0xc000)) {
467 
468  // Not a very nice shortcut
469  // The global counter of the words is incremented for the CTS subevent header here
470  // However for the TRB subevent headers it is incremented in the second run,
471  // where only TRB subevent headers are processed and the CTS subevents are skipped
472  LOG(debug4) << "[" << fGwordCnt << "]\t"
473  << mRichSupport::GetWordHexRepr((uint8_t*) &headerCopy)
474  << "\t"
475  << "ok"
476  << "\t"
477  << "hub ID = 0x"
479  (uint8_t*) &headerCopy)
480  << "\t"
481  << "subevent size = " << SubEvSize;
482  fGwordCnt++;
483 
484  fSubSubEvId = HubId;
486  offset += (4 + ProcessCTSsubevent(SubEvSize * 4, ptr + offset)); //
488 
489  //std::cout<<"Words in CTS 0x"<< std::hex << HubId << std::dec <<" : "<< SubEvSize <<std::endl;
490  // In principle, should be reset here for safety
491  fSubSubEvId = 0;
492  } else {
493  // Skip all other subevents
494  offset += (4 + SubEvSize * 4);
495  }
496  }
497 
498  offset = 16; // start from after the TRB event header again
499 
500  // 2. Process TRB subsubevents
501 
502  //Int_t iIter = 0;
503  while (static_cast<size_t>(offset) < size) {
505  if (fSkipMs == kTRUE) break;
506 
507  //std::cout << "SE iteration " << iIter++ << "\toffset=" << offset << "\tsize=" << size << std::endl;
508 
509  // We suppose that the fifth word is the header of the subevent
510  // <Length> <HubId>
511  mRichSupport::SwapBytes(4, ptr + offset);
512  dataPtr = (Int_t*) (ptr + offset);
513  Int_t SubEvSize = (Int_t)((dataPtr[0] >> 16) & 0xffff);
514  Int_t HubId = (Int_t)((dataPtr[0]) & 0xffff);
515 
516  //FIXME change from 0xc001 to 0xc000 at some point // ?
517  if ((HubId == 0xc001) || (HubId == 0xc000)) {
524 
525  // Skip CTS subevent as it has been already processed during the first run
526  offset += (4 + SubEvSize * 4);
527  fLastFeeOnHub = false;
528  } else if (HubId == 0x5555) {
529  LOG(debug4) << "[" << fGwordCnt << "]\t"
530  << mRichSupport::GetWordHexRepr(ptr + offset) << "\t"
531  << "ok"
532  << "\t"
533  << "hub ID = 0x"
534  << mRichSupport::GetHexRepresentation(2, ptr + offset) << "\t"
535  << "subevent size = " << SubEvSize;
536  fGwordCnt++;
537  fLastFeeOnHub = false;
538  //TODO one could implement additional checks here about the
539  // words coming after the "event end" but we skip everything by now.
541  offset += (4 + ProcessSKIPsubevent(SubEvSize * 4, ptr + offset)); //
543  } else if (((HubId >> 8) & 0xFF) == 0x82) {
544  LOG(debug4) << "[" << fGwordCnt << "]\t"
545  << mRichSupport::GetWordHexRepr(ptr + offset) << "\t"
546  << "ok"
547  << "\t"
548  << "hub ID = 0x"
549  << mRichSupport::GetHexRepresentation(2, ptr + offset) << "\t"
550  << "subevent size = " << SubEvSize;
551  fGwordCnt++;
552  fLastFeeOnHub = false;
553  //std::cout<<"Hub: "<<std::hex<<HubId <<std::dec<<" Size:"<< SubEvSize<<std::endl;
555  offset += (4 + ProcessTRBsubevent(SubEvSize * 4, ptr + offset)); //
557 
558  //std::cout<<"Words in Hub 0x"<< std::hex << HubId << std::dec <<" : "<< SubEvSize <<std::endl;
559  // Bytes in a Hub
560  if (fbDebugMonitorMode) {
561  uint16_t combiner_address = ((HubId >> 4) & 0xF) * 3 + (HubId & 0xF);
562  fhSubEventSize->Fill(combiner_address, (SubEvSize * 4));
563  }
564 
565  } else {
566  LOG(WARN) << "[" << fGwordCnt << "]\t"
567  << mRichSupport::GetWordHexRepr(ptr + offset) << "\t"
568  << "ok"
569  << "\t"
570  << "hub ID = 0x"
571  << mRichSupport::GetHexRepresentation(2, ptr + offset) << "\t"
572  << "subevent size = " << SubEvSize << "\n"
573  << "This is not a valid Combiner Id!"
574  << "\n"
575  << "prev prev2:"
576  << mRichSupport::GetWordHexRepr(ptr + offset - 12) << "\n"
577  << "prev prev: "
578  << mRichSupport::GetWordHexRepr(ptr + offset - 8) << "\n"
579  << "prev: "
580  << mRichSupport::GetWordHexRepr(ptr + offset - 4) << "\n"
581  << "next: "
582  << mRichSupport::GetWordHexRepr(ptr + offset + 4) << "\n"
583  << "next next: "
584  << mRichSupport::GetWordHexRepr(ptr + offset + 8) << "\n";
586  offset += (4 + SubEvSize * 4);
588  }
589  }
590 
592  //TODO implement checks
593  if (size != static_cast<size_t>(offset)) {
594  LOG(WARN) << "CbmMcbm2018UnpackerAlgoRich::ProcessTRBevent() warning:"
595  << "Number of processed bytes is not equal to the expected size. "
596  "This should not happen. ("
597  << size << " VS " << offset << ")";
598  }
599 
600  return size; //TODO check
601 }
602 
603 // Process TRB event header.
604 // Input arguments are the size of the TRB event header (16 bytes) and the pointer to the first word.
605 // Note that the first word can already be analysed outside of this method.
606 // Return number of bytes processed. For this particular method the value of the input 'size' argument
607 // is returned as we expect that the TRB header is always 16 bytes.
609  size_t const size,
610  uint8_t const* const ptr) {
611  Int_t offset; // offset in bytes
612  Int_t* dataPtr;
613 
614  // Skip first word (already processed outside)
615  //offset = 0;
616  // do nothing
617 
618  // We suppose that the second word consists of
619  // 0002 - number of following word till the Event Data Starts (should be the same)
620  // 00<TriggerType>1 - value in [7:4] defines TriggerType
621  offset = 4;
622  mRichSupport::SwapBytes(4, ptr + offset);
623  dataPtr = (Int_t*) (ptr + offset);
624  Int_t checkSize = (Int_t)((dataPtr[0] >> 16) & 0xffff);
625  Int_t triggerType = (Int_t)((dataPtr[0] >> 4) & 0xf);
626  if (checkSize == 2) {
627  LOG(debug4) << "[" << fGwordCnt << "]\t"
628  << mRichSupport::GetWordHexRepr(ptr + offset) << "\t"
629  << "ok"
630  << "\t"
631  << "checkSize == 2"
632  << "\t"
633  << "trigger type = " << triggerType;
634  fGwordCnt++;
635  } else {
636  LOG(warning) << "[" << fGwordCnt << "]\t"
637  << mRichSupport::GetWordHexRepr(ptr + offset) << "\t"
638  << "er"
639  << "\t"
640  << "checkSize != 2 (" << checkSize << ")\t"
641  << "trigger type = " << triggerType;
642  fGwordCnt++;
643 
645  fSkipMs = kTRUE;
646  return 0;
647  }
648 
649  /*for (size_t iWord=2; iWord<size; iWord++) {
650  offset = iWord*4;
651  LOG(debug4) << "\t" << GetWordHexRepr(ptr+offset);
652  }*/
653 
654  // We suppose that the third word consists of
655  // 0000 <SubEventId>
656  offset = 8;
657  mRichSupport::SwapBytes(4, ptr + offset);
658  dataPtr = (Int_t*) (ptr + offset);
659  Int_t checkBytes = (Int_t)((dataPtr[0] >> 16) & 0xffff);
660  // Int_t SubEvId = (Int_t)((dataPtr[0]) & 0xffff);
661  if (checkBytes == 0) {
662  LOG(debug4) << "[" << fGwordCnt << "]\t"
663  << mRichSupport::GetWordHexRepr(ptr + offset) << "\t"
664  << "ok"
665  << "\t"
666  << "checkBytes == 0"
667  << "\t"
668  << "subevent ID = 0x"
669  << mRichSupport::GetHexRepresentation(2, ptr + offset);
670  fGwordCnt++;
671  } else {
672  LOG(warning) << "[" << fGwordCnt++ << "]\t"
673  << mRichSupport::GetWordHexRepr(ptr + offset) << "\t"
674  << "er"
675  << "\t"
676  << "checkBytes != 0 (" << checkBytes << ")\t"
677  << "subevent ID = 0x"
678  << mRichSupport::GetHexRepresentation(2, ptr + offset);
679  fGwordCnt++;
680 
682  fSkipMs = kTRUE;
683  return 0;
684  }
685 
686  // We suppose that the fourth word is the trigger number
687  offset = 12;
688  mRichSupport::SwapBytes(4, ptr + offset);
689  dataPtr = (Int_t*) (ptr + offset);
690  UInt_t TriggerNum = (UInt_t)(dataPtr[0]);
691  LOG(debug4) << "[" << fGwordCnt << "]\t"
692  << mRichSupport::GetWordHexRepr(ptr + offset) << "\t"
693  << "ok"
694  << "\t"
695  << "trigger num = " << TriggerNum;
696  fGwordCnt++;
697 
698  return size;
699 }
700 
702  size_t const size,
703  uint8_t const* const ptr) {
705 
706  Int_t offset; // offset in bytes
707  Int_t* dataPtr; //(FU) not used
708  uint16_t SubEventError = 0;
709 
710  // Skip first word (already processed outside)
711  offset = 4;
712 
713  //Start Error identification
714  mRichSupport::SwapBytes(4, ptr + offset);
715  dataPtr = (Int_t*) (ptr + offset);
716  SubEventError = (uint16_t)((dataPtr[0] >> 16) & 0xffff);
717  ErrorMsg(static_cast<uint16_t>(SubEventError), RichErrorType::subEventError);
718 
719  offset = 8;
720  //End Error identification
721 
722  while (static_cast<size_t>(offset) < size + 4) {
723  mRichSupport::SwapBytes(4, ptr + offset);
724  // dataPtr = (Int_t*)(ptr+offset); (FU) not used
725  LOG(debug4) << "[" << fGwordCnt << "]\t"
726  << mRichSupport::GetWordHexRepr(ptr + offset);
727  fGwordCnt++;
728 
729  offset += 4;
730  }
731 
733  //TODO implement checks
734  if (size != static_cast<size_t>(offset - 4)) {
735  LOG(WARN) << "CbmMcbm2018UnpackerAlgoRich::ProcessSKIPsubevent() warning:"
736  << "Number of processed bytes is not equal to the expected size. "
737  "This should not happen.";
738  }
739 
740  return size; //TODO check
741 }
742 
744  size_t const size,
745  uint8_t const* const ptr) {
747 
748  Int_t offset; // offset in bytes
749  Int_t* dataPtr;
750 
751  // Skip first word (already processed outside)
752 
753  // We suppose that the second word is the header of the subsubevent
754  offset = 4;
755  mRichSupport::SwapBytes(4, ptr + offset);
756  dataPtr = (Int_t*) (ptr + offset);
757  LOG(debug4) << "[" << fGwordCnt << "]\t"
758  << mRichSupport::GetWordHexRepr(ptr + offset) << "\t"
759  << "ok"
760  << "\t"
761  << "CTS header";
762  fGwordCnt++;
763 
764  /* (FU) not used
765  Short_t trigState[16];
766  for (Int_t i=0; i<16; i++) {
767  trigState[i] = ((*dataPtr >> i) & 0x1); // 16 x 1 bit
768  }
769 */
770  Short_t nInp = ((*dataPtr >> 16) & 0xf); // 4 bits
771  Short_t nTrigCh = ((*dataPtr >> 20) & 0x1f); // 5 bits
772  Short_t inclLastIdle = ((*dataPtr >> 25) & 0x1); // 1 bit
773  Short_t inclTrigInfo = ((*dataPtr >> 26) & 0x1); // 1 bit
774  Short_t inclTS = ((*dataPtr >> 27) & 0x1); // 1 bit
775  Short_t ETM = ((*dataPtr >> 28) & 0x3); // 2 bits
776 
777  // in words (not bytes)
778  Short_t CTSinfo_size =
779  nInp * 2 + nTrigCh * 2 + inclLastIdle * 2 + inclTrigInfo * 3 + inclTS;
780  switch (ETM) {
781  case 0: break;
782  case 1: CTSinfo_size += 1; break;
783  case 2: CTSinfo_size += 4; break;
784  case 3:
785  LOG(debug) << "ETM == 3";
786  //TODO implement
787  break;
788  }
789 
790  LOG(debug) << "CTS information size (extracted from the CTS header): "
791  << CTSinfo_size;
792 
793  offset = 8;
794 
795  while (offset - 8 < CTSinfo_size * 4) {
796  mRichSupport::SwapBytes(4, ptr + offset);
797  dataPtr = (Int_t*) (ptr + offset);
798  ULong_t MSidx = 102400UL * ((ULong_t)(*dataPtr) - 1);
799  LOG(debug) << "[" << fGwordCnt << "]\t"
800  << mRichSupport::GetWordHexRepr(ptr + offset) << "\t"
801  << "ok"
802  << "\t"
803  << "CTS information"
804  << " MSidx=" << MSidx;
805  fGwordCnt++;
806 
807  offset += 4;
808  }
809 
810  // size - full size including CTS header word, CTS informations words (CTSinfo_size) and TCD data
811  // Thus TDC data size = full size - 1 word (header) - CTSinfo_size words (CTS informations)
813  fChnlMsgCnt.fill(0);
814  offset += (ProcessTRBsubsubevent(
815  (size - (1 + CTSinfo_size) * 4), ptr + offset, 0, 0)); //
817 
819  //TODO implement checks
820  if (size != static_cast<size_t>(offset - 4)) {
821  LOG(WARN) << "CbmMcbm2018UnpackerAlgoRich::ProcessCTSsubevent() warning:"
822  << "Number of processed bytes is not equal to the expected size. "
823  "This should not happen.";
824  }
825 
826  return size; //TODO check
827 }
828 
830  size_t const size,
831  uint8_t const* const ptr) {
833 
834  Int_t offset; // offset in bytes
835  Int_t* dataPtr;
836 
837  // Skip first word (already processed outside)
838  offset = 4;
839 
841 
842  findTDCAlignmentError(ptr, size);
843 
844  //Int_t iIter = 0;
845  while (static_cast<size_t>(offset)
846  < (size - 2)) { // test for cases with odd number of corrections
847  if (fSkipMs == kTRUE) break;
848  //std::cout << "SSE iteration " << iIter++ << "\toffset=" << offset << "\tsize=" << size << std::endl;
849 
850  //correct for misalignment
851  if (fTDCAlignmentErrorPositions.size()
852  > static_cast<unsigned int>(fTdcWordCorrectionCnt)
854  //std::cout<<"Correction in DiRICH Header: "<< fTDCAlignmentErrorPositions[fTdcWordCorrectionCnt]<<std::endl;
855  offset += 2;
857  }
858 
859  // We suppose that the second word is the header of the subsubevent
860  // <Length> <SubSubEv.Id>
861  mRichSupport::SwapBytes(4, ptr + offset);
862  dataPtr = (Int_t*) (ptr + offset);
863  Int_t SubSubEvSize = (Int_t)((dataPtr[0] >> 16) & 0xffff);
864  fSubSubEvId = (Int_t)((dataPtr[0]) & 0xffff);
865 
866  //check if it is the last DiRICH in the Hub Data stream
867  //TODO CHECK!
868  if ((static_cast<size_t>(offset) + SubSubEvSize * 4) >= size) {
869  LOG(debug) << "Last DiRICH on HUB";
870  fLastFeeOnHub = true;
871  }
872 
873  if (((fSubSubEvId >> 12) & 0xF) != 0x7) {
874  LOG(error) << mRichSupport::GetWordHexRepr(ptr + offset - 12) << "\t"
875  << "er"
876  << "\t"
877  << "ILLEGAL SubSubEvent Id prev";
878  LOG(error) << mRichSupport::GetWordHexRepr(ptr + offset - 8) << "\t"
879  << "er"
880  << "\t"
881  << "ILLEGAL SubSubEvent Id prev";
882  LOG(error) << mRichSupport::GetWordHexRepr(ptr + offset - 4) << "\t"
883  << "er"
884  << "\t"
885  << "ILLEGAL SubSubEvent Id prev";
886  LOG(error) << mRichSupport::GetWordHexRepr(ptr + offset) << "\t"
887  << "er"
888  << "\t"
889  << "ILLEGAL SubSubEvent Id "
890  << "Offset:" << static_cast<size_t>(offset)
891  << " Size:" << size;
892  LOG(error) << mRichSupport::GetWordHexRepr(ptr + offset + 4) << "\t"
893  << "er"
894  << "\t"
895  << "ILLEGAL SubSubEvent Id next";
896  LOG(error) << mRichSupport::GetWordHexRepr(ptr + offset + 8) << "\t"
897  << "er"
898  << "\t"
899  << "ILLEGAL SubSubEvent Id next";
900  LOG(error) << mRichSupport::GetWordHexRepr(ptr + offset + 12) << "\t"
901  << "er"
902  << "\t"
903  << "ILLEGAL SubSubEvent Id next";
904  }
905 
906  LOG(debug) << "[" << fGwordCnt << "]\t"
907  << mRichSupport::GetWordHexRepr(ptr + offset) << "\t"
908  << "ok"
909  << "\t"
910  << "subsubevent ID (FPGA ID) = 0x"
911  << mRichSupport::GetHexRepresentation(2, ptr + offset) << "\t"
912  << "subsubevent size = " << SubSubEvSize
913  << " | HUB Offset:" << static_cast<size_t>(offset)
914  << " Size:" << size;
915  fGwordCnt++;
916 
917  if (size + 4 < static_cast<size_t>(offset + 4 + SubSubEvSize * 4
918  - fTdcWordCorrectionCnt * 2)) {
919  LOG(WARN) << "CbmMcbm2018UnpackerAlgoRich::ProcessTRBsubevent() warning:"
920  << "SubEvent out of bounds. This should not happen. (" << size
921  << " VS "
922  << (offset + 4 + SubSubEvSize * 4 - fTdcWordCorrectionCnt * 2)
923  << ")";
924 
926  //fSkipMs = kTRUE;
927  }
928 
929  fChnlMsgCnt.fill(0);
930 
931  // Add 4 bytes which correspond to the header word
933  offset += (4
935  SubSubEvSize * 4, ptr + offset + 4, offset + 4, size)); //
937 
938  //std::cout<<"Words in DiRICH 0x"<< std::hex << fSubSubEvId << std::dec <<" : "<< SubSubEvSize <<std::endl;
939 
940  if (fbDebugMonitorMode) {
941  //This address calculation is just for mCBM; will be a problem when using full CBM RICH acceptance
942  uint16_t DiRICH_address = ((fSubSubEvId >> 8) & 0xF) * 18
943  + ((fSubSubEvId >> 4) & 0xF) * 2
944  + (fSubSubEvId & 0xF);
945  fhSubSubEventSize->Fill(DiRICH_address,
946  SubSubEvSize); // Words in a DiRICH
947 
948  //Words per channel
949  for (size_t i = 1; i < fChnlMsgCnt.size(); ++i) {
950  if (fChnlMsgCnt.at(i) > 0)
951  fhChnlSize->Fill(static_cast<int>(i), fChnlMsgCnt.at(i));
952  }
953  }
954 
955  // In principle, should be reset here for safety
956  fSubSubEvId = 0;
957  }
958 
959  if (static_cast<Int_t>(fTDCAlignmentErrorPositions.size())
961  std::cout << "Missing Correction" << std::endl;
962 
963  // if (fTDCAlignmentErrorPositions.size() > 0){
964  // std::cout<<"Offset : "<<offset-4<<" Size:"<< size <<std::endl;
965  // std::cout<<"END of Hub : "<<mRichSupport::GetWordHexRepr(ptr+offset-4)<<std::endl; // Last word, processed as TDCWord
966  // std::cout<<"END of Hub +1 : "<<mRichSupport::GetWordHexRepr(ptr+offset+0)<<std::endl;
967  // std::cout<<"END of Hub +2 : "<<mRichSupport::GetWordHexRepr(ptr+offset+4)<<std::endl;
968  // std::cout<<"END of Hub +3 : "<<mRichSupport::GetWordHexRepr(ptr+offset+8)<<std::endl;
969  // }
970 
972  if (size != static_cast<size_t>(offset - 4)) {
973  LOG(WARN) << "CbmMcbm2018UnpackerAlgoRich::ProcessTRBsubevent() warning:"
974  << "Number of processed bytes is not equal to the expected size. "
975  "This should not happen. ("
976  << size << " VS " << (offset - 4) << ")"
977  << " Correction: " << fTdcWordCorrectionCnt * 2
978  << " fLastFeeOnHub:" << fLastFeeOnHub;
979 
981  //fSkipMs = kTRUE;
982  }
983 
985 
986  return size; //TODO check
987 }
988 
990  size_t const size,
991  uint8_t const* const ptr,
992  Int_t const hubOffset,
993  size_t const hubSize) { //size: Size of Data from DiRICH in Bytes
995  Int_t offset = 0; // offset in bytes
996  fCurEpochCounter = 0; //TODO check
997  fInSubSubEvent = kFALSE; //TODO check
999  Int_t TdcWordCorrection_local = 0;
1000  Int_t WordCnt = 0;
1001  bool break_flag = false;
1002 
1003  for (size_t iWord = 0; iWord < size / 4; iWord++) { // iWord is size in Lines
1004  //correct for misalignment
1005  //hubOffset is pointing to first word after DiRICH address
1006  if (fTDCAlignmentErrorPositions.size()
1007  > static_cast<unsigned int>(fTdcWordCorrectionCnt)
1009  == static_cast<Int_t>(hubOffset + offset + iWord * 4)) {
1010  //BEGIN DEBUG
1011  // std::cout<<"DEBUG -1: "<< mRichSupport::GetWordHexRepr(ptr-hubOffset+fTDCAlignmentErrorPositions[fTdcWordCorrectionCnt]-4) << std::endl;
1012  // std::cout<<"DEBUG 0: "<< mRichSupport::GetWordHexRepr(ptr-hubOffset+fTDCAlignmentErrorPositions[fTdcWordCorrectionCnt]) << std::endl;
1013  // std::cout<<"DEBUG +1: "<< mRichSupport::GetWordHexRepr(ptr-hubOffset+fTDCAlignmentErrorPositions[fTdcWordCorrectionCnt]+4) << std::endl;
1014  // std::cout<<"DEBUG_ : "<< mRichSupport::GetWordHexRepr(ptr+iWord*4+offset) << std::endl;
1015  //
1016  // std::cout<<"Correction in DiRICH Header: "<< fTDCAlignmentErrorPositions[fTdcWordCorrectionCnt]<<std::endl;
1017 
1018  //END DEBUG
1019  offset += 2;
1021  TdcWordCorrection_local++;
1022  // repeat word
1023  iWord--;
1024  continue;
1025  }
1026  if (fSkipMs == kTRUE) break;
1027 
1028 
1029  //if (fTDCAlignmentErrorPositions.size() > 0 && fLastFeeOnHub) std::cout<<"Final Word: "<< mRichSupport::GetWordHexRepr(ptr+iWord*4+offset)<<std::endl;
1030 
1032  if ((hubSize > 0) && (hubOffset + offset + iWord * 4 > hubSize)) {
1033  //std::cout<<"BREAKING : "<<hubOffset+offset+iWord*4 <<" > "<< hubSize <<" | "<< offset << " | "<< fTdcWordCorrectionCnt <<std::endl;
1034  break_flag = true;
1035  break;
1036  }
1037  //if (isCTSWord) std::cout<<"TDCWORD: "<<mRichSupport::GetWordHexRepr(ptr+iWord*4+offset)<<std::endl;
1038 
1039  mRichSupport::SwapBytes(4, ptr + iWord * 4 + offset);
1040  ProcessTDCword(ptr + iWord * 4 + offset, iWord, size); //
1041 
1042  WordCnt++;
1043 
1044  //std::cout<<" "<< iWord <<" "<< WordCnt <<std::endl;
1045  } //END of for Loop
1046 
1047  // if (fTdcWordCorrectionCnt > 0){
1048  // std::cout<<"LAST Processed Word : "<<mRichSupport::GetWordHexRepr(ptr+(WordCnt-1)*4+offset)<<std::endl;
1049  // }
1050  //if (TdcWordCorrection_local != 0) printf(" --- TDC WORD FIX APPLIED ! --- [DiRICH : 0x%4x]\n",fSubSubEvId);
1051 
1052  if (fSkipMs == kTRUE) return 0;
1053 
1054  //TODO Implement checks that the first word was the header and the last word was the trailer
1055 
1056  //if (size != static_cast<size_t>((WordCnt)*4) && fTdcWordCorrectionCnt == 0) {
1057  if (!((!break_flag && ((size) == static_cast<size_t>((WordCnt) *4)))
1058  || (break_flag
1059  && ((size - (fTdcWordCorrectionCnt * 2))
1060  == static_cast<size_t>((WordCnt) *4))))) {
1061  LOG(WARN) << "CbmMcbm2018UnpackerAlgoRich::ProcessTRBsubsubevent() warning:"
1062  << "Number of processed bytes is not equal to the expected size. "
1063  "This should not happen."
1064  << static_cast<size_t>(WordCnt * 4) << " " << size;
1066  //fSkipMs = kTRUE;
1067  }
1068 
1069 
1070  return (WordCnt * 4 + offset); //TODO check
1071 }
1072 
1073 Int_t CbmMcbm2018UnpackerAlgoRich::ProcessTDCword(uint8_t const* const ptr,
1074  Int_t const word,
1075  size_t const size) {
1076  Int_t* tdcDataPtr = (Int_t*) ptr;
1077  Int_t tdcData = tdcDataPtr[0];
1078  Int_t tdcTimeDataMarker = (tdcData >> 31) & 0x1; // 1 bit
1079 
1080  bool errorInData = false;
1081 
1082  // A TDC Time i only valid after a EPOCH or another TDC value
1083  if ((tdcTimeDataMarker == 0x1 && fTrbState == TrbNetState::TDC)
1084  || (tdcTimeDataMarker == 0x1 && fTrbState == TrbNetState::EPOCH)) {
1085  UInt_t tdcMarker = (tdcData >> 29) & 0x7; // 3 bits
1086  if (tdcMarker == 0x4 || tdcMarker == 0x5) {
1087  fDebugPrint = 0;
1089  ProcessTimestampWord(tdcData); //
1092  } else {
1093  std::cout << "wrong TDC Word!!" << std::endl;
1094  errorInData = true;
1095  }
1096 
1097  } else {
1098  UInt_t tdcMarker = (tdcData >> 29) & 0x7; // 3 bits
1099 
1100  if (tdcMarker == 0x0) { // TDC trailer
1101  if (fInSubSubEvent) {
1104  || fTrbState == TrbNetState::TDC)) {
1105  LOG(error) << "[" << fGwordCnt << "]\t"
1106  << mRichSupport::GetWordHexRepr(ptr) << "\t"
1107  << "er"
1108  << "\t"
1109  << "ILLEGAL TRAILER Position";
1110  errorInData = true;
1111  } else if ((size / 4 - static_cast<size_t>(word)) > 1) {
1112  //Trailer only at end of SubSubEvent!
1113  LOG(error) << "[" << fGwordCnt << "]\t"
1114  << mRichSupport::GetWordHexRepr(ptr) << "\t"
1115  << "er"
1116  << "\t"
1117  << "Trailer only at end of SubSubEvent!" << size / 4
1118  << " " << static_cast<size_t>(word);
1119  errorInData = true;
1120  } else {
1122 
1123  LOG(debug4) << "[" << fGwordCnt << "]\t"
1124  << mRichSupport::GetWordHexRepr(ptr) << "\t"
1125  << "ok"
1126  << "\t"
1127  << "TDC TRAILER";
1128  //extract TDC Trailer Error
1129  uint16_t errorBits = (tdcData) &0xffff; //16 bits
1131  fInSubSubEvent = kFALSE; // go out of InSubSubEvent state
1132  //fGwordCnt++;
1133  fDebugPrint = 0;
1134  }
1135  } else {
1136  LOG(info) << "[" << fGwordCnt << "]\t"
1137  << mRichSupport::GetWordHexRepr(ptr) << "\t"
1138  << "er"
1139  << "\t"
1140  << "UNKNOWN (TDC TRAILER not after header)";
1141  //fSkipMs = kTRUE;
1142  errorInData = true;
1143  //exit(EXIT_FAILURE); //TODO probably one should get rid of explicit EXIT calls not to ruin unpacking of other detectors?
1144  }
1145  } else if (tdcMarker == 0x1) { // TDC header
1146  // UInt_t randomCode = (tdcData >> 16) & 0xff; // 8 bits
1147  // UInt_t errorBits = (tdcData) & 0xffff; //16 bits
1148  if (!fInSubSubEvent) {
1149  fInSubSubEvent = kTRUE; // go into InSubSubEvent state
1150 
1151  if (!(fTrbState == TrbNetState::IDLE
1153  LOG(error) << "[" << fGwordCnt << "]\t"
1154  << mRichSupport::GetWordHexRepr(ptr) << "\t"
1155  << "er"
1156  << "\t"
1157  << "ILLEGAL HEADER Position";
1158  errorInData = true;
1159  } else if (!((((tdcData >> 8) & 0xFFFFFF) == 0x200096)
1160  || (((tdcData >> 8) & 0xFFFFFF) == 0x200095))) {
1161  LOG(error) << "[" << fGwordCnt << "]\t"
1162  << mRichSupport::GetWordHexRepr(ptr) << "\t"
1163  << "er"
1164  << "\t"
1165  << "ILLEGAL HEADER Value";
1166  errorInData = true;
1167  } else {
1169  //extract TDC Header Error
1170  uint8_t errorBits = (tdcData) &0xff; //8 bits
1172  LOG(debug4) << "[" << fGwordCnt << "]\t"
1173  << mRichSupport::GetWordHexRepr(ptr) << "\t"
1174  << "ok"
1175  << "\t"
1176  << "TDC HEADER";
1177  }
1178  //fGwordCnt++;
1179  } else {
1180  LOG(info) << "[" << fGwordCnt << "]\t"
1181  << mRichSupport::GetWordHexRepr(ptr) << "\t"
1182  << "er"
1183  << "\t"
1184  << "UNKNOWN (TDC HEADER not after trailer)";
1185  errorInData = true;
1186  //fGwordCnt++;
1187  //fSkipMs = kTRUE;
1188  //exit(EXIT_FAILURE); //TODO probably one should get rid of explicit EXIT calls not to ruin unpacking of other detectors?
1189  }
1190  } else if (tdcMarker == 0x2) { // DEBUG
1191  // UInt_t debugMode = (tdcData >> 24) & 0x1f; // 5 bits
1192  // UInt_t debugBits = (tdcData) & 0xffffff; // 24 bits
1193  //fTrbState = TrbNetState::DEBUG;
1194  LOG(debug4) << "[" << fGwordCnt << "]\t"
1195  << mRichSupport::GetWordHexRepr(ptr) << "\t"
1196  << "ok"
1197  << "\t"
1198  << "DEBUG";
1199  LOG(info) << "DEBUG VALUE [" << fGwordCnt << "]\t"
1201  errorInData = true;
1202  //fGwordCnt++;
1203  // currently no actions if a DEBUG message is encountered.
1204  } else if (tdcMarker == 0x3) { // EPOCH counter
1206  || fTrbState == TrbNetState::EPOCH)) {
1207  LOG(error) << "[" << fGwordCnt << "]\t"
1208  << mRichSupport::GetWordHexRepr(ptr) << "\t"
1209  << "er"
1210  << "\t"
1211  << "ILLEGAL EPOCH Position!";
1212  errorInData = true;
1213  } else if (((tdcData >> 28) & 0xF) != 0x6) { //EPOCH is always 0x6....
1214  LOG(error) << "[" << fGwordCnt << "]\t"
1215  << mRichSupport::GetWordHexRepr(ptr) << "\t"
1216  << "er"
1217  << "\t"
1218  << "ILLEGAL EPOCH value :";
1219  errorInData = true;
1220  } else {
1222  fDebugPrint = 0;
1223  fCurEpochCounter = (tdcData) &0xfffffff; // 28 bits
1224  LOG(debug4) << "[" << fGwordCnt << "]\t"
1225  << mRichSupport::GetWordHexRepr(ptr) << "\t"
1226  << "ok"
1227  << "\t"
1228  << "EPOCH\t" << fCurEpochCounter;
1229  //fGwordCnt++;
1230  }
1231  } else {
1232  if (tdcTimeDataMarker != 0x1) {
1233  LOG(error) << "[" << fGwordCnt << "]\t"
1234  << mRichSupport::GetWordHexRepr(ptr) << "\t"
1235  << "er"
1236  << "\t"
1237  << "UNKNOWN";
1238  errorInData = true;
1239  }
1240  }
1241  }
1242 
1243  if (errorInData) {
1244  //Handle error
1245  fSkipMs = kTRUE;
1246  fSkipCnt++;
1247  LOG(error) << " >>> Skipping MicroTS due to error in data! <<<";
1248  }
1249 
1250 
1251  return 0; //correction;
1252 }
1253 
1255  Int_t channel = (tdcData >> 22) & 0x7f; // 7 bits
1256  Int_t fine = (tdcData >> 12) & 0x3ff; // 10 bits
1257  Int_t edge = (tdcData >> 11) & 0x1; // 1 bit
1258  Int_t coarse = (tdcData) &0x7ff; // 11 bits
1259  Int_t epoch = fCurEpochCounter;
1260 
1261  //TODO move full time calculation outside
1262  Double_t fullTime = (Double_t) epoch * 2048. * 5. + (Double_t)(coarse) *5.
1263  - (Double_t)(fine) *0.005;
1264 
1265  LOG(debug4) << "[" << fGwordCnt << "]\t"
1266  << mRichSupport::GetWordHexRepr((uint8_t*) &tdcData) << "\t"
1267  << "ok"
1268  << "\t"
1269  << "TIMESTAMP"
1270  << "\t"
1271  << "ch=" << channel << "\t"
1272  << "edge=" << edge << "\t"
1273  << "epoch=" << epoch << "\t"
1274  << "coarse=" << coarse << "\t"
1275  << "fine=" << fine << "\t"
1276  << "full=" << fullTime;
1277  //fGwordCnt++;
1278 
1279  // Storing reference times
1280  // =======================
1281 
1283  Int_t idx = fUnpackPar->GetAddressIdx(fSubSubEvId);
1284  if (-1 == idx) {
1286  fSkipMs = kTRUE;
1287  return;
1288  }
1290 
1291  if ((fSubSubEvId == 0xc000) || (fSubSubEvId == 0xc001)) {
1292  // if CTS
1293  if ((channel == 0) && (edge == RISINGEDGEID)) {
1295  fLastCTSch0_re_time = fullTime;
1297  } else if ((channel == 2) && (edge == RISINGEDGEID)) {
1299  fLastCTSch2_re_time = fullTime;
1301  } else if ((channel == 2) && (edge == FALLINGEDGEID)) {
1303  fLastCTSch2_fe_time = fullTime;
1305  }
1306  } else {
1307  // if not CTS (which means TRB)
1308  if ((channel == 0) && (edge == RISINGEDGEID)) {
1310  fLastCh0_re_time[idx] = fullTime;
1312  }
1313  }
1314 
1315  // Calculation of corrected time
1316  // =============================
1317  Double_t fullTimeCorr = 0.;
1318  if (!((fSubSubEvId == 0xc000) || (fSubSubEvId == 0xc001))) {
1319  if (channel != 0) {
1320  Double_t dT = fullTime - fPrevLastCh0_re_time[idx];
1322  fullTimeCorr = dT - corr;
1323  }
1324  }
1325 
1326  // Filling histograms
1327  // ==================
1328  if (fbMonitorMode == kTRUE) {
1329  if (!((fSubSubEvId == 0xc000) || (fSubSubEvId == 0xc001))) {
1330  // if not CTS (which means TRB)
1331  if ((channel == 0) && (edge == RISINGEDGEID)) {
1332  /* Double_t dT1 = fullTime - fLastCTSch0_re_time;
1333  Double_t dT2 = fullTime - fLastCTSch2_re_time;
1334  Double_t dT3 = fullTime - fLastCTSch2_fe_time;
1335  fhTDCch0re_minusCTSch0re->Fill(idx, dT1);
1336  fhTDCch0re_minusCTSch2re->Fill(idx, dT2);
1337  fhTDCch0re_minusCTSch2fe->Fill(idx, dT3);
1338 
1339  Double_t dT4 = fullTime - fPrevLastCTSch0_re_time;
1340  Double_t dT5 = fullTime - fPrevLastCTSch2_re_time;
1341  Double_t dT6 = fullTime - fPrevLastCTSch2_fe_time;
1342  fhTDCch0re_minusPrevCTSch0re->Fill(idx, dT4);
1343  fhTDCch0re_minusPrevCTSch2re->Fill(idx, dT5);
1344  fhTDCch0re_minusPrevCTSch2fe->Fill(idx, dT6);
1345 
1346  LOG(debug4) << "dT1=" << dT1 << "\tdT2=" << dT2 << "\tdT3=" << dT3
1347  << "\tdT4=" << dT4 << "\tdT5=" << dT5 << "\tdT6=" << dT6;
1348 */
1349  }
1350 
1351  if ((channel != 0) && (edge == RISINGEDGEID)) {
1352  /*Double_t dT7 = fullTime - fLastCh0_re_time[idx];
1353  TH2D* h1 = fhTDCre_minusTDCch0re.at(idx);
1354  h1->Fill(channel, dT7);*/
1355 
1356  Double_t dT8 = fullTime - fPrevLastCh0_re_time[idx];
1357  /*TH2D* h2 = fhTDCre_minusPrevTDCch0re.at(idx);
1358  h2->Fill(channel, dT8);*/
1359 
1361  Double_t correctedT1 = dT8 + corr1;
1362  Double_t correctedT2 = dT8 - corr1;
1363  /*
1364 // TH2D* h3 = fhTDCre_corrected1.at(idx);
1365 // h3->Fill(channel, correctedT1);
1366 // TH2D* h4 = fhTDCre_corrected2.at(idx);
1367 // h4->Fill(channel, correctedT2);
1368 */
1369  LOG(debug4)
1370  /*<< "dT7=" << dT7*/ << "\tdT8=" << dT8 << "\tcorr1=" << corr1
1371  << "\tcorrectedT1=" << correctedT1
1372  << "\tcorrectedT2=" << correctedT2;
1373  }
1374  }
1375  }
1376 
1377  if (edge == RISINGEDGEID) {
1378  this->ProcessRisingEdge(fSubSubEvId, channel, fullTimeCorr);
1379  } else {
1380  this->ProcessFallingEdge(fSubSubEvId, channel, fullTimeCorr);
1381  }
1382 
1383  fChnlMsgCnt.at(channel)++;
1385  fChnlMsgCnt.at(channel)++; // If there was a correp. EPOCH before
1386 }
1387 
1389  Int_t channel,
1390  Double_t time) {
1392 
1393  //TODO: not a very nice hack.
1394  // All messages from ch0 are skipped. Though, probably, that is corect.
1395  if (channel == 0) return;
1396 
1397  // Also skip everything from CST
1398  if ((subSubEvId == 0xc000) || (subSubEvId == 0xc001)) return;
1399 
1400  fRisingEdgesBuf.push_back(CbmMcbmRichEdge(subSubEvId, channel, time));
1401 }
1402 
1404  Int_t channel,
1405  Double_t time) {
1407 
1408  // Skip everything from CST
1409  if ((subSubEvId == 0xc000) || (subSubEvId == 0xc001)) return;
1410 
1411  Bool_t reFound = kFALSE;
1412 
1413  std::vector<CbmMcbmRichEdge>::iterator reIter = fRisingEdgesBuf.begin();
1414 
1415  while (reIter != fRisingEdgesBuf.end()) {
1416  if (((*reIter).fSubSubEventID == subSubEvId)
1417  && ((*reIter).fChannel == channel)) {
1418  Double_t reTime = (*reIter).fTime;
1419  // Found corresponding rising edge
1420  Double_t ToT = time - reTime;
1421 
1422  if ((ToT >= TOTMIN) && (ToT <= TOTMAX)) {
1423  // Time-over-threshold is within allowed range
1424 
1425  reFound = kTRUE;
1426 
1427  LOG(debug4) << "Found pair for FPGA ID 0x" << std::hex << subSubEvId
1428  << std::dec << "\tch=" << channel << "\tToT=" << ToT;
1429 
1430  //TODO implement
1431  // Writing output digi
1433  if (fbMonitorMode) {
1434  TH1D* h = GetTotH1(subSubEvId, channel);
1435  if (h != nullptr) h->Fill(ToT);
1436 
1437  TH2D* h2 = GetTotH2(subSubEvId);
1438  if (h2 != nullptr) h2->Fill(channel, ToT);
1439  }
1440  WriteOutputDigi(subSubEvId, channel, reTime, ToT, fCurMSidx); //
1442 
1443  reIter = fRisingEdgesBuf.erase(reIter);
1444  continue; // Take care. This has to be the last operation in this block
1445 
1446  } else {
1447  //TODO: exception. By now we can just do nothing
1448  }
1449  } // end of if condition
1450 
1451  // This construction is a little bit tricky.
1452  // The iterator is either incremented here or (if a pair was found)
1453  // incremented using erase call, followed by the continue.
1454  ++reIter;
1455  } // end of for loop
1456 
1457  if (reFound == kFALSE) {
1458  // Corresponding rising edge not found - store the falling edge in the bufer
1459  fFallingEdgesBuf.push_back(CbmMcbmRichEdge(subSubEvId, channel, time));
1460  }
1461 }
1462 
1464  Int_t channel,
1465  Double_t time,
1466  Double_t tot,
1467  uint64_t MSidx) {
1468  Double_t ToTcorr =
1469  fbDoToTCorr ? fUnpackPar->GetToTshift(fpgaID, channel) : 0.;
1470  Int_t pixelUID = this->GetPixelUID(fpgaID, channel);
1471  //check ordering
1472  Double_t finalTime = time + (Double_t) MSidx - fdTimeOffsetNs;
1473 
1474  Double_t lastTime = 0.;
1475 
1476  if (fDigiVect.size() < 1) {
1477  fDigiVect.emplace_back(pixelUID, finalTime, tot - ToTcorr);
1478  } else {
1479  lastTime = fDigiVect[fDigiVect.size() - 1].GetTime();
1480  if (lastTime > finalTime) {
1481  for (int i = fDigiVect.size() - 1; i >= 0; i--) {
1482  lastTime = fDigiVect[i].GetTime();
1483  if (lastTime <= finalTime) {
1484  // LOG(info) << " before:"<< fDigiVect.size();
1485  fDigiVect.emplace(
1486  fDigiVect.begin() + i + 1, pixelUID, finalTime, tot - ToTcorr);
1487  // LOG(info) << fDigiVect.size();
1488  break;
1489  }
1490  }
1491  } else {
1492  fDigiVect.emplace_back(pixelUID, finalTime, tot - ToTcorr);
1493  }
1494  }
1495  LOG(debug4) << "CbmMcbm2018UnpackerAlgoRich::WriteOutputDigi fDigiVect.size="
1496  << fDigiVect.size();
1497 }
1498 
1500  // for (int i = 0; i < fDigiVect.size();++i) {
1501  // LOG(info) << "CbmMcbm2018UnpackerAlgoRich::Final Vector: "
1502  // << i+1 <<"/"<<fDigiVect.size()
1503  // << "\t" << std::setprecision(15)<< fDigiVect[i].GetTime();
1504  //
1505  //
1506  // }
1507  LOG(debug4) << "CbmMcbm2018UnpackerAlgoRich::FinalizeTs: "
1508  << fRisingEdgesBuf.size() << " entries in fRisingEdgesBuf"
1509  << "\t" << fFallingEdgesBuf.size()
1510  << " entries in fFallingEdgesBuf";
1511 
1512  // Clear rising edges buffer
1513  LOG(debug4) << "Rising edges: "
1514  "----------------------------------------------------------";
1515  std::vector<CbmMcbmRichEdge>::iterator reIter = fRisingEdgesBuf.begin();
1516  while (reIter != fRisingEdgesBuf.end()) {
1517  LOG(debug4) << "FPGA=0x" << std::hex << (*reIter).fSubSubEventID << std::dec
1518  << "\tch=" << (*reIter).fChannel;
1519  ++reIter;
1520  }
1521  fRisingEdgesBuf.clear();
1522 
1523  // Clear falling edges buffer
1524  LOG(debug4) << "Falling edges: "
1525  "---------------------------------------------------------";
1526  std::vector<CbmMcbmRichEdge>::iterator feIter = fFallingEdgesBuf.begin();
1527  while (feIter != fFallingEdgesBuf.end()) {
1528  LOG(debug4) << "FPGA=0x" << std::hex << (*feIter).fSubSubEventID << std::dec
1529  << "\tch=" << (*feIter).fChannel;
1530  ++feIter;
1531  }
1532  fFallingEdgesBuf.clear();
1533 
1534  LOG(debug4) << "---------------------------------------------------------";
1535 }
1536 
1538  Int_t nTDCs = fUnpackPar->GetNaddresses();
1539  // std::vector<TCanvas*> fcToT2d;
1540  /*
1541  fhTDCch0re_minusCTSch0re = new TH2D("fhTDCch0re_minusCTSch0re", "TDC ch0 re - CTS ch0 re;TDC index;ns", nTDCs, 0, nTDCs, 1000, -500., 500.);
1542  fhTDCch0re_minusCTSch2re = new TH2D("fhTDCch0re_minusCTSch2re", "TDC ch0 re - CTS ch2 re;TDC index;ns", nTDCs, 0, nTDCs, 1000, -500., 500.);
1543  fhTDCch0re_minusCTSch2fe = new TH2D("fhTDCch0re_minusCTSch2fe", "TDC ch0 re - CTS ch2 fe;TDC index;ns", nTDCs, 0, nTDCs, 1000, -500., 500.);
1544 
1545  AddHistoToVector(fhTDCch0re_minusCTSch0re, "");
1546  AddHistoToVector(fhTDCch0re_minusCTSch2re, "");
1547  AddHistoToVector(fhTDCch0re_minusCTSch2fe, "");
1548 
1549  fhTDCch0re_minusPrevCTSch0re = new TH2D("fhTDCch0re_minusPrevCTSch0re", "TDC ch0 re - prev CTS ch0 re;TDC index;ns", nTDCs, 0, nTDCs, 1000, -500., 500.);
1550  fhTDCch0re_minusPrevCTSch2re = new TH2D("fhTDCch0re_minusPrevCTSch2re", "TDC ch0 re - prev CTS ch2 re;TDC index;ns", nTDCs, 0, nTDCs, 1000, -500., 500.);
1551  fhTDCch0re_minusPrevCTSch2fe = new TH2D("fhTDCch0re_minusPrevCTSch2fe", "TDC ch0 re - prev CTS ch2 fe;TDC index;ns", nTDCs, 0, nTDCs, 1000, -500., 500.);
1552 
1553  AddHistoToVector(fhTDCch0re_minusPrevCTSch0re, "");
1554  AddHistoToVector(fhTDCch0re_minusPrevCTSch2re, "");
1555  AddHistoToVector(fhTDCch0re_minusPrevCTSch2fe, "");
1556 */
1557 
1558  fhTdcErrors = new TH2D("fhTdcErrors",
1559  "Errors in TDC msgs;;",
1560  nTDCs,
1561  -0.5,
1562  nTDCs - 0.5,
1563  9,
1564  -0.5,
1565  8.5);
1566  fhTdcErrors->GetYaxis()->SetBinLabel(1, "RingBuffOverw.");
1567  fhTdcErrors->GetYaxis()->SetBinLabel(2, "noRefTime");
1568  fhTdcErrors->GetYaxis()->SetBinLabel(3, "refTimePrecedes");
1569  fhTdcErrors->GetYaxis()->SetBinLabel(4, "trigW/oRefTime");
1570  fhTdcErrors->GetYaxis()->SetBinLabel(5, "markMisRefTime");
1571  fhTdcErrors->GetYaxis()->SetBinLabel(6, "multiRefTime");
1572  fhTdcErrors->GetYaxis()->SetBinLabel(7, "refTime<40ns");
1573  fhTdcErrors->GetYaxis()->SetBinLabel(8, "noValidation");
1574  fhTdcErrors->GetYaxis()->SetBinLabel(9, "trigger!=0x1");
1575  fhTdcErrors->GetXaxis()->LabelsOption("v");
1576  fhTdcErrors->GetYaxis()->SetTickSize(0.0);
1577  fhTdcErrors->GetXaxis()->SetTickSize(0.0);
1578  //fhTdcErrors->SetGrid();
1579 
1580  fhEventErrors = new TH2D("fhEventErrors",
1581  "Errors in Event/mts msgs;;",
1582  1,
1583  -0.5,
1584  0.5,
1585  13,
1586  -0.5,
1587  12.5);
1588  fhEventErrors->GetYaxis()->SetBinLabel(1, "UDPProblem");
1589  fhEventErrors->GetYaxis()->SetBinLabel(2, "evNumMism");
1590  fhEventErrors->GetYaxis()->SetBinLabel(3, "trigMism");
1591  fhEventErrors->GetYaxis()->SetBinLabel(4, "wrongLength");
1592  fhEventErrors->GetYaxis()->SetBinLabel(5, "answMissing");
1593  fhEventErrors->GetYaxis()->SetBinLabel(6, "evRequFail");
1594  fhEventErrors->GetYaxis()->SetBinLabel(7, "evPartFound");
1595  fhEventErrors->GetYaxis()->SetBinLabel(8, "sevBuffProb");
1596  fhEventErrors->GetYaxis()->SetBinLabel(9, "brokenEv");
1597  fhEventErrors->GetYaxis()->SetBinLabel(10, "ethLinkDwn");
1598  fhEventErrors->GetYaxis()->SetBinLabel(11, "subEvBuffAlmFull");
1599  fhEventErrors->GetYaxis()->SetBinLabel(12, "eth/BufProb");
1600  fhEventErrors->GetYaxis()->SetBinLabel(13, "timingTrigErr");
1601  fhEventErrors->GetXaxis()->LabelsOption("v");
1602  fhEventErrors->GetXaxis()->SetTickSize(0.0);
1603  fhEventErrors->GetYaxis()->SetTickSize(0.0);
1604 
1605  for (Int_t iTDC = 0; iTDC < nTDCs; iTDC++) {
1606  TString histoName;
1607  TString histoTitle;
1608  TString subFolder;
1609 
1610  Int_t Addr = fUnpackPar->GetAddress(iTDC);
1611  fMapFEE[Addr] = iTDC;
1612  fhTdcErrors->GetXaxis()->SetBinLabel(iTDC + 1, Form("0x%4x", Addr));
1613  /*
1614  histoName.Form("fhTDC%dre_minusTDC%dch0re", iTDC, iTDC);
1615  histoTitle.Form("TDC %d re - TDC %d ch0 re;channel;ns", iTDC, iTDC);
1616  TH2D* h1 = new TH2D(histoName, histoTitle, 32, 0., 32., 1200, 0., 600.);
1617  fhTDCre_minusTDCch0re.push_back(h1);
1618  AddHistoToVector(h1);
1619 
1620  histoName.Form("fhTDC%dre_minusPrevTDC%dch0re", iTDC, iTDC);
1621  histoTitle.Form("TDC %d re - prev. TDC %d ch0 re;channel;ns", iTDC, iTDC);
1622  TH2D* h2 = new TH2D(histoName, histoTitle, 32, 0., 32., 1200, 0., 600.);
1623  fhTDCre_minusPrevTDCch0re.push_back(h2);
1624  AddHistoToVector(h2);
1625 */
1626  /* histoName.Form("fhTDC%dre_corrected1", iTDC);
1627  histoTitle.Form("TDC %d re corrected1;channel;ns", iTDC);
1628  TH2D* h3 = new TH2D(histoName, histoTitle, 32, 0., 32., 1200, 0., 600.);
1629  fhTDCre_corrected1.push_back(h3);
1630  AddHistoToVector(h3);
1631 
1632  histoName.Form("fhTDC%dre_corrected2", iTDC);
1633  histoTitle.Form("TDC %d re corrected2;channel;ns", iTDC);
1634  TH2D* h4 = new TH2D(histoName, histoTitle, 32, 0., 32., 1200, 0., 600.);
1635  fhTDCre_corrected2.push_back(h4);
1636  AddHistoToVector(h4);
1637 */
1638  // TODO
1639  //workaround we need to init all histograms for ToT here. Otherwise they will not be added to monitoring.
1640  for (Int_t iCh = 0; iCh <= 32; iCh++) {
1641  Int_t tdc = fUnpackPar->GetAddress(iTDC);
1642  GetTotH1(tdc, iCh);
1643  }
1644  {
1645  Int_t tdc = fUnpackPar->GetAddress(iTDC);
1646  GetTotH2(tdc);
1647  }
1648 
1649  /*******************************************************************/
1650 
1652  { //if (iTDC == 0){
1653  Double_t w = 10;
1654  Double_t h = 10;
1655 
1656  TCanvas* c;
1657  TString canvasName;
1658  TString canvasTitle;
1659  Int_t tdc = fUnpackPar->GetAddress(iTDC);
1660  canvasName.Form("cToT2d_TDC_0x%4x", tdc);
1661  canvasTitle.Form("ToTs of TDC 0x%4x", tdc);
1662  c = new TCanvas(canvasName, canvasTitle, w, h);
1663  // fcHitMaps->Divide( 2 );
1664  // fcHitMaps->cd( 1 );
1665  // gPad->SetGridx();
1666  // gPad->SetGridy();
1667  // gPad->SetLogy();
1668  // fhChannelMap->Draw();
1669  // fcHitMaps->cd( 2 );
1670  // gPad->SetGridx();
1671  // gPad->SetGridy();
1672  // gPad->SetLogz();
1673  TH2D* h2 = GetTotH2(tdc);
1674  h2->Draw("colz");
1675  fcTot2d.push_back(c);
1676  AddCanvasToVector(c, "ToT_Canvases");
1677  }
1678  /*******************************************************************/
1679  }
1680 
1681 
1684 
1685  fhVectorSize =
1686  new TH1I("fhVectorSize",
1687  "Size of the vector VS TS index; TS index; Size [bytes]",
1688  10000,
1689  0.,
1690  10000.);
1692  new TH1I("fhVectorCapacity",
1693  "Size of the vector VS TS index; TS index; Size [bytes]",
1694  10000,
1695  0.,
1696  10000.);
1699 
1700  if (fbDebugMonitorMode) {
1701  fhEventSize = new TH1I("fhEventSize",
1702  "Size of the Event from TrbNet; Size [bytes]",
1703  350,
1704  0.,
1705  70000.);
1707 
1708  fhSubEventSize = new TH2I("fhSubEventSize",
1709  "fhSubEventSize; HubId ; Size [bytes]; Entries",
1710  6,
1711  0,
1712  6,
1713  10000,
1714  0.,
1715  10000.);
1717 
1719  new TH2I("fhSubSubEventSize",
1720  "fhSubSubEventSize; DiRICH ; Size [words]; Entries",
1721  72,
1722  0,
1723  72,
1724  510,
1725  0.,
1726  510.);
1728 
1729  fhChnlSize = new TH2I("fhChnlSize",
1730  "fhChnlSize; channel; Size [words]; Entries",
1731  33,
1732  0,
1733  33,
1734  25,
1735  0,
1736  25.);
1738  }
1739 
1740  return kTRUE;
1741 }
1742 
1743 TH1D* CbmMcbm2018UnpackerAlgoRich::GetTotH1(Int_t tdc, Int_t channel) {
1744  TH1D* h = fhTotMap[tdc][channel];
1745  if (h == nullptr) {
1746  TString name, title, subFolder;
1747  name.Form("ToT_tdc0x%x_ch%u", tdc, channel);
1748  title.Form("%s;ToT [ns];Entries", name.Data());
1749  subFolder.Form("ToT/tdc0x%x", tdc);
1750  h = new TH1D(name, title, 100, -1., 49.);
1751  AddHistoToVector(h, std::string(subFolder.Data()));
1752  fhTotMap[tdc][channel] = h;
1753  }
1754  return h;
1755 }
1756 
1758  TH2D* h = fhTot2dMap[tdc];
1759  if (h == nullptr) {
1760  TString name, title, subFolder;
1761  name.Form("ToT_2d_tdc0x%x", tdc);
1762  title.Form("%s;channels;ToT [ns]", name.Data());
1763  subFolder.Form("ToT2d");
1764  h = new TH2D(name, title, 33, 0, 32, 200, -1., 49.);
1765  AddHistoToVector(h, std::string(subFolder.Data()));
1766  fhTot2dMap[tdc] = h;
1767  }
1768  return h;
1769 }
1770 
1771 Bool_t CbmMcbm2018UnpackerAlgoRich::DebugMs(const fles::Timeslice& ts,
1772  size_t uMsCompIdx,
1773  size_t uMsIdx) {
1774  const fles::MicrosliceView mv = ts.get_microslice(uMsCompIdx, uMsIdx);
1775  const fles::MicrosliceDescriptor& msDesc = mv.desc();
1776  const uint8_t* ptr = mv.content();
1777  const size_t size = msDesc.size;
1778 
1779  if (size == 0) return kTRUE;
1780  Debug(ptr, size);
1781 
1782  return kTRUE;
1783 }
1784 
1785 Int_t CbmMcbm2018UnpackerAlgoRich::Debug(const uint8_t* ptr,
1786  const size_t size) {
1787 
1788  if (size == 0) return size;
1789 
1790  //LOG(info)<<"DEBUG MODE IS ACTIVE; Printing raw data:";
1791 
1792  uint8_t nblCnt = 0;
1793  uint8_t wrdCnt = 0;
1794  std::cout << std::endl << "SIZE: " << std::dec << size << "Byte" << std::endl;
1795  for (size_t i = 0; i < size; ++i) {
1796 
1797  //if (wrdCnt == 0) std::cout<<"HEX: ";
1798  uint8_t* tdcDataPtr = (uint8_t*) (ptr + i);
1799 
1800  if (wrdCnt == 0 && nblCnt == 0) { printf("%08d : ", static_cast<int>(i)); }
1801 
1802  printf("%02x", unsigned(*tdcDataPtr));
1803  nblCnt++;
1804  if (nblCnt % 2 == 0) { printf(" "); }
1805  if (nblCnt % 4 == 0) {
1806  printf(" ");
1807  wrdCnt++;
1808  nblCnt = 0;
1809  }
1810 
1811  if (wrdCnt == 10) {
1812  printf("\n");
1813  wrdCnt = 0;
1814  }
1815  }
1816  printf("\n");
1817  return size;
1818 }
1819 
1820 
1822  RichErrorType type,
1823  uint16_t tdcAddr) {
1824  if (fbMonitorMode) {
1825  switch (type) {
1827  //UDP problem
1828  if ((errbits & 0x1) == 1) fhEventErrors->Fill(0.0, 0.0);
1829 
1830  break;
1831 
1833  // min. 1 rinǵ buffer overwritten
1834  if ((errbits & 0x1) == 1) fhTdcErrors->Fill(fMapFEE[tdcAddr], 0.0);
1835 
1836  break;
1837 
1839  // no reference time in trigger handler in TDC
1840  if (((errbits >> 0) & 0x1) == 1)
1841  fhTdcErrors->Fill(fMapFEE[tdcAddr], 1.0);
1842 
1843  // reference time precedes a non-timing trigger
1844  if (((errbits >> 1) & 0x1) == 1)
1845  fhTdcErrors->Fill(fMapFEE[tdcAddr], 2.0);
1846 
1847  // timing trigger is delivered without a reference time
1848  if (((errbits >> 2) & 0x1) == 1)
1849  fhTdcErrors->Fill(fMapFEE[tdcAddr], 3.0);
1850 
1851  // Set with the bit 2 to mark the missing reference time
1852  if (((errbits >> 3) & 0x1) == 1)
1853  fhTdcErrors->Fill(fMapFEE[tdcAddr], 4.0);
1854 
1855  // there are more than one detected reference time
1856  if (((errbits >> 4) & 0x1) == 1)
1857  fhTdcErrors->Fill(fMapFEE[tdcAddr], 5.0);
1858 
1859  // reference time was too short (<40 ns)
1860  if (((errbits >> 5) & 0x1) == 1)
1861  fhTdcErrors->Fill(fMapFEE[tdcAddr], 6.0);
1862 
1863  // no trigger validation arrives from the endpoint after a valid reference time
1864  if (((errbits >> 6) & 0x1) == 1)
1865  fhTdcErrors->Fill(fMapFEE[tdcAddr], 7.0);
1866 
1867  // any timing trigger type except 0x1 is send
1868  if (((errbits >> 7) & 0x1) == 1)
1869  fhTdcErrors->Fill(fMapFEE[tdcAddr], 8.0);
1870 
1871  break;
1872 
1874  // To be implemented
1875  break;
1876 
1878  // To be implemented
1879  break;
1880 
1882  // event number mismatch
1883  if (((errbits >> 0) & 0x1) == 1) fhEventErrors->Fill(0.0, 1.0);
1884 
1885  // trigger code mismatch
1886  if (((errbits >> 1) & 0x1) == 1) fhEventErrors->Fill(0.0, 2.0);
1887 
1888  // wrong length
1889  if (((errbits >> 2) & 0x1) == 1) fhEventErrors->Fill(0.0, 3.0);
1890 
1891  // answer missing
1892  if (((errbits >> 3) & 0x1) == 1) fhEventErrors->Fill(0.0, 4.0);
1893 
1894  // event number request by CTS was not available (Not found)
1895  if (((errbits >> 4) & 0x1) == 1) fhEventErrors->Fill(0.0, 5.0);
1896 
1897  // event partially found in data buffer
1898  if (((errbits >> 5) & 0x1) == 1) fhEventErrors->Fill(0.0, 6.0);
1899 
1900  // Severe Problem with data buffer and/or read-out
1901  if (((errbits >> 6) & 0x1) == 1) fhEventErrors->Fill(0.0, 7.0);
1902 
1903  // Single broken event
1904  if (((errbits >> 7) & 0x1) == 1) fhEventErrors->Fill(0.0, 8.0);
1905 
1906  // Ethernet Link down
1907  if (((errbits >> 8) & 0x1) == 1) fhEventErrors->Fill(0.0, 9.0);
1908 
1909  // SubEvent buffer almost full
1910  if (((errbits >> 9) & 0x1) == 1) fhEventErrors->Fill(0.0, 10.0);
1911 
1912  // Ethernet/SubEventBuilder error
1913  if (((errbits >> 10) & 0x1) == 1) fhEventErrors->Fill(0.0, 11.0);
1914 
1915  // Timing trigger error
1916  if (((errbits >> 11) & 0x1) == 1) fhEventErrors->Fill(0.0, 12.0);
1917 
1918  break;
1919 
1920  default: break;
1921  }
1922  }
1923 }
1924 
1925 /*
1926 Bool_t CbmMcbm2018UnpackerAlgoRich::FillHistograms()
1927 {
1928  return kTRUE;
1929 }
1930 */
1932  //TODO: do something?
1933  return kTRUE;
1934 }
1935 
1937  uint8_t const* const ptr,
1938  size_t const size) {
1939 
1941 
1942  // mRichSupport::SwapBytes(4, ptr+size);
1943  // if((((((Int_t*)(ptr+size))[0]) >> 28) & 0xF) != 0x0) {
1944  // LOG(WARN) << "CbmMcbm2018UnpackerAlgoRich::ProcessTRBsubevent() warning:"
1945  // << "End on Hub is not where expected. Is it a Buffer overflow? LastWord: "<<mRichSupport::GetWordHexRepr(ptr+size);
1946  // }
1947  // mRichSupport::SwapBytes(4, ptr+size);
1948 
1949  /***
1950  * Signature of Error:
1951  * 82b7 8ca6
1952  * 8297 *34ad*
1953  * *34ad* 66af // data Ptr
1954  * *cf8b* *cf8b*
1955  * 82c8 cca9
1956  */
1957 
1958  //start at 8 to skip header of Hub and first row as this has to be checked
1959  //stop at size -4 to avoid comparing with following hub
1960 
1961  for (Int_t i = 8; i < static_cast<Int_t>(size - 4);
1962  i += 4) { // i represents bytes (4 per line)
1963  //TODO: Optimize the swaping
1964  mRichSupport::SwapBytes(4, ptr + i - 4);
1965  mRichSupport::SwapBytes(4, ptr + i);
1966  mRichSupport::SwapBytes(4, ptr + i + 4);
1967  bool problem = false;
1968  if ((((Int_t*) (ptr + i - 4))[0] & 0xFFFF)
1969  == ((((Int_t*) (ptr + i))[0] >> 16) & 0xFFFF)) {
1970  if ((((Int_t*) (ptr + i + 4))[0] & 0xFFFF)
1971  == ((((Int_t*) (ptr + i + 4))[0] >> 16) & 0xFFFF)) {
1972  //Signature of problem!
1973  problem = true;
1974  fTDCAlignmentErrorPositions.push_back(i);
1975  fTDCAlignmentErrorPositions.push_back(i + 6);
1976  }
1977  }
1978 
1979  mRichSupport::SwapBytes(4, ptr + i - 4);
1980  mRichSupport::SwapBytes(4, ptr + i);
1981  mRichSupport::SwapBytes(4, ptr + i + 4);
1982 
1983  if (problem) i += 8; //jump after the problem
1984  }
1985 }
1986 
CbmMcbm2018UnpackerAlgoRich::fTDCAlignmentErrorPositions
std::vector< Int_t > fTDCAlignmentErrorPositions
Definition: CbmMcbm2018UnpackerAlgoRich.h:245
CbmMcbm2018UnpackerAlgoRich::ProcessTRBevent
Int_t ProcessTRBevent(size_t const size, uint8_t const *const ptr)
Definition: CbmMcbm2018UnpackerAlgoRich.cxx:434
CbmMcbmRichEdge
Definition: CbmMcbm2018UnpackerUtilRich.h:10
CbmMcbm2018UnpackerAlgoRich::fLastFeeOnHub
Bool_t fLastFeeOnHub
Definition: CbmMcbm2018UnpackerAlgoRich.h:243
CbmMcbm2018RichPar::GetToTshift
Double_t GetToTshift(Int_t tdc, Int_t ch) const
Definition: CbmMcbm2018RichPar.h:36
CbmMcbm2018UnpackerAlgoRich::InitStorage
void InitStorage()
Definition: CbmMcbm2018UnpackerAlgoRich.cxx:160
CbmMcbm2018UnpackerAlgoRich::fhVectorSize
TH1 * fhVectorSize
Definition: CbmMcbm2018UnpackerAlgoRich.h:350
CbmMcbm2018UnpackerAlgoRich::fSubSubEvId
Int_t fSubSubEvId
Definition: CbmMcbm2018UnpackerAlgoRich.h:238
CbmMcbm2018UnpackerAlgoRich::fTdcWordCorrectionCnt
Int_t fTdcWordCorrectionCnt
Definition: CbmMcbm2018UnpackerAlgoRich.h:247
CbmMcbm2018UnpackerAlgoRich::InitParameters
Bool_t InitParameters()
Definition: CbmMcbm2018UnpackerAlgoRich.cxx:155
CbmStar2019Algo< CbmRichDigi >::fdMsSizeInNs
Double_t fdMsSizeInNs
/‍** Ignore Overlap Ms: all fuOverlapMsNb MS at the end of timeslice **‍/
Definition: CbmStar2019Algo.h:117
CbmMcbm2018UnpackerAlgoRich::fRisingEdgesBuf
std::vector< CbmMcbmRichEdge > fRisingEdgesBuf
Definition: CbmMcbm2018UnpackerAlgoRich.h:306
CbmMcbm2018RichPar::GetAddress
Int_t GetAddress(Int_t ind) const
Definition: CbmMcbm2018RichPar.cxx:71
CbmMcbm2018RichPar.h
TrbNetState::IDLE
@ IDLE
CbmMcbm2018UnpackerAlgoRich::fTScounter
uint64_t fTScounter
Definition: CbmMcbm2018UnpackerAlgoRich.h:207
CbmMcbm2018UnpackerAlgoRich::fdTimeOffsetNs
Double_t fdTimeOffsetNs
User settings: Data correction parameters.
Definition: CbmMcbm2018UnpackerAlgoRich.h:188
CbmMcbm2018UnpackerAlgoRich::fhTotMap
std::map< Int_t, std::map< Int_t, TH1D * > > fhTotMap
Definition: CbmMcbm2018UnpackerAlgoRich.h:372
CbmRichDigi
Definition: CbmRichDigi.h:25
TrbNetState::HEADER
@ HEADER
CbmStar2019Algo< CbmRichDigi >::fuNbMsLoop
size_t fuNbMsLoop
Definition: CbmStar2019Algo.h:114
RichErrorType::ctsHeader
@ ctsHeader
CbmMcbm2018UnpackerAlgoRich::ProcessTs
virtual Bool_t ProcessTs(const fles::Timeslice &ts)
Definition: CbmMcbm2018UnpackerAlgoRich.cxx:193
mRichSupport::GetWordHexRepr
std::string GetWordHexRepr(uint8_t const *const ptr)
Definition: CbmMcbm2018UnpackerUtilRich.cxx:48
CbmMcbm2018UnpackerAlgoRich::fcTot2d
std::vector< TCanvas * > fcTot2d
Definition: CbmMcbm2018UnpackerAlgoRich.h:348
TOTMIN
#define TOTMIN
Definition: CbmMcbm2018UnpackerAlgoRich.h:30
CbmMcbm2018UnpackerAlgoRich::FinalizeTs
void FinalizeTs()
Definition: CbmMcbm2018UnpackerAlgoRich.cxx:1499
CbmMcbm2018UnpackerAlgoRich::fSkipCnt
Int_t fSkipCnt
Definition: CbmMcbm2018UnpackerAlgoRich.h:251
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
CbmMcbm2018UnpackerAlgoRich::ErrorMsg
void ErrorMsg(uint16_t errbits, RichErrorType type, uint16_t tdcAddr=0)
Definition: CbmMcbm2018UnpackerAlgoRich.cxx:1821
TrbNetState
TrbNetState
Definition: CbmMcbm2018UnpackerAlgoRich.h:33
CbmMcbm2018RichPar::GetNaddresses
Int_t GetNaddresses(void) const
Definition: CbmMcbm2018RichPar.h:26
CbmStar2019Algo< CbmRichDigi >::fuNbOverMsPerTs
size_t fuNbOverMsPerTs
Definition: CbmStar2019Algo.h:113
CbmMcbm2018RichPar
Definition: CbmMcbm2018RichPar.h:13
CbmMcbm2018UnpackerAlgoRich::fGwordCnt
Int_t fGwordCnt
Definition: CbmMcbm2018UnpackerAlgoRich.h:223
CbmStar2019Algo< CbmRichDigi >::AddHistoToVector
void AddHistoToVector(TNamed *pointer, std::string sFolder="")
For monitor algos.
Definition: CbmStar2019Algo.h:80
CbmMcbm2018UnpackerAlgoRich::fhTot2dMap
std::map< Int_t, TH2D * > fhTot2dMap
Definition: CbmMcbm2018UnpackerAlgoRich.h:374
CbmMcbm2018UnpackerAlgoRich::fhChnlSize
TH2 * fhChnlSize
Definition: CbmMcbm2018UnpackerAlgoRich.h:365
CbmStar2019Algo< CbmRichDigi >::fuNbCoreMsPerTs
size_t fuNbCoreMsPerTs
Definition: CbmStar2019Algo.h:112
RichErrorType::subEventError
@ subEventError
CbmMcbm2018UnpackerAlgoRich::fMapFEE
std::map< uint16_t, uint16_t > fMapFEE
Definition: CbmMcbm2018UnpackerAlgoRich.h:370
CbmMcbm2018UnpackerAlgoRich::fCurEpochCounter
UInt_t fCurEpochCounter
Definition: CbmMcbm2018UnpackerAlgoRich.h:233
CbmMcbm2018UnpackerAlgoRich::AddMsComponentToList
void AddMsComponentToList(size_t component, UShort_t usDetectorId)
Definition: CbmMcbm2018UnpackerAlgoRich.cxx:171
CbmMcbm2018UnpackerAlgoRich::fbMonitorMode
Bool_t fbMonitorMode
Control flags.
Definition: CbmMcbm2018UnpackerAlgoRich.h:170
CbmStar2019Algo< CbmRichDigi >::fdTsFullSizeInNs
Double_t fdTsFullSizeInNs
Total size of the core MS in a TS, [nanoseconds].
Definition: CbmStar2019Algo.h:121
CbmStar2019Algo< CbmRichDigi >::fParCList
TList * fParCList
Parameter management.
Definition: CbmStar2019Algo.h:108
CbmMcbm2018UnpackerAlgoRich::InitContainers
virtual Bool_t InitContainers()
Definition: CbmMcbm2018UnpackerAlgoRich.cxx:128
CbmStar2019Algo< CbmRichDigi >::fvMsComponentsList
std::vector< size_t > fvMsComponentsList
Parameters related to FLES containers.
Definition: CbmStar2019Algo.h:111
CbmMcbm2018UnpackerAlgoRich::fPrevLastCh0_re_time
TArrayD fPrevLastCh0_re_time
Definition: CbmMcbm2018UnpackerAlgoRich.h:292
CbmMcbm2018UnpackerAlgoRich::GetParList
virtual TList * GetParList()
Definition: CbmMcbm2018UnpackerAlgoRich.cxx:147
CbmMcbm2018UnpackerAlgoRich::fbDoToTCorr
Bool_t fbDoToTCorr
User setting: kTRUE activates ToT correction from Parameterfile.
Definition: CbmMcbm2018UnpackerAlgoRich.h:184
CbmMcbm2018UnpackerAlgoRich::GetTotH2
TH2D * GetTotH2(Int_t fpgaID)
Definition: CbmMcbm2018UnpackerAlgoRich.cxx:1757
RichErrorType::tdcTrailer
@ tdcTrailer
RichErrorType::tdcHeader
@ tdcHeader
TrbNetState::TDC
@ TDC
TrbNetState::EPOCH
@ EPOCH
CbmMcbm2018UnpackerAlgoRich::ProcessTDCword
Int_t ProcessTDCword(uint8_t const *const ptr, Int_t const word, size_t const size)
Definition: CbmMcbm2018UnpackerAlgoRich.cxx:1073
CbmMcbm2018UnpackerAlgoRich::fRawDataMode
Bool_t fRawDataMode
Switch ON the filling of a additional set of histograms.
Definition: CbmMcbm2018UnpackerAlgoRich.h:175
mRichSupport::SwapBytes
void SwapBytes(size_t const size, uint8_t const *ptr)
Definition: CbmMcbm2018UnpackerUtilRich.cxx:88
CbmMcbm2018UnpackerAlgoRich::WriteOutputDigi
void WriteOutputDigi(Int_t fpgaID, Int_t channel, Double_t time, Double_t tot, uint64_t MSidx)
Definition: CbmMcbm2018UnpackerAlgoRich.cxx:1463
h
Data class with information on a STS local track.
CbmMcbm2018UnpackerAlgoRich::DebugMs
Bool_t DebugMs(const fles::Timeslice &ts, size_t uMsCompIdx, size_t uMsIdx)
Definition: CbmMcbm2018UnpackerAlgoRich.cxx:1771
CbmMcbm2018UnpackerAlgoRich::GetTotH1
TH1D * GetTotH1(Int_t fpgaID, Int_t channel)
Definition: CbmMcbm2018UnpackerAlgoRich.cxx:1743
CbmMcbm2018RichPar::GetAddressIdx
Int_t GetAddressIdx(Int_t addr) const
Definition: CbmMcbm2018RichPar.cxx:58
CbmMcbm2018UnpackerAlgoRich::fPrevLastCTSch0_re_time
Double_t fPrevLastCTSch0_re_time
Definition: CbmMcbm2018UnpackerAlgoRich.h:272
CbmStar2019Algo
Definition: CbmStar2019Algo.h:43
CbmMcbm2018UnpackerAlgoRich::fCurMSid
Int_t fCurMSid
Definition: CbmMcbm2018UnpackerAlgoRich.h:212
CbmMcbm2018UnpackerAlgoRich::Finish
virtual void Finish()
Definition: CbmMcbm2018UnpackerAlgoRich.cxx:126
FALLINGEDGEID
#define FALLINGEDGEID
Definition: CbmMcbm2018UnpackerAlgoRich.h:28
CbmStar2019Algo< CbmRichDigi >::fdTsCoreSizeInNs
Double_t fdTsCoreSizeInNs
Size of a single MS, [nanoseconds].
Definition: CbmStar2019Algo.h:119
CbmMcbm2018UnpackerAlgoRich::fLastCTSch0_re_time
Double_t fLastCTSch0_re_time
Definition: CbmMcbm2018UnpackerAlgoRich.h:257
CbmMcbm2018UnpackerAlgoRich::fhSubSubEventSize
TH2 * fhSubSubEventSize
Definition: CbmMcbm2018UnpackerAlgoRich.h:364
CbmMcbm2018UnpackerAlgoRich::fRICHcompIdx
Int_t fRICHcompIdx
Definition: CbmMcbm2018UnpackerAlgoRich.h:197
CbmMcbm2018UnpackerAlgoRich::ProcessSKIPsubevent
Int_t ProcessSKIPsubevent(size_t const size, uint8_t const *const ptr)
Definition: CbmMcbm2018UnpackerAlgoRich.cxx:701
TrbNetState::TRAILER
@ TRAILER
RichErrorType::mtsError
@ mtsError
CbmStar2019Algo< CbmRichDigi >::fDigiVect
std::vector< CbmRichDigi > fDigiVect
Vector of pointers to canvases + optional folder name.
Definition: CbmStar2019Algo.h:140
ClassImp
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
Definition: CbmConverterManager.cxx:12
CbmMcbm2018UnpackerAlgoRich::findTDCAlignmentError
void findTDCAlignmentError(uint8_t const *const ptr, size_t const size)
Definition: CbmMcbm2018UnpackerAlgoRich.cxx:1936
CbmMcbm2018UnpackerAlgoRich::fdCapacityIncFactor
Double_t fdCapacityIncFactor
Definition: CbmMcbm2018UnpackerAlgoRich.h:377
CbmMcbm2018UnpackerAlgoRich::fhEventSize
TH1 * fhEventSize
Definition: CbmMcbm2018UnpackerAlgoRich.h:362
CbmMcbm2018UnpackerAlgoRich::fuTsMaxVectorSize
size_t fuTsMaxVectorSize
Definition: CbmMcbm2018UnpackerAlgoRich.h:376
CbmMcbm2018UnpackerAlgoRich::fLastCTSch2_re_time
Double_t fLastCTSch2_re_time
Definition: CbmMcbm2018UnpackerAlgoRich.h:262
CbmMcbm2018UnpackerAlgoRich::Reset
virtual void Reset()
Definition: CbmMcbm2018UnpackerAlgoRich.cxx:124
CbmMcbm2018UnpackerAlgoRich::fPrevLastCTSch2_re_time
Double_t fPrevLastCTSch2_re_time
Definition: CbmMcbm2018UnpackerAlgoRich.h:277
CbmMcbm2018UnpackerAlgoRich::fPrevLastCTSch2_fe_time
Double_t fPrevLastCTSch2_fe_time
Definition: CbmMcbm2018UnpackerAlgoRich.h:282
CbmMcbm2018UnpackerAlgoRich::Debug
Int_t Debug(const uint8_t *ptr, const size_t size)
Definition: CbmMcbm2018UnpackerAlgoRich.cxx:1785
CbmMcbm2018UnpackerAlgoRich::ReInitContainers
virtual Bool_t ReInitContainers()
Definition: CbmMcbm2018UnpackerAlgoRich.cxx:135
CbmMcbm2018UnpackerAlgoRich::~CbmMcbm2018UnpackerAlgoRich
virtual ~CbmMcbm2018UnpackerAlgoRich()
Definition: CbmMcbm2018UnpackerAlgoRich.cxx:112
mRichSupport::GetHexRepresentation
std::string GetHexRepresentation(size_t const size, uint8_t const *const ptr)
Definition: CbmMcbm2018UnpackerUtilRich.cxx:29
CbmMcbm2018UnpackerAlgoRich::Init
virtual Bool_t Init()
Definition: CbmMcbm2018UnpackerAlgoRich.cxx:117
CbmMcbm2018UnpackerAlgoRich::CbmMcbm2018UnpackerAlgoRich
CbmMcbm2018UnpackerAlgoRich()
Definition: CbmMcbm2018UnpackerAlgoRich.cxx:73
TOTMAX
#define TOTMAX
Definition: CbmMcbm2018UnpackerAlgoRich.h:31
CbmMcbm2018UnpackerAlgoRich::fbDebugMonitorMode
Bool_t fbDebugMonitorMode
Switch ON the filling of a minimal set of histograms.
Definition: CbmMcbm2018UnpackerAlgoRich.h:173
CbmMcbm2018UnpackerAlgoRich
Definition: CbmMcbm2018UnpackerAlgoRich.h:44
CbmMcbm2018UnpackerAlgoRich::ProcessRisingEdge
void ProcessRisingEdge(Int_t subSubEvId, Int_t channel, Double_t time)
Definition: CbmMcbm2018UnpackerAlgoRich.cxx:1388
CbmMcbm2018UnpackerAlgoRich::fFallingEdgesBuf
std::vector< CbmMcbmRichEdge > fFallingEdgesBuf
Exclude from ROOT dictionnary due to missing empty constructor!!
Definition: CbmMcbm2018UnpackerAlgoRich.h:312
CbmMcbm2018UnpackerAlgoRich::fhTdcErrors
TH2D * fhTdcErrors
Definition: CbmMcbm2018UnpackerAlgoRich.h:356
CbmMcbm2018UnpackerAlgoRich::fhEventErrors
TH2D * fhEventErrors
Definition: CbmMcbm2018UnpackerAlgoRich.h:357
CbmMcbm2018UnpackerAlgoRich.h
CbmMcbm2018UnpackerAlgoRich::fTdcWordCorrectionGlobalCnt
Int_t fTdcWordCorrectionGlobalCnt
Definition: CbmMcbm2018UnpackerAlgoRich.h:249
CbmMcbm2018UnpackerAlgoRich::fUnpackPar
CbmMcbm2018RichPar * fUnpackPar
Definition: CbmMcbm2018UnpackerAlgoRich.h:202
CbmMcbm2018UnpackerAlgoRich::fSkipMs
Bool_t fSkipMs
Definition: CbmMcbm2018UnpackerAlgoRich.h:186
CbmStar2019Algo< CbmRichDigi >::AddCanvasToVector
void AddCanvasToVector(TCanvas *pointer, std::string sFolder="")
Definition: CbmStar2019Algo.h:87
CbmMcbm2018UnpackerAlgoRich::fInSubSubEvent
Bool_t fInSubSubEvent
Definition: CbmMcbm2018UnpackerAlgoRich.h:228
CbmMcbm2018UnpackerAlgoRich::fCurMSidx
uint64_t fCurMSidx
Definition: CbmMcbm2018UnpackerAlgoRich.h:218
CbmMcbm2018UnpackerAlgoRich::ProcessFallingEdge
void ProcessFallingEdge(Int_t subSubEvId, Int_t channel, Double_t time)
Definition: CbmMcbm2018UnpackerAlgoRich.cxx:1403
RichErrorType::ctsTrailer
@ ctsTrailer
CbmMcbm2018UnpackerAlgoRich::fDebugPrint
bool fDebugPrint
Definition: CbmMcbm2018UnpackerAlgoRich.h:369
CbmMcbm2018UnpackerAlgoRich::ProcessTRBsubevent
Int_t ProcessTRBsubevent(size_t const size, uint8_t const *const ptr)
Definition: CbmMcbm2018UnpackerAlgoRich.cxx:829
RichErrorType
RichErrorType
Definition: CbmMcbm2018UnpackerAlgoRich.h:35
CbmMcbm2018UnpackerAlgoRich::ResetHistograms
Bool_t ResetHistograms()
Definition: CbmMcbm2018UnpackerAlgoRich.cxx:1931
CbmMcbm2018UnpackerAlgoRich::fChnlMsgCnt
std::array< unsigned int, 33 > fChnlMsgCnt
Definition: CbmMcbm2018UnpackerAlgoRich.h:367
CbmMcbm2018UnpackerAlgoRich::fLastCh0_re_time
TArrayD fLastCh0_re_time
Definition: CbmMcbm2018UnpackerAlgoRich.h:287
CbmMcbm2018UnpackerAlgoRich::fTrbState
TrbNetState fTrbState
flag for an error in the datastream
Definition: CbmMcbm2018UnpackerAlgoRich.h:179
CbmMcbm2018UnpackerAlgoRich::fhSubEventSize
TH2 * fhSubEventSize
Definition: CbmMcbm2018UnpackerAlgoRich.h:363
CbmMcbm2018UnpackerAlgoRich::ProcessTRBeventHeader
Int_t ProcessTRBeventHeader(size_t const size, uint8_t const *const ptr)
Definition: CbmMcbm2018UnpackerAlgoRich.cxx:608
CbmMcbm2018UnpackerAlgoRich::ProcessTimestampWord
void ProcessTimestampWord(Int_t tdcData)
Definition: CbmMcbm2018UnpackerAlgoRich.cxx:1254
CbmMcbm2018UnpackerAlgoRich::CreateHistograms
Bool_t CreateHistograms()
Exclude from ROOT dictionnary due to missing empty constructor!!
Definition: CbmMcbm2018UnpackerAlgoRich.cxx:1537
CbmMcbm2018UnpackerAlgoRich::fLastCTSch2_fe_time
Double_t fLastCTSch2_fe_time
Definition: CbmMcbm2018UnpackerAlgoRich.h:267
RISINGEDGEID
#define RISINGEDGEID
Definition: CbmMcbm2018UnpackerAlgoRich.h:27
CbmStar2019Algo< CbmRichDigi >::fbIgnoreOverlapMs
Bool_t fbIgnoreOverlapMs
Definition: CbmStar2019Algo.h:116
CbmMcbm2018UnpackerAlgoRich::ProcessCTSsubevent
Int_t ProcessCTSsubevent(size_t const size, uint8_t const *const ptr)
Definition: CbmMcbm2018UnpackerAlgoRich.cxx:743
CbmMcbm2018UnpackerAlgoRich::fhVectorCapacity
TH1 * fhVectorCapacity
Definition: CbmMcbm2018UnpackerAlgoRich.h:351
CbmMcbm2018UnpackerAlgoRich::ProcessMs
virtual Bool_t ProcessMs(const fles::Timeslice &ts, size_t uMsCompIdx, size_t uMsIdx)
Definition: CbmMcbm2018UnpackerAlgoRich.cxx:308
CbmMcbm2018UnpackerAlgoRich::ProcessTRBsubsubevent
Int_t ProcessTRBsubsubevent(size_t const size, uint8_t const *const ptr, Int_t const hubOffset, size_t const hubSize)
Definition: CbmMcbm2018UnpackerAlgoRich.cxx:989
CbmMcbm2018UnpackerAlgoRich::GetPixelUID
Int_t GetPixelUID(Int_t fpgaID, Int_t ch) const
Definition: CbmMcbm2018UnpackerAlgoRich.h:159