CbmRoot
CbmStar2019EventBuilderEtofAlgo.cxx
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------
2 // ----- -----
3 // ----- CbmStar2019EventBuilderEtofAlgo -----
4 // ----- Created 03.11.2018 by P.-A. Loizeau -----
5 // ----- -----
6 // -----------------------------------------------------------------------------
7 
9 
10 #include "CbmHistManager.h"
11 #include "CbmStar2019TofPar.h"
12 
13 #include "FairLogger.h"
14 #include "FairRootManager.h"
15 #include "FairRun.h"
16 #include "FairRunOnline.h"
17 #include "FairRuntimeDb.h"
18 
19 #include "TCanvas.h"
20 #include "TH1.h"
21 #include "TH2.h"
22 #include "TList.h"
23 #include "TProfile.h"
24 #include "TROOT.h"
25 #include "TString.h"
26 
27 #include <fstream>
28 #include <iomanip>
29 #include <iostream>
30 #include <stdint.h>
31 
32 // -------------------------------------------------------------------------
34  : CbmStar2019Algo()
35  ,
37  fbMonitorMode(kFALSE)
38  , fbDebugMonitorMode(kFALSE)
39  , fbStoreLostEventMsg(kFALSE)
40  , fbAddStatusToEvent(kTRUE)
41  , fUnpackPar(nullptr)
42  , fuNrOfGdpbs(0)
43  , fGdpbIdIndexMap()
44  , fuNrOfFeePerGdpb(0)
45  , fuNrOfGet4PerFee(0)
46  , fuNrOfChannelsPerGet4(0)
47  , fuNrOfChannelsPerFee(0)
48  , fuNrOfGet4(0)
49  , fuNrOfGet4PerGdpb(0)
50  , fuNrOfChannelsPerGdpb(0)
51  , fuNrOfGbtx(0)
52  , fuNrOfModules(0)
53  , fviNrOfRpc()
54  , fviRpcType()
55  , fviRpcSide()
56  , fviModuleId()
57  , fdAllowedTriggersSpread(-1.0)
58  , fdStarTriggerDeadtime()
59  , fdStarTriggerDelay()
60  , fdStarTriggerWinSize()
61  , fuMinTotPulser(90)
62  , fuMaxTotPulser(110)
63  , fulCurrentTsIndex(0)
64  , fdTsStartTime(-1.0)
65  , fdTsStopTimeCore(-1.0)
66  , fuCurrentMs(0)
67  , fdMsTime(-1.0)
68  , fuMsIndex(0)
69  , fuGdpbId(0)
70  , fuGdpbNr(0)
71  , fuGet4Id(0)
72  , fuGet4Nr(0)
73  , fiEquipmentId(0)
74  , fvulCurrentEpoch()
75  , fvulCurrentEpochCycle()
76  , fvulCurrentEpochFull()
77  , fvvmEpSupprBuffer()
78  , fvvBufferMajorAsicErrors()
79  , fvvBufferMessages()
80  , fvvBufferTriggers()
81  , fbTriggerFoundA(kFALSE)
82  , fbTriggerFoundB(kFALSE)
83  , fbTriggerFoundC(kFALSE)
84  , fvulGdpbTsMsb()
85  , fvulGdpbTsLsb()
86  , fvulStarTsMsb()
87  , fvulStarTsMid()
88  , fvulGdpbTsFullLast()
89  , fvulStarTsFullLast()
90  , fvuStarTokenLast()
91  , fvuStarDaqCmdLast()
92  , fvuStarTrigCmdLast()
93  , fvulGdpbTsFullLastCore()
94  , fvulStarTsFullLastCore()
95  , fvuStarTokenLastCore()
96  , fvuStarDaqCmdLastCore()
97  , fvuStarTrigCmdLastCore()
98  , fvdMessCandidateTimeStart()
99  , fvdMessCandidateTimeStop()
100  , fvdTrigCandidateTimeStart()
101  , fvdTrigCandidateTimeStop()
102  , fbEpochAfterCandWinFound(kFALSE)
103  , fbTriggerAfterCandWinFound(kFALSE)
104  , fvbGdpbLastMissmatchPattern()
105  , fvbGdpbLastEnablePattern()
106  , fvbGdpbLastResyncPattern()
107  , fvSectorStatusPattern()
108  , fvhHitsTimeToTriggerRaw()
109  , fvhHitsTimeToTriggerRawPulser()
110  , fvhHitsTimeToTriggerSel()
111  , fvhHitsTimeToTriggerSelVsDaq()
112  , fvhHitsTimeToTriggerSelVsTrig()
113  , fvhTriggerDt()
114  , fvhTriggerDistributionInTs()
115  , fvhTriggerDistributionInMs()
116  , fvhMessDistributionInMs()
117  , fhEventSizeDistribution(nullptr)
118  , fhEventSizeEvolution(nullptr)
119  , fhEventNbEvolution(nullptr)
120  , fhEventNbDistributionInTs(nullptr)
121  , fhEventSizeDistributionInTs(nullptr)
122  , fhRawTriggersStats(nullptr)
123  , fhRawTriggersStatsCore(nullptr)
124  , fhRawTriggersStatsOver(nullptr)
125  , fhRawTriggersStatsSel(nullptr)
126  , fhMissingTriggersEvolution(nullptr)
127  , fcTimeToTrigRaw(nullptr)
128  , fcTimeToTrigSel(nullptr)
129  , fcTrigDistMs(nullptr)
130  , fcMessDistMs(nullptr)
131  , fcEventBuildStats(nullptr)
132  , fcTriggerStats(nullptr) {}
135  for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
136  fvvmEpSupprBuffer[uGdpb].clear();
137  fvvBufferMajorAsicErrors[uGdpb].clear();
138  fvvBufferMessages[uGdpb].clear();
139  fvvBufferTriggers[uGdpb].clear();
140  } // for (Int_t iGdpb = 0; iGdpb < fuNrOfGdpbs; ++iGdpb)
141 }
142 
143 // -------------------------------------------------------------------------
145  LOG(info) << "Initializing STAR eTOF 2019 event builder algo";
146 
147  return kTRUE;
148 }
152 
154 }
155 
156 // -------------------------------------------------------------------------
158  LOG(info) << "Init parameter containers for CbmStar2019EventBuilderEtofAlgo";
159  Bool_t initOK = ReInitContainers();
160 
161  return initOK;
162 }
164  LOG(info) << "**********************************************";
165  LOG(info)
166  << "ReInit parameter containers for CbmStar2019EventBuilderEtofAlgo";
167 
168  fUnpackPar = (CbmStar2019TofPar*) fParCList->FindObject("CbmStar2019TofPar");
169  if (nullptr == fUnpackPar) return kFALSE;
170 
171  Bool_t initOK = InitParameters();
172 
173  return initOK;
174 }
176  if (nullptr == fParCList) fParCList = new TList();
177  fUnpackPar = new CbmStar2019TofPar("CbmStar2019TofPar");
178  fParCList->Add(fUnpackPar);
179 
180  return fParCList;
181 }
184  // fbMonitorMode = fUnpackPar->GetMonitorMode();
185  LOG(info) << "Monitor mode: " << (fbMonitorMode ? "ON" : "OFF");
186 
187  // fbDebugMonitorMode = fUnpackPar->GetDebugMonitorMode();
188  LOG(info) << "Debug Monitor mode: " << (fbDebugMonitorMode ? "ON" : "OFF");
189 
190  LOG(info) << "Store Lost Event Msg in event: "
191  << (fbStoreLostEventMsg ? "ON" : "OFF");
192 
193  LOG(info) << "Add status pattern to event: "
194  << (fbAddStatusToEvent ? "ON" : "OFF");
195 
198  LOG(info) << "Nr. of Tof GDPBs: " << fuNrOfGdpbs;
199 
201  LOG(info) << "Nr. of FEEs per Tof GDPB: " << fuNrOfFeePerGdpb;
202 
204  LOG(info) << "Nr. of GET4 per Tof FEE: " << fuNrOfGet4PerFee;
205 
207  LOG(info) << "Nr. of channels per GET4: " << fuNrOfChannelsPerGet4;
208 
210  LOG(info) << "Nr. of channels per FEE: " << fuNrOfChannelsPerFee;
211 
213  LOG(info) << "Nr. of GET4s: " << fuNrOfGet4;
214 
216  LOG(info) << "Nr. of GET4s per GDPB: " << fuNrOfGet4PerGdpb;
217 
219  LOG(info) << "Nr. of channels per GDPB: " << fuNrOfChannelsPerGdpb;
220 
221  fGdpbIdIndexMap.clear();
222  for (UInt_t i = 0; i < fuNrOfGdpbs; ++i) {
224  LOG(info) << "GDPB Id of TOF " << Form("%02d", i) << " : " << std::hex
225  << Form("0x%04x", fUnpackPar->GetGdpbId(i)) << std::dec;
226  } // for( UInt_t i = 0; i < fuNrOfGdpbs; ++i )
227 
229  LOG(info) << "Nr. of GBTx: " << fuNrOfGbtx;
230 
232  LOG(info) << "Nr. of GBTx: " << fuNrOfModules;
233 
235  fviRpcType.resize(fuNrOfGbtx);
236  fviModuleId.resize(fuNrOfGbtx);
237  fviNrOfRpc.resize(fuNrOfGbtx);
238  fviRpcSide.resize(fuNrOfGbtx);
239  for (UInt_t uGbtx = 0; uGbtx < fuNrOfGbtx; ++uGbtx) {
240  fviNrOfRpc[uGbtx] = fUnpackPar->GetNrOfRpc(uGbtx);
241  fviRpcType[uGbtx] = fUnpackPar->GetRpcType(uGbtx);
242  fviRpcSide[uGbtx] = fUnpackPar->GetRpcSide(uGbtx);
243  fviModuleId[uGbtx] = fUnpackPar->GetModuleId(uGbtx);
244  } // for( UInt_t uGbtx = 0; uGbtx < uNrOfGbtx; ++uGbtx)
245 
246  LOG(info) << "Nr. of RPCs per GBTx: ";
247  std::stringstream ss;
248  for (UInt_t uGbtx = 0; uGbtx < fuNrOfGbtx; ++uGbtx)
249  ss << Form(" %2d", fviNrOfRpc[uGbtx]);
250  LOG(info) << ss.str();
251 
252  LOG(info) << "RPC type per GBTx: ";
253  ss.clear();
254  for (UInt_t uGbtx = 0; uGbtx < fuNrOfGbtx; ++uGbtx)
255  ss << Form(" %2d", fviRpcType[uGbtx]);
256  LOG(info) << ss.str();
257 
258  LOG(info) << "RPC side per GBTx: ";
259  ss.clear();
260  for (UInt_t uGbtx = 0; uGbtx < fuNrOfGbtx; ++uGbtx)
261  ss << Form(" %2d", fviRpcSide[uGbtx]);
262  LOG(info) << ss.str();
263 
264  LOG(info) << "Module ID per GBTx: ";
265  ss.clear();
266  for (UInt_t uGbtx = 0; uGbtx < fuNrOfGbtx; ++uGbtx)
267  ss << Form(" %2d", fviModuleId[uGbtx]);
268  LOG(info) << ss.str();
269 
272  LOG(info) << "Timeslice parameters: each MS is " << fdMsSizeInNs << " ns";
273 
276  fdStarTriggerDeadtime.resize(fuNrOfGdpbs, 0.0);
277  fdStarTriggerDelay.resize(fuNrOfGdpbs, 0.0);
278  fdStarTriggerWinSize.resize(fuNrOfGdpbs, 0.0);
287  for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
291  LOG(info) << Form("Trigger window parameters for gDPB %2u are: ", uGdpb)
292  << fdStarTriggerDeadtime[uGdpb] << " ns deadtime, "
293  << fdStarTriggerDelay[uGdpb] << " ns delay, "
294  << fdStarTriggerWinSize[uGdpb] << " ns window width, "
295  << fdAllowedTriggersSpread << " ns allowed spread";
296  } // for (Int_t iGdpb = 0; iGdpb < fuNrOfGdpbs; ++iGdpb)
297 
299  fvulCurrentEpoch.resize(fuNrOfGdpbs, 0);
302 
308 
310  fvulGdpbTsMsb.resize(fuNrOfGdpbs, 0);
311  fvulGdpbTsLsb.resize(fuNrOfGdpbs, 0);
312  fvulStarTsMsb.resize(fuNrOfGdpbs, 0);
313  fvulStarTsMid.resize(fuNrOfGdpbs, 0);
314  fvulGdpbTsFullLast.resize(fuNrOfGdpbs, 0);
315  fvulStarTsFullLast.resize(fuNrOfGdpbs, 0);
316  fvuStarTokenLast.resize(fuNrOfGdpbs, 0);
317  fvuStarDaqCmdLast.resize(fuNrOfGdpbs, 0);
318  fvuStarTrigCmdLast.resize(fuNrOfGdpbs, 0);
324 
325  return kTRUE;
326 }
327 // -------------------------------------------------------------------------
328 
330  size_t component,
331  UShort_t usDetectorId) {
333  for (UInt_t uCompIdx = 0; uCompIdx < fvMsComponentsList.size(); ++uCompIdx)
334  if (component == fvMsComponentsList[uCompIdx]) return;
335 
337  fvMsComponentsList.push_back(component);
338 
339  LOG(info)
340  << "CbmStar2019EventBuilderEtofAlgo::AddMsComponentToList => Component "
341  << component << " with detector ID 0x" << std::hex << usDetectorId
342  << std::dec << " added to list";
343 }
344 // -------------------------------------------------------------------------
345 
346 Bool_t CbmStar2019EventBuilderEtofAlgo::ProcessTs(const fles::Timeslice& ts) {
347  fulCurrentTsIndex = ts.index();
348  fdTsStartTime = static_cast<Double_t>(ts.descriptor(0, 0).idx);
349 
351  if (-1.0 == fdTsCoreSizeInNs) {
352  fuNbCoreMsPerTs = ts.num_core_microslices();
353  fuNbOverMsPerTs = ts.num_microslices(0) - ts.num_core_microslices();
356  LOG(info) << "Timeslice parameters: each TS has " << fuNbCoreMsPerTs
357  << " Core MS and " << fuNbOverMsPerTs
358  << " Overlap MS, for a core duration of " << fdTsCoreSizeInNs
359  << " ns and a full duration of " << fdTsFullSizeInNs << " ns";
360 
363  if (kFALSE == fbIgnoreOverlapMs) fuNbMsLoop += fuNbOverMsPerTs;
364  LOG(info) << "In each TS " << fuNbMsLoop << " MS will be looped over";
365  } // if( -1.0 == fdTsCoreSizeInNs )
366 
369  // LOG(info) << Form( "TS %5d Start %12f Stop %12f", fulCurrentTsIndex, fdTsStartTime, fdTsStopTimeCore );
370 
373  for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
374  if (fdStarTriggerDelay[uGdpb] < 0.0) {
376  if (fdStarTriggerDelay[uGdpb] + fdStarTriggerWinSize[uGdpb] < 0.0) {
379  // << Accept more than needed as this should be safer and small amounts >>
380  fvdMessCandidateTimeStop[uGdpb] =
382  + 2.0
384  [uGdpb]; // + fdStarTriggerWinSize[ uGdpb ];
389  - fdStarTriggerDelay[uGdpb];
390 
391  } // if( fdStarTriggerDelay[ uGdpb ] + fdStarTriggerWinSize[ uGdpb ] < 0.0 )
392  else {
395  // << Accept more than needed as this should be safer and small amounts >>
396  fvdMessCandidateTimeStop[uGdpb] =
398  + 2.0
399  * fdStarTriggerWinSize[uGdpb]; // + fdStarTriggerDelay[ uGdpb ];
404  - fdStarTriggerDelay[uGdpb];
405  } // else of if( fdStarTriggerDelay[ uGdpb ] + fdStarTriggerWinSize[ uGdpb ] < 0.0 )
406  } // if( fdStarTriggerDeadtime[ uGdpb ] < 0.0 )
407  else {
409  // << Accept more than needed as this should be safer and small amounts >>
411  fdTsStartTime; // - fdAllowedTriggersSpread + fdStarTriggerDelay[ uGdpb ];
412  fvdMessCandidateTimeStop[uGdpb] =
414  + fdStarTriggerWinSize[uGdpb];
417  fvdTrigCandidateTimeStop[uGdpb] =
419  } // else of if( fdStarTriggerDelay[ uGdpb ] < 0.0 )
420  } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
421 
423  for (UInt_t uMsCompIdx = 0; uMsCompIdx < fvMsComponentsList.size();
424  ++uMsCompIdx) {
425  UInt_t uMsComp = fvMsComponentsList[uMsCompIdx];
426 
428  fbTriggerFoundA = kFALSE;
429  fbTriggerFoundB = kFALSE;
430  fbTriggerFoundC = kFALSE;
431 
433  fbEpochAfterCandWinFound = kFALSE;
435 
437  for (fuMsIndex = 0; fuMsIndex < fuNbMsLoop; fuMsIndex++) {
438  if (kFALSE == ProcessMs(ts, uMsComp, fuMsIndex)) {
439  LOG(error) << "Failed to process ts " << fulCurrentTsIndex << " MS "
440  << fuMsIndex << " for component " << uMsComp;
441  return kFALSE;
442  } // if( kFALSE == ProcessMs( ts, uMsCompIdx, fuMsIndex ) )
443  } // for( fuMsIndex = 0; fuMsIndex < uNbMsLoop; fuMsIndex ++ )
444  } // for( UInt_t uMsCompIdx = 0; uMsCompIdx < fvMsComponentsList.size(); ++uMsCompIdx )
445 
448  fvEventsBuffer.clear();
449 
451  if (kFALSE == BuildEvents()) {
452  LOG(error) << "Failed to build events in ts " << fulCurrentTsIndex;
453  return kFALSE;
454  } // if( kFALSE == BuildEvents() )
455 
457  for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
458  fvvmEpSupprBuffer[uGdpb].clear();
459  fvvBufferMajorAsicErrors[uGdpb].clear();
460  fvvBufferMessages[uGdpb].clear();
461  fvvBufferTriggers[uGdpb].clear();
462 
463  fvbGdpbLastMissmatchPattern[uGdpb] = 0;
464  fvbGdpbLastEnablePattern[uGdpb] = 0;
465  fvbGdpbLastResyncPattern[uGdpb] = 0;
466  fvSectorStatusPattern[uGdpb].clear();
467  } // for (Int_t iGdpb = 0; iGdpb < fuNrOfGdpbs; ++iGdpb)
468 
470  if (fbMonitorMode) {
471  if (kFALSE == FillHistograms()) {
472  LOG(error) << "Failed to fill histos in ts " << fulCurrentTsIndex;
473  return kFALSE;
474  } // if( kFALSE == FillHistograms() )
475  } // if( fbMonitorMode )
476 
477  return kTRUE;
478 }
479 
480 static Int_t iWarn = 0;
481 static Int_t iWarnMess = 0;
482 
483 Bool_t CbmStar2019EventBuilderEtofAlgo::ProcessMs(const fles::Timeslice& ts,
484  size_t uMsCompIdx,
485  size_t uMsIdx) {
486  UInt_t uMsComp = fvMsComponentsList[uMsCompIdx];
487  auto msDescriptor = ts.descriptor(uMsComp, uMsIdx);
488 
490  fuCurrentMs = uMsIdx;
491  fiEquipmentId = msDescriptor.eq_id;
492  fdMsTime = static_cast<double>(msDescriptor.idx);
493  uint32_t size = msDescriptor.size;
494  // fulLastMsIdx = msDescriptor.idx;
495  if (size > 0)
496  LOG(debug) << "Microslice: " << msDescriptor.idx << " has size: " << size;
497 
499  const uint8_t* msContent =
500  reinterpret_cast<const uint8_t*>(ts.content(uMsComp, uMsIdx));
501 
502  /*
503  if( fdStartTimeMsSz < 0 )
504  fdStartTimeMsSz = (1e-9) * fdMsTime;
505 
506  fvhMsSzPerLink[ uMsComp ]->Fill(size);
507  if( 2 * fuHistoryHistoSize < (1e-9) * fdMsTime - fdStartTimeMsSz )
508  {
509  // Reset the evolution Histogram and the start time when we reach the end of the range
510  fvhMsSzTimePerLink[ uMsComp ]->Reset();
511  fdStartTimeMsSz = (1e-9) * fdMsTime;
512  } // if( 2 * fuHistoryHistoSize < (1e-9) * fdMsTime - fdStartTimeMsSz )
513  fvhMsSzTimePerLink[ uMsComp ]->Fill((1e-9) * fdMsTime - fdStartTimeMsSz, size);
514 */
515 
517  if (0 != (size % fUnpackPar->GetNbByteMessage()))
518  LOG(error) << "The input microslice buffer does NOT "
519  << "contain only complete nDPB messages!";
520 
522  uint32_t uNbMessages = (size - (size % fUnpackPar->GetNbByteMessage()))
524 
527 
529  auto it = fGdpbIdIndexMap.find(fuGdpbId);
530  if (it == fGdpbIdIndexMap.end()) {
531  iWarn++;
532  LOG(warning) << "Could not find the gDPB index for AFCK id 0x" << std::hex
533  << fuGdpbId << std::dec << " in microslice " << fdMsTime
534  << "\n"
535  << "If valid this index has to be added in the TOF parameter "
536  "file in the RocIdArray field";
537  if (iWarn == 100) LOG(fatal) << "Got max number of Warnings!";
538  return kFALSE;
539  } // if( it == fGdpbIdIndexMap.end() )
540  else
542 
550  } // if( 0 < fuNbOverMsPerTs && fuNbCoreMsPerTs == fuCurrentMs )
551 
553  if (0 < fuNbOverMsPerTs && 0 == fuCurrentMs) {
559  } // if( 0 < fuNbOverMsPerTs && 0 == fuCurrentMs )
560 
561  // Prepare variables for the loop on contents
562  Int_t messageType = -111;
563  const uint64_t* pInBuff = reinterpret_cast<const uint64_t*>(msContent);
564  for (uint32_t uIdx = 0; uIdx < uNbMessages; uIdx++) {
567  && kTRUE == fbTriggerAfterCandWinFound)
568  break;
569 
570  // Fill message
571  uint64_t ulData = static_cast<uint64_t>(pInBuff[uIdx]);
572 
574  if (0 == uIdx) {
575  // std::cout << Form( "gDPB %2d", fuGdpbNr) << " Epoch cycle " << Form( "0x%012lx", ulData ) << std::endl;
576  ProcessEpochCycle(ulData);
577  continue;
578  } // if( 0 == uIdx )
579 
580  gdpbv100::Message mess(ulData);
582  messageType = mess.getMessageType();
584  && 255 > mess.getGdpbGenChipId()) { //FIXME
585  if (iWarnMess < 100)
586  LOG(warn) << iWarnMess << ": Invalid ChipID " << mess.getGdpbGenChipId()
587  << " in messageType " << messageType;
588  iWarnMess++;
589  continue;
590  }
591 
594  /*
595  if( 5916 == fulCurrentTsIndex && gdpbv100::MSG_STAR_TRI_A <= messageType)
596  mess.printDataCout();
597 */
598  /*
599  if( gdpbv100::MSG_STAR_TRI_A <= messageType )
600  mess.printDataCout();
601  continue;
602 */
603 
604  if (fuNrOfGet4PerGdpb <= fuGet4Id && !mess.isStarTrigger()
606  LOG(warning) << "Message with Get4 ID too high: " << fuGet4Id << " VS "
607  << fuNrOfGet4PerGdpb << " set in parameters.";
608 
609  switch (messageType) {
610  case gdpbv100::MSG_HIT: {
611  if (mess.getGdpbHitIs24b()) {
612  LOG(error)
613  << "This event builder does not support 24b hit message!!!.";
614  continue;
615  } // if( getGdpbHitIs24b() )
616  else {
617  fvvmEpSupprBuffer[fuGdpbNr].push_back(mess);
618  } // else of if( getGdpbHitIs24b() )
619  break;
620  } // case gdpbv100::MSG_HIT:
621  case gdpbv100::MSG_EPOCH: {
623  ProcessEpoch(mess);
624  /*
625  if( kTRUE == fbPrintAllEpochsEnable )
626  {
627  LOG(info) << "Epoch: " << Form("0x%08x ", fuGdpbId)
628  << ", Merg"
629  << ", Link " << std::setw(1) << mess.getGdpbEpLinkId()
630  << ", epoch " << std::setw(8) << mess.getGdpbEpEpochNb()
631  << ", Sync " << std::setw(1) << mess.getGdpbEpSync()
632  << ", Data loss " << std::setw(1) << mess.getGdpbEpDataLoss()
633  << ", Epoch loss " << std::setw(1) << mess.getGdpbEpEpochLoss()
634  << ", Epoch miss " << std::setw(1) << mess.getGdpbEpMissmatch();
635  } // if( kTRUE == fbPrintAllEpochsEnable )
636 */
637  } // if this epoch message is a merged one valid for all chips
638  else {
640  LOG(debug2) << "This event builder does not support unmerged epoch "
641  "messages!!!.";
642  continue;
643  } // if single chip epoch message
644  break;
645  } // case gdpbv100::MSG_EPOCH:
646  case gdpbv100::MSG_SLOWC: {
647  fvvmEpSupprBuffer[fuGdpbNr].push_back(mess);
648  break;
649  } // case gdpbv100::MSG_SLOWC:
650  case gdpbv100::MSG_SYST: {
651  fvvmEpSupprBuffer[fuGdpbNr].push_back(mess);
652  break;
653  } // case gdpbv100::MSG_SYST:
658  ProcessStarTrigger(mess);
659 
662  /*
663  if( gdpbv100::MSG_STAR_TRI_A == messageType )
664  {
665  } // if( gdpbv100::MSG_STAR_TRI_A == messageType )
666 */
667  break;
668  } // case gdpbv100::MSG_STAR_TRI_A-D
669  default:
670  LOG(error) << "Message type " << std::hex << std::setw(2)
671  << static_cast<uint16_t>(messageType)
672  << " not included in Get4 unpacker.";
673  } // switch( mess.getMessageType() )
674  } // for (uint32_t uIdx = 0; uIdx < uNbMessages; uIdx ++)
675 
676  return kTRUE;
677 }
678 
679 // -------------------------------------------------------------------------
681  ULong64_t ulEpochCycleVal = ulCycleData & gdpbv100::kulEpochCycleFieldSz;
682  /*
683  if( fuRawDataPrintMsgIdx < fuRawDataPrintMsgNb || gLogger->IsLogNeeded( fair::Severity::debug2 ) )
684  {
685  LOG(info) << "CbmMcbm2018MonitorTof::ProcessEpochCyle => "
686  << Form( " TS %5d MS %3d In data 0x%016X Cycle 0x%016X",
687  fulCurrentTsIndex, fuCurrentMs, ulCycleData, ulEpochCycleVal );
688  fuRawDataPrintMsgIdx ++;
689  } // if( fuRawDataPrintMsgIdx < fuRawDataPrintMsgNb || gLogger->IsLogNeeded( fair::Severity::debug2 ) )
690 */
691  if (!(ulEpochCycleVal == fvulCurrentEpochCycle[fuGdpbNr]
692  || ulEpochCycleVal == fvulCurrentEpochCycle[fuGdpbNr] + 1)) {
693  LOG(warning) << "CbmStar2019EventBuilderEtofAlgo::ProcessEpochCycle => "
694  << " Missmatch in epoch cycles detected for Gdpb " << fuGdpbNr
695  << ", probably fake cycles due to epoch index corruption! "
696  << Form(" Current cycle 0x%09llX New cycle 0x%09llX",
698  ulEpochCycleVal);
699  }
700  if (ulEpochCycleVal != fvulCurrentEpochCycle[fuGdpbNr]) {
701  LOG(info) << "CbmStar2019EventBuilderEtofAlgo::ProcessEpochCycle => "
702  << " New epoch cycle for Gdpb " << fuGdpbNr
703  << Form(": Current cycle 0x%09llX New cycle 0x%09llX",
705  ulEpochCycleVal);
706  } // if( ulEpochCycleVal != fvulCurrentEpochCycle[fuGdpbNr] )
707  fvulCurrentEpochCycle[fuGdpbNr] = ulEpochCycleVal;
708 
709  return;
710 }
711 
713  ULong64_t ulEpochNr = mess.getGdpbEpEpochNb();
714  /*
715  * /// FIXME: Need proper handling of overlap MS
716  if( 0 < fvulCurrentEpoch[ fuGdpbNr ] && ulEpochNr < fvulCurrentEpoch[ fuGdpbNr ] )
717  {
718  std::cout << Form( "gDPB %2d", fuGdpbNr) << " New Epoch cycle "
719  << Form( "0x%012llx old Ep %08llx new Ep %08llx", fvulCurrentEpochCycle[ fuGdpbNr ], fvulCurrentEpoch[ fuGdpbNr ], ulEpochNr )
720  << std::endl;
721  fvulCurrentEpochCycle[ fuGdpbNr ]++;
722  } // if( 0 < fvulCurrentEpoch[ fuGdpbNr ] && ulEpochNr < fvulCurrentEpoch[ fuGdpbNr ] )
723 */
724  fvulCurrentEpoch[fuGdpbNr] = ulEpochNr;
726  ulEpochNr
728 
729  // fulCurrentEpochTime = mess.getMsgFullTime(ulEpochNr);
730 
733  if (0 < ulEpochNr)
734  mess.setGdpbEpEpochNb(ulEpochNr - 1);
735  else
737 
740 
745  fbEpochAfterCandWinFound = kTRUE;
746  } // if( fuNbCoreMsPerTs <= fuCurrentMs && fvdMessCandidateTimeStop[ fuGdpbNr ] < fvulCurrentEpochFull[ fuGdpbNr ] * gdpbv100::kdEpochInNs )
747 }
748 
750  gdpbv100::Message mess) {
751  Int_t iMsgIndex = mess.getStarTrigMsgIndex();
752 
753  switch (iMsgIndex) {
754  case 0: {
756 
759  fhRawTriggersStats->Fill(
764  else
767 
768  if (kTRUE == fbTriggerFoundA)
769  LOG(info) << Form(
770  "Problem: Overwritting a A trigger in TS %12llu MS %3u Core? %u",
772  fuMsIndex,
774  << Form(" (%u %u %u)",
778  } // if( fbMonitorMode && fbDebugMonitorMode )
779  fbTriggerFoundA = kTRUE;
780 
781  break;
782  } // 1st trigger message
783  case 1: {
786 
789  fhRawTriggersStats->Fill(
794  else
797 
798  if (kFALSE == fbTriggerFoundA)
799  LOG(info) << Form(
800  "Problem: Found B trigger before A in TS %12llu MS %3u",
802  fuMsIndex);
803 
804  if (kTRUE == fbTriggerFoundB)
805  LOG(info) << Form(
806  "Problem: Overwritting a B trigger in TS %12llu MS %3u Core? %u",
808  fuMsIndex,
810  << Form(" (%u %u %u)",
814  } // if( fbMonitorMode && fbDebugMonitorMode )
815  fbTriggerFoundB = kTRUE;
816 
817  break;
818  } // 2nd trigger message
819  case 2: {
821 
824  fhRawTriggersStats->Fill(
829  else
832 
833  if (kFALSE == fbTriggerFoundB || kFALSE == fbTriggerFoundA)
834  LOG(info) << Form(
835  "Problem: Found C trigger before A or B in TS %12llu MS %3u",
837  fuMsIndex);
838 
839  if (kTRUE == fbTriggerFoundC)
840  LOG(info) << Form(
841  "Problem: Overwritting a C trigger in TS %12llu MS %3u Core? %u",
843  fuMsIndex,
845  << Form(" (%u %u %u)",
849  } // if( fbMonitorMode && fbDebugMonitorMode )
850  fbTriggerFoundC = kTRUE;
851 
852  break;
853  } // 3rd trigger message
854  case 3: {
855  ULong64_t ulNewGdpbTsFull =
857  ULong64_t ulNewStarTsFull = (fvulStarTsMsb[fuGdpbNr] << 48)
858  + (fvulStarTsMid[fuGdpbNr] << 8)
859  + mess.getStarTsLsbStarD();
860  UInt_t uNewToken = mess.getStarTokenStarD();
861  UInt_t uNewDaqCmd = mess.getStarDaqCmdStarD();
862  UInt_t uNewTrigCmd = mess.getStarTrigCmdStarD();
863 
867  if (kFALSE == fbTriggerFoundC || kFALSE == fbTriggerFoundB
868  || kFALSE == fbTriggerFoundA) {
870  LOG(info) << Form("Problem: Found D trigger before A or B or C in TS "
871  "%12llu MS %3u Core? %u",
873  fuMsIndex,
875  << Form(" (%u %u %u) token %5u",
879  uNewToken);
880 
882  fbTriggerFoundA = kFALSE;
883  fbTriggerFoundB = kFALSE;
884  fbTriggerFoundC = kFALSE;
885 
887  if (0 == fuCurrentMs) return;
888  } // if( kFALSE == fbTriggerFoundC || kFALSE == fbTriggerFoundB || kFALSE == fbTriggerFoundA )
889 
891  fbTriggerFoundA = kFALSE;
892  fbTriggerFoundB = kFALSE;
893  fbTriggerFoundC = kFALSE;
894 
896  fhRawTriggersStats->Fill(
901  else
904  } // if( fbMonitorMode && fbDebugMonitorMode )
905 
906  /*
907  UInt_t uNewTrigWord = ( (uNewTrigCmd & 0x00F) << 16 )
908  + ( (uNewDaqCmd & 0x00F) << 12 )
909  + ( (uNewToken & 0xFFF) );
910  LOG(info) << "New STAR trigger "
911  << " TS " << fulCurrentTsIndex
912  << " gDBB #" << fuGdpbNr << " "
913  << Form("token = %5u ", uNewToken )
914  << Form("gDPB ts = %12llu ", ulNewGdpbTsFull )
915  << Form("STAR ts = %12llu ", ulNewStarTsFull )
916  << Form("DAQ cmd = %2u ", uNewDaqCmd )
917  << Form("TRG cmd = %2u ", uNewTrigCmd )
918  << Form("TRG Wrd = %5x ", uNewTrigWord );
919 */
920 
921  if ((uNewToken == fvuStarTokenLast[fuGdpbNr])
922  && (ulNewGdpbTsFull == fvulGdpbTsFullLast[fuGdpbNr])
923  && (ulNewStarTsFull == fvulStarTsFullLast[fuGdpbNr])
924  && (uNewDaqCmd == fvuStarDaqCmdLast[fuGdpbNr])
925  && (uNewTrigCmd == fvuStarTrigCmdLast[fuGdpbNr])) {
926  UInt_t uTrigWord = ((fvuStarTrigCmdLast[fuGdpbNr] & 0x00F) << 16)
927  + ((fvuStarDaqCmdLast[fuGdpbNr] & 0x00F) << 12)
928  + ((fvuStarTokenLast[fuGdpbNr] & 0xFFF));
929  LOG(warning) << "Possible error: identical STAR tokens found twice in "
930  "a row => ignore 2nd! "
931  << " TS " << fulCurrentTsIndex << " gDBB #" << fuGdpbNr
932  << " " << Form("token = %5u ", fvuStarTokenLast[fuGdpbNr])
933  << Form("gDPB ts = %12llu ", fvulGdpbTsFullLast[fuGdpbNr])
934  << Form("STAR ts = %12llu ", fvulStarTsFullLast[fuGdpbNr])
935  << Form("DAQ cmd = %2u ", fvuStarDaqCmdLast[fuGdpbNr])
936  << Form("TRG cmd = %2u ", fvuStarTrigCmdLast[fuGdpbNr])
937  << Form("TRG Wrd = %5x ", uTrigWord);
938  return;
939  } // if exactly same message repeated
940 
941  // GDPB TS counter reset detection
942  if (ulNewGdpbTsFull < fvulGdpbTsFullLast[fuGdpbNr])
943  LOG(debug) << "Probable reset of the GDPB TS: old = "
944  << Form("%16llu", fvulGdpbTsFullLast[fuGdpbNr])
945  << " new = " << Form("%16llu", ulNewGdpbTsFull)
946  << " Diff = -"
947  << Form("%8llu",
948  fvulGdpbTsFullLast[fuGdpbNr] - ulNewGdpbTsFull)
949  << " GDPB #" << Form("%2u", fuGdpbNr);
950 
951  // STAR TS counter reset detection
952  if (ulNewStarTsFull < fvulStarTsFullLast[fuGdpbNr])
953  LOG(debug) << "Probable reset of the STAR TS: old = "
954  << Form("%16llu", fvulStarTsFullLast[fuGdpbNr])
955  << " new = " << Form("%16llu", ulNewStarTsFull)
956  << " Diff = -"
957  << Form("%8llu",
958  fvulStarTsFullLast[fuGdpbNr] - ulNewStarTsFull)
959  << " GDPB #" << Form("%2u", fuGdpbNr);
960 
961  /*
962  LOG(info) << "Updating trigger token for " << fuGdpbNr
963  << " " << fvuStarTokenLast[fuGdpbNr] << " " << uNewToken;
964 */
965 
967  CbmTofStarTrigger2019 newTrig(ulNewGdpbTsFull,
968  ulNewStarTsFull,
969  uNewToken,
970  uNewDaqCmd,
971  uNewTrigCmd,
972  fuGdpbId);
973  Double_t dTriggerTime =
975  if (fvdTrigCandidateTimeStart[fuGdpbNr] < dTriggerTime
976  && dTriggerTime < fvdTrigCandidateTimeStop[fuGdpbNr]) {
977  fvvBufferTriggers[fuGdpbNr].push_back(newTrig);
978 
980  fhRawTriggersStatsSel->Fill(
983  fhRawTriggersStatsSel->Fill(
985  else
986  fhRawTriggersStatsSel->Fill(
988  } // if( fbMonitorMode && fbDebugMonitorMode )
989  } // if( fvdTrigCandidateTimeStart[ fuGdpbNr ] < dTriggerTime && dTriggerTime < fvdTrigCandidateTimeStop[ fuGdpbNr ] )
990  else if (fuNbCoreMsPerTs <= fuCurrentMs
991  && fvdTrigCandidateTimeStop[fuGdpbNr] < dTriggerTime) {
994  } // else if( fuNbCoreMsPerTs <= fuCurrentMs && fvdTrigCandidateTimeStop[ fuGdpbNr ] < dTriggerTime )
995 
996  // if( fuCurrentMs < fuNbCoreMsPerTs )
997  {
998  // ULong64_t ulGdpbTsDiff = ulNewGdpbTsFull - fvulGdpbTsFullLast[fuGdpbNr];
999  fvulGdpbTsFullLast[fuGdpbNr] = ulNewGdpbTsFull;
1000  fvulStarTsFullLast[fuGdpbNr] = ulNewStarTsFull;
1001  fvuStarTokenLast[fuGdpbNr] = uNewToken;
1002  fvuStarDaqCmdLast[fuGdpbNr] = uNewDaqCmd;
1003  fvuStarTrigCmdLast[fuGdpbNr] = uNewTrigCmd;
1004  }
1008  fhRawTriggersStats->Fill(
1011  fhRawTriggersStatsCore->Fill(
1013  else
1014  fhRawTriggersStatsOver->Fill(
1017  (dTriggerTime - fdTsStartTime) / 1000.0);
1018  fvhTriggerDistributionInMs[fuGdpbNr]->Fill((dTriggerTime - fdMsTime)
1019  / 1000.0);
1020 
1021  if ((dTriggerTime - fdMsTime) / 1000.0 < -1000) {
1022  LOG(info) << Form("Trigger in wrong MS TS %6llu", fulCurrentTsIndex)
1023  << Form(" MS %3u ", fuMsIndex)
1024  << Form(" Sector %3u ", fuGdpbNr + 13)
1025  << Form(" Ttrig %15.2f", dTriggerTime)
1026  << Form(" Tms %15.2f", fdMsTime)
1027  << Form(" dT %15.5f", ((dTriggerTime - fdMsTime) / 1000.0));
1028  LOG(info) << Form("Full token, gDPB TS LSB bits: 0x%16llx, STAR TS "
1029  "MSB bits: 0x%16llx, token is %4u",
1030  ulNewGdpbTsFull,
1031  ulNewStarTsFull,
1032  uNewToken);
1033  } // if( (dTriggerTime - fdMsTime) / 1000.0 < -1000 )
1034  } // if( fbMonitorMode && fbDebugMonitorMode )
1035 
1036  // LOG(info) << "First full trigger in TS " << fulCurrentTsIndex;
1037 
1038  break;
1039  } // case 3
1040  default: LOG(error) << "Unknown Star Trigger messageindex: " << iMsgIndex;
1041  } // switch( iMsgIndex )
1042 }
1043 
1044 // -------------------------------------------------------------------------
1046  uint32_t /*uGdpbNr*/) {
1047  Int_t iBufferSize = fvvmEpSupprBuffer[fuGdpbNr].size();
1048 
1049  if (0 == iBufferSize) return;
1050 
1051  LOG(debug) << "Now processing stored messages for for gDPB " << fuGdpbNr
1052  << " with epoch number " << (fvulCurrentEpoch[fuGdpbNr] - 1);
1053 
1056  std::stable_sort(fvvmEpSupprBuffer[fuGdpbNr].begin(),
1057  fvvmEpSupprBuffer[fuGdpbNr].begin());
1058 
1060  ULong64_t ulCurEpochGdpbGet4 = fvulCurrentEpochFull[fuGdpbNr];
1061 
1063  if (0 == ulCurEpochGdpbGet4) return;
1064 
1066  ulCurEpochGdpbGet4--;
1067 
1068  Int_t messageType = -111;
1069  for (Int_t iMsgIdx = 0; iMsgIdx < iBufferSize; iMsgIdx++) {
1070 
1071  messageType = fvvmEpSupprBuffer[fuGdpbNr][iMsgIdx].getMessageType();
1072 
1074  fvvmEpSupprBuffer[fuGdpbNr][iMsgIdx].getGdpbGenChipId());
1076 
1079  ulCurEpochGdpbGet4);
1080 
1082  switch (messageType) {
1083  case gdpbv100::MSG_HIT: {
1084  // ProcessHit( fullMess, ulCurEpochGdpbGet4 );
1085  StoreMessageInBuffer(fullMess, fuGdpbNr);
1086  break;
1087  } // case gdpbv100::MSG_HIT:
1088  case gdpbv100::MSG_SLOWC: {
1089  // ProcessSlCtrl( fullMess, ulCurEpochGdpbGet4 );
1090  StoreMessageInBuffer(fullMess, fuGdpbNr);
1091  break;
1092  } // case gdpbv100::MSG_SLOWC:
1093  case gdpbv100::MSG_SYST: {
1094  if (gdpbv100::SYS_PATTERN == fullMess.getGdpbSysSubType()) {
1095  if (fbAddStatusToEvent) ProcessPattern(fullMess, ulCurEpochGdpbGet4);
1096  } // if( gdpbv100::SYS_PATTERN == fvvmEpSupprBuffer[ fuGdpbNr ][ iMsgIdx ].getGdpbSysSubType() )
1097  /*
1098  else ProcessSysMess( fullMess, ulCurEpochGdpbGet4 );
1099 */
1100  else
1101  StoreMessageInBuffer(fullMess, fuGdpbNr);
1102 
1103  break;
1104  } // case gdpbv100::MSG_SYST:
1105  case gdpbv100::MSG_EPOCH:
1109  case gdpbv100::MSG_STAR_TRI_D: break;
1110  default:
1111  LOG(error) << "Message type " << std::hex << std::setw(2)
1112  << static_cast<uint16_t>(messageType)
1113  << " not included in Get4 unpacker.";
1114  } // switch( mess.getMessageType() )
1115  } // for( Int_t iMsgIdx = 0; iMsgIdx < iBufferSize; iMsgIdx++ )
1116 
1117  fvvmEpSupprBuffer[fuGdpbNr].clear();
1118 }
1120  gdpbv100::FullMessage fullMess,
1121  uint32_t /*uGdpbNr*/) {
1123  uint16_t usG4ErrorType = fullMess.getGdpbSysErrData();
1124  if (gdpbv100::MSG_SYST == fullMess.getMessageType()
1126  && ((usG4ErrorType < gdpbv100::GET4_V2X_ERR_TOT_OVERWRT
1127  && gdpbv100::GET4_V2X_ERR_LOST_EVT != usG4ErrorType)
1128  || usG4ErrorType > gdpbv100::GET4_V2X_ERR_SEQUENCE_ER)) {
1129  fvvBufferMajorAsicErrors[fuGdpbNr].push_back(fullMess);
1130  return;
1131  } // if GET4 error out of TOT/hit building error range
1132  else if (fbStoreLostEventMsg
1133  && gdpbv100::GET4_V2X_ERR_LOST_EVT == usG4ErrorType) {
1134  fvvBufferMajorAsicErrors[fuGdpbNr].push_back(fullMess);
1135  return;
1136  } // else if( fbStoreLostEventMsg && gdpbv100::GET4_V2X_ERR_LOST_EVT == usG4ErrorType )
1137 
1139  && gdpbv100::MSG_HIT == fullMess.getMessageType())
1141  (fullMess.GetFullTimeNs() - fdMsTime) / 1000.0);
1142  /*
1143  LOG(info) << Form( "Message Full Time ns: %f MS time ns: %f diff: %f Start %f Stop %f",
1144  fullMess.GetFullTimeNs(), fdMsTime, fullMess.GetFullTimeNs() - fdMsTime,
1145  fvdMessCandidateTimeStart[ fuGdpbNr ], fvdMessCandidateTimeStop[ fuGdpbNr ] );
1146  LOG(info) << Form( "Current epoch %llu Current cycle %llu Current Full epoch %llu",
1147  fvulCurrentEpoch[ fuGdpbNr ], fvulCurrentEpochCycle[ fuGdpbNr ], fvulCurrentEpochFull[ fuGdpbNr ] );
1148 */
1152  && fullMess.GetFullTimeNs() < fvdMessCandidateTimeStop[fuGdpbNr]) {
1153  fvvBufferMessages[fuGdpbNr].push_back(fullMess);
1154  } // if in limits
1155 }
1156 
1157 // -------------------------------------------------------------------------
1159  gdpbv100::Message mess,
1160  uint64_t /*ulCurEpochGdpbGet4*/) {
1161  UInt_t uChannel = mess.getGdpbHitChanId();
1162  // UInt_t uTot = mess.getGdpbHit32Tot();
1163 
1164  // In 32b mode the coarse counter is already computed back to 112 FTS bins
1165  // => need to hide its contribution from the Finetime
1166  // => FTS = Fullt TS modulo 112
1167  // UInt_t uFts = mess.getGdpbHitFullTs() % 112;
1168 
1169  // UInt_t uChannelNr = fuGet4Id * fuNrOfChannelsPerGet4 + uChannel;
1170  // UInt_t uChannelNrInFee = (fuGet4Id % fuNrOfGet4PerFee) * fuNrOfChannelsPerGet4 + uChannel;
1171  // UInt_t uFeeNr = (fuGet4Id / fuNrOfGet4PerFee);
1172  // UInt_t uFeeNrInSys = fuGdpbNr * fuNrOfFeePerGdpb + uFeeNr;
1173  // UInt_t uRemappedChannelNr = uFeeNr * fuNrOfChannelsPerFee + fUnpackPar->Get4ChanToPadiChan( uChannelNrInFee );
1174  // UInt_t uGbtxNr = (uFeeNr / fUnpackPar->GetNrOfFeePerGbtx());
1175  // UInt_t uFeeInGbtx = (uFeeNr % fUnpackPar->GetNrOfFeePerGbtx());
1176  // UInt_t uGbtxNrInSys = fuGdpbNr * fUnpackPar->GetNrOfGbtxPerGdpb() + uGbtxNr;
1177 
1178  // ULong_t ulhitTime = mess.getMsgFullTime( ulCurEpochGdpbGet4 );
1179  // Double_t dHitTime = mess.getMsgFullTimeD( ulCurEpochGdpbGet4 );
1180  // Double_t dHitTot = uTot; // in bins
1181 
1182  // UInt_t uFebIdx = (fuGet4Id / fUnpackPar->GetNrOfGet4PerFee());
1183  // UInt_t uFullFebIdx = (fuGdpbNr * fUnpackPar->GetNrOfFeePerGdpb()) + uFebIdx;
1184 
1185  UInt_t uChanInGdpb = fuGet4Id * fuNrOfChannelsPerGet4 + uChannel;
1186  UInt_t uChanInSyst = fuGdpbNr * fuNrOfChannelsPerGdpb + uChanInGdpb;
1187  if (fUnpackPar->GetNumberOfChannels() < uChanInSyst) {
1188  LOG(error) << "Invalid mapping index " << uChanInSyst << " VS "
1189  << fUnpackPar->GetNumberOfChannels() << ", from " << fuGdpbNr
1190  << ", " << fuGet4Id << ", " << uChannel;
1191  return;
1192  } // if( fUnpackPar->GetNumberOfChannels() < uChanUId )
1193 }
1194 
1196  gdpbv100::Message /*mess*/,
1197  uint64_t /*ulCurEpochGdpbGet4*/) {}
1198 
1200  gdpbv100::Message mess,
1201  uint64_t /*ulCurEpochGdpbGet4*/) {
1202  switch (mess.getGdpbSysSubType()) {
1203  case gdpbv100::SYS_GET4_ERROR: {
1204  uint32_t uData = mess.getGdpbSysErrData();
1211  || gdpbv100::GET4_V2X_ERR_LOST_EVT == uData)
1212  LOG(debug) << " +++++++ > gDPB: " << std::hex << std::setw(4)
1213  << fuGdpbId << std::dec << ", Chip = " << std::setw(2)
1214  << mess.getGdpbGenChipId() << ", Chan = " << std::setw(1)
1215  << mess.getGdpbSysErrChanId() << ", Edge = " << std::setw(1)
1216  << mess.getGdpbSysErrEdge() << ", Empt = " << std::setw(1)
1217  << mess.getGdpbSysErrUnused() << ", Data = " << std::hex
1218  << std::setw(2) << uData << std::dec
1219  << " -- GET4 V1 Error Event";
1220  else
1221  LOG(debug) << " +++++++ >gDPB: " << std::hex << std::setw(4) << fuGdpbId
1222  << std::dec << ", Chip = " << std::setw(2)
1223  << mess.getGdpbGenChipId() << ", Chan = " << std::setw(1)
1224  << mess.getGdpbSysErrChanId() << ", Edge = " << std::setw(1)
1225  << mess.getGdpbSysErrEdge() << ", Empt = " << std::setw(1)
1226  << mess.getGdpbSysErrUnused() << ", Data = " << std::hex
1227  << std::setw(2) << uData << std::dec
1228  << " -- GET4 V1 Error Event ";
1229  break;
1230  } // case gdpbv100::SYSMSG_GET4_EVENT
1231  case gdpbv100::SYS_GDPB_UNKWN: {
1232  LOG(debug) << "Unknown GET4 message, data: " << std::hex << std::setw(8)
1233  << mess.getGdpbSysUnkwData() << std::dec
1234  << " Full message: " << std::hex << std::setw(16)
1235  << mess.getData() << std::dec;
1236  break;
1237  } // case gdpbv100::SYS_GDPB_UNKWN:
1239  LOG(debug) << "GET4 synchronization pulse missing";
1240  break;
1241  } // case gdpbv100::SYS_GET4_SYNC_MISS:
1242  case gdpbv100::SYS_PATTERN: {
1243  LOG(debug) << "ASIC pattern for missmatch, disable or resync";
1244  break;
1245  } // case gdpbv100::SYS_PATTERN:
1246  default: {
1247  LOG(debug) << "Crazy system message, subtype "
1248  << mess.getGdpbSysSubType();
1249  break;
1250  } // default
1251 
1252  } // switch( getGdpbSysSubType() )
1253 }
1254 // -------------------------------------------------------------------------
1256  gdpbv100::Message mess,
1257  uint64_t /*ulCurEpochGdpbGet4*/) {
1258  uint16_t usType = mess.getGdpbSysPattType();
1259  uint16_t usIndex = mess.getGdpbSysPattIndex();
1260  uint32_t uPattern = mess.getGdpbSysPattPattern();
1261  // std::bitset< 32 > bPattern( mess.getGdpbSysPattPattern() );
1262  UInt_t uNbBits = (kuNbMsgPerPattern - 1 == usIndex ? 16 : 32);
1263 
1264  switch (usType) {
1265  case gdpbv100::PATT_MISSMATCH: {
1266  // LOG(debug) << Form( "Missmatch pattern message => Type %d, Index %2d, Pattern 0x%08X", usType, usIndex, uPattern );
1267  for (UInt_t uBit = 0; uBit < uNbBits; ++uBit) {
1268  fvbGdpbLastMissmatchPattern[fuGdpbNr][32 * usIndex + uBit] =
1269  (uPattern >> uBit) & 0x1;
1270  // fvbGdpbLastMissmatchPattern[ fuGdpbNr ][ 32 * usIndex + uBit ] = bPattern[ uBit ];
1271  } // for( UInt_t uBit = 0; uBit < uNbBits; ++uBit )
1272  break;
1273  } // case gdpbv100::PATT_MISSMATCH:
1274  case gdpbv100::PATT_ENABLE: {
1275  // LOG(debug2) << Form( "Enable pattern message => Type %d, Index %2d, Pattern 0x%08X", usType, usIndex, uPattern );
1276  for (UInt_t uBit = 0; uBit < uNbBits; ++uBit) {
1277  fvbGdpbLastEnablePattern[fuGdpbNr][32 * usIndex + uBit] =
1278  (uPattern >> uBit) & 0x1;
1279  // fvbGdpbLastEnablePattern[ fuGdpbNr ][ 32 * usIndex + uBit ] = bPattern[ uBit ];
1280  } // for( UInt_t uBit = 0; uBit < uNbBits; ++uBit )
1281  break;
1282  } // case gdpbv100::PATT_ENABLE:
1283  case gdpbv100::PATT_RESYNC: {
1284  // LOG(debug) << Form( "RESYNC pattern message => Type %d, Index %2d, Pattern 0x%08X", usType, usIndex, uPattern );
1285  for (UInt_t uBit = 0; uBit < uNbBits; ++uBit) {
1286  fvbGdpbLastResyncPattern[fuGdpbNr][32 * usIndex + uBit] =
1287  (uPattern >> uBit) & 0x1;
1288  // fvbGdpbLastResyncPattern[ fuGdpbNr ][ 32 * usIndex + uBit ] = bPattern[ uBit ];
1289  } // for( UInt_t uBit = 0; uBit < uNbBits; ++uBit )
1290  break;
1291  } // case gdpbv100::PATT_RESYNC:
1292  default: {
1293  LOG(debug) << "Crazy pattern message, subtype " << usType;
1294  break;
1295  } // default
1296  } // switch( usType )
1297 
1298  if (kuNbMsgPerPattern - 1 == usIndex) UpdateStatusPatternCurrGdpb();
1299 
1300  return;
1301 }
1305  fvSectorStatusPattern[fuGdpbNr].push_back(
1306  std::pair<uint64_t, std::bitset<kuNbAsicPerGdpb>>(
1308 
1310  fvSectorStatusPattern[fuGdpbNr].back().second |=
1312  fvSectorStatusPattern[fuGdpbNr].back().second |=
1314 }
1316  uint16_t uGdpbId,
1317  uint32_t uIndex,
1318  std::pair<uint64_t, std::bitset<kuNbAsicPerGdpb>> statusIn) {
1320  static constexpr std::bitset<kuNbAsicPerGdpb> kbMask32 {0xFFFFFFFF};
1321 
1323  gdpbv100::FullMessage outMess(0, statusIn.first);
1324 
1326  const std::bitset<kuNbAsicPerGdpb> bPatterBlock {
1327  (statusIn.second >> (32 * uIndex)) & kbMask32};
1328 
1330  outMess.setGdpbGenGdpbId(uGdpbId);
1334  outMess.setGdpbSysPattIndex(uIndex);
1335  outMess.setGdpbSysPattPattern(
1336  bPatterBlock.to_ulong()); // Safe as we masked with 32b
1337 
1338  return outMess;
1339 }
1340 // -------------------------------------------------------------------------
1341 
1347  std::vector<std::vector<CbmTofStarTrigger2019>::iterator>
1348  itTrigger;
1349  std::vector<std::vector<gdpbv100::FullMessage>::iterator>
1350  itErrorMessStart;
1351  std::vector<std::vector<gdpbv100::FullMessage>::iterator>
1352  itMessStart;
1353  std::vector<
1354  std::vector<std::pair<uint64_t, std::bitset<kuNbAsicPerGdpb>>>::iterator>
1355  itStatUpdtStart;
1356  for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
1357  itTrigger.push_back(fvvBufferTriggers[uGdpb].begin());
1358  itErrorMessStart.push_back(fvvBufferMajorAsicErrors[uGdpb].begin());
1359  itMessStart.push_back(fvvBufferMessages[uGdpb].begin());
1360  itStatUpdtStart.push_back(fvSectorStatusPattern[uGdpb].begin());
1361  } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1362 
1364  Bool_t bAllSectAllTriggDone = kTRUE;
1365  for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
1367  if (fvvBufferTriggers[uGdpb].end() != itTrigger[uGdpb]) {
1368  bAllSectAllTriggDone = kFALSE;
1369  break;
1370  } // if( fvvBufferTriggers[ uGdpb ].end() != (*itTrigger[ uGdpb ]) )
1371  } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1372 
1376  while (kFALSE == bAllSectAllTriggDone) {
1378  Bool_t bAllSectorsMatch = kTRUE;
1379  UInt_t uFirstStarToken = 0;
1380  UShort_t usFirstStarDaqCmd = 0;
1381  UShort_t usFirstStarTrigCmd = 0;
1382  ULong64_t ulFirstFullGdpbTs = 0;
1383 
1386  if (0 == fvvBufferTriggers[0].size()) {
1387  bAllSectorsMatch = kFALSE;
1388  } // if( 0 == fvvBufferTriggers[ 0 ].size() )
1389  else {
1392  uFirstStarToken = (*itTrigger[0]).GetStarToken();
1393  usFirstStarDaqCmd = (*itTrigger[0]).GetStarDaqCmd();
1394  usFirstStarTrigCmd = (*itTrigger[0]).GetStarTrigCmd();
1395  ulFirstFullGdpbTs = (*itTrigger[0]).GetFullGdpbTs();
1396  for (UInt_t uGdpb = 1; uGdpb < fuNrOfGdpbs; ++uGdpb) {
1397  if (itTrigger[uGdpb] == fvvBufferTriggers[uGdpb].end()
1398  || (*itTrigger[uGdpb]).GetStarToken() != uFirstStarToken
1399  || (*itTrigger[uGdpb]).GetStarDaqCmd() != usFirstStarDaqCmd
1400  || (*itTrigger[uGdpb]).GetStarTrigCmd() != usFirstStarTrigCmd) {
1401  bAllSectorsMatch = kFALSE;
1402  break;
1403  } // If end of buffer or any field differs for any gDPB/sector current trigger, not all matched!
1404  } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1405  } // else of if( 0 == itTrigger[ uGdpb ].size() )
1406 
1407  if (kTRUE == bAllSectorsMatch) {
1411  starSubEvent;
1412 
1414  Double_t dMeanTriggerGdpbTs = 0;
1415  Double_t dMeanTriggerStarTs = 0;
1416  for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
1418  dMeanTriggerGdpbTs += (*itTrigger[uGdpb]).GetFullGdpbTs();
1419  dMeanTriggerStarTs += (*itTrigger[uGdpb]).GetFullStarTs();
1420 
1422  Long64_t ilTriggerDt =
1423  static_cast<Long64_t>((*itTrigger[uGdpb]).GetFullGdpbTs())
1424  - static_cast<Long64_t>(ulFirstFullGdpbTs);
1425  fvhTriggerDt[uGdpb]->Fill(ilTriggerDt);
1426  } // if( fbMonitorMode && fbDebugMonitorMode )
1427 
1429  std::vector<gdpbv100::FullMessage> vTrigMess =
1430  (*itTrigger[uGdpb]).GetGdpbMessages();
1431  for (std::vector<gdpbv100::FullMessage>::iterator itMess =
1432  vTrigMess.begin();
1433  itMess != vTrigMess.end();
1434  ++itMess) {
1435  starSubEvent.AddMsg((*itMess));
1436  } // for( std::vector< gdpbv100::FullMessage >::iterator itMess = vTrigMess.begin(); itMess != vTrigMess.end(); ++ itMess )
1437 
1438  if (fbAddStatusToEvent) {
1439  /*
1440  LOG(info) << Form( "Trying to add status to event, status buffer size is %d, first test status time is %llu, trigger time is %llu Evt size is %u",
1441  fvSectorStatusPattern[ uGdpb ].size(),
1442  (*itStatUpdtStart[ uGdpb ]).first * gdpbv100::kuCoarseCounterSize,
1443  (*itTrigger[ uGdpb ]).GetFullGdpbTs(),
1444  starSubEvent.GetMsgBuffSize() );
1445 */
1450  while (fvSectorStatusPattern[uGdpb].end() != itStatUpdtStart[uGdpb]
1451  && ((*itStatUpdtStart[uGdpb]).first)
1453  <= (*itTrigger[uGdpb]).GetFullGdpbTs()) {
1454  ++itStatUpdtStart[uGdpb];
1455  } // while( not at the end of updates vector AND Update time under trigger time )
1457  if (fvSectorStatusPattern[uGdpb].begin() != itStatUpdtStart[uGdpb]) {
1459  --itStatUpdtStart[uGdpb];
1461  uint16_t usGdpbId = fUnpackPar->GetGdpbId(uGdpb);
1462  for (uint32_t uIdx = 0; uIdx < kuNbMsgPerPattern; ++uIdx)
1463  starSubEvent.AddMsg(
1464  CreateStatusMessage(usGdpbId, uIdx, (*itStatUpdtStart[uGdpb])));
1465  /*
1466  LOG(info) << Form( "found status time is %llu, diff to trigger time is %llu Evt size is %u",
1467  ( (*itStatUpdtStart[ uGdpb ]).first ) * gdpbv100::kuCoarseCounterSize,
1468  (*itTrigger[ uGdpb ]).GetFullGdpbTs() - ( (*itStatUpdtStart[ uGdpb ]).first ) * gdpbv100::kuCoarseCounterSize,
1469  starSubEvent.GetMsgBuffSize() );
1470 */
1471  } // if( fvSectorStatusPattern[ uGdpb ].begin() != itStatUpdtStart[ uGdpb ] )
1472  } // if( fbAddStatusToEvent )
1473 
1475  Double_t dWinBeg =
1476  gdpbv100::kdClockCycleSizeNs * (*itTrigger[uGdpb]).GetFullGdpbTs()
1477  + fdStarTriggerDelay[uGdpb];
1478  Double_t dWinEnd =
1479  gdpbv100::kdClockCycleSizeNs * (*itTrigger[uGdpb]).GetFullGdpbTs()
1480  + fdStarTriggerDelay[uGdpb] + fdStarTriggerWinSize[uGdpb];
1481  Double_t dDeadEnd =
1482  gdpbv100::kdClockCycleSizeNs * (*itTrigger[uGdpb]).GetFullGdpbTs()
1483  + fdStarTriggerDeadtime[uGdpb];
1484  Double_t dWinBegErrors = dWinBeg - 2 * gdpbv100::kdEpochInNs;
1485 
1487  UInt_t uNbErrorsInEventGdpb = 0;
1488  while (itErrorMessStart[uGdpb] != fvvBufferMajorAsicErrors[uGdpb].end()
1489  && (*itErrorMessStart[uGdpb]).GetFullTimeNs() < dWinBegErrors) {
1490  ++itErrorMessStart[uGdpb];
1491  } // while( not at buffer end && (*itErrorMessStart[ uGdpb ]).GetFullTimeNs() < dWinBeg - 2 * gdpbv100::kdEpochInNs )
1492  while (itErrorMessStart[uGdpb] != fvvBufferMajorAsicErrors[uGdpb].end()
1493  && (*itErrorMessStart[uGdpb]).GetFullTimeNs() < dWinEnd) {
1495  if (uNbErrorsInEventGdpb < kuMaxNbErrorsPerGdpbPerEvent)
1496  starSubEvent.AddMsg((*itErrorMessStart[uGdpb]));
1497 
1498  ++itErrorMessStart[uGdpb];
1499  ++uNbErrorsInEventGdpb;
1500  } // while( not at buffer end && (*itErrorMessStart[ uGdpb ]).GetFullTimeNs() < dWinEnd )
1501 
1504  std::vector<gdpbv100::FullMessage>::iterator itFirstMessOutOfDeadtime =
1505  itMessStart[uGdpb];
1506  while (itMessStart[uGdpb] != fvvBufferMessages[uGdpb].end()
1507  && ((*itMessStart[uGdpb]).GetFullTimeNs() < dDeadEnd
1508  || (*itMessStart[uGdpb]).GetFullTimeNs() < dWinEnd)) {
1509  Double_t dMessTime = (*itMessStart[uGdpb]).GetFullTimeNs();
1510  /*
1511  if( 5916 == fulCurrentTsIndex )
1512  LOG(info) << Form( "gDPB %2u Match Mess %12f Start %12f Stop %12f dStart %6f dStop %6f",
1513  uGdpb, dMessTime,
1514  dWinBeg, dWinEnd,
1515  dMessTime - dWinBeg, dWinEnd - dMessTime )
1516  << ( dWinBeg < dMessTime && dMessTime < dWinEnd ? " IN" : "" );
1517 */
1518 
1520  if (fbMonitorMode) {
1521  fvhHitsTimeToTriggerRaw[uGdpb]->Fill(
1522  dMessTime
1524  * (*itTrigger[uGdpb]).GetFullGdpbTs());
1525  if (fbDebugMonitorMode
1527  == (*itMessStart[uGdpb]).getMessageType()) {
1528  UInt_t uTot = (*itMessStart[uGdpb]).getGdpbHit32Tot();
1529  Double_t dTimeDiff = dMessTime
1531  * (*itTrigger[uGdpb]).GetFullGdpbTs();
1532  if (fuMinTotPulser < uTot && uTot < fuMaxTotPulser
1533  && TMath::Abs(dTimeDiff) < 20e3)
1534  fvhHitsTimeToTriggerRawPulser[uGdpb]->Fill(dTimeDiff, uTot);
1535  } // if( fbDebugMonitorMode && gdpbv100::MSG_HIT == (*itMessStart[ uGdpb ]).getMessageType() )
1536  } // if( fbMonitorMode )
1537 
1538 
1540  if (dWinBeg < dMessTime && dMessTime < dWinEnd) {
1541  starSubEvent.AddMsg((*itMessStart[uGdpb]));
1543  if (fbMonitorMode) {
1544  fvhHitsTimeToTriggerSel[uGdpb]->Fill(
1545  dMessTime
1547  * (*itTrigger[uGdpb]).GetFullGdpbTs());
1548  if (fbDebugMonitorMode) {
1549  fvhHitsTimeToTriggerSelVsDaq[uGdpb]->Fill(
1550  dMessTime
1552  * (*itTrigger[uGdpb]).GetFullGdpbTs(),
1553  usFirstStarDaqCmd);
1554  fvhHitsTimeToTriggerSelVsTrig[uGdpb]->Fill(
1555  dMessTime
1557  * (*itTrigger[uGdpb]).GetFullGdpbTs(),
1558  usFirstStarTrigCmd);
1559  } // if( fbDebugMonitorMode )
1560  } // if( fbMonitorMode )
1561  } // if( dWinBeg < dMessTime && dMessTime < dWinEnd )
1562 
1564  if (dMessTime < dDeadEnd) ++itFirstMessOutOfDeadtime;
1565 
1566  ++itMessStart[uGdpb];
1567  } // while( not at buffer end && (not out of deadtime || not out of trigg win ) )
1568  itMessStart[uGdpb] = itFirstMessOutOfDeadtime;
1569 
1571  ++itTrigger[uGdpb];
1572  } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1573 
1575  dMeanTriggerGdpbTs /= fuNrOfGdpbs;
1576  dMeanTriggerStarTs /= fuNrOfGdpbs;
1577  CbmTofStarTrigger2019 meanTrigger(
1578  static_cast<ULong64_t>(dMeanTriggerGdpbTs),
1579  static_cast<ULong64_t>(dMeanTriggerStarTs),
1580  uFirstStarToken,
1581  usFirstStarDaqCmd,
1582  usFirstStarTrigCmd);
1583  starSubEvent.SetTrigger(meanTrigger);
1584 
1586  fvEventsBuffer.push_back(starSubEvent);
1587  } // if( kTRUE == bAllSectorsMatch )
1588  else {
1591  std::vector<CbmTofStarTrigger2019>::iterator itEarliestTrigger;
1592  ULong64_t ulEarliestGdpbTs = 0xFFFFFFFFFFFFFFFFUL;
1593  for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
1594  if (itTrigger[uGdpb] != fvvBufferTriggers[uGdpb].end()
1595  && ((*itTrigger[uGdpb]).GetFullGdpbTs() < ulEarliestGdpbTs
1596  || 0xFFFFFFFFFFFFFFFFUL
1597  == (*itTrigger[uGdpb]).GetFullGdpbTs())) {
1598  itEarliestTrigger = itTrigger[uGdpb];
1599  ulEarliestGdpbTs = (*itTrigger[uGdpb]).GetFullGdpbTs();
1600  } // if( not at end of buffer && (*itTrigger[ uGdpb ]).GetFullGdpbTs() < ulEarliestGdpbTs )
1601  } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1602  UInt_t uEarliestStarToken = (*itEarliestTrigger).GetStarToken();
1603  UShort_t usEarliestStarDaqCmd = (*itEarliestTrigger).GetStarDaqCmd();
1604  UShort_t usEarliestStarTrigCmd = (*itEarliestTrigger).GetStarTrigCmd();
1605  ULong64_t ulEarliestFullGdpbTs = (*itEarliestTrigger).GetFullGdpbTs();
1606 
1608  UInt_t uNrOfMatchedGdpbs = 0;
1609  std::vector<Bool_t> vbMatchingTrigger(fuNrOfGdpbs, kFALSE);
1610  Double_t dMeanTriggerGdpbTs = 0;
1611  Double_t dMeanTriggerStarTs = 0;
1612  for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
1613  if (itTrigger[uGdpb] != fvvBufferTriggers[uGdpb].end()
1614  && (*itTrigger[uGdpb]).GetStarToken() == uEarliestStarToken
1615  && (*itTrigger[uGdpb]).GetStarDaqCmd() == usEarliestStarDaqCmd
1616  && (*itTrigger[uGdpb]).GetStarTrigCmd() == usEarliestStarTrigCmd) {
1617  uNrOfMatchedGdpbs++;
1618  vbMatchingTrigger[uGdpb] = kTRUE;
1619 
1621  Long64_t ilTriggerDt =
1622  static_cast<Long64_t>((*itTrigger[uGdpb]).GetFullGdpbTs())
1623  - static_cast<Long64_t>(ulEarliestFullGdpbTs);
1624  fvhTriggerDt[uGdpb]->Fill(ilTriggerDt);
1625  } // if( fbMonitorMode && fbDebugMonitorMode )
1626 
1627  dMeanTriggerGdpbTs += (*itTrigger[uGdpb]).GetFullGdpbTs();
1628  dMeanTriggerStarTs += (*itTrigger[uGdpb]).GetFullStarTs();
1629  } // if matching trigger
1630  } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1631 
1633  dMeanTriggerGdpbTs /= uNrOfMatchedGdpbs;
1634  dMeanTriggerStarTs /= uNrOfMatchedGdpbs;
1635  CbmTofStarTrigger2019 meanTrigger(
1636  static_cast<ULong64_t>(dMeanTriggerGdpbTs),
1637  static_cast<ULong64_t>(dMeanTriggerStarTs),
1638  (*itEarliestTrigger).GetStarToken(),
1639  (*itEarliestTrigger).GetStarDaqCmd(),
1640  (*itEarliestTrigger).GetStarTrigCmd());
1641 
1644  starSubEvent;
1645  starSubEvent.SetTrigger(meanTrigger);
1646  starSubEvent.SetIncompleteEventFlag();
1647 
1649  for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
1653  ULong64_t ulTriggerTime = static_cast<ULong64_t>(dMeanTriggerGdpbTs);
1654  if (kTRUE == vbMatchingTrigger[uGdpb]) {
1656  ulTriggerTime = (*itTrigger[uGdpb]).GetFullGdpbTs();
1657 
1659  std::vector<gdpbv100::FullMessage> vTrigMess =
1660  (*itTrigger[uGdpb]).GetGdpbMessages();
1661  for (std::vector<gdpbv100::FullMessage>::iterator itMess =
1662  vTrigMess.begin();
1663  itMess != vTrigMess.end();
1664  ++itMess) {
1665  starSubEvent.AddMsg((*itMess));
1666  } // for( std::vector< gdpbv100::FullMessage >::iterator itMess = vTrigMess.begin(); itMess != vTrigMess.end(); ++ itMess )
1667  } // if( kTRUE == vbMatchingTrigger[ uGdpb ] )
1668  else if (fbMonitorMode && fbDebugMonitorMode) {
1670  fhMissingTriggersEvolution->Fill(dMeanTriggerGdpbTs / 1e9 / 60.0,
1672  + uGdpb);
1673  } // else if( fbMonitorMode && fbDebugMonitorMode )
1674 
1675  if (fbAddStatusToEvent) {
1680  while (fvSectorStatusPattern[uGdpb].end() != itStatUpdtStart[uGdpb]
1681  && ((*itStatUpdtStart[uGdpb]).first)
1683  <= ulTriggerTime) {
1684  ++itStatUpdtStart[uGdpb];
1685  } // while( not at the end of updates vector AND Update time under trigger time )
1687  if (fvSectorStatusPattern[uGdpb].begin() != itStatUpdtStart[uGdpb]) {
1689  --itStatUpdtStart[uGdpb];
1691  uint16_t usGdpbId = fUnpackPar->GetGdpbId(uGdpb);
1692  for (uint32_t uIdx = 0; uIdx < kuNbMsgPerPattern; ++uIdx)
1693  starSubEvent.AddMsg(
1694  CreateStatusMessage(usGdpbId, uIdx, (*itStatUpdtStart[uGdpb])));
1695  } // if( fvSectorStatusPattern[ uGdpb ].begin() != itStatUpdtStart[ uGdpb ] )
1696  } // if( fbAddStatusToEvent )
1697 
1699  Double_t dWinBeg = gdpbv100::kdClockCycleSizeNs * ulTriggerTime
1700  + fdStarTriggerDelay[uGdpb];
1701  Double_t dWinEnd = gdpbv100::kdClockCycleSizeNs * ulTriggerTime
1702  + fdStarTriggerDelay[uGdpb]
1703  + fdStarTriggerWinSize[uGdpb];
1704  Double_t dDeadEnd = gdpbv100::kdClockCycleSizeNs * ulTriggerTime
1705  + fdStarTriggerDeadtime[uGdpb];
1706  Double_t dWinBegErrors = dWinBeg - 2 * gdpbv100::kdEpochInNs;
1707 
1709  UInt_t uNbErrorsInEventGdpb = 0;
1710  while (itErrorMessStart[uGdpb] != fvvBufferMajorAsicErrors[uGdpb].end()
1711  && (*itErrorMessStart[uGdpb]).GetFullTimeNs() < dWinBegErrors) {
1712  ++itErrorMessStart[uGdpb];
1713  } // while( not at buffer end && (*itErrorMessStart[ uGdpb ]).GetFullTimeNs() < dWinBeg - 2 * gdpbv100::kdEpochInNs )
1714  while (itErrorMessStart[uGdpb] != fvvBufferMajorAsicErrors[uGdpb].end()
1715  && (*itErrorMessStart[uGdpb]).GetFullTimeNs() < dWinEnd) {
1717  if (uNbErrorsInEventGdpb < kuMaxNbErrorsPerGdpbPerEvent)
1718  starSubEvent.AddMsg((*itErrorMessStart[uGdpb]));
1719 
1720  ++itErrorMessStart[uGdpb];
1721  ++uNbErrorsInEventGdpb;
1722  } // while( not at buffer end && (*itErrorMessStart[ uGdpb ]).GetFullTimeNs() < dWinEnd )
1723 
1726  std::vector<gdpbv100::FullMessage>::iterator itFirstMessOutOfDeadtime =
1727  itMessStart[uGdpb];
1728  while (itMessStart[uGdpb] != fvvBufferMessages[uGdpb].end()
1729  && ((*itMessStart[uGdpb]).GetFullTimeNs() < dDeadEnd
1730  || (*itMessStart[uGdpb]).GetFullTimeNs() < dWinEnd)) {
1731  Double_t dMessTime = (*itMessStart[uGdpb]).GetFullTimeNs();
1732  /*
1733  if( 5916 == fulCurrentTsIndex )
1734  LOG(info) << Form( "gDPB %2u Miss Mess %12f Start %12f Stop %12f",
1735  uGdpb, dMessTime,
1736  dWinBeg,
1737  dWinEnd )
1738  << ( dWinBeg < dMessTime && dMessTime < dWinEnd ? " IN" : "" );
1739 */
1741  if (fbMonitorMode) {
1742  fvhHitsTimeToTriggerRaw[uGdpb]->Fill(
1743  dMessTime - gdpbv100::kdClockCycleSizeNs * ulTriggerTime);
1744  if (fbDebugMonitorMode
1746  == (*itMessStart[uGdpb]).getMessageType()) {
1747  UInt_t uTot = (*itMessStart[uGdpb]).getGdpbHit32Tot();
1748  Double_t dTimeDiff =
1749  dMessTime - gdpbv100::kdClockCycleSizeNs * ulTriggerTime;
1750  if (fuMinTotPulser < uTot && uTot < fuMaxTotPulser
1751  && TMath::Abs(dTimeDiff) < 20e3)
1752  fvhHitsTimeToTriggerRawPulser[uGdpb]->Fill(dTimeDiff, uTot);
1753  } // if( fbDebugMonitorMode && gdpbv100::MSG_HIT == (*itMessStart[ uGdpb ]).getMessageType() )
1754  } // if( fbMonitorMode )
1755 
1757  if (dWinBeg < dMessTime && dMessTime < dWinEnd) {
1758  starSubEvent.AddMsg((*itMessStart[uGdpb]));
1760  if (fbMonitorMode) {
1761  fvhHitsTimeToTriggerSel[uGdpb]->Fill(
1762  dMessTime - gdpbv100::kdClockCycleSizeNs * ulTriggerTime);
1763  if (fbDebugMonitorMode) {
1764  fvhHitsTimeToTriggerSelVsDaq[uGdpb]->Fill(
1765  dMessTime - gdpbv100::kdClockCycleSizeNs * ulTriggerTime,
1766  usEarliestStarDaqCmd);
1767  fvhHitsTimeToTriggerSelVsTrig[uGdpb]->Fill(
1768  dMessTime - gdpbv100::kdClockCycleSizeNs * ulTriggerTime,
1769  usEarliestStarTrigCmd);
1770  } // if( fbDebugMonitorMode )
1771  } // if( fbMonitorMode )
1772  } // if( dWinBeg < dMessTime && dMessTime < dWinEnd )
1773 
1775  if (dMessTime < dDeadEnd) ++itFirstMessOutOfDeadtime;
1776 
1777  ++itMessStart[uGdpb];
1778  } // while( not at buffer end && (not out of deadtime || not out of trigg win ) )
1779  itMessStart[uGdpb] = itFirstMessOutOfDeadtime;
1780 
1782  if (kTRUE == vbMatchingTrigger[uGdpb]) ++itTrigger[uGdpb];
1783  } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1784 
1786  fvEventsBuffer.push_back(starSubEvent);
1787  } // else of if( kTRUE == bAllSectorsMatch )
1788 
1790  bAllSectAllTriggDone = kTRUE;
1791  for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
1793  if (fvvBufferTriggers[uGdpb].end() != itTrigger[uGdpb]) {
1794  bAllSectAllTriggDone = kFALSE;
1795  break;
1796  } // if( fvvBufferTriggers[ uGdpb ].end() != (*itTrigger[ uGdpb ]) )
1797  } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1798  } // while( kFALSE == bAllSectAllTriggDone )
1799 
1800  return kTRUE;
1801 }
1802 
1803 // -------------------------------------------------------------------------
1804 
1807  for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
1808  UInt_t uSector = fUnpackPar->GetGdpbToSectorOffset() + uGdpb;
1809  std::string sFolder = Form("sector%2u", uSector);
1810 
1811  LOG(info) << "gDPB " << uGdpb << " is " << sFolder;
1812 
1813  fvhHitsTimeToTriggerRaw.push_back(
1814  new TH1D(Form("hHitsTimeToTriggerRawSect%2u", uSector),
1815  Form("Time to trigger for all neighboring hits in sector %2u; t "
1816  "- Ttrigg [ns]; Hits []",
1817  uSector),
1818  2000,
1819  -5000,
1820  5000));
1821 
1822  UInt_t uNbBinsDtSel = fdStarTriggerWinSize[uGdpb];
1823  Double_t dMaxDtSel =
1824  fdStarTriggerDelay[uGdpb] + fdStarTriggerWinSize[uGdpb];
1825  fvhHitsTimeToTriggerSel.push_back(
1826  new TH1D(Form("hHitsTimeToTriggerSelSect%2u", uSector),
1827  Form("Time to trigger for all selected hits in sector %2u; t - "
1828  "Ttrigg [ns]; Hits []",
1829  uSector),
1830  uNbBinsDtSel,
1831  fdStarTriggerDelay[uGdpb],
1832  dMaxDtSel));
1833 
1835  AddHistoToVector(fvhHitsTimeToTriggerRaw[uGdpb], sFolder);
1836  AddHistoToVector(fvhHitsTimeToTriggerSel[uGdpb], sFolder);
1837 
1838  if (kTRUE == fbDebugMonitorMode) {
1839  fvhHitsTimeToTriggerRawPulser.push_back(new TH2D(
1840  Form("hHitsTimeToTriggerRawPulserSect%2u", uSector),
1841  Form("Time to trigger for all neighboring hits within pulser TOT range "
1842  "in sector %2u; t - Ttrigg [ns]; TOT [bins]; Hits []",
1843  uSector),
1844  2000,
1845  -5000,
1846  5000,
1847  256,
1848  0,
1849  256));
1850 
1851  fvhHitsTimeToTriggerSelVsDaq.push_back(
1852  new TH2D(Form("hHitsTimeToTriggerSelVsDaqSect%2u", uSector),
1853  Form("Time to trigger for all selected hits vs DAQ CMD in "
1854  "sector %2u; t - Ttrigg [ns]; DAQ CMD []; Hits []",
1855  uSector),
1856  uNbBinsDtSel,
1857  fdStarTriggerDelay[uGdpb],
1858  dMaxDtSel,
1859  16,
1860  0.,
1861  16.));
1862 
1864  new TH2D(Form("hHitsTimeToTriggerSelVsTrigSect%2u", uSector),
1865  Form("Time to trigger for all selected hits vs TRIG CMD in "
1866  "sector %2u; t - Ttrigg [ns]; TRIG CMD []; Hits []",
1867  uSector),
1868  uNbBinsDtSel,
1869  fdStarTriggerDelay[uGdpb],
1870  dMaxDtSel,
1871  16,
1872  0.,
1873  16.));
1874 
1875  fvhTriggerDt.push_back(new TH1I(
1876  Form("hTriggerDtSect%2u", uSector),
1877  Form("Trigger time difference between sector %2u and the first sector, "
1878  "full events only; Ttrigg%2u - TtriggRef [Clk]; events []",
1879  uSector,
1880  uSector),
1881  200,
1882  -100,
1883  100));
1884 
1887  UInt_t uNbBinsInTs = fdMsSizeInNs * 111 / 1000. / 10.;
1888  UInt_t uNbBinsInMs = fdMsSizeInNs * 20 / 1000. / 10.;
1889 
1890  fvhTriggerDistributionInTs.push_back(
1891  new TH1I(Form("hTriggerDistInTsSect%2u", uSector),
1892  Form("Trigger distribution inside TS in sector %2u; Time in "
1893  "TS [us]; Trigger [];",
1894  uSector),
1895  uNbBinsInTs,
1896  -0.5 - fdMsSizeInNs * 10 / 1000.,
1897  fdMsSizeInNs * 101 / 1000. - 0.5));
1898 
1899  fvhTriggerDistributionInMs.push_back(
1900  new TH1I(Form("hTriggerDistInMsSect%2u", uSector),
1901  Form("Trigger distribution inside MS in sector %2u; Time in "
1902  "MS [us]; Trigger [];",
1903  uSector),
1904  uNbBinsInMs,
1905  -0.5 - fdMsSizeInNs * 10 / 1000.,
1906  fdMsSizeInNs * 10 / 1000. - 0.5));
1907 
1908  fvhMessDistributionInMs.push_back(
1909  new TH1I(Form("hMessDistInMsSect%2u", uSector),
1910  Form("Messages distribution inside MS in sector %2u; Time in "
1911  "MS [us]; Trigger [];",
1912  uSector),
1913  uNbBinsInMs,
1914  -0.5 - fdMsSizeInNs * 10 / 1000.,
1915  fdMsSizeInNs * 10 / 1000. - 0.5));
1916 
1921  AddHistoToVector(fvhTriggerDt[uGdpb], sFolder);
1924  AddHistoToVector(fvhMessDistributionInMs[uGdpb], sFolder);
1925  } // if( kTRUE == fbDebugMonitorMode )
1926  } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
1927 
1929  fhEventNbPerTs = new TH1I("hEventNbPerTs",
1930  "Number of Events per TS; Events []; TS []",
1931  1000,
1932  0,
1933  1000);
1934 
1936  new TH1I("hEventSizeDistribution",
1937  "Event size distribution; Event size [byte]; Events []",
1939  0,
1941 
1942  fhEventSizeEvolution = new TProfile(
1943  "hEventSizeEvolution",
1944  "Event size evolution; Time in run [min]; mean Event size [byte];",
1945  14400,
1946  0,
1947  14400);
1948 
1950  new TH1I("hEventNbEvolution",
1951  "Event number evolution; Time in run [min]; Events [];",
1952  14400,
1953  0,
1954  14400);
1955 
1957  AddHistoToVector(fhEventNbPerTs, "eventbuilder");
1958  AddHistoToVector(fhEventSizeDistribution, "eventbuilder");
1959  AddHistoToVector(fhEventSizeEvolution, "eventbuilder");
1960  AddHistoToVector(fhEventNbEvolution, "eventbuilder");
1961 
1962  if (kTRUE == fbDebugMonitorMode) {
1965  UInt_t uNbBinsInTs = fdMsSizeInNs * 101 / 1000. / 10.;
1966 
1967  fhEventNbDistributionInTs = new TH1I(
1968  "hEventNbDistributionInTs",
1969  "Event number distribution inside TS; Time in TS [us]; Events [];",
1970  uNbBinsInTs,
1971  -0.5,
1972  fdMsSizeInNs * 101 / 1000. - 0.5);
1973 
1975  new TProfile("hEventSizeDistributionInTs",
1976  "Event size distribution inside TS; Time in TS [us]; mean "
1977  "Event size [Byte];",
1978  uNbBinsInTs,
1979  -0.5,
1980  fdMsSizeInNs * 101 / 1000. - 0.5);
1981 
1983  new TH2I("hRawTriggersStats",
1984  "Raw triggers statistics per sector; ; Sector []; Messages []",
1985  5,
1986  0,
1987  5,
1988  12,
1989  13,
1990  25);
1991  fhRawTriggersStats->GetXaxis()->SetBinLabel(1, "A");
1992  fhRawTriggersStats->GetXaxis()->SetBinLabel(2, "B");
1993  fhRawTriggersStats->GetXaxis()->SetBinLabel(3, "C");
1994  fhRawTriggersStats->GetXaxis()->SetBinLabel(4, "D");
1995  fhRawTriggersStats->GetXaxis()->SetBinLabel(5, "F");
1996 
1997  fhRawTriggersStatsCore = new TH2I(
1998  "hRawTriggersStatsCore",
1999  "Raw triggers in Core MS statistics per sector; ; Sector []; Messages []",
2000  5,
2001  0,
2002  5,
2003  12,
2004  13,
2005  25);
2006  fhRawTriggersStatsCore->GetXaxis()->SetBinLabel(1, "A");
2007  fhRawTriggersStatsCore->GetXaxis()->SetBinLabel(2, "B");
2008  fhRawTriggersStatsCore->GetXaxis()->SetBinLabel(3, "C");
2009  fhRawTriggersStatsCore->GetXaxis()->SetBinLabel(4, "D");
2010  fhRawTriggersStatsCore->GetXaxis()->SetBinLabel(5, "F");
2011 
2012  fhRawTriggersStatsOver = new TH2I("hRawTriggersStatsOver",
2013  "Raw triggers in Overlap MS statistics "
2014  "per sector; ; Sector []; Messages []",
2015  5,
2016  0,
2017  5,
2018  12,
2019  13,
2020  25);
2021  fhRawTriggersStatsOver->GetXaxis()->SetBinLabel(1, "A");
2022  fhRawTriggersStatsOver->GetXaxis()->SetBinLabel(2, "B");
2023  fhRawTriggersStatsOver->GetXaxis()->SetBinLabel(3, "C");
2024  fhRawTriggersStatsOver->GetXaxis()->SetBinLabel(4, "D");
2025  fhRawTriggersStatsOver->GetXaxis()->SetBinLabel(5, "F");
2026 
2027  fhRawTriggersStatsSel = new TH2I(
2028  "hRawTriggersStatsSel",
2029  "Selected triggers statistics per sector; ; Sector []; Messages []",
2030  3,
2031  0,
2032  3,
2033  12,
2034  13,
2035  25);
2036  fhRawTriggersStatsSel->GetXaxis()->SetBinLabel(1, "All");
2037  fhRawTriggersStatsSel->GetXaxis()->SetBinLabel(2, "Core");
2038  fhRawTriggersStatsSel->GetXaxis()->SetBinLabel(3, "Over");
2039 
2041  new TH2I("hMissingTriggersEvolution",
2042  "Missing trigger counts per sector vs time in run; Time in run "
2043  "[min]; Sector []; Missing triggers []",
2044  14400,
2045  0,
2046  14400,
2047  12,
2048  13,
2049  25);
2050 
2054  AddHistoToVector(fhRawTriggersStats, "eventbuilder");
2055  AddHistoToVector(fhRawTriggersStatsCore, "eventbuilder");
2056  AddHistoToVector(fhRawTriggersStatsOver, "eventbuilder");
2057  AddHistoToVector(fhRawTriggersStatsSel, "eventbuilder");
2059  } // if( kTRUE == fbDebugMonitorMode )
2060 
2062  Double_t w = 10;
2063  Double_t h = 10;
2064 
2066  fcTimeToTrigRaw =
2067  new TCanvas("cTimeToTrigRaw", "Raw Time to trig for all sectors", w, h);
2068  fcTimeToTrigRaw->Divide(2, fuNrOfGdpbs / 2);
2069  for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
2070  fcTimeToTrigRaw->cd(1 + uGdpb);
2071  gPad->SetGridx();
2072  gPad->SetGridy();
2073  gPad->SetLogy();
2074  fvhHitsTimeToTriggerRaw[uGdpb]->Draw();
2075  } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
2076  AddCanvasToVector(fcTimeToTrigRaw, "canvases");
2077 
2079  fcTimeToTrigSel = new TCanvas(
2080  "cTimeToTrigSel", "Selected Time to trig for all sectors", w, h);
2081  fcTimeToTrigSel->Divide(2, fuNrOfGdpbs / 2);
2082  for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
2083  fcTimeToTrigSel->cd(1 + uGdpb);
2084  gPad->SetGridx();
2085  gPad->SetGridy();
2086  gPad->SetLogy();
2087  fvhHitsTimeToTriggerSel[uGdpb]->Draw();
2088  } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
2089  AddCanvasToVector(fcTimeToTrigSel, "canvases");
2090 
2091  if (kTRUE == fbDebugMonitorMode) {
2093  fcTrigDistMs = new TCanvas(
2094  "cTrigDistMs", "Trigger time to MS start for all sectors", w, h);
2095  fcTrigDistMs->Divide(2, fuNrOfGdpbs / 2);
2096  for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
2097  fcTrigDistMs->cd(1 + uGdpb);
2098  gPad->SetGridx();
2099  gPad->SetGridy();
2100  gPad->SetLogy();
2101  fvhTriggerDistributionInMs[uGdpb]->Draw();
2102  } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
2103  AddCanvasToVector(fcTrigDistMs, "canvases");
2104 
2106  fcMessDistMs = new TCanvas(
2107  "cMessDistMs", "Message time to MS start for all sectors", w, h);
2108  fcMessDistMs->Divide(2, fuNrOfGdpbs / 2);
2109  for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
2110  fcMessDistMs->cd(1 + uGdpb);
2111  gPad->SetGridx();
2112  gPad->SetGridy();
2113  gPad->SetLogy();
2114  fvhMessDistributionInMs[uGdpb]->Draw();
2115  } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
2116  AddCanvasToVector(fcMessDistMs, "canvases");
2117 
2118  fcTriggerStats =
2119  new TCanvas("cTriggerStats", "Trigger statistics per sector", w, h);
2120  fcTriggerStats->Divide(2, 2);
2121 
2122  fcTriggerStats->cd(1);
2123  gPad->SetGridx();
2124  gPad->SetGridy();
2125  gPad->SetLogz();
2126  fhRawTriggersStats->Draw("colz text");
2127 
2128  fcTriggerStats->cd(2);
2129  gPad->SetGridx();
2130  gPad->SetGridy();
2131  gPad->SetLogz();
2132  fhRawTriggersStatsCore->Draw("colz text");
2133 
2134  fcTriggerStats->cd(3);
2135  gPad->SetGridx();
2136  gPad->SetGridy();
2137  gPad->SetLogz();
2138  fhRawTriggersStatsOver->Draw("colz text");
2139 
2140  fcTriggerStats->cd(4);
2141  gPad->SetGridx();
2142  gPad->SetGridy();
2143  gPad->SetLogz();
2144  fhRawTriggersStatsSel->Draw("colz text");
2145 
2146  AddCanvasToVector(fcTriggerStats, "canvases");
2147  } // if( kTRUE == fbDebugMonitorMode )
2148 
2151  new TCanvas("cEvtBuildStats", "Event building statistics", w, h);
2152  if (kTRUE == fbDebugMonitorMode)
2153  fcEventBuildStats->Divide(2, 3);
2154  else
2155  fcEventBuildStats->Divide(2, 2);
2156 
2157  fcEventBuildStats->cd(1);
2158  gPad->SetGridx();
2159  gPad->SetGridy();
2160  gPad->SetLogy();
2161  fhEventNbPerTs->Draw();
2162 
2163  fcEventBuildStats->cd(2);
2164  gPad->SetGridx();
2165  gPad->SetGridy();
2166  gPad->SetLogy();
2167  fhEventSizeDistribution->Draw();
2168 
2169  fcEventBuildStats->cd(3);
2170  gPad->SetGridx();
2171  gPad->SetGridy();
2172  gPad->SetLogy();
2173  fhEventSizeEvolution->Draw();
2174 
2175  fcEventBuildStats->cd(4);
2176  gPad->SetGridx();
2177  gPad->SetGridy();
2178  gPad->SetLogy();
2179  fhEventNbEvolution->Draw();
2180 
2181  if (kTRUE == fbDebugMonitorMode) {
2182  fcEventBuildStats->cd(5);
2183  gPad->SetGridx();
2184  gPad->SetGridy();
2185  gPad->SetLogy();
2186  fhEventNbDistributionInTs->Draw();
2187 
2188  fcEventBuildStats->cd(6);
2189  gPad->SetGridx();
2190  gPad->SetGridy();
2191  gPad->SetLogy();
2193  } // if( kTRUE == fbDebugMonitorMode )
2194 
2195  AddCanvasToVector(fcEventBuildStats, "canvases");
2196 
2197  return kTRUE;
2198 }
2200  UInt_t uNbEvents = fvEventsBuffer.size();
2201  fhEventNbPerTs->Fill(uNbEvents);
2202 
2203  for (UInt_t uEvent = 0; uEvent < uNbEvents; ++uEvent) {
2204  UInt_t uEventSize = fvEventsBuffer[uEvent].GetEventSize();
2205  Double_t dEventTimeSec = fvEventsBuffer[uEvent].GetEventTimeSec();
2206  Double_t dEventTimeMin = dEventTimeSec / 60.0;
2207 
2208  fhEventSizeDistribution->Fill(uEventSize);
2209  if (fbDebugMonitorMode)
2210  fhEventSizeEvolution->Fill(dEventTimeSec, uEventSize);
2211  else
2212  fhEventSizeEvolution->Fill(dEventTimeMin, uEventSize);
2213  if (fbDebugMonitorMode)
2214  fhEventNbEvolution->Fill(dEventTimeSec);
2215  else
2216  fhEventNbEvolution->Fill(dEventTimeMin);
2217 
2218  if (kTRUE == fbDebugMonitorMode) {
2219  Double_t dEventTimeInTs =
2220  (fvEventsBuffer[uEvent].GetTrigger().GetFullGdpbTs()
2222  - fdTsStartTime)
2223  / 1000.0;
2224 
2225  fhEventNbDistributionInTs->Fill(dEventTimeInTs);
2226  fhEventSizeDistributionInTs->Fill(dEventTimeInTs, uEventSize);
2227  } // if( kTRUE == fbDebugMonitorMode )
2228  } // for( UInt_t uEvent = 0; uEvent < uNbEvents; ++uEvent )
2229 
2230  return kTRUE;
2231 }
2233  for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
2234  fvhHitsTimeToTriggerRaw[uGdpb]->Reset();
2235  fvhHitsTimeToTriggerSel[uGdpb]->Reset();
2236 
2237  if (kTRUE == fbDebugMonitorMode) {
2238  fvhHitsTimeToTriggerRawPulser[uGdpb]->Reset();
2239  fvhHitsTimeToTriggerSelVsDaq[uGdpb]->Reset();
2240  fvhHitsTimeToTriggerSelVsTrig[uGdpb]->Reset();
2241  fvhTriggerDt[uGdpb]->Reset();
2242  fvhTriggerDistributionInTs[uGdpb]->Reset();
2243  fvhTriggerDistributionInMs[uGdpb]->Reset();
2244  fvhMessDistributionInMs[uGdpb]->Reset();
2245  } // if( kTRUE == fbDebugMonitorMode )
2246  } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb )
2247 
2249  fhEventNbPerTs->Reset();
2250  fhEventSizeDistribution->Reset();
2251  fhEventSizeEvolution->Reset();
2252  fhEventNbEvolution->Reset();
2253 
2254  if (kTRUE == fbDebugMonitorMode) {
2255  fhEventNbDistributionInTs->Reset();
2256  fhEventSizeDistributionInTs->Reset();
2257  fhRawTriggersStats->Reset();
2258  fhRawTriggersStatsCore->Reset();
2259  fhRawTriggersStatsOver->Reset();
2260  fhRawTriggersStatsSel->Reset();
2261  fhMissingTriggersEvolution->Reset();
2262  } // if( kTRUE == fbDebugMonitorMode )
2263 
2264  return kTRUE;
2265 }
2266 // -------------------------------------------------------------------------
gdpbv100::Message::getStarTrigCmdStarD
uint32_t getStarTrigCmdStarD() const
Definition: gDpbMessv100.h:278
CbmStar2019EventBuilderEtofAlgo::fvulCurrentEpochCycle
std::vector< ULong64_t > fvulCurrentEpochCycle
Definition: CbmStar2019EventBuilderEtofAlgo.h:146
CbmStar2019TofPar::GetNrOfGet4PerGdpb
static constexpr UInt_t GetNrOfGet4PerGdpb()
Definition: CbmStar2019TofPar.h:59
gdpbv100::MSG_STAR_TRI_A
@ MSG_STAR_TRI_A
Definition: gDpbMessv100.h:63
gdpbv100::Message
Definition: gDpbMessv100.h:133
CbmStar2019EventBuilderEtofAlgo::fuMaxTotPulser
UInt_t fuMaxTotPulser
Definition: CbmStar2019EventBuilderEtofAlgo.h:123
CbmStar2019EventBuilderEtofAlgo::fvulCurrentEpoch
std::vector< ULong64_t > fvulCurrentEpoch
Current time references for each GDPB: merged epoch marker, epoch cycle, full epoch [fuNrOfGdpbs].
Definition: CbmStar2019EventBuilderEtofAlgo.h:144
CbmStar2019TofPar::GetNrOfRpc
Int_t GetNrOfRpc(UInt_t uGbtx)
Definition: CbmStar2019TofPar.cxx:207
CbmStar2019EventBuilderEtofAlgo::fuCurrentMs
size_t fuCurrentMs
Definition: CbmStar2019EventBuilderEtofAlgo.h:131
CbmStar2019EventBuilderEtofAlgo::fcTimeToTrigRaw
TCanvas * fcTimeToTrigRaw
extra monitor for debug
Definition: CbmStar2019EventBuilderEtofAlgo.h:227
CbmStar2019EventBuilderEtofAlgo::fdStarTriggerDeadtime
std::vector< Double_t > fdStarTriggerDeadtime
Definition: CbmStar2019EventBuilderEtofAlgo.h:117
CbmTofStarSubevent2019::SetIncompleteEventFlag
void SetIncompleteEventFlag(Bool_t bFlagState=kTRUE)
Definition: CbmTofStarData2019.h:115
CbmStar2019EventBuilderEtofAlgo::GetParList
TList * GetParList()
Definition: CbmStar2019EventBuilderEtofAlgo.cxx:175
CbmStar2019EventBuilderEtofAlgo::fvulGdpbTsLsb
std::vector< ULong64_t > fvulGdpbTsLsb
[sector]
Definition: CbmStar2019EventBuilderEtofAlgo.h:164
gdpbv100::Message::getGdpbSysErrChanId
uint16_t getGdpbSysErrChanId() const
Definition: gDpbMessv100.h:251
CbmStar2019EventBuilderEtofAlgo::fuNrOfGet4PerFee
UInt_t fuNrOfGet4PerFee
Definition: CbmStar2019EventBuilderEtofAlgo.h:101
CbmStar2019EventBuilderEtofAlgo::fhRawTriggersStats
TH2 * fhRawTriggersStats
extra monitor for debug
Definition: CbmStar2019EventBuilderEtofAlgo.h:222
CbmStar2019EventBuilderEtofAlgo::fbDebugMonitorMode
Bool_t fbDebugMonitorMode
Switch ON the filling of a minimal set of histograms.
Definition: CbmStar2019EventBuilderEtofAlgo.h:85
CbmStar2019EventBuilderEtofAlgo::fvbGdpbLastEnablePattern
std::vector< std::bitset< kuNbAsicPerGdpb > > fvbGdpbLastEnablePattern
[sector][asic] Exclude from dictionnary
Definition: CbmStar2019EventBuilderEtofAlgo.h:192
gdpbv100::Message::setMessageType
void setMessageType(uint8_t v)
Sets the message type field in the current message.
Definition: gDpbMessv100.h:209
gdpbv100::kdClockCycleSizeNs
const double kdClockCycleSizeNs
Definition: gDpbMessv100.h:10
gdpbv100::Message::getGdpbTsMsbStarA
uint64_t getGdpbTsMsbStarA() const
Definition: gDpbMessv100.h:266
gdpbv100::Message::getGdpbEpEpochNb
uint32_t getGdpbEpEpochNb() const
Definition: gDpbMessv100.h:231
CbmStar2019EventBuilderEtofAlgo::fvulCurrentEpochFull
std::vector< ULong64_t > fvulCurrentEpochFull
Epoch cycle from the Ms Start message and Epoch counter flip.
Definition: CbmStar2019EventBuilderEtofAlgo.h:147
CbmStar2019Algo< CbmTofDigi >::fdMsSizeInNs
Double_t fdMsSizeInNs
/‍** Ignore Overlap Ms: all fuOverlapMsNb MS at the end of timeslice **‍/
Definition: CbmStar2019Algo.h:117
CbmStar2019EventBuilderEtofAlgo::fdTsStartTime
Double_t fdTsStartTime
Definition: CbmStar2019EventBuilderEtofAlgo.h:128
CbmStar2019TofPar::GetNumberOfChannels
UInt_t GetNumberOfChannels()
Definition: CbmStar2019TofPar.h:62
gdpbv100::FullMessage::GetFullTimeNs
double GetFullTimeNs() const
Definition: gDpbMessv100.h:395
CbmStar2019EventBuilderEtofAlgo.h
CbmStar2019EventBuilderEtofAlgo::fGdpbIdIndexMap
std::map< UInt_t, UInt_t > fGdpbIdIndexMap
Definition: CbmStar2019EventBuilderEtofAlgo.h:99
CbmStar2019TofPar::GetStarTriggAllowedSpread
Double_t GetStarTriggAllowedSpread()
Definition: CbmStar2019TofPar.h:95
CbmStar2019EventBuilderEtofAlgo::fcMessDistMs
TCanvas * fcMessDistMs
All sectors, extra monitor for debug.
Definition: CbmStar2019EventBuilderEtofAlgo.h:230
gdpbv100::GET4_V2X_ERR_TOT_OVERWRT
@ GET4_V2X_ERR_TOT_OVERWRT
Definition: gDpbMessv100.h:121
CbmStar2019EventBuilderEtofAlgo::ProcessHit
void ProcessHit(gdpbv100::Message mess, uint64_t ulCurEpochGdpbGet4)
Definition: CbmStar2019EventBuilderEtofAlgo.cxx:1158
CbmStar2019TofPar::GetNrOfChannelsPerGet4
static constexpr UInt_t GetNrOfChannelsPerGet4()
Definition: CbmStar2019TofPar.h:45
CbmStar2019EventBuilderEtofAlgo::fhEventSizeDistributionInTs
TProfile * fhEventSizeDistributionInTs
extra monitor for debug
Definition: CbmStar2019EventBuilderEtofAlgo.h:221
CbmStar2019EventBuilderEtofAlgo::ReInitContainers
Bool_t ReInitContainers()
Definition: CbmStar2019EventBuilderEtofAlgo.cxx:163
CbmStar2019Algo< CbmTofDigi >::fuNbMsLoop
size_t fuNbMsLoop
Definition: CbmStar2019Algo.h:114
CbmStar2019EventBuilderEtofAlgo::fiEquipmentId
Int_t fiEquipmentId
Definition: CbmStar2019EventBuilderEtofAlgo.h:141
CbmStar2019EventBuilderEtofAlgo::fviRpcSide
std::vector< Int_t > fviRpcSide
Definition: CbmStar2019EventBuilderEtofAlgo.h:113
CbmStar2019EventBuilderEtofAlgo::kuMaxNbErrorsPerGdpbPerEvent
static const UInt_t kuMaxNbErrorsPerGdpbPerEvent
Switch ON the readout and insertion of STATUS pattern message (default is true)
Definition: CbmStar2019EventBuilderEtofAlgo.h:92
CbmStar2019TofPar::GetNbByteMessage
static constexpr UInt_t GetNbByteMessage()
Definition: CbmStar2019TofPar.h:36
CbmStar2019EventBuilderEtofAlgo::fbEpochAfterCandWinFound
Bool_t fbEpochAfterCandWinFound
[sector]
Definition: CbmStar2019EventBuilderEtofAlgo.h:183
gdpbv100::SYS_GET4_ERROR
@ SYS_GET4_ERROR
Definition: gDpbMessv100.h:70
CbmTofStarSubevent2019::GetMaxOutputSize
static uint32_t GetMaxOutputSize()
Definition: CbmTofStarData2019.h:148
CbmStar2019EventBuilderEtofAlgo::fvulStarTsMsb
std::vector< ULong64_t > fvulStarTsMsb
[sector]
Definition: CbmStar2019EventBuilderEtofAlgo.h:165
CbmStar2019EventBuilderEtofAlgo::Init
virtual Bool_t Init()
Definition: CbmStar2019EventBuilderEtofAlgo.cxx:144
CbmStar2019EventBuilderEtofAlgo::fhEventSizeDistribution
TH1 * fhEventSizeDistribution
Definition: CbmStar2019EventBuilderEtofAlgo.h:217
gdpbv100::MSG_HIT
@ MSG_HIT
Definition: gDpbMessv100.h:59
CbmStar2019EventBuilderEtofAlgo::ProcessEpoch
void ProcessEpoch(gdpbv100::Message mess)
Definition: CbmStar2019EventBuilderEtofAlgo.cxx:712
CbmStar2019EventBuilderEtofAlgo::AddMsComponentToList
void AddMsComponentToList(size_t component, UShort_t usDetectorId)
Definition: CbmStar2019EventBuilderEtofAlgo.cxx:329
CbmStar2019TofPar::GetNrOfGbtx
Int_t GetNrOfGbtx()
Definition: CbmStar2019TofPar.h:86
CbmStar2019EventBuilderEtofAlgo::fvhTriggerDistributionInTs
std::vector< TH1 * > fvhTriggerDistributionInTs
[sector], extra monitor for debug
Definition: CbmStar2019EventBuilderEtofAlgo.h:211
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
gdpbv100::Message::getGdpbSysPattType
uint16_t getGdpbSysPattType() const
Definition: gDpbMessv100.h:259
gdpbv100::MSG_SLOWC
@ MSG_SLOWC
Definition: gDpbMessv100.h:61
CbmStar2019EventBuilderEtofAlgo::fvulStarTsFullLastCore
std::vector< ULong64_t > fvulStarTsFullLastCore
[sector]
Definition: CbmStar2019EventBuilderEtofAlgo.h:173
CbmStar2019EventBuilderEtofAlgo::InitContainers
Bool_t InitContainers()
Definition: CbmStar2019EventBuilderEtofAlgo.cxx:157
CbmStar2019Algo< CbmTofDigi >::fuNbOverMsPerTs
size_t fuNbOverMsPerTs
Definition: CbmStar2019Algo.h:113
gdpbv100::MSG_STAR_TRI_D
@ MSG_STAR_TRI_D
Definition: gDpbMessv100.h:66
gdpbv100::Message::getMessageType
uint8_t getMessageType() const
Returns the message type. Valid for all message types. 4 bit.
Definition: gDpbMessv100.h:206
CbmStar2019EventBuilderEtofAlgo::fuGet4Id
UInt_t fuGet4Id
Definition: CbmStar2019EventBuilderEtofAlgo.h:138
CbmStar2019EventBuilderEtofAlgo::fhRawTriggersStatsSel
TH2 * fhRawTriggersStatsSel
extra monitor for debug
Definition: CbmStar2019EventBuilderEtofAlgo.h:225
CbmStar2019Algo< CbmTofDigi >::AddHistoToVector
void AddHistoToVector(TNamed *pointer, std::string sFolder="")
For monitor algos.
Definition: CbmStar2019Algo.h:80
gdpbv100::Message::getGdpbSysSubType
uint16_t getGdpbSysSubType() const
Definition: gDpbMessv100.h:245
CbmStar2019EventBuilderEtofAlgo::fuNrOfChannelsPerFee
UInt_t fuNrOfChannelsPerFee
Definition: CbmStar2019EventBuilderEtofAlgo.h:104
CbmStar2019EventBuilderEtofAlgo::fbTriggerAfterCandWinFound
Bool_t fbTriggerAfterCandWinFound
Definition: CbmStar2019EventBuilderEtofAlgo.h:184
CbmStar2019EventBuilderEtofAlgo::fcTrigDistMs
TCanvas * fcTrigDistMs
All sectors.
Definition: CbmStar2019EventBuilderEtofAlgo.h:229
gdpbv100::Message::setGdpbEpEpochNb
void setGdpbEpEpochNb(uint32_t v)
Definition: gDpbMessv100.h:283
CbmStar2019EventBuilderEtofAlgo::fbMonitorMode
Bool_t fbMonitorMode
Control flags.
Definition: CbmStar2019EventBuilderEtofAlgo.h:83
CbmStar2019EventBuilderEtofAlgo::ProcessMs
Bool_t ProcessMs(const fles::Timeslice &ts, size_t uMsCompIdx, size_t uMsIdx)
Definition: CbmStar2019EventBuilderEtofAlgo.cxx:483
gdpbv100::Message::setGdpbGenGdpbId
void setGdpbGenGdpbId(uint32_t v)
Definition: gDpbMessv100.h:213
CbmStar2019Algo< CbmTofDigi >::fuNbCoreMsPerTs
size_t fuNbCoreMsPerTs
Definition: CbmStar2019Algo.h:112
CbmStar2019EventBuilderEtofAlgo::CreateHistograms
Bool_t CreateHistograms()
Definition: CbmStar2019EventBuilderEtofAlgo.cxx:1805
CbmStar2019EventBuilderEtofAlgo::fvdMessCandidateTimeStop
std::vector< Double_t > fvdMessCandidateTimeStop
[sector]
Definition: CbmStar2019EventBuilderEtofAlgo.h:180
gdpbv100::kdEpochInNs
const double kdEpochInNs
Definition: gDpbMessv100.h:37
CbmStar2019EventBuilderEtofAlgo::fvuStarDaqCmdLast
std::vector< UInt_t > fvuStarDaqCmdLast
[sector]
Definition: CbmStar2019EventBuilderEtofAlgo.h:170
CbmStar2019EventBuilderEtofAlgo::fviRpcType
std::vector< Int_t > fviRpcType
Definition: CbmStar2019EventBuilderEtofAlgo.h:112
gdpbv100::kuEpochCounterSz
const uint32_t kuEpochCounterSz
Definition: gDpbMessv100.h:40
CbmStar2019EventBuilderEtofAlgo::fuMinTotPulser
UInt_t fuMinTotPulser
[sector]
Definition: CbmStar2019EventBuilderEtofAlgo.h:122
gdpbv100::Message::isStarTrigger
bool isStarTrigger() const
Returns true is message type is MSG_STAR_TRI_A, _B, _C, _D (STAR Trigger message)
Definition: gDpbMessv100.h:329
CbmStar2019EventBuilderEtofAlgo::fvvmEpSupprBuffer
std::vector< std::vector< gdpbv100::Message > > fvvmEpSupprBuffer
Epoch + Epoch Cycle.
Definition: CbmStar2019EventBuilderEtofAlgo.h:150
CbmStar2019EventBuilderEtofAlgo::fvdTrigCandidateTimeStart
std::vector< Double_t > fvdTrigCandidateTimeStart
[sector]
Definition: CbmStar2019EventBuilderEtofAlgo.h:181
CbmStar2019EventBuilderEtofAlgo::fuNrOfGdpbs
UInt_t fuNrOfGdpbs
Definition: CbmStar2019EventBuilderEtofAlgo.h:98
CbmStar2019Algo< CbmTofDigi >::fdTsFullSizeInNs
Double_t fdTsFullSizeInNs
Total size of the core MS in a TS, [nanoseconds].
Definition: CbmStar2019Algo.h:121
gdpbv100::Message::getGdpbSysErrData
uint16_t getGdpbSysErrData() const
Definition: gDpbMessv100.h:253
CbmStar2019Algo< CbmTofDigi >::fParCList
TList * fParCList
Parameter management.
Definition: CbmStar2019Algo.h:108
iWarnMess
static Int_t iWarnMess
Definition: CbmStar2019EventBuilderEtofAlgo.cxx:481
gdpbv100::Message::getGdpbSysPattIndex
uint16_t getGdpbSysPattIndex() const
Definition: gDpbMessv100.h:260
CbmStar2019EventBuilderEtofAlgo::fuNrOfModules
UInt_t fuNrOfModules
Definition: CbmStar2019EventBuilderEtofAlgo.h:110
CbmHistManager.h
Histogram manager.
CbmStar2019TofPar::GetGdpbId
Int_t GetGdpbId(Int_t i)
Definition: CbmStar2019TofPar.h:39
CbmStar2019EventBuilderEtofAlgo::BuildEvents
Bool_t BuildEvents()
Definition: CbmStar2019EventBuilderEtofAlgo.cxx:1342
CbmStar2019Algo< CbmTofDigi >::fvMsComponentsList
std::vector< size_t > fvMsComponentsList
Parameters related to FLES containers.
Definition: CbmStar2019Algo.h:111
CbmStar2019EventBuilderEtofAlgo::fcTimeToTrigSel
TCanvas * fcTimeToTrigSel
All sectors.
Definition: CbmStar2019EventBuilderEtofAlgo.h:228
CbmStar2019EventBuilderEtofAlgo::Reset
virtual void Reset()
Definition: CbmStar2019EventBuilderEtofAlgo.cxx:149
CbmStar2019EventBuilderEtofAlgo::CbmStar2019EventBuilderEtofAlgo
CbmStar2019EventBuilderEtofAlgo()
Definition: CbmStar2019EventBuilderEtofAlgo.cxx:33
CbmStar2019EventBuilderEtofAlgo::fvuStarDaqCmdLastCore
std::vector< UInt_t > fvuStarDaqCmdLastCore
[sector]
Definition: CbmStar2019EventBuilderEtofAlgo.h:175
CbmStar2019EventBuilderEtofAlgo::kuNbMsgPerPattern
static const uint32_t kuNbMsgPerPattern
ASIC status monitoring.
Definition: CbmStar2019EventBuilderEtofAlgo.h:187
CbmStar2019EventBuilderEtofAlgo::fvulGdpbTsFullLastCore
std::vector< ULong64_t > fvulGdpbTsFullLastCore
[sector]
Definition: CbmStar2019EventBuilderEtofAlgo.h:172
gdpbv100::Message::getStarTsLsbStarD
uint64_t getStarTsLsbStarD() const
Definition: gDpbMessv100.h:273
CbmStar2019EventBuilderEtofAlgo::fhEventNbEvolution
TH1 * fhEventNbEvolution
Definition: CbmStar2019EventBuilderEtofAlgo.h:219
gdpbv100::PATT_MISSMATCH
@ PATT_MISSMATCH
Definition: gDpbMessv100.h:81
CbmStar2019EventBuilderEtofAlgo::fvuStarTrigCmdLastCore
std::vector< UInt_t > fvuStarTrigCmdLastCore
[sector]
Definition: CbmStar2019EventBuilderEtofAlgo.h:176
gdpbv100::MSG_STAR_TRI_C
@ MSG_STAR_TRI_C
Definition: gDpbMessv100.h:65
CbmStar2019TofPar::ElinkIdxToGet4Idx
Int_t ElinkIdxToGet4Idx(UInt_t uElink)
Definition: CbmStar2019TofPar.cxx:169
CbmStar2019EventBuilderEtofAlgo::fvSectorStatusPattern
std::vector< std::vector< std::pair< uint64_t, std::bitset< kuNbAsicPerGdpb > > > > fvSectorStatusPattern
[sector][asic] Exclude from dictionnary
Definition: CbmStar2019EventBuilderEtofAlgo.h:197
gdpbv100::PATT_RESYNC
@ PATT_RESYNC
Definition: gDpbMessv100.h:83
CbmStar2019TofPar::GetNrOfModules
Int_t GetNrOfModules()
Definition: CbmStar2019TofPar.h:87
CbmStar2019EventBuilderEtofAlgo::fcEventBuildStats
TCanvas * fcEventBuildStats
All sectors, extra monitor for debug.
Definition: CbmStar2019EventBuilderEtofAlgo.h:231
h
Data class with information on a STS local track.
gdpbv100::Message::getData
uint64_t getData() const
Definition: gDpbMessv100.h:156
CbmStar2019EventBuilderEtofAlgo::StoreMessageInBuffer
void StoreMessageInBuffer(gdpbv100::FullMessage fullMess, uint32_t uGdpbNr)
Definition: CbmStar2019EventBuilderEtofAlgo.cxx:1119
CbmStar2019EventBuilderEtofAlgo::fuNrOfFeePerGdpb
UInt_t fuNrOfFeePerGdpb
Definition: CbmStar2019EventBuilderEtofAlgo.h:100
CbmStar2019EventBuilderEtofAlgo::fdStarTriggerWinSize
std::vector< Double_t > fdStarTriggerWinSize
[sector]
Definition: CbmStar2019EventBuilderEtofAlgo.h:119
CbmStar2019Algo
Definition: CbmStar2019Algo.h:43
CbmStar2019EventBuilderEtofAlgo::fvuStarTokenLast
std::vector< UInt_t > fvuStarTokenLast
[sector]
Definition: CbmStar2019EventBuilderEtofAlgo.h:169
CbmStar2019EventBuilderEtofAlgo::fdAllowedTriggersSpread
Double_t fdAllowedTriggersSpread
Event window limits.
Definition: CbmStar2019EventBuilderEtofAlgo.h:116
CbmStar2019EventBuilderEtofAlgo::ProcessPattern
void ProcessPattern(gdpbv100::Message mess, uint64_t ulCurEpochGdpbGet4)
Definition: CbmStar2019EventBuilderEtofAlgo.cxx:1255
gdpbv100::GET4_V2X_ERR_SEQUENCE_ER
@ GET4_V2X_ERR_SEQUENCE_ER
Definition: gDpbMessv100.h:127
CbmStar2019EventBuilderEtofAlgo::fvbGdpbLastResyncPattern
std::vector< std::bitset< kuNbAsicPerGdpb > > fvbGdpbLastResyncPattern
[sector][asic] Exclude from dictionnary
Definition: CbmStar2019EventBuilderEtofAlgo.h:194
gdpbv100::Message::getGdpbTsLsbStarB
uint64_t getGdpbTsLsbStarB() const
Definition: gDpbMessv100.h:268
iWarn
static Int_t iWarn
Definition: CbmStar2019EventBuilderEtofAlgo.cxx:480
gdpbv100::Message::getStarTrigMsgIndex
uint16_t getStarTrigMsgIndex() const
Definition: gDpbMessv100.h:264
CbmStar2019EventBuilderEtofAlgo::fdMsTime
Double_t fdMsTime
Definition: CbmStar2019EventBuilderEtofAlgo.h:132
gdpbv100::kuCoarseCounterSize
const uint32_t kuCoarseCounterSize
Definition: gDpbMessv100.h:21
CbmStar2019TofPar::GetStarTriggDelay
Double_t GetStarTriggDelay(UInt_t uGdpb)
Definition: CbmStar2019TofPar.cxx:259
CbmStar2019EventBuilderEtofAlgo::fvhHitsTimeToTriggerRawPulser
std::vector< TH2 * > fvhHitsTimeToTriggerRawPulser
[sector]
Definition: CbmStar2019EventBuilderEtofAlgo.h:203
CbmStar2019Algo< CbmTofDigi >::fdTsCoreSizeInNs
Double_t fdTsCoreSizeInNs
Size of a single MS, [nanoseconds].
Definition: CbmStar2019Algo.h:119
CbmStar2019EventBuilderEtofAlgo::fvuStarTrigCmdLast
std::vector< UInt_t > fvuStarTrigCmdLast
[sector]
Definition: CbmStar2019EventBuilderEtofAlgo.h:171
CbmStar2019TofPar::GetModuleId
Int_t GetModuleId(UInt_t uGbtx)
Definition: CbmStar2019TofPar.cxx:237
gdpbv100::kuChipIdMergedEpoch
const uint32_t kuChipIdMergedEpoch
Definition: gDpbMessv100.h:51
CbmStar2019EventBuilderEtofAlgo::ProcessSlCtrl
void ProcessSlCtrl(gdpbv100::Message mess, uint64_t ulCurEpochGdpbGet4)
Definition: CbmStar2019EventBuilderEtofAlgo.cxx:1195
gdpbv100::GET4_V2X_ERR_ADD_RIS_EDG
@ GET4_V2X_ERR_ADD_RIS_EDG
Definition: gDpbMessv100.h:125
CbmStar2019TofPar::GetNrOfGet4PerFee
static constexpr UInt_t GetNrOfGet4PerFee()
Definition: CbmStar2019TofPar.h:48
CbmStar2019EventBuilderEtofAlgo::fvulStarTsFullLast
std::vector< ULong64_t > fvulStarTsFullLast
[sector]
Definition: CbmStar2019EventBuilderEtofAlgo.h:168
CbmStar2019EventBuilderEtofAlgo::fuNrOfChannelsPerGdpb
UInt_t fuNrOfChannelsPerGdpb
Definition: CbmStar2019EventBuilderEtofAlgo.h:107
CbmStar2019TofPar.h
CbmStar2019TofPar::GetStarTriggWinSize
Double_t GetStarTriggWinSize(UInt_t uGdpb)
Definition: CbmStar2019TofPar.cxx:269
CbmStar2019EventBuilderEtofAlgo::fvhHitsTimeToTriggerRaw
std::vector< TH1 * > fvhHitsTimeToTriggerRaw
[sector][Update]<time, [asic]> Exclude from dictionnary
Definition: CbmStar2019EventBuilderEtofAlgo.h:201
CbmStar2019EventBuilderEtofAlgo::fuMsIndex
UInt_t fuMsIndex
Definition: CbmStar2019EventBuilderEtofAlgo.h:133
CbmStar2019EventBuilderEtofAlgo::InitParameters
Bool_t InitParameters()
Definition: CbmStar2019EventBuilderEtofAlgo.cxx:182
CbmStar2019EventBuilderEtofAlgo::UpdateStatusPatternCurrGdpb
void UpdateStatusPatternCurrGdpb()
Definition: CbmStar2019EventBuilderEtofAlgo.cxx:1302
gdpbv100::MSG_SYST
@ MSG_SYST
Definition: gDpbMessv100.h:62
CbmStar2019EventBuilderEtofAlgo::Finish
virtual void Finish()
Definition: CbmStar2019EventBuilderEtofAlgo.cxx:150
first
bool first
Definition: LKFMinuit.cxx:143
CbmStar2019EventBuilderEtofAlgo::fvhTriggerDistributionInMs
std::vector< TH1 * > fvhTriggerDistributionInMs
[sector], extra monitor for debug
Definition: CbmStar2019EventBuilderEtofAlgo.h:213
CbmStar2019EventBuilderEtofAlgo::fvEventsBuffer
std::vector< CbmTofStarSubevent2019 > fvEventsBuffer
[sector]
Definition: CbmStar2019EventBuilderEtofAlgo.h:157
CbmStar2019EventBuilderEtofAlgo::fvhTriggerDt
std::vector< TH1 * > fvhTriggerDt
[sector], extra monitor for debug
Definition: CbmStar2019EventBuilderEtofAlgo.h:209
CbmStar2019EventBuilderEtofAlgo::fvvBufferMessages
std::vector< std::vector< gdpbv100::FullMessage > > fvvBufferMessages
[sector], buffer to make sure GET4 errors 0-12 are always transmitted
Definition: CbmStar2019EventBuilderEtofAlgo.h:154
CbmStar2019EventBuilderEtofAlgo::fdStarTriggerDelay
std::vector< Double_t > fdStarTriggerDelay
[sector]
Definition: CbmStar2019EventBuilderEtofAlgo.h:118
CbmTofStarSubevent2019::AddMsg
void AddMsg(const gdpbv100::FullMessage &msgIn)
Definition: CbmTofStarData2019.h:119
CbmStar2019EventBuilderEtofAlgo::fdTsStopTimeCore
Double_t fdTsStopTimeCore
Definition: CbmStar2019EventBuilderEtofAlgo.h:130
CbmStar2019EventBuilderEtofAlgo::fbTriggerFoundA
Bool_t fbTriggerFoundA
Event buffer.
Definition: CbmStar2019EventBuilderEtofAlgo.h:160
CbmStar2019EventBuilderEtofAlgo::fvvBufferMajorAsicErrors
std::vector< std::vector< gdpbv100::FullMessage > > fvvBufferMajorAsicErrors
[sector]
Definition: CbmStar2019EventBuilderEtofAlgo.h:152
gdpbv100::Message::getStarTsMidStarC
uint64_t getStarTsMidStarC() const
Definition: gDpbMessv100.h:271
CbmStar2019EventBuilderEtofAlgo::ProcessTs
Bool_t ProcessTs(const fles::Timeslice &ts)
Definition: CbmStar2019EventBuilderEtofAlgo.cxx:346
CbmTofStarTrigger2019
Definition: CbmTofStarData2019.h:17
CbmStar2019EventBuilderEtofAlgo::fhEventSizeEvolution
TProfile * fhEventSizeEvolution
Definition: CbmStar2019EventBuilderEtofAlgo.h:218
CbmStar2019EventBuilderEtofAlgo::FillHistograms
Bool_t FillHistograms()
Definition: CbmStar2019EventBuilderEtofAlgo.cxx:2199
CbmStar2019EventBuilderEtofAlgo::fhEventNbDistributionInTs
TH1 * fhEventNbDistributionInTs
Definition: CbmStar2019EventBuilderEtofAlgo.h:220
CbmStar2019TofPar::GetRpcType
Int_t GetRpcType(UInt_t uGbtx)
Definition: CbmStar2019TofPar.cxx:217
gdpbv100::GET4_V2X_ERR_TOT_RANGE
@ GET4_V2X_ERR_TOT_RANGE
Definition: gDpbMessv100.h:123
CbmStar2019EventBuilderEtofAlgo::fulCurrentTsIndex
ULong64_t fulCurrentTsIndex
Running indices.
Definition: CbmStar2019EventBuilderEtofAlgo.h:126
CbmStar2019TofPar
Definition: CbmStar2019TofPar.h:18
CbmStar2019EventBuilderEtofAlgo::fhMissingTriggersEvolution
TH2 * fhMissingTriggersEvolution
extra monitor for debug
Definition: CbmStar2019EventBuilderEtofAlgo.h:226
gdpbv100::Message::getGdpbSysPattPattern
uint32_t getGdpbSysPattPattern() const
Definition: gDpbMessv100.h:261
CbmStar2019EventBuilderEtofAlgo::fuNrOfGet4
UInt_t fuNrOfGet4
Definition: CbmStar2019EventBuilderEtofAlgo.h:105
CbmStar2019EventBuilderEtofAlgo::CreateStatusMessage
gdpbv100::FullMessage CreateStatusMessage(uint16_t uGdpbId, uint32_t uIndex, std::pair< uint64_t, std::bitset< kuNbAsicPerGdpb >> statusIn)
Definition: CbmStar2019EventBuilderEtofAlgo.cxx:1315
CbmStar2019EventBuilderEtofAlgo::ProcessStarTrigger
void ProcessStarTrigger(gdpbv100::Message mess)
Definition: CbmStar2019EventBuilderEtofAlgo.cxx:749
gdpbv100::Message::setGdpbSysPattIndex
void setGdpbSysPattIndex(uint16_t v)
Definition: gDpbMessv100.h:289
CbmTofStarSubevent2019::SetTrigger
void SetTrigger(CbmTofStarTrigger2019 triggerIn)
Definition: CbmTofStarData2019.h:85
CbmStar2019EventBuilderEtofAlgo::fuGdpbNr
UInt_t fuGdpbNr
Definition: CbmStar2019EventBuilderEtofAlgo.h:136
gdpbv100::MSG_EPOCH
@ MSG_EPOCH
Definition: gDpbMessv100.h:60
gdpbv100::Message::getGdpbSysUnkwData
uint32_t getGdpbSysUnkwData() const
Definition: gDpbMessv100.h:255
CbmStar2019EventBuilderEtofAlgo::fbTriggerFoundC
Bool_t fbTriggerFoundC
Definition: CbmStar2019EventBuilderEtofAlgo.h:162
gdpbv100::GET4_V2X_ERR_LOST_EVT
@ GET4_V2X_ERR_LOST_EVT
Definition: gDpbMessv100.h:113
CbmStar2019EventBuilderEtofAlgo::fbTriggerFoundB
Bool_t fbTriggerFoundB
Definition: CbmStar2019EventBuilderEtofAlgo.h:161
CbmStar2019EventBuilderEtofAlgo::fhRawTriggersStatsOver
TH2 * fhRawTriggersStatsOver
extra monitor for debug
Definition: CbmStar2019EventBuilderEtofAlgo.h:224
CbmStar2019TofPar::GetNrOfGdpbs
Int_t GetNrOfGdpbs()
Definition: CbmStar2019TofPar.h:38
CbmStar2019EventBuilderEtofAlgo::fvuStarTokenLastCore
std::vector< UInt_t > fvuStarTokenLastCore
[sector]
Definition: CbmStar2019EventBuilderEtofAlgo.h:174
CbmStar2019EventBuilderEtofAlgo::fvdTrigCandidateTimeStop
std::vector< Double_t > fvdTrigCandidateTimeStop
[sector]
Definition: CbmStar2019EventBuilderEtofAlgo.h:182
gdpbv100::kulEpochCycleFieldSz
const uint64_t kulEpochCycleFieldSz
Definition: gDpbMessv100.h:49
CbmStar2019EventBuilderEtofAlgo::fvbGdpbLastMissmatchPattern
std::vector< std::bitset< kuNbAsicPerGdpb > > fvbGdpbLastMissmatchPattern
Definition: CbmStar2019EventBuilderEtofAlgo.h:190
CbmStar2019EventBuilderEtofAlgo::fvulGdpbTsFullLast
std::vector< ULong64_t > fvulGdpbTsFullLast
[sector]
Definition: CbmStar2019EventBuilderEtofAlgo.h:167
gdpbv100::Message::getGdpbHitIs24b
uint16_t getGdpbHitIs24b() const
Definition: gDpbMessv100.h:218
gdpbv100::Message::setGdpbSysPattPattern
void setGdpbSysPattPattern(uint32_t v)
Definition: gDpbMessv100.h:290
gdpbv100::Message::getGdpbGenChipId
uint16_t getGdpbGenChipId() const
Definition: gDpbMessv100.h:214
CbmStar2019EventBuilderEtofAlgo::fvulGdpbTsMsb
std::vector< ULong64_t > fvulGdpbTsMsb
Definition: CbmStar2019EventBuilderEtofAlgo.h:163
CbmStar2019EventBuilderEtofAlgo::fUnpackPar
CbmStar2019TofPar * fUnpackPar
Correspond to ~6000 error messages max per event, leaving 2000 for hits and epoch.
Definition: CbmStar2019EventBuilderEtofAlgo.h:96
CbmStar2019EventBuilderEtofAlgo::fvhMessDistributionInMs
std::vector< TH1 * > fvhMessDistributionInMs
[sector], extra monitor for debug
Definition: CbmStar2019EventBuilderEtofAlgo.h:215
CbmStar2019EventBuilderEtofAlgo::fbAddStatusToEvent
Bool_t fbAddStatusToEvent
Switch ON the insertion of the LostEvent messages from GET4s with the critical errors (default is fal...
Definition: CbmStar2019EventBuilderEtofAlgo.h:89
CbmStar2019EventBuilderEtofAlgo::fcTriggerStats
TCanvas * fcTriggerStats
Definition: CbmStar2019EventBuilderEtofAlgo.h:232
CbmStar2019EventBuilderEtofAlgo::fhRawTriggersStatsCore
TH2 * fhRawTriggersStatsCore
extra monitor for debug
Definition: CbmStar2019EventBuilderEtofAlgo.h:223
gdpbv100::MSG_STAR_TRI_B
@ MSG_STAR_TRI_B
Definition: gDpbMessv100.h:64
gdpbv100::Message::setGdpbSysSubType
void setGdpbSysSubType(uint16_t v)
Definition: gDpbMessv100.h:286
gdpbv100::Message::getGdpbSysErrEdge
bool getGdpbSysErrEdge() const
Definition: gDpbMessv100.h:252
gdpbv100::SYS_PATTERN
@ SYS_PATTERN
Definition: gDpbMessv100.h:76
CbmStar2019EventBuilderEtofAlgo::ProcessSysMess
void ProcessSysMess(gdpbv100::Message mess, uint64_t ulCurEpochGdpbGet4)
Definition: CbmStar2019EventBuilderEtofAlgo.cxx:1199
CbmStar2019EventBuilderEtofAlgo::fuNrOfGet4PerGdpb
UInt_t fuNrOfGet4PerGdpb
Definition: CbmStar2019EventBuilderEtofAlgo.h:106
CbmStar2019Algo< CbmTofDigi >::AddCanvasToVector
void AddCanvasToVector(TCanvas *pointer, std::string sFolder="")
Definition: CbmStar2019Algo.h:87
gdpbv100::FullMessage
Definition: gDpbMessv100.h:362
CbmStar2019EventBuilderEtofAlgo::fvhHitsTimeToTriggerSelVsTrig
std::vector< TH2 * > fvhHitsTimeToTriggerSelVsTrig
[sector], extra monitor for debug
Definition: CbmStar2019EventBuilderEtofAlgo.h:208
CbmStar2019EventBuilderEtofAlgo::fuNrOfGbtx
UInt_t fuNrOfGbtx
Detector Mapping.
Definition: CbmStar2019EventBuilderEtofAlgo.h:109
CbmStar2019EventBuilderEtofAlgo::fuNrOfChannelsPerGet4
UInt_t fuNrOfChannelsPerGet4
Definition: CbmStar2019EventBuilderEtofAlgo.h:102
CbmTofStarSubevent2019
Definition: CbmTofStarData2019.h:72
gdpbv100::PATT_STATUS
@ PATT_STATUS
Definition: gDpbMessv100.h:84
gdpbv100::Message::setGdpbSysPattType
void setGdpbSysPattType(uint16_t v)
Definition: gDpbMessv100.h:288
CbmStar2019TofPar::GetStarTriggDeadtime
Double_t GetStarTriggDeadtime(UInt_t uGdpb)
Definition: CbmStar2019TofPar.cxx:248
CbmStar2019EventBuilderEtofAlgo::~CbmStar2019EventBuilderEtofAlgo
~CbmStar2019EventBuilderEtofAlgo()
Definition: CbmStar2019EventBuilderEtofAlgo.cxx:133
gdpbv100::Message::getStarTokenStarD
uint32_t getStarTokenStarD() const
Definition: gDpbMessv100.h:280
gdpbv100::Message::getStarTsMsbStarB
uint64_t getStarTsMsbStarB() const
Definition: gDpbMessv100.h:269
CbmStar2019EventBuilderEtofAlgo::ResetHistograms
Bool_t ResetHistograms()
Definition: CbmStar2019EventBuilderEtofAlgo.cxx:2232
CbmStar2019TofPar::GetGdpbToSectorOffset
static constexpr UInt_t GetGdpbToSectorOffset()
Definition: CbmStar2019TofPar.h:72
gdpbv100::Message::getGdpbHitChanId
uint16_t getGdpbHitChanId() const
Definition: gDpbMessv100.h:219
CbmStar2019TofPar::GetSizeMsInNs
Double_t GetSizeMsInNs()
Definition: CbmStar2019TofPar.h:93
PairAnalysisStyler::Fill
static Int_t Fill[]
Definition: PairAnalysisStyleDefs.h:82
CbmTofStarTrigger2019::GetFullGdpbTs
ULong64_t GetFullGdpbTs() const
Definition: CbmTofStarData2019.h:46
CbmStar2019EventBuilderEtofAlgo::fhEventNbPerTs
TH1 * fhEventNbPerTs
[sector], extra monitor for debug
Definition: CbmStar2019EventBuilderEtofAlgo.h:216
CbmStar2019EventBuilderEtofAlgo::fvulStarTsMid
std::vector< ULong64_t > fvulStarTsMid
[sector]
Definition: CbmStar2019EventBuilderEtofAlgo.h:166
CbmStar2019EventBuilderEtofAlgo::fvhHitsTimeToTriggerSel
std::vector< TH1 * > fvhHitsTimeToTriggerSel
[sector], extra monitor for debug
Definition: CbmStar2019EventBuilderEtofAlgo.h:204
CbmStar2019EventBuilderEtofAlgo::fviModuleId
std::vector< Int_t > fviModuleId
Definition: CbmStar2019EventBuilderEtofAlgo.h:114
CbmStar2019EventBuilderEtofAlgo::fvhHitsTimeToTriggerSelVsDaq
std::vector< TH2 * > fvhHitsTimeToTriggerSelVsDaq
[sector]
Definition: CbmStar2019EventBuilderEtofAlgo.h:206
gdpbv100::PATT_ENABLE
@ PATT_ENABLE
Definition: gDpbMessv100.h:82
CbmStar2019TofPar::GetNrOfFeePerGdpb
static constexpr UInt_t GetNrOfFeePerGdpb()
Definition: CbmStar2019TofPar.h:60
CbmStar2019TofPar::GetRpcSide
Int_t GetRpcSide(UInt_t uGbtx)
Definition: CbmStar2019TofPar.cxx:227
CbmStar2019EventBuilderEtofAlgo::fuGet4Nr
UInt_t fuGet4Nr
Definition: CbmStar2019EventBuilderEtofAlgo.h:140
CbmStar2019EventBuilderEtofAlgo::fbStoreLostEventMsg
Bool_t fbStoreLostEventMsg
Switch ON the filling of a additional set of histograms.
Definition: CbmStar2019EventBuilderEtofAlgo.h:87
gdpbv100::GET4_V2X_ERR_UNPAIR_FALL
@ GET4_V2X_ERR_UNPAIR_FALL
Definition: gDpbMessv100.h:126
gdpbv100::SYS_GET4_SYNC_MISS
@ SYS_GET4_SYNC_MISS
Definition: gDpbMessv100.h:73
CbmStar2019Algo< CbmTofDigi >::fbIgnoreOverlapMs
Bool_t fbIgnoreOverlapMs
Definition: CbmStar2019Algo.h:116
gdpbv100::Message::getGdpbSysErrUnused
uint16_t getGdpbSysErrUnused() const
Definition: gDpbMessv100.h:249
CbmStar2019EventBuilderEtofAlgo::fviNrOfRpc
std::vector< Int_t > fviNrOfRpc
Definition: CbmStar2019EventBuilderEtofAlgo.h:111
CbmStar2019EventBuilderEtofAlgo::fuGdpbId
UInt_t fuGdpbId
Definition: CbmStar2019EventBuilderEtofAlgo.h:134
gdpbv100::GET4_V2X_ERR_EVT_DISCARD
@ GET4_V2X_ERR_EVT_DISCARD
Definition: gDpbMessv100.h:124
gdpbv100::Message::getStarDaqCmdStarD
uint32_t getStarDaqCmdStarD() const
Definition: gDpbMessv100.h:279
CbmStar2019EventBuilderEtofAlgo::fvdMessCandidateTimeStart
std::vector< Double_t > fvdMessCandidateTimeStart
[sector]
Definition: CbmStar2019EventBuilderEtofAlgo.h:179
gdpbv100::SYS_GDPB_UNKWN
@ SYS_GDPB_UNKWN
Definition: gDpbMessv100.h:71
CbmStar2019EventBuilderEtofAlgo::ProcessEpSupprBuffer
void ProcessEpSupprBuffer(uint32_t uGdpbNr)
Definition: CbmStar2019EventBuilderEtofAlgo.cxx:1045
CbmStar2019EventBuilderEtofAlgo::fvvBufferTriggers
std::vector< std::vector< CbmTofStarTrigger2019 > > fvvBufferTriggers
[sector]
Definition: CbmStar2019EventBuilderEtofAlgo.h:156
CbmStar2019EventBuilderEtofAlgo::ProcessEpochCycle
void ProcessEpochCycle(uint64_t ulCycleData)
All sectors, extra monitor for debug.
Definition: CbmStar2019EventBuilderEtofAlgo.cxx:680