CbmRoot
CbmMcbm2018UnpackerAlgoMuch.cxx
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------
2 // ----- -----
3 // ----- CbmMcbm2018UnpackerAlgoMuch -----
4 // ----- Created 02.02.2019 by P.-A. Loizeau -----
5 // ----- -----
6 // -----------------------------------------------------------------------------
7 
9 
11 #include "CbmMcbm2018MuchPar.h"
12 
13 #include <Logger.h>
14 
15 #include "TCanvas.h"
16 #include "TH1.h"
17 #include "TH2.h"
18 #include "TList.h"
19 #include "TProfile.h"
20 #include "TROOT.h"
21 #include "TString.h"
22 
23 #include <fstream>
24 #include <iomanip>
25 #include <iostream>
26 #include <stdint.h>
27 
28 // -------------------------------------------------------------------------
30  : CbmStar2019Algo()
31  ,
33  fbMonitorMode(kFALSE)
34  , fbDebugMonitorMode(kFALSE)
35  , fvbMaskedComponents()
36  , fiFlag(0)
37  , fUnpackPar(nullptr)
38  , fuNrOfDpbs(0)
39  , fDpbIdIndexMap()
40  , fvbCrobActiveFlag()
41  , fuNbFebs(0)
42  ,
43  //fviFebAddress(),
44  fuNbStsXyters(0)
45  , fdTimeOffsetNs(0.0)
46  , fvdTimeOffsetNsAsics()
47  , fbUseChannelMask(kFALSE)
48  , fvvbMaskedChannels()
49  , fdAdcCut(0)
50  , fulCurrentTsIdx(0)
51  , fulCurrentMsIdx(0)
52  , fdTsStartTime(-1.0)
53  , fdTsStopTimeCore(-1.0)
54  , fdMsTime(-1.0)
55  , fuMsIndex(0)
56  , fmMsgCounter()
57  , fuCurrentEquipmentId(0)
58  , fuCurrDpbId(0)
59  , fuCurrDpbIdx(0)
60  , fiRunStartDateTimeSec(-1)
61  , fiBinSizeDatePlots(-1)
62  , fvulCurrentTsMsb()
63  , fvuCurrentTsMsbCycle()
64  , fdStartTime(0.0)
65  , fdStartTimeMsSz(0.0)
66  , ftStartTimeUnix(std::chrono::steady_clock::now())
67  , fvmHitsInMs()
68  , fvvusLastTsChan()
69  , fvvusLastAdcChan()
70  , fvvusLastTsMsbChan()
71  , fvvusLastTsMsbCycleChan()
72  , fhDigisTimeInRun(nullptr)
73 /*
74  fvhHitsTimeToTriggerRaw(),
75  fvhMessDistributionInMs(),
76  fhEventNbPerTs( nullptr ),
77  fcTimeToTrigRaw( nullptr )
78 */
79 {}
82  fvmHitsInMs.clear();
83  /*
84  for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
85  {
86  fvmHitsInMs[ uDpb ].clear();
87  } // for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
88 */
89 
90  if (nullptr != fParCList) delete fParCList;
91  if (nullptr != fUnpackPar) delete fUnpackPar;
92 }
93 
94 // -------------------------------------------------------------------------
96  LOG(info) << "Initializing mCBM MUCH 2019 unpacker algo";
97 
98  return kTRUE;
99 }
103 
105 }
106 
107 // -------------------------------------------------------------------------
109  LOG(info) << "Init parameter containers for CbmMcbm2018UnpackerAlgoMuch";
110  Bool_t initOK = ReInitContainers();
111 
112  return initOK;
113 }
115  LOG(info) << "**********************************************";
116  LOG(info) << "ReInit parameter containers for CbmMcbm2018UnpackerAlgoMuch";
117 
118  fUnpackPar =
119  (CbmMcbm2018MuchPar*) fParCList->FindObject("CbmMcbm2018MuchPar");
120  if (nullptr == fUnpackPar) return kFALSE;
121 
122  Bool_t initOK = InitParameters();
123 
124  return initOK;
125 }
127  if (nullptr == fParCList) fParCList = new TList();
128  fUnpackPar = new CbmMcbm2018MuchPar("CbmMcbm2018MuchPar");
129  fParCList->Add(fUnpackPar);
130 
131  return fParCList;
132 }
135  LOG(info) << "Nr. of MUCH DPBs: " << fuNrOfDpbs;
136 
137  fDpbIdIndexMap.clear();
138  for (UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb) {
139  fDpbIdIndexMap[fUnpackPar->GetDpbId(uDpb)] = uDpb;
140  LOG(info) << "Eq. ID for DPB #" << std::setw(2) << uDpb << " = 0x"
141  << std::setw(4) << std::hex << fUnpackPar->GetDpbId(uDpb)
142  << std::dec << " => "
144  } // for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
145 
147  LOG(info) << "Nr. of FEBs: " << fuNbFebs;
148 
150  LOG(info) << "Nr. of StsXyter ASICs: " << fuNbStsXyters;
151 
152  if (fvdTimeOffsetNsAsics.size() < fuNbStsXyters) {
153  fvdTimeOffsetNsAsics.resize(fuNbStsXyters, 0.0);
154  } // if( fvdTimeOffsetNsAsics.size() < fuNbStsXyters )
155 
157  for (UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb) {
159  for (UInt_t uCrobIdx = 0; uCrobIdx < fUnpackPar->GetNbCrobsPerDpb();
160  ++uCrobIdx) {
161  fvbCrobActiveFlag[uDpb][uCrobIdx] =
162  fUnpackPar->IsCrobActive(uDpb, uCrobIdx);
163  } // for( UInt_t uCrobIdx = 0; uCrobIdx < fUnpackPar->GetNbCrobsPerDpb(); ++uCrobIdx )
164  } // for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
165 
166  for (UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb) {
167  TString sPrintoutLine = Form("DPB #%02u CROB Active ?: ", uDpb);
168  for (UInt_t uCrobIdx = 0; uCrobIdx < fUnpackPar->GetNbCrobsPerDpb();
169  ++uCrobIdx) {
170  sPrintoutLine +=
171  Form("%1u", (fvbCrobActiveFlag[uDpb][uCrobIdx] == kTRUE));
172  } // for( UInt_t uCrobIdx = 0; uCrobIdx < fUnpackPar->GetNbCrobsPerDpb(); ++uCrobIdx )
173  LOG(info) << sPrintoutLine;
174  } // for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
175  /*
176  for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
177  {
178  for( UInt_t uCrobIdx = 0; uCrobIdx < fUnpackPar->GetNbCrobsPerDpb(); ++uCrobIdx )
179  {
180  LOG(info) << Form( "DPB #%02u CROB #%u: ", uDpb, uCrobIdx);
181  for( UInt_t uFebIdx = 0; uFebIdx < fUnpackPar->GetNbFebsPerCrob(); ++ uFebIdx )
182  if( 0 <= fviFebModuleIdx[ uDpb ][ uCrobIdx ][ uFebIdx ] )
183  {
184  LOG(info) << Form( " FEB #%02u: Mod. Idx = %03d Side %c (%2d) Type %c (%2d) ADC gain %4.0f e- ADC Offs %5.0f e-",
185  uFebIdx,
186  fviFebModuleIdx[ uDpb ][ uCrobIdx ][ uFebIdx ],
187  1 == fviFebModuleSide[ uDpb ][ uCrobIdx ][ uFebIdx ] ? 'N': 'P',
188  fviFebModuleSide[ uDpb ][ uCrobIdx ][ uFebIdx ],
189  1 == fviFebType[ uDpb ][ uCrobIdx ][ uFebIdx ] ? 'B' : 'A',
190  fviFebType[ uDpb ][ uCrobIdx ][ uFebIdx ],
191  fvdFebAdcGain[ uDpb ][ uCrobIdx ][ uFebIdx ],
192  fvdFebAdcOffs[ uDpb ][ uCrobIdx ][ uFebIdx ]
193  );
194  } // for( UInt_t uFebIdx = 0; uFebIdx < fUnpackPar->GetNbFebsPerCrob(); ++ uFebIdx )
195  } // for( UInt_t uCrobIdx = 0; uCrobIdx < fUnpackPar->GetNbCrobsPerDpb(); ++uCrobIdx )
196  } // for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
197 */
198 
199  if (fbBinningFw)
200  LOG(info) << "Unpacking data in bin sorter FW mode";
201  else
202  LOG(info) << "Unpacking data in full time sorter FW mode (legacy)";
203 
204  // Internal status initialization
207  for (UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb) {
208  fvulCurrentTsMsb[uDpb] = 0;
209  fvuCurrentTsMsbCycle[uDpb] = 0;
210  } // for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
211 
216  for (UInt_t uAsicIdx = 0; uAsicIdx < fuNbStsXyters; ++uAsicIdx) {
217  fvvusLastTsChan[uAsicIdx].resize(fUnpackPar->GetNbChanPerAsic(), 0);
218  fvvusLastAdcChan[uAsicIdx].resize(fUnpackPar->GetNbChanPerAsic(), 0);
219  fvvusLastTsMsbChan[uAsicIdx].resize(fUnpackPar->GetNbChanPerAsic(), 0);
220  fvvusLastTsMsbCycleChan[uAsicIdx].resize(fUnpackPar->GetNbChanPerAsic(), 0);
221  } // for( UInt_t uAsicIdx = 0; uAsicIdx < fuNbStsXyters; ++ uAsicIdx )
222 
223  return kTRUE;
224 }
225 // -------------------------------------------------------------------------
226 
228  UShort_t usDetectorId) {
230  for (UInt_t uCompIdx = 0; uCompIdx < fvMsComponentsList.size(); ++uCompIdx)
231  if (component == fvMsComponentsList[uCompIdx]) return;
232 
234  fvMsComponentsList.push_back(component);
235 
236  LOG(info) << "CbmMcbm2018UnpackerAlgoMuch::AddMsComponentToList => Component "
237  << component << " with detector ID 0x" << std::hex << usDetectorId
238  << std::dec << " added to list";
239 }
240 // -------------------------------------------------------------------------
241 
242 Bool_t CbmMcbm2018UnpackerAlgoMuch::ProcessTs(const fles::Timeslice& ts) {
243  fulCurrentTsIdx = ts.index();
244  fdTsStartTime = static_cast<Double_t>(ts.descriptor(0, 0).idx);
245 
247  if (0 == fulCurrentTsIdx) { return kTRUE; } // if( 0 == fulCurrentTsIdx )
248 
250  if (-1.0 == fdTsCoreSizeInNs) {
251  fuNbCoreMsPerTs = ts.num_core_microslices();
252  fuNbOverMsPerTs = ts.num_microslices(0) - ts.num_core_microslices();
255  LOG(info) << "Timeslice parameters: each TS has " << fuNbCoreMsPerTs
256  << " Core MS and " << fuNbOverMsPerTs
257  << " Overlap MS, for a core duration of " << fdTsCoreSizeInNs
258  << " ns and a full duration of " << fdTsFullSizeInNs << " ns";
259 
262  if (kFALSE == fbIgnoreOverlapMs) fuNbMsLoop += fuNbOverMsPerTs;
263  LOG(info) << "In each TS " << fuNbMsLoop << " MS will be looped over";
264  } // if( -1.0 == fdTsCoreSizeInNs )
265 
268  // LOG(info) << Form( "TS %5d Start %12f Stop %12f", fulCurrentTsIdx, fdTsStartTime, fdTsStopTimeCore );
269 
271  for (fuMsIndex = 0; fuMsIndex < fuNbMsLoop; fuMsIndex++) {
273  for (UInt_t uMsCompIdx = 0; uMsCompIdx < fvMsComponentsList.size();
274  ++uMsCompIdx) {
275  UInt_t uMsComp = fvMsComponentsList[uMsCompIdx];
276 
277  if (kFALSE == ProcessMs(ts, uMsComp, fuMsIndex)) {
278  LOG(error) << "Failed to process ts " << fulCurrentTsIdx << " MS "
279  << fuMsIndex << " for component " << uMsComp;
280  return kFALSE;
281  } // if( kFALSE == ProcessMs( ts, uMsCompIdx, fuMsIndex ) )
282  } // for( UInt_t uMsCompIdx = 0; uMsCompIdx < fvMsComponentsList.size(); ++uMsCompIdx )
283 
286  // std::sort( fvmHitsInMs.begin(), fvmHitsInMs.end() );
287 
289  for (auto itHitIn = fvmHitsInMs.begin(); itHitIn < fvmHitsInMs.end();
290  ++itHitIn) {
292 
293  CbmMuchBeamTimeDigi* digi = CreateMuchDigi(&(*itHitIn));
294  if (digi == NULL) continue;
295  fDigiVect.push_back(*digi);
296  delete digi;
297  } // for( auto itHitIn = fvmHitsInMs.begin(); itHitIn < fvmHitsInMs.end(); ++itHitIn )
298 
300  fvmHitsInMs.clear();
301  } // for( fuMsIndex = 0; fuMsIndex < uNbMsLoop; fuMsIndex ++ )
302 
304  fvmHitsInMs.clear();
305  /*
306  for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
307  {
308  fvmHitsInMs[ uDpb ].clear();
309  } // for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
310 */
311 
313  std::sort(
314  fDigiVect.begin(),
315  fDigiVect.end(),
316  [](const CbmMuchBeamTimeDigi& a, const CbmMuchBeamTimeDigi& b) -> bool {
317  return a.GetTime() < b.GetTime();
318  });
319 
321  if (fbMonitorMode) {
322  if (kFALSE == FillHistograms()) {
323  LOG(error) << "Failed to fill histos in ts " << fulCurrentTsIdx;
324  return kFALSE;
325  } // if( kFALSE == FillHistograms() )
326  fhVectorSize->Fill(fulCurrentTsIdx, fDigiVect.size());
327  fhVectorCapacity->Fill(fulCurrentTsIdx, fDigiVect.capacity());
328  } // if( fbMonitorMode )
329 
330  if (fuTsMaxVectorSize < fDigiVect.size()) {
332  fDigiVect.shrink_to_fit();
333  fDigiVect.reserve(fuTsMaxVectorSize);
334  } // if( fuTsMaxVectorSize < fDigiVect.size() )
335 
336  return kTRUE;
337 }
338 
339 // -------------------------------------------------------------------------
342  /*
343  UInt_t uFebIdx = itHitIn->GetAsic() / fUnpackPar->GetNbAsicsPerFeb()
344  + ( itHitIn->GetDpb() * fUnpackPar->GetNbCrobsPerDpb() + itHitIn->GetCrob() )
345  * fUnpackPar->GetNbFebsPerCrob();
346  UInt_t uChanInFeb = itHitIn->GetChan()
347  + fUnpackPar->GetNbChanPerAsic() * (itHitIn->GetAsic() % fUnpackPar->GetNbAsicsPerFeb());
348  */
349  UInt_t uAsicIdx = itHitIn->GetAsic();
351  Int_t iFebId = fUnpackPar->GetFebId(itHitIn->GetAsic());
352 
353  Short_t station = 0; // for mCBM setup only one station
354  Short_t layer = fUnpackPar->GetModule(
355  itHitIn->GetAsic()); // 0 for Module GEM-A and 1 for Module GEM-B
356  Short_t layerside = 0; // 0 in mCBM
357  Short_t module = 0; // 0 in mCBM
358  Short_t sSector =
359  0; //channel values are from 0-96 therefore as per CbmMuchAddress it is sector
360  Short_t sChannel =
361  0; //sector values are from 0-22 therefore as per CbmMuchAddress it is channel
362 
363  Int_t usChan = itHitIn->GetChan();
364 
365  // ----------------------------- //
366  // Channel flip in stsXYTER v2.1 : 0<->1, 2<->3, 3<->4 and so on...
367  if (fiFlag == 1) {
368  if (usChan % 2 == 0)
369  usChan = usChan + 1;
370  else
371  usChan = usChan - 1;
372  }
373  // ---------------------------- //
374 
375  // ---------------------------- //
376  //Due to two FLEX cable connected to single FEB; First Flex Connector number 1 - 63 and second flex connector number 64 - 127
377  //in few FEB positioned these flex connectors are flipped so below correction applied.
378  if (fiFlag == 1 && layer == 0) { // First layer (GEM1) has old readout PCB
379 
380  if (iFebId == 0 || iFebId == 1 || iFebId == 2 || iFebId == 3 || iFebId == 4
381  || iFebId == 8 || iFebId == 9 || iFebId == 10 || iFebId == 11
382  || iFebId == 17) {
383  sSector = fUnpackPar->GetPadXA(iFebId, 127 - usChan);
384  sChannel = fUnpackPar->GetPadYA(iFebId, 127 - usChan);
385  } else {
386  sSector = fUnpackPar->GetPadXA(iFebId, usChan);
387  sChannel = fUnpackPar->GetPadYA(iFebId, usChan);
388  }
389  } // if( fiFlag == 1 && layer == 0 )
390 
391  else if (fiFlag == 1
392  && layer == 1) { // second layer (GEM2) has new readout PCB
393 
394  if (iFebId == 0 || iFebId == 1 || iFebId == 2 || iFebId == 3 || iFebId == 4
395  || iFebId == 8 || iFebId == 9 || iFebId == 10 || iFebId == 11
396  || iFebId == 17) {
397  sSector = fUnpackPar->GetPadXB(iFebId, 127 - usChan);
398  sChannel = fUnpackPar->GetPadYB(iFebId, 127 - usChan);
399  } else {
400  sSector = fUnpackPar->GetPadXB(iFebId, usChan);
401  sChannel = fUnpackPar->GetPadYB(iFebId, usChan);
402  }
403  } // else if( fiFlag == 1 && layer == 1 )
404 
405  else { // Both layer with same type of PCB
406  if (iFebId == 0 || iFebId == 1 || iFebId == 2 || iFebId == 3 || iFebId == 4
407  || iFebId == 8 || iFebId == 9 || iFebId == 10 || iFebId == 11
408  || iFebId == 17) {
409  sSector = fUnpackPar->GetPadXA(iFebId, 127 - usChan);
410  sChannel = fUnpackPar->GetPadYA(iFebId, 127 - usChan);
411  } else {
412  sSector = fUnpackPar->GetPadXA(iFebId, itHitIn->GetChan());
413  sChannel = fUnpackPar->GetPadYA(iFebId, itHitIn->GetChan());
414  }
415  } // else{
416  // ---------------------------- //
417 
418  // Checking for the not connected or misconnected pads
419  if (sSector < 0 || sChannel < 0) {
420  LOG(debug)
421  << "Sector " << sSector << " channel " << sChannel
422  << " is not connected or misconnected to pad. Skipping this hit message.";
423  return NULL;
424  }
425  //Creating Unique address of the particular channel of GEM
426  UInt_t address = CbmMuchAddress::GetAddress(
427  station, layer, layerside, module, sChannel, sSector);
428  Double_t dTimeInNs =
430  if (uAsicIdx < fvdTimeOffsetNsAsics.size())
431  dTimeInNs -= fvdTimeOffsetNsAsics[uAsicIdx];
432  ULong64_t ulTimeInNs = static_cast<ULong64_t>(dTimeInNs);
433 
435  // fDigiVect.push_back( CbmMuchDigi( address, itHitIn->GetAdc(), ulTimeInNs ) );
436 
438  CbmMuchBeamTimeDigi* digi =
439  new CbmMuchBeamTimeDigi(address, itHitIn->GetAdc(), ulTimeInNs);
440  LOG(debug) << "Sector " << sSector << " channel " << sChannel << " layer "
441  << layer << " Address " << address << " Time " << ulTimeInNs;
442 
443  digi->SetPadX(sSector);
444  digi->SetPadY(sChannel);
445  digi->SetRocId(itHitIn->GetDpb());
446  digi->SetNxId(itHitIn->GetAsic());
447  digi->SetNxCh(itHitIn->GetChan());
448  // Add Elink also in the stsxyter::FinalHit as one more variable such that may be used.
449  //digi.SetElink(itHitIn->GetElink());
450 
451  return digi;
452 }
453 // -------------------------------------------------------------------------
454 
455 Bool_t CbmMcbm2018UnpackerAlgoMuch::ProcessMs(const fles::Timeslice& ts,
456  size_t uMsCompIdx,
457  size_t uMsIdx) {
458  auto msDescriptor = ts.descriptor(uMsCompIdx, uMsIdx);
459  fuCurrentEquipmentId = msDescriptor.eq_id;
460  const uint8_t* msContent =
461  reinterpret_cast<const uint8_t*>(ts.content(uMsCompIdx, uMsIdx));
462 
463  uint32_t uSize = msDescriptor.size;
464  fulCurrentMsIdx = msDescriptor.idx;
465  // Double_t dMsTime = (1e-9) * static_cast<double>(fulCurrentMsIdx);
466  LOG(debug) << "Microslice: " << fulCurrentMsIdx << " from EqId " << std::hex
467  << fuCurrentEquipmentId << std::dec << " has size: " << uSize;
468 
469  if (0 == fvbMaskedComponents.size())
470  fvbMaskedComponents.resize(ts.num_components(), kFALSE);
471 
472  fuCurrDpbId = static_cast<uint32_t>(fuCurrentEquipmentId & 0xFFFF);
473  // fuCurrDpbIdx = fDpbIdIndexMap[ fuCurrDpbId ];
474 
476  auto it = fDpbIdIndexMap.find(fuCurrDpbId);
477  if (it == fDpbIdIndexMap.end()) {
478  if (kFALSE == fvbMaskedComponents[uMsCompIdx]) {
479  LOG(info)
480  << "---------------------------------------------------------------";
481  /*
482  LOG(info) << "hi hv eqid flag si sv idx/start crc size offset";
483  LOG(info) << Form( "%02x %02x %04x %04x %02x %02x %016llx %08x %08x %016llx",
484  static_cast<unsigned int>(msDescriptor.hdr_id),
485  static_cast<unsigned int>(msDescriptor.hdr_ver), msDescriptor.eq_id, msDescriptor.flags,
486  static_cast<unsigned int>(msDescriptor.sys_id),
487  static_cast<unsigned int>(msDescriptor.sys_ver), msDescriptor.idx, msDescriptor.crc,
488  msDescriptor.size, msDescriptor.offset );
489 */
490  LOG(info) << FormatMsHeaderPrintout(msDescriptor);
491  LOG(warning) << "Could not find the sDPB index for AFCK id 0x" << std::hex
492  << fuCurrDpbId << std::dec << " in timeslice "
493  << fulCurrentTsIdx << " in microslice " << uMsIdx
494  << " component " << uMsCompIdx << "\n"
495  << "If valid this index has to be added in the MUCH "
496  "parameter file in the DbpIdArray field";
497  fvbMaskedComponents[uMsCompIdx] = kTRUE;
498 
501  if (1 == fulCurrentTsIdx) return kTRUE;
502  } // if( kFALSE == fvbMaskedComponents[ uMsComp ] )
503  else
504  return kTRUE;
505 
506  return kFALSE;
507  } // if( it == fDpbIdIndexMap.end() )
508  else
510 
512  UInt_t uTsMsbCycleHeader = std::floor(
514 
516  if (kTRUE == fbBinningFw)
517  uTsMsbCycleHeader = std::floor(
520 
521  if (0 == uMsIdx) {
522  if (uTsMsbCycleHeader != fvuCurrentTsMsbCycle[fuCurrDpbIdx])
523  LOG(info) << " TS " << std::setw(12) << fulCurrentTsIdx << " MS "
524  << std::setw(12) << fulCurrentMsIdx << " MS Idx "
525  << std::setw(4) << uMsIdx << " Msg Idx " << std::setw(5) << 0
526  << " DPB " << std::setw(2) << fuCurrDpbIdx << " Old TsMsb "
527  << std::setw(5) << fvulCurrentTsMsb[fuCurrDpbIdx]
528  << " Old MsbCy " << std::setw(5)
529  << fvuCurrentTsMsbCycle[fuCurrDpbIdx] << " New MsbCy "
530  << uTsMsbCycleHeader;
531  fvuCurrentTsMsbCycle[fuCurrDpbIdx] = uTsMsbCycleHeader;
533  } // if( 0 == uMsIdx )
534  else if (uTsMsbCycleHeader != fvuCurrentTsMsbCycle[fuCurrDpbIdx]) {
535  if (4194303 == fvulCurrentTsMsb[fuCurrDpbIdx]) {
536  LOG(info) << " TS " << std::setw(12) << fulCurrentTsIdx << " MS "
537  << std::setw(12) << fulCurrentMsIdx << " MS Idx "
538  << std::setw(4) << uMsIdx << " Msg Idx " << std::setw(5) << 0
539  << " DPB " << std::setw(2) << fuCurrDpbIdx << " Old TsMsb "
540  << std::setw(5) << fvulCurrentTsMsb[fuCurrDpbIdx]
541  << " Old MsbCy " << std::setw(5)
542  << fvuCurrentTsMsbCycle[fuCurrDpbIdx] << " New MsbCy "
543  << uTsMsbCycleHeader;
544  } else {
545  LOG(warning)
546  << "TS MSB cycle from MS header does not match current cycle from data "
547  << "for TS " << std::setw(12) << fulCurrentTsIdx << " MS "
548  << std::setw(12) << fulCurrentMsIdx << " MsInTs " << std::setw(3)
549  << uMsIdx << " ====> " << fvuCurrentTsMsbCycle[fuCurrDpbIdx] << " VS "
550  << uTsMsbCycleHeader;
551  } // else of if( 4194303 == fvulCurrentTsMsb[fuCurrDpbIdx] )
552  fvuCurrentTsMsbCycle[fuCurrDpbIdx] = uTsMsbCycleHeader;
553  } // else if( uTsMsbCycleHeader != fvuCurrentTsMsbCycle[ fuCurrDpbIdx ] )
554 
555  // If not integer number of message in input buffer, print warning/error
556  if (0 != (uSize % sizeof(stsxyter::Message)))
557  LOG(error) << "The input microslice buffer does NOT "
558  << "contain only complete sDPB messages!";
559 
560  // Compute the number of complete messages in the input microslice buffer
561  uint32_t uNbMessages =
562  (uSize - (uSize % sizeof(stsxyter::Message))) / sizeof(stsxyter::Message);
563 
564  // Prepare variables for the loop on contents
565  const stsxyter::Message* pMess =
566  reinterpret_cast<const stsxyter::Message*>(msContent);
567  for (uint32_t uIdx = 0; uIdx < uNbMessages; uIdx++) {
569  stsxyter::MessType typeMess = pMess[uIdx].GetMessType();
570  fmMsgCounter[typeMess]++;
571  // fhStsMessType->Fill( static_cast< uint16_t > (typeMess) );
572  // fhStsMessTypePerDpb->Fill( fuCurrDpbIdx, static_cast< uint16_t > (typeMess) );
573 
574  switch (typeMess) {
576  // Extract the eLink and Asic indices => Should GO IN the fill method now that obly hits are link/asic specific!
577  UShort_t usElinkIdx = pMess[uIdx].GetLinkIndex();
579  if (kTRUE == fbBinningFw)
580  usElinkIdx = pMess[uIdx].GetLinkIndexHitBinning();
581  // fhStsMessTypePerElink->Fill( usElinkIdx, static_cast< uint16_t > (typeMess) );
582  // fhStsHitsElinkPerDpb->Fill( fuCurrDpbIdx, usElinkIdx );
583 
584  UInt_t uCrobIdx = usElinkIdx / fUnpackPar->GetNbElinkPerCrob();
585  Int_t uFebIdx = fUnpackPar->ElinkIdxToFebIdx(usElinkIdx);
586 
587  if (-1 == uFebIdx) {
588  LOG(warning) << "CbmMcbm2018UnpackerAlgoMuch::DoUnpack => "
589  << "Wrong elink Idx! Elink raw "
590  << Form("%d remap %d", usElinkIdx, uFebIdx);
591  continue;
592  } // if( -1 == uFebIdx )
593 
594  UInt_t uAsicIdx =
595  (fuCurrDpbIdx * fUnpackPar->GetNbCrobsPerDpb() + uCrobIdx)
597  + fUnpackPar->ElinkIdxToAsicIdx(usElinkIdx);
598 
599  ProcessHitInfo(pMess[uIdx], usElinkIdx, uAsicIdx, uMsIdx);
600  break;
601  } // case stsxyter::MessType::Hit :
603  // fhStsMessTypePerElink->Fill( fuCurrDpbIdx * fUnpackPar->GetNbElinkPerDpb(), static_cast< uint16_t > (typeMess) );
604 
605  ProcessTsMsbInfo(pMess[uIdx], uIdx, uMsIdx);
606  break;
607  } // case stsxyter::MessType::TsMsb :
609  // fhStsMessTypePerElink->Fill( fuCurrDpbIdx * fUnpackPar->GetNbElinkPerDpb(), static_cast< uint16_t > (typeMess) );
610 
611  // The first message in the TS is a special ones: EPOCH
612  ProcessEpochInfo(pMess[uIdx]);
613 
614  if (0 < uIdx)
615  LOG(info) << "CbmMcbm2018UnpackerAlgoMuch::DoUnpack => "
616  << "EPOCH message at unexpected position in MS: message "
617  << uIdx << " VS message 0 expected!";
618  break;
619  } // case stsxyter::MessType::TsMsb :
622  UShort_t usElinkIdx = pMess[uIdx].GetStatusLink();
623  UInt_t uCrobIdx = usElinkIdx / fUnpackPar->GetNbElinkPerCrob();
624  Int_t uFebIdx = fUnpackPar->ElinkIdxToFebIdx(usElinkIdx);
625 
626  if (-1 == uFebIdx) {
627  LOG(warning) << "CbmMcbm2018UnpackerAlgoMuch::DoUnpack => "
628  << "Wrong elink Idx! Elink raw "
629  << Form("%d remap %d", usElinkIdx, uFebIdx);
630  continue;
631  } // if( -1 == uFebIdx )
632 
633  UInt_t uAsicIdx =
634  (fuCurrDpbIdx * fUnpackPar->GetNbCrobsPerDpb() + uCrobIdx)
636  + fUnpackPar->ElinkIdxToAsicIdx(usElinkIdx);
637 
638  ProcessStatusInfo(pMess[uIdx], uAsicIdx);
639  break;
640  } // case stsxyter::MessType::Status
642  // fhStsMessTypePerElink->Fill( fuCurrDpbIdx * fUnpackPar->GetNbElinkPerDpb(), static_cast< uint16_t > (typeMess) );
643  // FillTsMsbInfo( pMess[uIdx] );
644  break;
645  } // case stsxyter::MessType::Empty :
647  if (pMess[uIdx].IsMsErrorFlagOn()) {
650  fuCurrDpbIdx,
651  0x20,
652  pMess[uIdx].GetMsErrorType()));
653  } // if( pMess[uIdx].IsMsErrorFlagOn() )
654  break;
655  } // case stsxyter::MessType::EndOfMs :
657  // fhStsMessTypePerElink->Fill( fuCurrDpbIdx * fUnpackPar->GetNbElinkPerDpb(), static_cast< uint16_t > (typeMess) );
658  break;
659  } // case stsxyter::MessType::Dummy / ReadDataAck / Ack :
660  default: {
661  LOG(fatal) << "CbmMcbm2018UnpackerAlgoMuch::DoUnpack => "
662  << "Unknown message type, should never happen, stopping "
663  "here! Type found was: "
664  << static_cast<int>(typeMess);
665  }
666  } // switch( typeMess )
667  } // for (uint32_t uIdx = 0; uIdx < uNbMessages; uIdx ++)
668 
669  return kTRUE;
670 }
671 
672 // -------------------------------------------------------------------------
674  const UShort_t& usElinkIdx,
675  const UInt_t& uAsicIdx,
676  const UInt_t& /*uMsIdx*/) {
677  UShort_t usChan = mess.GetHitChannel();
678  UShort_t usRawAdc = mess.GetHitAdc();
679  // UShort_t usFullTs = mess.GetHitTimeFull();
680  // UShort_t usTsOver = mess.GetHitTimeOver();
681  UShort_t usRawTs = mess.GetHitTime();
682 
684  if (kTRUE == fbBinningFw) usRawTs = mess.GetHitTimeBinning();
685 
687  // usChan = 127 - usChan;
688 
689  /*
690  fhStsChanCntRaw[ uAsicIdx ]->Fill( usChan );
691  fhStsChanAdcRaw[ uAsicIdx ]->Fill( usChan, usRawAdc );
692  fhStsChanAdcRawProf[ uAsicIdx ]->Fill( usChan, usRawAdc );
693  fhStsChanRawTs[ uAsicIdx ]->Fill( usChan, usRawTs );
694  fhStsChanMissEvt[ uAsicIdx ]->Fill( usChan, mess.IsHitMissedEvts() );
695 */
696  UInt_t uCrobIdx = usElinkIdx / fUnpackPar->GetNbElinkPerCrob();
697  // UInt_t uFebIdx = uAsicIdx / fUnpackPar->GetNbAsicsPerFeb();
698  // UInt_t uAsicInFeb = uAsicIdx % fUnpackPar->GetNbAsicsPerFeb();
699  // UInt_t uChanInFeb = usChan + fUnpackPar->GetNbChanPerAsic() * (uAsicIdx % fUnpackPar->GetNbAsicsPerFeb());
700 
702  if (
703  usRawTs == fvvusLastTsChan[uAsicIdx][usChan] &&
704  // usRawAdc == fvvusLastAdcChan[ uAsicIdx ][ usChan ] &&
708  == fvvusLastTsMsbCycleChan[uAsicIdx][usChan]) {
710  return;
711  } // if same TS, ADC, TS MSB, TS MSB cycle!
712  fvvusLastTsChan[uAsicIdx][usChan] = usRawTs;
713  fvvusLastAdcChan[uAsicIdx][usChan] = usRawAdc;
714  fvvusLastTsMsbChan[uAsicIdx][usChan] = fvulCurrentTsMsb[fuCurrDpbIdx];
715  fvvusLastTsMsbCycleChan[uAsicIdx][usChan] =
717 
718  /*
719  Double_t dCalAdc = fvdFebAdcOffs[ fuCurrDpbIdx ][ uCrobIdx ][ uFebIdx ]
720  + (usRawAdc - 1)* fvdFebAdcGain[ fuCurrDpbIdx ][ uCrobIdx ][ uFebIdx ];
721 */
722  /*
723  fhStsFebChanCntRaw[ uFebIdx ]->Fill( uChanInFeb );
724  fhStsFebChanAdcRaw[ uFebIdx ]->Fill( uChanInFeb, usRawAdc );
725  fhStsFebChanAdcRawProf[ uFebIdx ]->Fill( uChanInFeb, usRawAdc );
726  fhStsFebChanAdcCal[ uFebIdx ]->Fill( uChanInFeb, dCalAdc );
727  fhStsFebChanAdcCalProf[ uFebIdx ]->Fill( uChanInFeb, dCalAdc );
728  fhStsFebChanRawTs[ uFebIdx ]->Fill( usChan, usRawTs );
729  fhStsFebChanMissEvt[ uFebIdx ]->Fill( usChan, mess.IsHitMissedEvts() );
730 */
731  // Compute the Full time stamp
732  // Use TS w/o overlap bits as they will anyway come from the TS_MSB
733  Long64_t ulHitTime = usRawTs;
734  ulHitTime += static_cast<ULong64_t>(stsxyter::kuHitNbTsBins)
735  * static_cast<ULong64_t>(fvulCurrentTsMsb[fuCurrDpbIdx])
736  + static_cast<ULong64_t>(stsxyter::kulTsCycleNbBins)
737  * static_cast<ULong64_t>(fvuCurrentTsMsbCycle[fuCurrDpbIdx]);
738 
740  if (kTRUE == fbBinningFw)
741  ulHitTime =
742  usRawTs
743  + static_cast<ULong64_t>(stsxyter::kuHitNbTsBinsBinning)
744  * static_cast<ULong64_t>(fvulCurrentTsMsb[fuCurrDpbIdx])
745  + static_cast<ULong64_t>(stsxyter::kulTsCycleNbBinsBinning)
746  * static_cast<ULong64_t>(fvuCurrentTsMsbCycle[fuCurrDpbIdx]);
747 
748  // Convert the Hit time in bins to Hit time in ns
749  Double_t dHitTimeNs = ulHitTime * stsxyter::kdClockCycleNs;
750 
752  //if( 0 != fviFebAddress[ uFebIdx ] && fdAdcCut < usRawAdc )
753  if (fdAdcCut < usRawAdc) {
756  if (kFALSE == fbUseChannelMask
757  || false == fvvbMaskedChannels[uAsicIdx][usChan])
759  ulHitTime, usRawAdc, uAsicIdx, usChan, fuCurrDpbIdx, uCrobIdx));
760  } // if( 0 != fviFebAddress[ uFebIdx ] )
761 
762  // fvmHitsInMs.push_back( stsxyter::FinalHit( ulHitTime, usRawAdc, uAsicIdx, usChan, fuCurrDpbIdx, uCrobIdx ) );
763 
765  if (mess.IsHitMissedEvts())
767  dHitTimeNs,
768  uAsicIdx,
770  usChan));
771 
772  // Check Starting point of histos with time as X axis
773  if (-1 == fdStartTime) fdStartTime = dHitTimeNs;
774  /*
775  // Fill histos with time as X axis
776  Double_t dTimeSinceStartSec = (dHitTimeNs - fdStartTime)* 1e-9;
777  Double_t dTimeSinceStartMin = dTimeSinceStartSec / 60.0;
778 
779  fviFebCountsSinceLastRateUpdate[uFebIdx]++;
780  fvdFebChanCountsSinceLastRateUpdate[uFebIdx][uChanInFeb] += 1;
781 
782  fhStsFebChanHitRateEvo[ uFebIdx ]->Fill( dTimeSinceStartSec, uhanInFeb );
783  fhStsFebAsicHitRateEvo[ uFebIdx ]->Fill( dTimeSinceStartSec, uAsicInFeb );
784  fhStsFebHitRateEvo[ uFebIdx ]->Fill( dTimeSinceStartSec );
785  fhStsFebChanHitRateEvoLong[ uFebIdx ]->Fill( dTimeSinceStartMin, uChanInFeb, 1.0/60.0 );
786  fhStsFebAsicHitRateEvoLong[ uFebIdx ]->Fill( dTimeSinceStartMin, uAsicInFeb, 1.0/60.0 );
787  fhStsFebHitRateEvoLong[ uFebIdx ]->Fill( dTimeSinceStartMin, 1.0/60.0 );
788  if( mess.IsHitMissedEvts() )
789  {
790  fhStsFebChanMissEvtEvo[ uFebIdx ]->Fill( dTimeSinceStartSec, uChanInFeb );
791  fhStsFebAsicMissEvtEvo[ uFebIdx ]->Fill( dTimeSinceStartSec, uAsicInFeb );
792  fhStsFebMissEvtEvo[ uFebIdx ]->Fill( dTimeSinceStartSec );
793  } // if( mess.IsHitMissedEvts() )
794 */
795  /*
796  if( kTRUE == fbLongHistoEnable )
797  {
798  std::chrono::steady_clock::time_point tNow = std::chrono::steady_clock::now();
799  Double_t dUnixTimeInRun = std::chrono::duration_cast< std::chrono::seconds >(tNow - ftStartTimeUnix).count();
800  fhFebRateEvoLong[ uAsicIdx ]->Fill( dUnixTimeInRun , 1.0 / fuLongHistoBinSizeSec );
801  fhFebChRateEvoLong[ uAsicIdx ]->Fill( dUnixTimeInRun , usChan, 1.0 / fuLongHistoBinSizeSec );
802  } // if( kTRUE == fbLongHistoEnable )
803 */
804 }
805 
807  const stsxyter::Message& mess,
808  UInt_t uMessIdx,
809  UInt_t uMsIdx) {
810  UInt_t uVal = mess.GetTsMsbVal();
811 
813  if (kTRUE == fbBinningFw) uVal = mess.GetTsMsbValBinning();
814 
815  /*
816  if( (uVal != fvulCurrentTsMsb[fuCurrDpbIdx] + 1) && 0 < uVal &&
817  !( 1 == uMessIdx && usVal == fvulCurrentTsMsb[fuCurrDpbIdx] ) ) // 1st TS_MSB in MS is always a repeat of the last one in previous MS!
818  {
819  LOG(info) << "TS MSB not increasing by 1! TS " << std::setw( 12 ) << fulCurrentTsIdx
820  << " MS " << std::setw( 12 ) << fulCurrentMsIdx
821  << " MsInTs " << std::setw( 3 ) << uMsIdx
822  << " DPB " << std::setw( 2 ) << fuCurrDpbIdx
823  << " Mess " << std::setw( 5 ) << uMessIdx
824  << " Old TsMsb " << std::setw( 5 ) << fvulCurrentTsMsb[fuCurrDpbIdx]
825  << " new TsMsb " << std::setw( 5 ) << uVal
826  << " Diff " << std::setw( 5 ) << uVal - fvulCurrentTsMsb[fuCurrDpbIdx]
827  << " Old MsbCy " << std::setw( 5 ) << fvuCurrentTsMsbCycle[fuCurrDpbIdx];
828  } // if( (uVal != fvulCurrentTsMsb[fuCurrDpbIdx] + 1) && 0 < uVal )
829 */
830 
831  // Update Status counters
832  if (uVal < fvulCurrentTsMsb[fuCurrDpbIdx]) {
833 
834  LOG(info) << " TS " << std::setw(12) << fulCurrentTsIdx << " MS "
835  << std::setw(12) << fulCurrentMsIdx << " MS Idx " << std::setw(4)
836  << uMsIdx << " Msg Idx " << std::setw(5) << uMessIdx << " DPB "
837  << std::setw(2) << fuCurrDpbIdx << " Old TsMsb " << std::setw(5)
838  << fvulCurrentTsMsb[fuCurrDpbIdx] << " Old MsbCy " << std::setw(5)
839  << fvuCurrentTsMsbCycle[fuCurrDpbIdx] << " new TsMsb "
840  << std::setw(5) << uVal;
841 
843  } // if( uVal < fvulCurrentTsMsb[fuCurrDpbIdx] )
844  if (
845  uVal != fvulCurrentTsMsb[fuCurrDpbIdx] + 1
846  && !(0 == uVal && 4194303 == fvulCurrentTsMsb[fuCurrDpbIdx])
847  &&
848  1 != uMessIdx &&
849  !(0 == uVal && 0 == fvulCurrentTsMsb[fuCurrDpbIdx] && 2 == uMessIdx)
850  &&
851  uVal < fvulCurrentTsMsb
852  [fuCurrDpbIdx]
853  ) {
854  LOG(info) << "TS MSb Jump in "
855  << " TS " << std::setw(12) << fulCurrentTsIdx << " MS "
856  << std::setw(12) << fulCurrentMsIdx << " MS Idx " << std::setw(4)
857  << uMsIdx << " Msg Idx " << std::setw(5) << uMessIdx << " DPB "
858  << std::setw(2) << fuCurrDpbIdx << " => Old TsMsb "
859  << std::setw(5) << fvulCurrentTsMsb[fuCurrDpbIdx] << " new TsMsb "
860  << std::setw(5) << uVal;
861  } // if( uVal + 1 != fvulCurrentTsMsb[fuCurrDpbIdx] && 4194303 != uVal && 0 != fvulCurrentTsMsb[fuCurrDpbIdx] )
862 
865  if (4194303 == uVal && 1 == uMessIdx)
867  else
869  /*
870  if( 1 < uMessIdx )
871  {
872  fhStsDpbRawTsMsb->Fill( fuCurrDpbIdx, fvulCurrentTsMsb[fuCurrDpbIdx] );
873  fhStsDpbRawTsMsbSx->Fill( fuCurrDpbIdx, ( fvulCurrentTsMsb[fuCurrDpbIdx] & 0x1F ) );
874  fhStsDpbRawTsMsbDpb->Fill( fuCurrDpbIdx, ( fvulCurrentTsMsb[fuCurrDpbIdx] >> 5 ) );
875  } // if( 0 < uMessIdx )
876 */
877  // fhStsAsicTsMsb->Fill( fvulCurrentTsMsb[fuCurrDpbIdx], uAsicIdx );
878  /*
879  ULong64_t ulNewTsMsbTime = static_cast< ULong64_t >( stsxyter::kuHitNbTsBins )
880  * static_cast< ULong64_t >( fvulCurrentTsMsb[fuCurrDpbIdx])
881  + static_cast< ULong64_t >( stsxyter::kulTsCycleNbBins )
882  * static_cast< ULong64_t >( fvuCurrentTsMsbCycle[fuCurrDpbIdx] );
883 */
884 }
885 
887  const stsxyter::Message& /*mess*/) {
888  // UInt_t uVal = mess.GetEpochVal();
889  // UInt_t uCurrentCycle = uVal % stsxyter::kulTsCycleNbBins;
890 
891  /*
892  // Update Status counters
893  if( usVal < fvulCurrentTsMsb[fuCurrDpbIdx] )
894  fvuCurrentTsMsbCycle[fuCurrDpbIdx] ++;
895  fvulCurrentTsMsb[fuCurrDpbIdx] = usVal;
896 
897 // fhStsAsicTsMsb->Fill( fvulCurrentTsMsb[fuCurrDpbIdx], uAsicIdx );
898 */
899 }
900 
902  const stsxyter::Message& mess,
903  const UInt_t& uAsicIdx) {
904  /*
905  UShort_t usStatusField = mess.GetStatusStatus();
906 
907  fhPulserStatusMessType->Fill( uAsicIdx, usStatusField );
909  if( fbPrintMessages )
910  {
911  std::cout << Form("DPB %2u TS %12u MS %12u mess %5u ", fuCurrDpbIdx, fulCurrentTsIdx, fulCurrentMsIdx, uIdx );
912  mess.PrintMess( std::cout, fPrintMessCtrl );
913  } // if( fbPrintMessages )
914 */
917  Long64_t ulTime =
918  static_cast<ULong64_t>(stsxyter::kuHitNbTsBins)
919  * static_cast<ULong64_t>(fvulCurrentTsMsb[fuCurrDpbIdx])
920  + static_cast<ULong64_t>(stsxyter::kulTsCycleNbBins)
921  * static_cast<ULong64_t>(fvuCurrentTsMsbCycle[fuCurrDpbIdx]);
922 
924  if (kTRUE == fbBinningFw)
925  ulTime = static_cast<ULong64_t>(stsxyter::kuHitNbTsBinsBinning)
926  * static_cast<ULong64_t>(fvulCurrentTsMsb[fuCurrDpbIdx])
927  + static_cast<ULong64_t>(stsxyter::kulTsCycleNbBinsBinning)
928  * static_cast<ULong64_t>(fvuCurrentTsMsbCycle[fuCurrDpbIdx]);
929 
931  Double_t dTimeNs = ulTime * stsxyter::kdClockCycleNs;
932 
934  dTimeNs,
935  uAsicIdx,
936  mess.GetStatusStatus(),
937  mess.GetData()));
938 }
939 
940 // -------------------------------------------------------------------------
941 
942 // -------------------------------------------------------------------------
943 
947  new TH1I("hMuchDigisTimeInRun",
948  "Digis Nb vs Time in Run; Time in run [s]; Digis Nb []",
949  36000,
950  0,
951  3600);
953 
954  fhVectorSize =
955  new TH1I("fhVectorSize",
956  "Size of the vector VS TS index; TS index; Size [bytes]",
957  10000,
958  0.,
959  10000.);
961  new TH1I("fhVectorCapacity",
962  "Size of the vector VS TS index; TS index; Size [bytes]",
963  10000,
964  0.,
965  10000.);
968 
969  /*
971  for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
972  {
973  UInt_t uSector = fUnpackPar->GetGdpbToSectorOffset() + uGdpb;
974  std::string sFolder = Form( "sector%2u", uSector);
975 
976  LOG(info) << "gDPB " << uGdpb << " is " << sFolder;
977 
978  fvhHitsTimeToTriggerRaw.push_back( new TH1D(
979  Form( "hHitsTimeToTriggerRawSect%2u", uSector ),
980  Form( "Time to trigger for all neighboring hits in sector %2u; t - Ttrigg [ns]; Hits []", uSector ),
981  2000, -5000, 5000 ) );
982 
983  UInt_t uNbBinsDtSel = fdStarTriggerWinSize[ uGdpb ];
984  Double_t dMaxDtSel = fdStarTriggerDelay[ uGdpb ] + fdStarTriggerWinSize[ uGdpb ];
985  fvhHitsTimeToTriggerSel.push_back( new TH1D(
986  Form( "hHitsTimeToTriggerSelSect%2u", uSector ),
987  Form( "Time to trigger for all selected hits in sector %2u; t - Ttrigg [ns]; Hits []", uSector ),
988  uNbBinsDtSel, fdStarTriggerDelay[ uGdpb ], dMaxDtSel ) );
989 
991  AddHistoToVector( fvhHitsTimeToTriggerRaw[ uGdpb ], sFolder );
992  AddHistoToVector( fvhHitsTimeToTriggerSel[ uGdpb ], sFolder );
993 
994  if( kTRUE == fbDebugMonitorMode )
995  {
996  fvhHitsTimeToTriggerSelVsDaq.push_back( new TH2D(
997  Form( "hHitsTimeToTriggerSelVsDaqSect%2u", uSector ),
998  Form( "Time to trigger for all selected hits vs DAQ CMD in sector %2u; t - Ttrigg [ns]; DAQ CMD []; Hits []", uSector ),
999  uNbBinsDtSel, fdStarTriggerDelay[ uGdpb ], dMaxDtSel,
1000  16, 0., 16. ) );
1001 
1002  fvhHitsTimeToTriggerSelVsTrig.push_back( new TH2D(
1003  Form( "hHitsTimeToTriggerSelVsTrigSect%2u", uSector ),
1004  Form( "Time to trigger for all selected hits vs TRIG CMD in sector %2u; t - Ttrigg [ns]; TRIG CMD []; Hits []", uSector ),
1005  uNbBinsDtSel, fdStarTriggerDelay[ uGdpb ], dMaxDtSel,
1006  16, 0., 16. ) );
1007 
1008  fvhTriggerDt.push_back( new TH1I(
1009  Form( "hTriggerDtSect%2u", uSector ),
1010  Form( "Trigger time difference between sector %2u and the first sector, full events only; Ttrigg%2u - TtriggRef [Clk]; events []",
1011  uSector, uSector ),
1012  200, -100, 100 ) );
1013 
1016  UInt_t uNbBinsInTs = fdMsSizeInNs * 111 / 1000. / 10.;
1017  UInt_t uNbBinsInMs = fdMsSizeInNs * 20 / 1000. / 10.;
1018 
1019  fvhTriggerDistributionInTs.push_back( new TH1I( Form( "hTriggerDistInTsSect%2u", uSector ),
1020  Form( "Trigger distribution inside TS in sector %2u; Time in TS [us]; Trigger [];", uSector ),
1021  uNbBinsInTs, -0.5 - fdMsSizeInNs * 10 / 1000., fdMsSizeInNs * 101 / 1000. - 0.5 ) );
1022 
1023  fvhTriggerDistributionInMs.push_back( new TH1I( Form( "hTriggerDistInMsSect%2u", uSector ),
1024  Form( "Trigger distribution inside MS in sector %2u; Time in MS [us]; Trigger [];", uSector ),
1025  uNbBinsInMs, -0.5 - fdMsSizeInNs * 10 / 1000., fdMsSizeInNs * 10 / 1000. - 0.5 ) );
1026 
1027  fvhMessDistributionInMs.push_back( new TH1I( Form( "hMessDistInMsSect%2u", uSector ),
1028  Form( "Messages distribution inside MS in sector %2u; Time in MS [us]; Trigger [];", uSector ),
1029  uNbBinsInMs, -0.5 - fdMsSizeInNs * 10 / 1000., fdMsSizeInNs * 10 / 1000. - 0.5 ) );
1030 
1032  AddHistoToVector( fvhHitsTimeToTriggerSelVsDaq[ uGdpb ], sFolder );
1033  AddHistoToVector( fvhHitsTimeToTriggerSelVsTrig[ uGdpb ], sFolder );
1034  AddHistoToVector( fvhTriggerDt[ uGdpb ], sFolder );
1035  AddHistoToVector( fvhTriggerDistributionInTs[ uGdpb ], sFolder );
1036  AddHistoToVector( fvhTriggerDistributionInMs[ uGdpb ], sFolder );
1037  AddHistoToVector( fvhMessDistributionInMs[ uGdpb ], sFolder );
1038  } // if( kTRUE == fbDebugMonitorMode )
1039  } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1040 
1042  fhEventNbPerTs = new TH1I( "hEventNbPerTs",
1043  "Number of Events per TS; Events []; TS []",
1044  1000 , 0, 1000 );
1045 
1046  fhEventSizeDistribution = new TH1I( "hEventSizeDistribution",
1047  "Event size distribution; Event size [byte]; Events []",
1048  CbmTofStarSubevent2019::GetMaxOutputSize()/8 , 0, CbmTofStarSubevent2019::GetMaxOutputSize() );
1049 
1050  fhEventSizeEvolution = new TProfile( "hEventSizeEvolution",
1051  "Event size evolution; Time in run [min]; mean Event size [byte];",
1052  14400, 0, 14400 );
1053 
1054  fhEventNbEvolution = new TH1I( "hEventNbEvolution",
1055  "Event number evolution; Time in run [min]; Events [];",
1056  14400, 0, 14400 );
1057 
1059  AddHistoToVector( fhEventNbPerTs, "eventbuilder" );
1060  AddHistoToVector( fhEventSizeDistribution, "eventbuilder" );
1061  AddHistoToVector( fhEventSizeEvolution, "eventbuilder" );
1062  AddHistoToVector( fhEventNbEvolution, "eventbuilder" );
1063 
1064  if( kTRUE == fbDebugMonitorMode )
1065  {
1068  UInt_t uNbBinsInTs = fdMsSizeInNs * 101 / 1000. / 10.;
1069 
1070  fhEventNbDistributionInTs = new TH1I( "hEventNbDistributionInTs",
1071  "Event number distribution inside TS; Time in TS [us]; Events [];",
1072  uNbBinsInTs, -0.5, fdMsSizeInNs * 101 / 1000. - 0.5 );
1073 
1074  fhEventSizeDistributionInTs = new TProfile( "hEventSizeDistributionInTs",
1075  "Event size distribution inside TS; Time in TS [us]; mean Event size [Byte];",
1076  uNbBinsInTs, -0.5, fdMsSizeInNs * 101 / 1000. - 0.5 );
1077 
1078  fhRawTriggersStats = new TH2I(
1079  "hRawTriggersStats",
1080  "Raw triggers statistics per sector; ; Sector []; Messages []",
1081  5, 0, 5,
1082  12, 13, 25 );
1083  fhRawTriggersStats->GetXaxis()->SetBinLabel( 1, "A");
1084  fhRawTriggersStats->GetXaxis()->SetBinLabel( 2, "B");
1085  fhRawTriggersStats->GetXaxis()->SetBinLabel( 3, "C");
1086  fhRawTriggersStats->GetXaxis()->SetBinLabel( 4, "D");
1087  fhRawTriggersStats->GetXaxis()->SetBinLabel( 5, "F");
1088 
1089  fhMissingTriggersEvolution = new TH2I(
1090  "hMissingTriggersEvolution",
1091  "Missing trigger counts per sector vs time in run; Time in run [min]; Sector []; Missing triggers []",
1092  14400, 0, 14400,
1093  12, 13, 25 );
1094 
1096  AddHistoToVector( fhEventNbDistributionInTs, "eventbuilder" );
1097  AddHistoToVector( fhEventSizeDistributionInTs, "eventbuilder" );
1098  AddHistoToVector( fhRawTriggersStats, "eventbuilder" );
1099  AddHistoToVector( fhMissingTriggersEvolution, "eventbuilder" );
1100  } // if( kTRUE == fbDebugMonitorMode )
1101 
1103  Double_t w = 10;
1104  Double_t h = 10;
1105 
1107  fcTimeToTrigRaw = new TCanvas( "cTimeToTrigRaw", "Raw Time to trig for all sectors", w, h);
1108  fcTimeToTrigRaw->Divide( 2, fuNrOfGdpbs / 2 );
1109  for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1110  {
1111  fcTimeToTrigRaw->cd( 1 + uGdpb );
1112  gPad->SetGridx();
1113  gPad->SetGridy();
1114  gPad->SetLogy();
1115  fvhHitsTimeToTriggerRaw[ uGdpb ]->Draw();
1116  } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1117 
1119  fcTimeToTrigSel = new TCanvas( "cTimeToTrigSel", "Selected Time to trig for all sectors", w, h);
1120  fcTimeToTrigSel->Divide( 2, fuNrOfGdpbs / 2 );
1121  for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1122  {
1123  fcTimeToTrigSel->cd( 1 + uGdpb );
1124  gPad->SetGridx();
1125  gPad->SetGridy();
1126  gPad->SetLogy();
1127  fvhHitsTimeToTriggerSel[ uGdpb ]->Draw();
1128  } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1129 
1130  if( kTRUE == fbDebugMonitorMode )
1131  {
1133  fcTrigDistMs = new TCanvas( "cTrigDistMs", "Trigger time to MS start for all sectors", w, h);
1134  fcTrigDistMs->Divide( 2, fuNrOfGdpbs / 2 );
1135  for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1136  {
1137  fcTrigDistMs->cd( 1 + uGdpb );
1138  gPad->SetGridx();
1139  gPad->SetGridy();
1140  gPad->SetLogy();
1141  fvhTriggerDistributionInMs[ uGdpb ]->Draw();
1142  } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1143 
1145  fcMessDistMs = new TCanvas( "cMessDistMs", "Message time to MS start for all sectors", w, h);
1146  fcMessDistMs->Divide( 2, fuNrOfGdpbs / 2 );
1147  for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1148  {
1149  fcMessDistMs->cd( 1 + uGdpb );
1150  gPad->SetGridx();
1151  gPad->SetGridy();
1152  gPad->SetLogy();
1153  fvhMessDistributionInMs[ uGdpb ]->Draw();
1154  } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1155  } // if( kTRUE == fbDebugMonitorMode )
1156 
1158  fcEventBuildStats = new TCanvas( "cEvtBuildStats", "Event building statistics", w, h);
1159  if( kTRUE == fbDebugMonitorMode )
1160  fcEventBuildStats->Divide( 2, 3 );
1161  else fcEventBuildStats->Divide( 2, 2 );
1162 
1163  fcEventBuildStats->cd( 1 );
1164  gPad->SetGridx();
1165  gPad->SetGridy();
1166  gPad->SetLogy();
1167  fhEventNbPerTs->Draw();
1168 
1169  fcEventBuildStats->cd( 2 );
1170  gPad->SetGridx();
1171  gPad->SetGridy();
1172  gPad->SetLogy();
1173  fhEventSizeDistribution->Draw();
1174 
1175  fcEventBuildStats->cd( 3 );
1176  gPad->SetGridx();
1177  gPad->SetGridy();
1178  gPad->SetLogy();
1179  fhEventSizeEvolution->Draw();
1180 
1181  fcEventBuildStats->cd( 4 );
1182  gPad->SetGridx();
1183  gPad->SetGridy();
1184  gPad->SetLogy();
1185  fhEventNbEvolution->Draw();
1186 
1187  if( kTRUE == fbDebugMonitorMode )
1188  {
1189  fcEventBuildStats->cd( 5 );
1190  gPad->SetGridx();
1191  gPad->SetGridy();
1192  gPad->SetLogy();
1193  fhEventNbDistributionInTs->Draw();
1194 
1195  fcEventBuildStats->cd( 6 );
1196  gPad->SetGridx();
1197  gPad->SetGridy();
1198  gPad->SetLogy();
1199  fhEventSizeDistributionInTs->Draw();
1200  } // if( kTRUE == fbDebugMonitorMode )
1201 
1202  AddCanvasToVector( fcEventBuildStats, "canvases" );
1203 */
1204  return kTRUE;
1205 }
1207  for (auto itHit = fDigiVect.begin(); itHit != fDigiVect.end(); ++itHit) {
1208  fhDigisTimeInRun->Fill(itHit->GetTime() * 1e-9);
1209  } // for( auto itHit = fDigiVect.begin(); itHit != fDigiVect.end(); ++itHit)
1210  return kTRUE;
1211 }
1213  fhDigisTimeInRun->Reset();
1214  /*
1215  for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1216  {
1217  fvhHitsTimeToTriggerRaw[ uGdpb ]->Reset();
1218  fvhHitsTimeToTriggerSel[ uGdpb ]->Reset();
1219 
1220  if( kTRUE == fbDebugMonitorMode )
1221  {
1222  fvhHitsTimeToTriggerSelVsDaq[ uGdpb ]->Reset();
1223  fvhHitsTimeToTriggerSelVsTrig[ uGdpb ]->Reset();
1224  fvhTriggerDt[ uGdpb ]->Reset();
1225  fvhTriggerDistributionInTs[ uGdpb ]->Reset();
1226  fvhTriggerDistributionInMs[ uGdpb ]->Reset();
1227  fvhMessDistributionInMs[ uGdpb ]->Reset();
1228  } // if( kTRUE == fbDebugMonitorMode )
1229  } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1230 
1232  fhEventNbPerTs->Reset();
1233  fhEventSizeDistribution->Reset();
1234  fhEventSizeEvolution->Reset();
1235  fhEventNbEvolution->Reset();
1236 
1237  if( kTRUE == fbDebugMonitorMode )
1238  {
1239  fhEventNbDistributionInTs->Reset();
1240  fhEventSizeDistributionInTs->Reset();
1241  fhRawTriggersStats->Reset();
1242  fhMissingTriggersEvolution->Reset();
1243  } // if( kTRUE == fbDebugMonitorMode )
1244 */
1245  return kTRUE;
1246 }
1247 // -------------------------------------------------------------------------
1248 
1250  Double_t dOffsetIn) {
1251  if (uAsicIdx >= fvdTimeOffsetNsAsics.size()) {
1252  fvdTimeOffsetNsAsics.resize(uAsicIdx + 1, 0.0);
1253  } // if( uAsicIdx < fvdTimeOffsetNsAsics.size() )
1254 
1255  fvdTimeOffsetNsAsics[uAsicIdx] = dOffsetIn;
1256 }
1257 // -------------------------------------------------------------------------
1259  UInt_t uChan,
1260  Bool_t bMasked) {
1261  if (kFALSE == fbUseChannelMask) {
1262  fbUseChannelMask = kTRUE;
1263  fvvbMaskedChannels.resize(fuNbFebs);
1264  for (UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx) {
1265  fvvbMaskedChannels[uFebIdx].resize(fUnpackPar->GetNbChanPerFeb(), false);
1266  } // for( UInt_t uFeb = 0; uFeb < fuNbFebs; ++uFeb )
1267  } // if( kFALSE == fbUseChannelMask )
1268  if (uFeb < fuNbFebs && uChan < fUnpackPar->GetNbChanPerFeb())
1269  fvvbMaskedChannels[uFeb][uChan] = bMasked;
1270  else
1271  LOG(fatal) << "CbmMcbm2018UnpackerAlgoMuch::MaskNoisyChannel => Invalid "
1272  "FEB and/or CHAN index:"
1273  << Form(" %u vs %u and %u vs %u",
1274  uFeb,
1275  fuNbFebs,
1276  uChan,
1278 }
1279 // -------------------------------------------------------------------------
stsxyter::FinalHit::GetAdc
uint16_t GetAdc() const
Definition: StsXyterFinalHit.h:81
CbmMuchBeamTimeDigi::SetPadX
void SetPadX(Int_t padX)
Definition: CbmMuchBeamTimeDigi.h:40
CbmMcbm2018MuchPar::GetNbAsicsPerCrob
static constexpr UInt_t GetNbAsicsPerCrob()
Definition: CbmMcbm2018MuchPar.h:44
CbmMcbm2018UnpackerAlgoMuch::fmMsgCounter
std::map< stsxyter::MessType, UInt_t > fmMsgCounter
Definition: CbmMcbm2018UnpackerAlgoMuch.h:135
CbmMcbm2018UnpackerAlgoMuch::MaskNoisyChannel
void MaskNoisyChannel(UInt_t uFeb, UInt_t uChan, Bool_t bMasked=kTRUE)
Definition: CbmMcbm2018UnpackerAlgoMuch.cxx:1258
CbmMcbm2018MuchPar::IsCrobActive
Bool_t IsCrobActive(UInt_t uDpbIdx, UInt_t uCrobIdx)
Definition: CbmMcbm2018MuchPar.cxx:151
CbmMcbm2018UnpackerAlgoMuch::fdAdcCut
UInt_t fdAdcCut
Vector of channel masks, [ NbFeb ][ NbCHanInFeb ], used only if fbUseChannelMask is true.
Definition: CbmMcbm2018UnpackerAlgoMuch.h:119
CbmMcbm2018UnpackerAlgoMuch::CreateHistograms
Bool_t CreateHistograms()
Definition: CbmMcbm2018UnpackerAlgoMuch.cxx:944
CbmStar2019Algo< CbmMuchBeamTimeDigi >::fdMsSizeInNs
Double_t fdMsSizeInNs
/‍** Ignore Overlap Ms: all fuOverlapMsNb MS at the end of timeslice **‍/
Definition: CbmStar2019Algo.h:117
CbmMcbm2018MuchPar::GetNbElinkPerCrob
static constexpr UInt_t GetNbElinkPerCrob()
Definition: CbmMcbm2018MuchPar.h:38
CbmMcbm2018MuchPar::ElinkIdxToAsicIdx
UInt_t ElinkIdxToAsicIdx(UInt_t uElink)
Definition: CbmMcbm2018MuchPar.h:60
CbmMcbm2018UnpackerAlgoMuch::ProcessHitInfo
void ProcessHitInfo(const stsxyter::Message &mess, const UShort_t &usElinkIdx, const UInt_t &uAsicIdx, const UInt_t &uMsIdx)
Definition: CbmMcbm2018UnpackerAlgoMuch.cxx:673
CbmStar2019Algo< CbmMuchBeamTimeDigi >::fuNbMsLoop
size_t fuNbMsLoop
Definition: CbmStar2019Algo.h:114
CbmMcbm2018UnpackerAlgoMuch::fbBinningFw
Bool_t fbBinningFw
=> Quick and dirty hack for binning FW!!!
Definition: CbmMcbm2018UnpackerAlgoMuch.h:95
CbmStar2019Algo< CbmMuchBeamTimeDigi >::fErrVect
std::vector< CbmErrorMessage > fErrVect
Definition: CbmStar2019Algo.h:141
CbmMcbm2018MuchPar.h
stsxyter::Message
Definition: StsXyterMessage.h:165
CbmMcbm2018MuchPar::GetDpbId
UInt_t GetDpbId(UInt_t uDpbIdx)
Definition: CbmMcbm2018MuchPar.cxx:142
CbmMcbm2018UnpackerAlgoMuch::fdTsStartTime
Double_t fdTsStartTime
Definition: CbmMcbm2018UnpackerAlgoMuch.h:128
stsxyter::MessType::Status
@ Status
CbmMuchBeamTimeDigi
Definition: CbmMuchBeamTimeDigi.h:29
CbmMcbm2018UnpackerAlgoMuch::fvulCurrentTsMsb
std::vector< ULong64_t > fvulCurrentTsMsb
Definition: CbmMcbm2018UnpackerAlgoMuch.h:146
CbmMcbm2018UnpackerAlgoMuch::InitParameters
Bool_t InitParameters()
Definition: CbmMcbm2018UnpackerAlgoMuch.cxx:133
stsxyter::kulTsCycleNbBinsBinning
static const uint64_t kulTsCycleNbBinsBinning
Definition: StsXyterMessage.h:161
CbmStar2019Algo< CbmMuchBeamTimeDigi >::fuNbOverMsPerTs
size_t fuNbOverMsPerTs
Definition: CbmStar2019Algo.h:113
CbmMuchBeamTimeDigi::SetPadY
void SetPadY(Int_t padY)
Definition: CbmMuchBeamTimeDigi.h:41
stsxyter::Message::GetLinkIndexHitBinning
uint16_t GetLinkIndexHitBinning() const
Definition: StsXyterMessage.h:296
CbmMcbm2018MuchPar::GetNrOfDpbs
UInt_t GetNrOfDpbs()
Definition: CbmMcbm2018MuchPar.h:68
CbmStar2019Algo< CbmMuchBeamTimeDigi >::AddHistoToVector
void AddHistoToVector(TNamed *pointer, std::string sFolder="")
For monitor algos.
Definition: CbmStar2019Algo.h:80
stsxyter::Message::GetTsMsbVal
uint32_t GetTsMsbVal() const
For TS MSB data: Returns the TS MSB 22 bit field)
Definition: StsXyterMessage.h:334
CbmMcbm2018UnpackerAlgoMuch::fbMonitorMode
Bool_t fbMonitorMode
Control flags.
Definition: CbmMcbm2018UnpackerAlgoMuch.h:90
CbmMcbm2018UnpackerAlgoMuch::kuMaxTsMsbDiffDuplicates
static const UInt_t kuMaxTsMsbDiffDuplicates
All hits (time in bins, ADC in bins, asic, channel) in last MS, sorted with "<" operator.
Definition: CbmMcbm2018UnpackerAlgoMuch.h:161
CbmMcbm2018MuchPar::GetNbChanPerFeb
static constexpr UInt_t GetNbChanPerFeb()
Definition: CbmMcbm2018MuchPar.h:51
stsxyter::Message::GetLinkIndex
uint16_t GetLinkIndex() const
For all data: Returns the (global) index of the eLink on which the message was received (n bit field)
Definition: StsXyterMessage.h:249
CbmMuchBeamTimeDigi::SetRocId
void SetRocId(Int_t rocId)
Definition: CbmMuchBeamTimeDigi.h:42
stsxyter::MessType
MessType
Message types.
Definition: StsXyterMessage.h:27
CbmMcbm2018UnpackerAlgoMuch::fvvusLastTsMsbCycleChan
std::vector< std::vector< UShort_t > > fvvusLastTsMsbCycleChan
TS MSB of last hit message for each channel, [ AsicIdx ][ Chan ].
Definition: CbmMcbm2018UnpackerAlgoMuch.h:170
CbmStar2019Algo< CbmMuchBeamTimeDigi >::fuNbCoreMsPerTs
size_t fuNbCoreMsPerTs
Definition: CbmStar2019Algo.h:112
CbmMcbm2018UnpackerAlgoMuch::ProcessTs
Bool_t ProcessTs(const fles::Timeslice &ts)
Definition: CbmMcbm2018UnpackerAlgoMuch.cxx:242
stsxyter::kulTsCycleNbBins
static const uint64_t kulTsCycleNbBins
Definition: StsXyterMessage.h:152
CbmStar2019Algo< CbmMuchBeamTimeDigi >::fdTsFullSizeInNs
Double_t fdTsFullSizeInNs
Total size of the core MS in a TS, [nanoseconds].
Definition: CbmStar2019Algo.h:121
CbmStar2019Algo< CbmMuchBeamTimeDigi >::fParCList
TList * fParCList
Parameter management.
Definition: CbmStar2019Algo.h:108
CbmMcbm2018UnpackerAlgoMuch::Finish
virtual void Finish()
Definition: CbmMcbm2018UnpackerAlgoMuch.cxx:101
CbmStar2019Algo< CbmMuchBeamTimeDigi >::fvMsComponentsList
std::vector< size_t > fvMsComponentsList
Parameters related to FLES containers.
Definition: CbmStar2019Algo.h:111
CbmMcbm2018UnpackerAlgoMuch::fhVectorSize
TH1 * fhVectorSize
Definition: CbmMcbm2018UnpackerAlgoMuch.h:180
stsxyter::Message::IsHitMissedEvts
bool IsHitMissedEvts() const
For Hit data: Returns Missed event flag (1 bit field)
Definition: StsXyterMessage.h:301
stsxyter::Message::GetData
uint32_t GetData() const
Definition: StsXyterMessage.h:189
CbmMcbm2018UnpackerAlgoMuch::GetParList
TList * GetParList()
Definition: CbmMcbm2018UnpackerAlgoMuch.cxx:126
stsxyter::Message::GetHitAdc
uint16_t GetHitAdc() const
For Hit data: Returns ADC value (5 bit field)
Definition: StsXyterMessage.h:277
CbmMcbm2018MuchPar::GetPadYA
Short_t GetPadYA(UShort_t febid, UShort_t channelid)
Definition: CbmMcbm2018MuchPar.cxx:228
CbmMcbm2018UnpackerAlgoMuch::SetTimeOffsetNsAsic
void SetTimeOffsetNsAsic(UInt_t uAsicIdx, Double_t dOffsetIn=0.0)
Definition: CbmMcbm2018UnpackerAlgoMuch.cxx:1249
CbmMcbm2018UnpackerAlgoMuch::fdStartTime
Double_t fdStartTime
Definition: CbmMcbm2018UnpackerAlgoMuch.h:150
CbmMcbm2018UnpackerAlgoMuch::ProcessStatusInfo
void ProcessStatusInfo(const stsxyter::Message &mess, const UInt_t &uAsicIdx)
Definition: CbmMcbm2018UnpackerAlgoMuch.cxx:901
CbmMcbm2018UnpackerAlgoMuch::fvuCurrentTsMsbCycle
std::vector< UInt_t > fvuCurrentTsMsbCycle
Current TS MSB for each DPB.
Definition: CbmMcbm2018UnpackerAlgoMuch.h:147
CbmMcbm2018UnpackerAlgoMuch::~CbmMcbm2018UnpackerAlgoMuch
~CbmMcbm2018UnpackerAlgoMuch()
Definition: CbmMcbm2018UnpackerAlgoMuch.cxx:80
stsxyter::MessType::Empty
@ Empty
CbmMcbm2018UnpackerAlgoMuch::fhVectorCapacity
TH1 * fhVectorCapacity
Definition: CbmMcbm2018UnpackerAlgoMuch.h:181
CbmMcbm2018UnpackerAlgoMuch::ProcessMs
Bool_t ProcessMs(const fles::Timeslice &ts, size_t uMsCompIdx, size_t uMsIdx)
Definition: CbmMcbm2018UnpackerAlgoMuch.cxx:455
CbmMcbm2018MuchPar::GetNbCrobsPerDpb
static constexpr UInt_t GetNbCrobsPerDpb()
Definition: CbmMcbm2018MuchPar.h:37
CbmStar2019Algo
Definition: CbmStar2019Algo.h:43
stsxyter::FinalHit
Definition: StsXyterFinalHit.h:16
CbmMcbm2018UnpackerAlgoMuch::FillHistograms
Bool_t FillHistograms()
Definition: CbmMcbm2018UnpackerAlgoMuch.cxx:1206
stsxyter::MessType::Hit
@ Hit
CbmMcbm2018UnpackerAlgoMuch::fDpbIdIndexMap
std::map< UInt_t, UInt_t > fDpbIdIndexMap
Total number of STS DPBs in system.
Definition: CbmMcbm2018UnpackerAlgoMuch.h:105
CbmErrorMessage
CbmRoot (+externals) headers.
Definition: CbmErrorMessage.h:39
stsxyter::FinalHit::GetChan
uint16_t GetChan() const
Definition: StsXyterFinalHit.h:83
CbmMcbm2018UnpackerAlgoMuch::fuCurrDpbIdx
UInt_t fuCurrDpbIdx
Temp holder until Current equipment ID is properly filled in MS.
Definition: CbmMcbm2018UnpackerAlgoMuch.h:141
stsxyter::kuHitNbTsBins
static const uint32_t kuHitNbTsBins
Definition: StsXyterMessage.h:146
CbmStar2019Algo< CbmMuchBeamTimeDigi >::fdTsCoreSizeInNs
Double_t fdTsCoreSizeInNs
Size of a single MS, [nanoseconds].
Definition: CbmStar2019Algo.h:119
CbmMcbm2018UnpackerAlgoMuch::ProcessEpochInfo
void ProcessEpochInfo(const stsxyter::Message &mess)
Definition: CbmMcbm2018UnpackerAlgoMuch.cxx:886
CbmMcbm2018UnpackerAlgoMuch::Reset
virtual void Reset()
Definition: CbmMcbm2018UnpackerAlgoMuch.cxx:100
CbmMuchBeamTimeDigi::SetNxId
void SetNxId(Int_t nxId)
Definition: CbmMuchBeamTimeDigi.h:43
CbmMcbm2018UnpackerAlgoMuch::ReInitContainers
Bool_t ReInitContainers()
Definition: CbmMcbm2018UnpackerAlgoMuch.cxx:114
CbmMcbm2018UnpackerAlgoMuch::fvvusLastTsChan
std::vector< std::vector< UShort_t > > fvvusLastTsChan
Limit how many different TS_MSB are checked for same duplicate hit => set to 1 uS.
Definition: CbmMcbm2018UnpackerAlgoMuch.h:164
stsxyter::Message::GetStatusStatus
uint16_t GetStatusStatus() const
For Status data: Returns the Status field from ACK frame (4 bit field)
Definition: StsXyterMessage.h:359
CbmMcbm2018UnpackerAlgoMuch::fvvusLastAdcChan
std::vector< std::vector< UShort_t > > fvvusLastAdcChan
TS of last hit message for each channel, [ AsicIdx ][ Chan ].
Definition: CbmMcbm2018UnpackerAlgoMuch.h:166
CbmMcbm2018UnpackerAlgoMuch::fuCurrDpbId
UInt_t fuCurrDpbId
Current equipment ID, tells from which DPB the current MS is originating.
Definition: CbmMcbm2018UnpackerAlgoMuch.h:139
CbmStar2019Algo< CbmMuchBeamTimeDigi >::fDigiVect
std::vector< CbmMuchBeamTimeDigi > fDigiVect
Vector of pointers to canvases + optional folder name.
Definition: CbmStar2019Algo.h:140
CbmMcbm2018UnpackerAlgoMuch::fdCapacityIncFactor
Double_t fdCapacityIncFactor
Definition: CbmMcbm2018UnpackerAlgoMuch.h:183
CbmMcbm2018UnpackerAlgoMuch::fuNrOfDpbs
UInt_t fuNrOfDpbs
Definition: CbmMcbm2018UnpackerAlgoMuch.h:103
CbmMcbm2018UnpackerAlgoMuch::fuMsIndex
UInt_t fuMsIndex
Start Time in ns of current MS from its index field in header.
Definition: CbmMcbm2018UnpackerAlgoMuch.h:133
CbmMcbm2018MuchPar::GetNrOfAsics
UInt_t GetNrOfAsics()
Definition: CbmMcbm2018MuchPar.h:72
CbmMcbm2018UnpackerAlgoMuch::fdTimeOffsetNs
Double_t fdTimeOffsetNs
Number of StsXyter ASICs.
Definition: CbmMcbm2018UnpackerAlgoMuch.h:112
CbmMcbm2018UnpackerAlgoMuch::fUnpackPar
CbmMcbm2018MuchPar * fUnpackPar
Switch to smx2.0/smx2.1 data-> fiFlag = 0 for 2.0 and fiFlag = 1 for 2.1.
Definition: CbmMcbm2018UnpackerAlgoMuch.h:101
CbmMcbm2018UnpackerAlgoMuch::ResetHistograms
Bool_t ResetHistograms()
Definition: CbmMcbm2018UnpackerAlgoMuch.cxx:1212
CbmMcbm2018UnpackerAlgoMuch::fuTsMaxVectorSize
size_t fuTsMaxVectorSize
Definition: CbmMcbm2018UnpackerAlgoMuch.h:182
CbmMcbm2018UnpackerAlgoMuch::ProcessTsMsbInfo
void ProcessTsMsbInfo(const stsxyter::Message &mess, UInt_t uMessIdx=0, UInt_t uMsIdx=0)
Definition: CbmMcbm2018UnpackerAlgoMuch.cxx:806
CbmMcbm2018UnpackerAlgoMuch::fvvbMaskedChannels
std::vector< std::vector< bool > > fvvbMaskedChannels
Definition: CbmMcbm2018UnpackerAlgoMuch.h:118
CbmMcbm2018UnpackerAlgoMuch::fdTsStopTimeCore
Double_t fdTsStopTimeCore
Time in ns of current TS from the index of the first MS first component.
Definition: CbmMcbm2018UnpackerAlgoMuch.h:130
stsxyter::kdClockCycleNs
static const double kdClockCycleNs
Definition: StsXyterMessage.h:156
CbmMcbm2018UnpackerAlgoMuch::fulCurrentTsIdx
ULong64_t fulCurrentTsIdx
Definition: CbmMcbm2018UnpackerAlgoMuch.h:125
CbmMcbm2018UnpackerAlgoMuch::fiFlag
Int_t fiFlag
Definition: CbmMcbm2018UnpackerAlgoMuch.h:98
stsxyter::kuHitNbTsBinsBinning
static const uint32_t kuHitNbTsBinsBinning
Definition: StsXyterMessage.h:160
CbmMcbm2018MuchPar::GetPadXB
Short_t GetPadXB(UShort_t febid, UShort_t channelid)
Definition: CbmMcbm2018MuchPar.cxx:241
CbmMcbm2018MuchPar
Definition: CbmMcbm2018MuchPar.h:19
CbmMcbm2018UnpackerAlgoMuch::fuNbStsXyters
UInt_t fuNbStsXyters
Number of FEBs with StsXyter ASICs.
Definition: CbmMcbm2018UnpackerAlgoMuch.h:109
CbmMcbm2018MuchPar::GetNrOfFebs
UInt_t GetNrOfFebs()
Definition: CbmMcbm2018MuchPar.h:71
stsxyter::Message::GetMessType
MessType GetMessType() const
Returns the message type, see enum MessType.
Definition: StsXyterMessage.h:259
CbmMcbm2018UnpackerAlgoMuch::fhDigisTimeInRun
TH1 * fhDigisTimeInRun
TS MSB cycle of last hit message for each channel, [ AsicIdx ][ Chan ].
Definition: CbmMcbm2018UnpackerAlgoMuch.h:173
stsxyter::FinalHit::GetAsic
uint16_t GetAsic() const
Definition: StsXyterFinalHit.h:82
CbmMcbm2018UnpackerAlgoMuch::fvmHitsInMs
std::vector< stsxyter::FinalHit > fvmHitsInMs
Hits time-sorting.
Definition: CbmMcbm2018UnpackerAlgoMuch.h:158
FormatMsHeaderPrintout
std::string FormatMsHeaderPrintout(const fles::MicrosliceDescriptor &msDescriptor)
Definition: CbmFormatMsHeaderPrintout.cxx:5
CbmMcbm2018MuchPar::GetPadYB
Short_t GetPadYB(UShort_t febid, UShort_t channelid)
Definition: CbmMcbm2018MuchPar.cxx:254
CbmMcbm2018UnpackerAlgoMuch::Init
virtual Bool_t Init()
Definition: CbmMcbm2018UnpackerAlgoMuch.cxx:95
CbmMcbm2018UnpackerAlgoMuch::fuCurrentEquipmentId
UInt_t fuCurrentEquipmentId
Definition: CbmMcbm2018UnpackerAlgoMuch.h:137
CbmMcbm2018MuchPar::ElinkIdxToFebIdx
Int_t ElinkIdxToFebIdx(UInt_t uElink)
Definition: CbmMcbm2018MuchPar.cxx:119
stsxyter::Message::GetHitChannel
uint16_t GetHitChannel() const
For Hit data: Returns StsXYTER channel number (7 bit field)
Definition: StsXyterMessage.h:274
CbmMcbm2018MuchPar::GetModule
UInt_t GetModule(UInt_t)
Definition: CbmMcbm2018MuchPar.cxx:283
stsxyter::Message::GetStatusLink
uint16_t GetStatusLink() const
For Status data: Returns the Link Inedx (9 bit field)
Definition: StsXyterMessage.h:353
CbmMcbm2018UnpackerAlgoMuch::fvvusLastTsMsbChan
std::vector< std::vector< UShort_t > > fvvusLastTsMsbChan
ADC of last hit message for each channel, [ AsicIdx ][ Chan ].
Definition: CbmMcbm2018UnpackerAlgoMuch.h:168
CbmMuchBeamTimeDigi::SetNxCh
void SetNxCh(Int_t nxCh)
Definition: CbmMuchBeamTimeDigi.h:44
CbmMcbm2018UnpackerAlgoMuch::CreateMuchDigi
CbmMuchBeamTimeDigi * CreateMuchDigi(stsxyter::FinalHit *)
Definition: CbmMcbm2018UnpackerAlgoMuch.cxx:341
stsxyter::MessType::TsMsb
@ TsMsb
ECbmModuleId::kMuch
@ kMuch
Muon detection system.
stsxyter::Message::GetHitTime
uint16_t GetHitTime() const
For Hit data: Returns timestamp (8 bit field, 2 MSB bits overlap removed)
Definition: StsXyterMessage.h:286
stsxyter::MessType::Dummy
@ Dummy
CbmMcbm2018UnpackerAlgoMuch::fvbMaskedComponents
std::vector< Bool_t > fvbMaskedComponents
Switch ON the filling of a additional set of histograms.
Definition: CbmMcbm2018UnpackerAlgoMuch.h:93
CbmMcbm2018UnpackerAlgoMuch::CbmMcbm2018UnpackerAlgoMuch
CbmMcbm2018UnpackerAlgoMuch()
Definition: CbmMcbm2018UnpackerAlgoMuch.cxx:29
CbmMcbm2018UnpackerAlgoMuch.h
CbmMcbm2018UnpackerAlgoMuch::InitContainers
Bool_t InitContainers()
Definition: CbmMcbm2018UnpackerAlgoMuch.cxx:108
CbmMcbm2018MuchPar::GetNbChanPerAsic
static constexpr UInt_t GetNbChanPerAsic()
Definition: CbmMcbm2018MuchPar.h:50
stsxyter::MessType::Epoch
@ Epoch
stsxyter::FinalHit::GetTs
uint64_t GetTs() const
Definition: StsXyterFinalHit.h:80
CbmMuchAddress::GetAddress
static UInt_t GetAddress(Int_t station=0, Int_t layer=0, Int_t side=0, Int_t module=0, Int_t sector=0, Int_t channel=0)
Definition: CbmMuchAddress.cxx:43
CbmMcbm2018UnpackerAlgoMuch::fvdTimeOffsetNsAsics
std::vector< Double_t > fvdTimeOffsetNsAsics
Definition: CbmMcbm2018UnpackerAlgoMuch.h:113
stsxyter::Message::GetTsMsbValBinning
uint32_t GetTsMsbValBinning() const
For TS MSB data: Returns the TS MSB 29 bit field)
Definition: StsXyterMessage.h:337
stsxyter::FinalHit::GetDpb
uint16_t GetDpb() const
Definition: StsXyterFinalHit.h:84
CbmMcbm2018UnpackerAlgoMuch::fuNbFebs
UInt_t fuNbFebs
Array to hold the active flag for all CROBs, [ NbDpb ][ NbCrobPerDpb ].
Definition: CbmMcbm2018UnpackerAlgoMuch.h:108
CbmMcbm2018MuchPar::GetFebId
UInt_t GetFebId(UInt_t)
Definition: CbmMcbm2018MuchPar.cxx:267
CbmMcbm2018MuchPar::GetPadXA
Short_t GetPadXA(UShort_t febid, UShort_t channelid)
Definition: CbmMcbm2018MuchPar.cxx:215
CbmMcbm2018UnpackerAlgoMuch::fbUseChannelMask
Bool_t fbUseChannelMask
Definition: CbmMcbm2018UnpackerAlgoMuch.h:116
CbmMcbm2018UnpackerAlgoMuch::fulCurrentMsIdx
ULong64_t fulCurrentMsIdx
Definition: CbmMcbm2018UnpackerAlgoMuch.h:126
stsxyter::kusLenStatStatus
static const uint16_t kusLenStatStatus
Definition: StsXyterMessage.h:106
CbmMcbm2018UnpackerAlgoMuch::fvbCrobActiveFlag
std::vector< std::vector< Bool_t > > fvbCrobActiveFlag
Map of DPB Identifier to DPB index.
Definition: CbmMcbm2018UnpackerAlgoMuch.h:107
CbmStar2019Algo< CbmMuchBeamTimeDigi >::fbIgnoreOverlapMs
Bool_t fbIgnoreOverlapMs
Definition: CbmStar2019Algo.h:116
CbmMcbm2018UnpackerAlgoMuch::AddMsComponentToList
void AddMsComponentToList(size_t component, UShort_t usDetectorId)
Definition: CbmMcbm2018UnpackerAlgoMuch.cxx:227
CbmFormatMsHeaderPrintout.h
stsxyter::MessType::EndOfMs
@ EndOfMs
stsxyter::Message::GetHitTimeBinning
uint16_t GetHitTimeBinning() const
Definition: StsXyterMessage.h:290