CbmRoot
CbmMcbm2018MonitorStsSync.cxx
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------
2 // ----- -----
3 // ----- CbmMcbm2018MonitorStsSync -----
4 // ----- Created 11/05/18 by P.-A. Loizeau -----
5 // ----- -----
6 // -----------------------------------------------------------------------------
7 
9 
10 // Data
11 
12 // CbmRoot
13 #include "CbmCern2017UnpackParHodo.h"
14 #include "CbmHistManager.h"
15 
16 // FairRoot
17 #include "FairLogger.h"
18 #include "FairRootManager.h"
19 #include "FairRun.h"
20 #include "FairRunOnline.h"
21 #include "FairRuntimeDb.h"
22 
23 // Root
24 #include "TClonesArray.h"
25 #include "TFile.h"
26 #include "THttpServer.h"
27 #include "TMath.h"
28 #include "TROOT.h"
29 #include "TRandom.h"
30 #include "TString.h"
31 #include "TStyle.h"
32 
33 // C++11
34 #include <bitset>
35 
36 // C/C++
37 #include <iomanip>
38 #include <iostream>
39 #include <stdint.h>
40 
41 Bool_t bMcbm2018ResetStsSync = kFALSE;
42 Bool_t bMcbm2018WriteStsSync = kFALSE;
43 
45  : CbmMcbmUnpack()
46  , fvMsComponentsList()
47  , fuNbCoreMsPerTs(0)
48  , fuNbOverMsPerTs(0)
49  , fbIgnoreOverlapMs(kFALSE)
50  , fUnpackParHodo(NULL)
51  , fuNrOfDpbs(0)
52  , fDpbIdIndexMap()
53  , fuNbElinksPerDpb(0)
54  , fuNbStsXyters(0)
55  , fuNbChanPerAsic(0)
56  , fvuElinkToAsic()
57  , fsHistoFileFullname("data/SetupHistos.root")
58  , fbPrintMessages(kFALSE)
59  , fPrintMessCtrl(stsxyter::MessagePrintMask::msg_print_Human)
60  , fulCurrentTsIdx(0)
61  , fulCurrentMsIdx(0)
62  , fmMsgCounter()
63  , fuCurrentEquipmentId(0)
64  , fuCurrDpbId(0)
65  , fuCurrDpbIdx(0)
66  , fiRunStartDateTimeSec(-1)
67  , fiBinSizeDatePlots(-1)
68  , fvulCurrentTsMsb()
69  , fvuCurrentTsMsbCycle()
70  , fvuInitialHeaderDone()
71  , fvuInitialTsMsbCycleHeader()
72  , fvuElinkLastTsHit()
73  , fvulChanLastHitTime()
74  , fvdChanLastHitTime()
75  , fvdMsTime()
76  , fvuChanNbHitsInMs()
77  , fvdChanLastHitTimeInMs()
78  , fvusChanLastHitAdcInMs()
79  ,
80  // fvmChanHitsInTs(),
81  fdStartTime(-1.0)
82  , fdStartTimeMsSz(-1.0)
83  , ftStartTimeUnix(std::chrono::steady_clock::now())
84  , fvmHitsInMs()
85  , fvmAsicHitsInMs()
86  , fuMaxNbMicroslices(100)
87  , fbLongHistoEnable(kFALSE)
88  , fuLongHistoNbSeconds(0)
89  , fuLongHistoBinSizeSec(0)
90  , fuLongHistoBinNb(0)
91  , fdCoincCenter(0.0)
92  , fdCoincBorder(50.0)
93  , fdCoincMin(fdCoincCenter - fdCoincBorder)
94  , fdCoincMax(fdCoincCenter + fdCoincBorder)
95  , fHM(new CbmHistManager())
96  , fhPulserMessType(NULL)
97  , fhPulserSysMessType(NULL)
98  , fhPulserMessTypePerDpb(NULL)
99  , fhPulserSysMessTypePerDpb(NULL)
100  , fhPulserMessTypePerElink(NULL)
101  , fhPulserSysMessTypePerElink(NULL)
102  , fhPulserStatusMessType(NULL)
103  , fhPulserMsStatusFieldType(NULL)
104  , fhPulserChanCntRaw()
105  , fhPulserChanCntRawGood()
106  , fhPulserChanAdcRaw()
107  , fhPulserChanAdcRawProf()
108  , fhPulserChanRawTs()
109  , fhPulserChanMissEvt()
110  , fhPulserChanMissEvtEvo()
111  , fhPulserChanHitRateEvo()
112  , fhPulserFebRateEvo()
113  , fhPulserFebMissEvtEvo()
114  , fhPulserChanHitRateEvoLong()
115  , fhPulserFebRateEvoLong()
116  , fcMsSizeAll(NULL)
117  , fdStartTs(0.0)
118  , fvmLastHitAsic()
119  , fhPulserTimeDiffPerAsic()
120  , fhPulserTimeDiffPerAsicPair()
121  , fhPulserTimeDiffClkPerAsicPair()
122  , fhPulserTimeDiffEvoPerAsicPair()
123  , fhPulserTimeDiffEvoPerAsicPairProf()
124  , fhPulserRawTimeDiffEvoPerAsicPairProf()
125  , fhPulserTsLsbMatchPerAsicPair()
126  , fhPulserTsMsbMatchPerAsicPair()
127  , fhPulserTsLsbDiffEvoPerAsicPairProf()
128  , fhPulserTsMsbDiffEvoPerAsicPairProf()
129  , fhPulserIntervalAsic()
130  , fhPulserIntervalLongAsic()
131  , fvdLastTimeDiffValuesAsicPair()
132  , fvuLastTimeDiffSlotAsicPair()
133  , fvdMeanTimeDiffAsicPair() {}
134 
136 
138  LOG(info) << "Initializing flib StsXyter unpacker for STS";
139 
140  FairRootManager* ioman = FairRootManager::Instance();
141  if (ioman == NULL) { LOG(fatal) << "No FairRootManager instance"; }
142 
143  return kTRUE;
144 }
145 
147  LOG(info) << "Setting parameter containers for " << GetName();
149  (CbmCern2017UnpackParHodo*) (FairRun::Instance()
150  ->GetRuntimeDb()
151  ->getContainer("CbmCern2017UnpackParHodo"));
152 }
153 
154 
156  LOG(info) << "Init parameter containers for " << GetName();
157 
158  Bool_t bReInit = ReInitContainers();
160 
161  return bReInit;
162 }
163 
165  LOG(info) << "ReInit parameter containers for " << GetName();
166 
167  fuNrOfDpbs = fUnpackParHodo->GetNrOfDpbs();
168  fuNbElinksPerDpb = fUnpackParHodo->GetNbElinksPerDpb();
169  fuNbStsXyters = fUnpackParHodo->GetNbStsXyters();
170  fuNbChanPerAsic = fUnpackParHodo->GetNbChanPerAsic();
171 
172 
173  LOG(info) << "Nr. of STS DPBs: " << fuNrOfDpbs;
174 
175  fDpbIdIndexMap.clear();
176  fvuElinkToAsic.resize(fuNrOfDpbs);
177  for (UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb) {
178  fDpbIdIndexMap[fUnpackParHodo->GetDpbId(uDpb)] = uDpb;
179  LOG(info) << "Eq. ID for DPB #" << std::setw(2) << uDpb << " = "
180  << std::setw(4) << std::hex << fUnpackParHodo->GetDpbId(uDpb)
181  << std::dec << " => "
182  << fDpbIdIndexMap[fUnpackParHodo->GetDpbId(uDpb)];
183 
184  fvuElinkToAsic[uDpb].resize(fuNbElinksPerDpb);
185  for (UInt_t uElink = 0; uElink < fuNbElinksPerDpb; ++uElink)
186  fvuElinkToAsic[uDpb][uElink] =
187  fUnpackParHodo->GetElinkToAsicIdx(uDpb * fuNbElinksPerDpb + uElink);
188  } // for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
189 
190  LOG(info) << "Nr. eLinks per DPB: " << fuNbElinksPerDpb;
191  LOG(info) << "Nr. of StsXyter ASICs: " << fuNbStsXyters;
192  LOG(info) << "Nb. channels per ASIC: " << fuNbChanPerAsic;
193 
194  for (UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb) {
195  LOG(info) << "ASIC ID for eLinks in DPB #" << std::setw(2) << uDpb << ": ";
196 
197  std::stringstream ss;
198  for (UInt_t uElink = 0; uElink < fuNbElinksPerDpb; ++uElink) {
199  if (0 == uElink % 10) ss << "\n------> ";
200 
201  ss << std::setw(5) << fvuElinkToAsic[uDpb][uElink] << " ";
202  } // for( UInt_t uElink = 0; uElink < fuNbElinksPerDpb; ++uElink )
203  LOG(info) << ss.str();
204  } // for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
205 
206  // Internal status initialization
212  for (UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb) {
213  fvulCurrentTsMsb[uDpb] = 0;
214  fvuCurrentTsMsbCycle[uDpb] = 0;
215  fvuInitialHeaderDone[uDpb] = kFALSE;
216  fvuInitialTsMsbCycleHeader[uDpb] = 0;
217  /*
218  fvuElinkLastTsHit[uDpb].resize( fuNbElinksPerDpb );
219  for( UInt_t uElink = 0; uElink < fuNbElinksPerDpb; ++uElink )
220  {
221  fvuElinkLastTsHit[uDpb][uElink] = 0;
222  } // for( UInt_t uElink = 0; uElink < fuNbElinksPerDpb; ++uElink )
223 */
224  } // for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
225 
243  for (UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx) {
244  fvulChanLastHitTime[uXyterIdx].resize(fuNbChanPerAsic);
245  fvdChanLastHitTime[uXyterIdx].resize(fuNbChanPerAsic);
246  fvuChanNbHitsInMs[uXyterIdx].resize(fuNbChanPerAsic);
247  fvdChanLastHitTimeInMs[uXyterIdx].resize(fuNbChanPerAsic);
248  fvusChanLastHitAdcInMs[uXyterIdx].resize(fuNbChanPerAsic);
249  fvmAsicHitsInMs[uXyterIdx].clear();
250  fhPulserTimeDiffPerAsicPair[uXyterIdx].clear();
251  fhPulserTimeDiffClkPerAsicPair[uXyterIdx].clear();
252  fhPulserTimeDiffEvoPerAsicPair[uXyterIdx].clear();
253  fhPulserTimeDiffEvoPerAsicPairProf[uXyterIdx].clear();
254  fhPulserRawTimeDiffEvoPerAsicPairProf[uXyterIdx].clear();
255  fhPulserTsLsbMatchPerAsicPair[uXyterIdx].clear();
256  fhPulserTsMsbMatchPerAsicPair[uXyterIdx].clear();
257  fhPulserTsLsbDiffEvoPerAsicPairProf[uXyterIdx].clear();
258  fhPulserTsMsbDiffEvoPerAsicPairProf[uXyterIdx].clear();
259  for (UInt_t uChan = 0; uChan < fuNbChanPerAsic; ++uChan) {
260  fvulChanLastHitTime[uXyterIdx][uChan] = 0;
261  fvdChanLastHitTime[uXyterIdx][uChan] = -1.0;
262 
263  fvuChanNbHitsInMs[uXyterIdx][uChan].resize(fuMaxNbMicroslices);
264  fvdChanLastHitTimeInMs[uXyterIdx][uChan].resize(fuMaxNbMicroslices);
265  fvusChanLastHitAdcInMs[uXyterIdx][uChan].resize(fuMaxNbMicroslices);
266  for (UInt_t uMsIdx = 0; uMsIdx < fuMaxNbMicroslices; ++uMsIdx) {
267  fvuChanNbHitsInMs[uXyterIdx][uChan][uMsIdx] = 0;
268  fvdChanLastHitTimeInMs[uXyterIdx][uChan][uMsIdx] = -1.0;
269  fvusChanLastHitAdcInMs[uXyterIdx][uChan][uMsIdx] = 0;
270  } // for( UInt_t uMsIdx = 0; uMsIdx < fuMaxNbMicroslices; ++uMsIdx )
271  } // for( UInt_t uChan = 0; uChan < fuNbChanPerAsic; ++uChan )
272  } // for( UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx )
273  LOG(info) << "CbmMcbm2018MonitorStsSync::ReInitContainers => Changed "
274  "fvuChanNbHitsInMs size "
275  << fvuChanNbHitsInMs.size() << " VS " << fuNbStsXyters;
276  LOG(info) << "CbmMcbm2018MonitorStsSync::ReInitContainers => Changed "
277  "fvuChanNbHitsInMs size "
278  << fvuChanNbHitsInMs[0].size() << " VS " << fuNbChanPerAsic;
279  LOG(info) << "CbmMcbm2018MonitorStsSync::ReInitContainers => Changed "
280  "fvuChanNbHitsInMs size "
281  << fvuChanNbHitsInMs[0][0].size() << " VS " << fuMaxNbMicroslices;
282 
283  return kTRUE;
284 }
285 
287  size_t component,
288  UShort_t /*usDetectorId*/) {
290  for (UInt_t uCompIdx = 0; uCompIdx < fvMsComponentsList.size(); ++uCompIdx)
291  if (component == fvMsComponentsList[uCompIdx]) return;
292 
294  fvMsComponentsList.push_back(component);
295 
297  if (component < kiMaxNbFlibLinks)
298  if (NULL == fhMsSz[component]) {
299  TString sMsSzName = Form("MsSz_link_%02lu", component);
300  TString sMsSzTitle =
301  Form("Size of MS for nDPB of link %02lu; Ms Size [bytes]", component);
302  fhMsSz[component] =
303  new TH1F(sMsSzName.Data(), sMsSzTitle.Data(), 160000, 0., 20000.);
304  fHM->Add(sMsSzName.Data(), fhMsSz[component]);
305 
306  sMsSzName = Form("MsSzTime_link_%02lu", component);
307  sMsSzTitle = Form(
308  "Size of MS vs time for gDPB of link %02lu; Time[s] ; Ms Size [bytes]",
309  component);
310  fhMsSzTime[component] =
311  new TProfile(sMsSzName.Data(), sMsSzTitle.Data(), 15000, 0., 300.);
312  fHM->Add(sMsSzName.Data(), fhMsSzTime[component]);
313 
314  if (NULL != fcMsSizeAll) {
315  fcMsSizeAll->cd(1 + component);
316  gPad->SetLogy();
317  fhMsSzTime[component]->Draw("hist le0");
318  } // if( NULL != fcMsSizeAll )
319  LOG(info) << "Added MS size histo for component: " << component
320  << " (DPB)";
321 
322  THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
323  if (server) {
324  server->Register("/FlibRaw", fhMsSz[component]);
325  server->Register("/FlibRaw", fhMsSzTime[component]);
326  } // if( server )
327  } // if( NULL == fhMsSz[ component ] )
328 }
330  size_t uOverlapMsNb) {
331  fuNbCoreMsPerTs = uCoreMsNb;
332  fuNbOverMsPerTs = uOverlapMsNb;
333 
334  UInt_t uNbMsTotal = fuNbCoreMsPerTs + fuNbOverMsPerTs;
335 
336  if (fuMaxNbMicroslices < uNbMsTotal) {
337  fuMaxNbMicroslices = uNbMsTotal;
338 
343  for (UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx) {
344  fvuChanNbHitsInMs[uXyterIdx].resize(fuNbChanPerAsic);
345  fvdChanLastHitTimeInMs[uXyterIdx].resize(fuNbChanPerAsic);
346  fvusChanLastHitAdcInMs[uXyterIdx].resize(fuNbChanPerAsic);
347  for (UInt_t uChan = 0; uChan < fuNbChanPerAsic; ++uChan) {
348  fvuChanNbHitsInMs[uXyterIdx][uChan].resize(fuMaxNbMicroslices);
349  fvdChanLastHitTimeInMs[uXyterIdx][uChan].resize(fuMaxNbMicroslices);
350  fvusChanLastHitAdcInMs[uXyterIdx][uChan].resize(fuMaxNbMicroslices);
351  for (UInt_t uMsIdx = 0; uMsIdx < fuMaxNbMicroslices; ++uMsIdx) {
352  fvuChanNbHitsInMs[uXyterIdx][uChan][uMsIdx] = 0;
353  fvdChanLastHitTimeInMs[uXyterIdx][uChan][uMsIdx] = -1.0;
354  fvusChanLastHitAdcInMs[uXyterIdx][uChan][uMsIdx] = 0;
355  } // for( UInt_t uMsIdx = 0; uMsIdx < fuMaxNbMicroslices; ++uMsIdx )
356  } // for( UInt_t uChan = 0; uChan < fuNbChanPerAsic; ++uChan )
357  } // for( UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx )
358  LOG(info) << "CbmMcbm2018MonitorStsSync::DoUnpack => Changed "
359  "fvuChanNbHitsInMs size "
360  << fvuChanNbHitsInMs.size() << " VS " << fuNbStsXyters;
361  LOG(info) << "CbmMcbm2018MonitorStsSync::DoUnpack => Changed "
362  "fvuChanNbHitsInMs size "
363  << fvuChanNbHitsInMs[0].size() << " VS " << fuNbChanPerAsic;
364  LOG(info) << "CbmMcbm2018MonitorStsSync::DoUnpack => Changed "
365  "fvuChanNbHitsInMs size "
366  << fvuChanNbHitsInMs[0][0].size() << " VS " << fuMaxNbMicroslices;
367  } // if( fuMaxNbMicroslices < uNbMsTotal )
368 }
369 
371  Double_t dBorderVal) {
372  fdCoincCenter = dCenterPos;
373  fdCoincBorder = dBorderVal;
374  fdCoincMin = dCenterPos - dBorderVal;
375  fdCoincMax = dCenterPos + dBorderVal;
376 }
377 
379  TString sHistName {""};
380  TString title {""};
381 
382  sHistName = "hPulserMessageType";
383  title = "Nb of message for each type; Type";
384  fhPulserMessType = new TH1I(sHistName, title, 6, 0., 6.);
385  fhPulserMessType->GetXaxis()->SetBinLabel(1, "Dummy");
386  fhPulserMessType->GetXaxis()->SetBinLabel(2, "Hit");
387  fhPulserMessType->GetXaxis()->SetBinLabel(3, "TsMsb");
388  fhPulserMessType->GetXaxis()->SetBinLabel(4, "Epoch");
389  fhPulserMessType->GetXaxis()->SetBinLabel(5, "Status");
390  fhPulserMessType->GetXaxis()->SetBinLabel(6, "Empty");
391  /* *** Missing int + MessType OP!!!! ****
392  fhPulserMessType->GetXaxis()->SetBinLabel(1 + stsxyter::MessType::Dummy, "Dummy");
393  fhPulserMessType->GetXaxis()->SetBinLabel(1 + stsxyter::MessType::Hit, "Hit");
394  fhPulserMessType->GetXaxis()->SetBinLabel(1 + stsxyter::MessType::TsMsb, "TsMsb");
395  fhPulserMessType->GetXaxis()->SetBinLabel(1 + stsxyter::MessType::ReadDataAck, "ReadDataAck");
396  fhPulserMessType->GetXaxis()->SetBinLabel(1 + stsxyter::MessType::Ack, "Ack");
397 */
398 
399  sHistName = "hPulserSysMessType";
400  title = "Nb of system message for each type; System Type";
401  fhPulserSysMessType = new TH1I(sHistName, title, 17, 0., 17.);
402  /*
403  hSysMessType->GetXaxis()->SetBinLabel(1 + ngdpb::SYSMSG_DAQ_START, "DAQ START");
404  hSysMessType->GetXaxis()->SetBinLabel(1 + ngdpb::SYSMSG_DAQ_FINISH, "DAQ FINISH");
405  hSysMessType->GetXaxis()->SetBinLabel(1 + 16, "GET4 Hack 32B");
406 */
407 
408  sHistName = "hPulserMessageTypePerDpb";
409  title = "Nb of message of each type for each DPB; DPB; Type";
411  new TH2I(sHistName, title, fuNrOfDpbs, 0, fuNrOfDpbs, 6, 0., 6.);
412  fhPulserMessTypePerDpb->GetYaxis()->SetBinLabel(1, "Dummy");
413  fhPulserMessTypePerDpb->GetYaxis()->SetBinLabel(2, "Hit");
414  fhPulserMessTypePerDpb->GetYaxis()->SetBinLabel(3, "TsMsb");
415  fhPulserMessTypePerDpb->GetYaxis()->SetBinLabel(4, "Epoch");
416  fhPulserMessTypePerDpb->GetYaxis()->SetBinLabel(5, "Status");
417  fhPulserMessTypePerDpb->GetYaxis()->SetBinLabel(6, "Empty");
418  /* *** Missing int + MessType OP!!!! ****
419  fhPulserMessType->GetYaxis()->SetBinLabel(1 + stsxyter::MessType::Dummy, "Dummy");
420  fhPulserMessType->GetYaxis()->SetBinLabel(1 + stsxyter::MessType::Hit, "Hit");
421  fhPulserMessType->GetYaxis()->SetBinLabel(1 + stsxyter::MessType::TsMsb, "TsMsb");
422  fhPulserMessType->GetYaxis()->SetBinLabel(1 + stsxyter::MessType::ReadDataAck, "ReadDataAck");
423  fhPulserMessType->GetYaxis()->SetBinLabel(1 + stsxyter::MessType::Ack, "Ack");
424 */
425 
426  sHistName = "hPulserSysMessTypePerDpb";
427  title = "Nb of system message of each type for each DPB; DPB; System Type";
429  new TH2I(sHistName, title, fuNrOfDpbs, 0, fuNrOfDpbs, 17, 0., 17.);
430  /*
431  hSysMessType->GetYaxis()->SetBinLabel(1 + ngdpb::SYSMSG_DAQ_START, "DAQ START");
432  hSysMessType->GetYaxis()->SetBinLabel(1 + ngdpb::SYSMSG_DAQ_FINISH, "DAQ FINISH");
433  hSysMessType->GetYaxis()->SetBinLabel(1 + 16, "GET4 Hack 32B");
434 */
435 
436  sHistName = "hPulserMessageTypePerElink";
437  title = "Nb of message of each type for each eLink; eLink; Type";
438  fhPulserMessTypePerElink = new TH2I(sHistName,
439  title,
441  0,
443  5,
444  0.,
445  5.);
446  fhPulserMessTypePerElink->GetYaxis()->SetBinLabel(1, "Dummy");
447  fhPulserMessTypePerElink->GetYaxis()->SetBinLabel(2, "Hit");
448  fhPulserMessTypePerElink->GetYaxis()->SetBinLabel(3, "TsMsb");
449  fhPulserMessTypePerElink->GetYaxis()->SetBinLabel(4, "ReadDataAck");
450  fhPulserMessTypePerElink->GetYaxis()->SetBinLabel(5, "Ack");
451  /* *** Missing int + MessType OP!!!! ****
452  fhPulserMessTypePerElink->GetYaxis()->SetBinLabel(1 + stsxyter::MessType::Dummy, "Dummy");
453  fhPulserMessTypePerElink->GetYaxis()->SetBinLabel(1 + stsxyter::MessType::Hit, "Hit");
454  fhPulserMessTypePerElink->GetYaxis()->SetBinLabel(1 + stsxyter::MessType::TsMsb, "TsMsb");
455  fhPulserMessTypePerElink->GetYaxis()->SetBinLabel(1 + stsxyter::MessType::ReadDataAck, "ReadDataAck");
456  fhPulserMessTypePerElink->GetYaxis()->SetBinLabel(1 + stsxyter::MessType::Ack, "Ack");
457 */
458 
459  sHistName = "hPulserSysMessTypePerElink";
460  title =
461  "Nb of system message of each type for each eLink; eLink; System Type";
462  fhPulserSysMessTypePerElink = new TH2I(sHistName,
463  title,
465  0,
467  17,
468  0.,
469  17.);
470  /*
471  fhPulserSysMessTypePerElink->GetYaxis()->SetBinLabel(1 + ngdpb::SYSMSG_DAQ_START, "DAQ START");
472  fhPulserSysMessTypePerElink->GetYaxis()->SetBinLabel(1 + ngdpb::SYSMSG_DAQ_FINISH, "DAQ FINISH");
473  fhPulserSysMessTypePerElink->GetYaxis()->SetBinLabel(1 + 16, "GET4 Hack 32B");
474 */
475 
476  sHistName = "hPulserStatusMessType";
477  title = "Nb of status message of each type for each DPB; eLink; Status Type";
478  fhPulserStatusMessType = new TH2I(sHistName,
479  title,
481  0,
483  16,
484  0.,
485  16.);
486  /*
487  fhPulserStatusMessType->GetYaxis()->SetBinLabel( 1, "Dummy");
488  fhPulserStatusMessType->GetYaxis()->SetBinLabel( 2, "Hit");
489  fhPulserStatusMessType->GetYaxis()->SetBinLabel( 3, "TsMsb");
490  fhPulserStatusMessType->GetYaxis()->SetBinLabel( 4, "Epoch");
491 */
492  sHistName = "hPulserMsStatusFieldType";
493  title =
494  "For each flag in the MS header, ON/OFF counts; Flag bit []; ON/OFF; MS []";
496  new TH2I(sHistName, title, 16, -0.5, 15.5, 2, -0.5, 1.5);
497  /*
498  fhPulserMsStatusFieldType->GetYaxis()->SetBinLabel( 1, "Dummy");
499  fhPulserMsStatusFieldType->GetYaxis()->SetBinLabel( 2, "Hit");
500  fhPulserMsStatusFieldType->GetYaxis()->SetBinLabel( 3, "TsMsb");
501  fhPulserMsStatusFieldType->GetYaxis()->SetBinLabel( 4, "Epoch");
502 */
503  /*
504  // Number of rate bins =
505  // 9 for the sub-unit decade
506  // + 9 for each unit of each decade * 10 for the subdecade range
507  // + 1 for the closing bin top edge
508  const Int_t iNbDecadesRate = 9;
509  const Int_t iNbStepsDecade = 9;
510  const Int_t iNbSubStepsInStep = 10;
511  const Int_t iNbBinsRate = iNbStepsDecade
512  + iNbStepsDecade * iNbSubStepsInStep * iNbDecadesRate
513  + 1;
514  Double_t dBinsRate[iNbBinsRate];
515  // First fill sub-unit decade
516  for( Int_t iSubU = 0; iSubU < iNbStepsDecade; iSubU ++ )
517  dBinsRate[ iSubU ] = 0.1 * ( 1 + iSubU );
518  std::cout << std::endl;
519  // Then fill the main decades
520  Double_t dSubstepSize = 1.0 / iNbSubStepsInStep;
521  for( Int_t iDecade = 0; iDecade < iNbDecadesRate; iDecade ++)
522  {
523  Double_t dBase = std::pow( 10, iDecade );
524  Int_t iDecadeIdx = iNbStepsDecade
525  + iDecade * iNbStepsDecade * iNbSubStepsInStep;
526  for( Int_t iStep = 0; iStep < iNbStepsDecade; iStep++ )
527  {
528  Int_t iStepIdx = iDecadeIdx + iStep * iNbSubStepsInStep;
529  for( Int_t iSubStep = 0; iSubStep < iNbSubStepsInStep; iSubStep++ )
530  {
531  dBinsRate[ iStepIdx + iSubStep ] = dBase * (1 + iStep)
532  + dBase * dSubstepSize * iSubStep;
533  } // for( Int_t iSubStep = 0; iSubStep < iNbSubStepsInStep; iSubStep++ )
534  } // for( Int_t iStep = 0; iStep < iNbStepsDecade; iStep++ )
535  } // for( Int_t iDecade = 0; iDecade < iNbDecadesRate; iDecade ++)
536  dBinsRate[ iNbBinsRate - 1 ] = std::pow( 10, iNbDecadesRate );
537 */
539  UInt_t uAlignedLimit =
541  fuLongHistoBinNb = uAlignedLimit / fuLongHistoBinSizeSec;
542 
543  UInt_t uNbBinEvo = (32768 + 1) * 2;
544  Double_t dMaxEdgeEvo =
545  stsxyter::kdClockCycleNs * static_cast<Double_t>(uNbBinEvo) / 2.0;
546  Double_t dMinEdgeEvo = dMaxEdgeEvo * -1.0;
547 
548  // UInt_t uNbBinDt = static_cast<UInt_t>( (fdCoincMax - fdCoincMin )/stsxyter::kdClockCycleNs );
549 
550  for (UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx) {
551  // Channel counts
552  sHistName = Form("hPulserChanCntRaw_%03u", uXyterIdx);
553  title = Form("Hits Count per channel, StsXyter #%03u; Channel; Hits []",
554  uXyterIdx);
555  fhPulserChanCntRaw.push_back(
556  new TH1I(sHistName, title, fuNbChanPerAsic, -0.5, fuNbChanPerAsic - 0.5));
557 
558  sHistName = Form("hPulserChanCntRawGood_%03u", uXyterIdx);
559  title = Form(
560  "Hits Count per channel in good MS, StsXyter #%03u; Channel; Hits []",
561  uXyterIdx);
562  fhPulserChanCntRawGood.push_back(
563  new TH1I(sHistName, title, fuNbChanPerAsic, -0.5, fuNbChanPerAsic - 0.5));
564 
565  // Raw Adc Distribution
566  sHistName = Form("hPulserChanAdcRaw_%03u", uXyterIdx);
567  title = Form("Raw Adc distribution per channel, StsXyter #%03u; Channel "
568  "[]; Adc []; Hits []",
569  uXyterIdx);
570  fhPulserChanAdcRaw.push_back(new TH2I(sHistName,
571  title,
573  -0.5,
574  fuNbChanPerAsic - 0.5,
576  -0.5,
577  stsxyter::kuHitNbAdcBins - 0.5));
578 
579  // Raw Adc Distribution profile
580  sHistName = Form("hPulserChanAdcRawProfc_%03u", uXyterIdx);
581  title =
582  Form("Raw Adc prodile per channel, StsXyter #%03u; Channel []; Adc []",
583  uXyterIdx);
584  fhPulserChanAdcRawProf.push_back(new TProfile(
585  sHistName, title, fuNbChanPerAsic, -0.5, fuNbChanPerAsic - 0.5));
586 
587  // Raw Ts Distribution
588  sHistName = Form("hPulserChanRawTs_%03u", uXyterIdx);
589  title = Form("Raw Timestamp distribution per channel, StsXyter #%03u; "
590  "Channel []; Ts []; Hits []",
591  uXyterIdx);
592  fhPulserChanRawTs.push_back(new TH2I(sHistName,
593  title,
595  -0.5,
596  fuNbChanPerAsic - 0.5,
598  -0.5,
599  stsxyter::kuHitNbTsBins - 0.5));
600 
601  // Missed event flag
602  sHistName = Form("hPulserChanMissEvt_%03u", uXyterIdx);
603  title = Form("Missed Event flags per channel, StsXyter #%03u; Channel []; "
604  "Miss Evt []; Hits []",
605  uXyterIdx);
606  fhPulserChanMissEvt.push_back(new TH2I(sHistName,
607  title,
609  -0.5,
610  fuNbChanPerAsic - 0.5,
611  2,
612  -0.5,
613  1.5));
614 
615  // Missed event flag counts evolution
616 
617  sHistName = Form("hPulserChanMissEvtEvo_%03u", uXyterIdx);
618  title = Form("Missed Evt flags per second & channel in StsXyter #%03u; "
619  "Time [s]; Channel []; Missed Evt flags []",
620  uXyterIdx);
621  fhPulserChanMissEvtEvo.push_back(new TH2I(sHistName,
622  title,
623  1800,
624  0,
625  1800,
627  -0.5,
628  fuNbChanPerAsic - 0.5));
629 
630  // Missed event flag counts evo per StsXyter
631 
632  sHistName = Form("hPulserFebMissEvtEvo%03u", uXyterIdx);
633  title = Form("Missed Evt flags per second in StsXyter #%03u; Time [s]; "
634  "Missed Evt flags []",
635  uXyterIdx);
636  fhPulserFebMissEvtEvo.push_back(new TH1I(sHistName, title, 1800, 0, 1800));
637 
638  // Hit rates evo per channel
639  sHistName = Form("hPulserChanRateEvo_%03u", uXyterIdx);
640  title = Form("Hits per second & channel in StsXyter #%03u; Time [s]; "
641  "Channel []; Hits []",
642  uXyterIdx);
643  fhPulserChanHitRateEvo.push_back(new TH2I(sHistName,
644  title,
645  1800,
646  0,
647  1800,
649  -0.5,
650  fuNbChanPerAsic - 0.5));
651 
652  // Hit rates evo per StsXyter
653  sHistName = Form("hPulserFebRateEvo_%03u", uXyterIdx);
654  title =
655  Form("Hits per second in StsXyter #%03u; Time [s]; Hits []", uXyterIdx);
656  fhPulserFebRateEvo.push_back(new TH1I(sHistName, title, 1800, 0, 1800));
657 
658  // Hit rates evo per channel, 1 minute bins, 24h
659  sHistName = Form("hPulserChanRateEvoLong_%03u", uXyterIdx);
660  title = Form("Hits per second & channel in StsXyter #%03u; Time [min]; "
661  "Channel []; Hits []",
662  uXyterIdx);
663  fhPulserChanHitRateEvoLong.push_back(new TH2D(sHistName,
664  title,
666  -0.5,
667  uAlignedLimit - 0.5,
669  -0.5,
670  fuNbChanPerAsic - 0.5));
671 
672  // Hit rates evo per StsXyter, 1 minute bins, 24h
673  sHistName = Form("hPulserFebRateEvoLong_%03u", uXyterIdx);
674  title =
675  Form("Hits per second in StsXyter #%03u; Time [min]; Hits []", uXyterIdx);
676  fhPulserFebRateEvoLong.push_back(
677  new TH1D(sHistName, title, fuLongHistoBinNb, -0.5, uAlignedLimit - 0.5));
678 
680  sHistName = Form("fhPulserTimeDiffPerAsic_%03u", uXyterIdx);
681  title = Form("Time diff for pulser hits between ASIC %03u and other ASICs; "
682  "tn - t%03u [ns]; ASIC n; Counts",
683  uXyterIdx,
684  uXyterIdx);
685  fhPulserTimeDiffPerAsic.push_back(new TH2I(sHistName,
686  title,
687  uNbBinEvo,
688  dMinEdgeEvo,
689  dMaxEdgeEvo,
691  -0.5,
692  fuNbStsXyters - 0.5));
693 
694  for (UInt_t uXyterIdxB = 0; uXyterIdxB < fuNbStsXyters; ++uXyterIdxB) {
695  if (uXyterIdxB == uXyterIdx) {
696  sHistName = Form("fhPulserTimeDiffSameAsic_%03u", uXyterIdx);
697  title = Form(
698  "Time diff for consecutive hits in ASIC %03u; tn - t [ns]; Counts",
699  uXyterIdx);
700  } // if( uXyterIdxB == uXyterIdx )
701  else {
702  sHistName =
703  Form("fhPulserTimeDiffPerAsicPair_%03u_%03u", uXyterIdx, uXyterIdxB);
704  title = Form("Time diff for pulser hits in ASIC %03u and %03u; tn - t "
705  "[ns]; Counts",
706  uXyterIdx,
707  uXyterIdxB);
708  } // else of if( uXyterIdxB == uXyterIdx )
709  fhPulserTimeDiffPerAsicPair[uXyterIdx].push_back(
710  new TH1I(sHistName, title, uNbBinEvo, dMinEdgeEvo, dMaxEdgeEvo));
711 
712  if (uXyterIdxB == uXyterIdx) {
713  sHistName = Form("fhPulserTimeDiffClkSameAsic_%03u", uXyterIdx);
714  title = Form(
715  "Time diff for consecutive hits in ASIC %03u; tn - t [Clk]; Counts",
716  uXyterIdx);
717  } // if( uXyterIdxB == uXyterIdx )
718  else {
719  sHistName = Form(
720  "fhPulserTimeDiffClkPerAsicPair_%03u_%03u", uXyterIdx, uXyterIdxB);
721  title = Form("Time diff for pulser hits in ASIC %03u and %03u; tn - t "
722  "[Clk]; Counts",
723  uXyterIdx,
724  uXyterIdxB);
725  } // else of if( uXyterIdxB == uXyterIdx )
726  fhPulserTimeDiffClkPerAsicPair[uXyterIdx].push_back(
727  new TH1I(sHistName, title, 601, -300.5, 300.5));
728 
729  if (uXyterIdxB == uXyterIdx) {
730  sHistName = Form("fhPulserTimeDiffEvoSameAsic_%03u", uXyterIdx);
731  title = Form("Time diff for consecutive hits in ASIC %03u; Time in run "
732  "[s]; tn - t [ns]; Counts",
733  uXyterIdx);
734  } // if( uXyterIdxB == uXyterIdx )
735  else {
736  sHistName = Form(
737  "fhPulserTimeDiffEvoPerAsicPair_%03u_%03u", uXyterIdx, uXyterIdxB);
738  title = Form("Time diff for pulser hits in ASIC %03u and %03u; Time in "
739  "run [s]; tn - t [ns]; Counts",
740  uXyterIdx,
741  uXyterIdxB);
742  } // else of if( uXyterIdxB == uXyterIdx )
743  fhPulserTimeDiffEvoPerAsicPair[uXyterIdx].push_back(
744  new TH2I(sHistName,
745  title,
746  3600,
747  0,
748  18000,
749  200,
751  100 * stsxyter::kdClockCycleNs));
752 
753  if (uXyterIdxB == uXyterIdx) {
754  sHistName = Form("fhPulserTimeDiffEvoSameAsicProf_%03u", uXyterIdx);
755  title = Form("Time diff for consecutive hits in ASIC %03u; Time in run "
756  "[s]; tn - t [ns]",
757  uXyterIdx);
758  } // if( uXyterIdxB == uXyterIdx )
759  else {
760  sHistName = Form("fhPulserTimeDiffEvoPerAsicPairProf_%03u_%03u",
761  uXyterIdx,
762  uXyterIdxB);
763  title = Form("Time diff for pulser hits in ASIC %03u and %03u; Time in "
764  "run [s]; tn - t [ns]",
765  uXyterIdx,
766  uXyterIdxB);
767  } // else of if( uXyterIdxB == uXyterIdx )
768  fhPulserTimeDiffEvoPerAsicPairProf[uXyterIdx].push_back(
769  new TProfile(sHistName, title, 52000, 0, 52000));
770 
771  if (uXyterIdxB == uXyterIdx) {
772  sHistName = Form("fhPulserRawTimeDiffEvoSameAsicProf_%03u", uXyterIdx);
773  title = Form("Time diff for consecutive hits in ASIC %03u; Time in run "
774  "[s]; tn - t [ns]",
775  uXyterIdx);
776  } // if( uXyterIdxB == uXyterIdx )
777  else {
778  sHistName = Form("fhPulserRawTimeDiffEvoPerAsicPairProf_%03u_%03u",
779  uXyterIdx,
780  uXyterIdxB);
781  title = Form("Time diff for pulser hits in ASIC %03u and %03u; Time in "
782  "run [s]; tn - t [ns]",
783  uXyterIdx,
784  uXyterIdxB);
785  } // else of if( uXyterIdxB == uXyterIdx )
786  fhPulserRawTimeDiffEvoPerAsicPairProf[uXyterIdx].push_back(
787  new TProfile(sHistName, title, 10400, 0, 52000));
788 
789  sHistName =
790  Form("fhPulserTsLsbMatchPerAsicPair_%03u_%03u", uXyterIdx, uXyterIdxB);
791  title = Form("TS LSB for pulser hits in ASIC %03u and %03u; TS LSB %03u "
792  "[bin]; TS LSB %03u [bin]",
793  uXyterIdx,
794  uXyterIdxB,
795  uXyterIdx,
796  uXyterIdxB);
797  fhPulserTsLsbMatchPerAsicPair[uXyterIdx].push_back(
798  new TH2I(sHistName, title, 256, -0.5, 255.5, 256, -0.5, 255.5));
799 
800  sHistName =
801  Form("fhPulserTsMsbMatchPerAsicPair_%03u_%03u", uXyterIdx, uXyterIdxB);
802  title = Form("TS MSB for pulser hits in ASIC %03u and %03u; TS MSB %03u "
803  "[bin]; TS MSB %03u [bin]",
804  uXyterIdx,
805  uXyterIdxB,
806  uXyterIdx,
807  uXyterIdxB);
808  fhPulserTsMsbMatchPerAsicPair[uXyterIdx].push_back(
809  new TH2I(sHistName, title, 64, -0.5, 63.5, 64, -0.5, 63.5));
810 
811  if (uXyterIdxB == uXyterIdx) {
812  sHistName = Form("fhPulserTsLsbDiffEvoSameAsicProf_%03u", uXyterIdx);
813  title = Form("TS LSB diff for consecutive hits in ASIC %03u; Time in "
814  "run [s]; LSBn - LSB [bins]",
815  uXyterIdx);
816  } // if( uXyterIdxB == uXyterIdx )
817  else {
818  sHistName = Form("fhPulserTsLsbDiffEvoPerAsicPairProf_%03u_%03u",
819  uXyterIdx,
820  uXyterIdxB);
821  title = Form("TS LSB diff for pulser hits in ASIC %03u and %03u; Time "
822  "in run [s]; LSBn - LSB [Bins]",
823  uXyterIdx,
824  uXyterIdxB);
825  } // else of if( uXyterIdxB == uXyterIdx )
826  fhPulserTsLsbDiffEvoPerAsicPairProf[uXyterIdx].push_back(
827  new TProfile(sHistName, title, 52000, 0, 52000));
828 
829  if (uXyterIdxB == uXyterIdx) {
830  sHistName = Form("fhPulserTsMsbDiffEvoSameAsicProf_%03u", uXyterIdx);
831  title = Form("TS MSB diff for consecutive hits in ASIC %03u; Time in "
832  "run [s]; MSBn - MSB [bins]",
833  uXyterIdx);
834  } // if( uXyterIdxB == uXyterIdx )
835  else {
836  sHistName = Form("fhPulserTsMsbDiffEvoPerAsicPairProf_%03u_%03u",
837  uXyterIdx,
838  uXyterIdxB);
839  title = Form("TS MSB diff for pulser hits in ASIC %03u and %03u; Time "
840  "in run [s]; MSBn - MSB [Bins]",
841  uXyterIdx,
842  uXyterIdxB);
843  } // else of if( uXyterIdxB == uXyterIdx )
844  fhPulserTsMsbDiffEvoPerAsicPairProf[uXyterIdx].push_back(
845  new TProfile(sHistName, title, 52000, 0, 52000));
846 
847  } // for( UInt_t uXyterIdxB = 0; uXyterIdxB < fuNbStsXyters; ++uXyterIdxB )
848 
849  sHistName = Form("fhPulserIntervalAsic_%03u", uXyterIdx);
850  title =
851  Form("Time diff between consecutive hits in ASIC %03us; dt [ns]; Counts",
852  uXyterIdx);
853  fhPulserIntervalAsic.push_back(
854  new TH1I(sHistName, title, 200, 0, 200 * stsxyter::kdClockCycleNs));
855 
856  sHistName = Form("fhPulserIntervalLongAsic_%03u", uXyterIdx);
857  title =
858  Form("Time diff between consecutive hits in ASIC %03us; dt [ns]; Counts",
859  uXyterIdx);
860  fhPulserIntervalLongAsic.push_back(
861  new TH1I(sHistName, title, 1e5, 0, 1e6 * stsxyter::kdClockCycleNs));
862 
864  } // for( UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx )
868  for (UInt_t uAsicA = 0; uAsicA < fhPulserTimeDiffPerAsicPair.size();
869  ++uAsicA) {
870  fvdLastTimeDiffValuesAsicPair[uAsicA].resize(
871  fhPulserTimeDiffPerAsicPair[uAsicA].size());
872  fvuLastTimeDiffSlotAsicPair[uAsicA].resize(
873  fhPulserTimeDiffPerAsicPair[uAsicA].size(), 0);
874  fvdMeanTimeDiffAsicPair[uAsicA].resize(
875  fhPulserTimeDiffPerAsicPair[uAsicA].size(), 0.0);
876  } // for( UInt_t uAsicA = 0; uAsicA < fhPulserTimeDiffPerAsicPair.size(); ++uAsicA )
877 
878 
880 
881  /*
882  // Distribution of the TS_MSB per StsXyter
883  sHistName = "hPulserFebTsMsb";
884  title = "Raw Timestamp Msb distribution per StsXyter; Ts MSB []; StsXyter []; Hits []";
885  fhPulserFebTsMsb = new TH2I( sHistName, title, stsxyter::kuTsMsbNbTsBins, -0.5, stsxyter::kuTsMsbNbTsBins - 0.5,
886  fuNbStsXyters, -0.5, fuNbStsXyters - 0.5 );
887  if( server ) server->Register("/StsRaw", fhPulserFebTsMsb );
888 */
889  // Miscroslice properties histos
890  for (Int_t component = 0; component < kiMaxNbFlibLinks; component++) {
891  fhMsSz[component] = NULL;
892  fhMsSzTime[component] = NULL;
893  } // for( Int_t component = 0; component < kiMaxNbFlibLinks; component ++ )
894 
895  // Online histo browser commands
896  THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
897  if (server) {
898  server->Register("/StsRaw", fhPulserMessType);
899  server->Register("/StsRaw", fhPulserSysMessType);
900  server->Register("/StsRaw", fhPulserMessTypePerDpb);
901  server->Register("/StsRaw", fhPulserSysMessTypePerDpb);
902  server->Register("/StsRaw", fhPulserMessTypePerElink);
903  server->Register("/StsRaw", fhPulserSysMessTypePerElink);
904  server->Register("/StsRaw", fhPulserStatusMessType);
905  server->Register("/StsRaw", fhPulserMsStatusFieldType);
906  for (UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx) {
907  server->Register("/StsRaw", fhPulserChanCntRaw[uXyterIdx]);
908  server->Register("/StsRaw", fhPulserChanCntRawGood[uXyterIdx]);
909  server->Register("/StsRaw", fhPulserChanAdcRaw[uXyterIdx]);
910  server->Register("/StsRaw", fhPulserChanAdcRawProf[uXyterIdx]);
911  server->Register("/StsRaw", fhPulserChanRawTs[uXyterIdx]);
912  server->Register("/StsRaw", fhPulserChanMissEvt[uXyterIdx]);
913  server->Register("/StsRaw", fhPulserChanMissEvtEvo[uXyterIdx]);
914  server->Register("/StsRaw", fhPulserFebMissEvtEvo[uXyterIdx]);
915  server->Register("/StsRaw", fhPulserChanHitRateEvo[uXyterIdx]);
916  server->Register("/StsRaw", fhPulserFebRateEvo[uXyterIdx]);
917  server->Register("/StsRaw", fhPulserChanHitRateEvoLong[uXyterIdx]);
918  server->Register("/StsRaw", fhPulserFebRateEvoLong[uXyterIdx]);
919 
920  server->Register("/DtAsic", fhPulserTimeDiffPerAsic[uXyterIdx]);
921  for (UInt_t uXyterIdxB = 0; uXyterIdxB < fuNbStsXyters; ++uXyterIdxB) {
922  if (uXyterIdxB == uXyterIdx) {
923  server->Register("/DtChan",
924  fhPulserTimeDiffPerAsicPair[uXyterIdx][uXyterIdxB]);
925  server->Register(
926  "/DtChan", fhPulserTimeDiffClkPerAsicPair[uXyterIdx][uXyterIdxB]);
927  server->Register(
928  "/DtChan", fhPulserTimeDiffEvoPerAsicPair[uXyterIdx][uXyterIdxB]);
929  server->Register(
930  "/DtChan",
931  fhPulserTimeDiffEvoPerAsicPairProf[uXyterIdx][uXyterIdxB]);
932  server->Register(
933  "/DtChan",
934  fhPulserRawTimeDiffEvoPerAsicPairProf[uXyterIdx][uXyterIdxB]);
935  server->Register(
936  "/DtChan",
937  fhPulserTsLsbDiffEvoPerAsicPairProf[uXyterIdx][uXyterIdxB]);
938  server->Register(
939  "/DtChan",
940  fhPulserTsMsbDiffEvoPerAsicPairProf[uXyterIdx][uXyterIdxB]);
941  } // if( uXyterIdxB == uXyterIdx )
942  else {
943  server->Register("/DtAsicPair",
944  fhPulserTimeDiffPerAsicPair[uXyterIdx][uXyterIdxB]);
945  server->Register(
946  "/DtAsicPair",
947  fhPulserTimeDiffClkPerAsicPair[uXyterIdx][uXyterIdxB]);
948  server->Register(
949  "/DtAsicPair",
950  fhPulserTimeDiffEvoPerAsicPair[uXyterIdx][uXyterIdxB]);
951  server->Register(
952  "/DtAsicPair",
953  fhPulserTimeDiffEvoPerAsicPairProf[uXyterIdx][uXyterIdxB]);
954  server->Register(
955  "/DtAsicPair",
956  fhPulserRawTimeDiffEvoPerAsicPairProf[uXyterIdx][uXyterIdxB]);
957  server->Register(
958  "/DtAsicPair",
959  fhPulserTsLsbDiffEvoPerAsicPairProf[uXyterIdx][uXyterIdxB]);
960  server->Register(
961  "/DtAsicPair",
962  fhPulserTsMsbDiffEvoPerAsicPairProf[uXyterIdx][uXyterIdxB]);
963  } // else of if( uXyterIdxB == uXyterIdx )
964  server->Register("/TsMatch",
965  fhPulserTsLsbMatchPerAsicPair[uXyterIdx][uXyterIdxB]);
966  server->Register("/TsMatch",
967  fhPulserTsMsbMatchPerAsicPair[uXyterIdx][uXyterIdxB]);
968  } // for( UInt_t uXyterIdxB = 0; uXyterIdxB < fuNbStsXyters; ++uXyterIdxB )
969  server->Register("/DtPulses", fhPulserIntervalAsic[uXyterIdx]);
970  server->Register("/DtPulses", fhPulserIntervalLongAsic[uXyterIdx]);
971 
972  } // for( UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx )
973 
974  server->RegisterCommand("/Reset_All_Pulser", "bMcbm2018ResetStsSync=kTRUE");
975  server->RegisterCommand("/Write_All_Pulser", "bMcbm2018WriteStsSync=kTRUE");
976 
977  server->Restrict("/Reset_All_Pulser", "allow=admin");
978  server->Restrict("/Write_All_Pulser", "allow=admin");
979  } // if( server )
980 
982  Double_t w = 10;
983  Double_t h = 10;
984 
985  // Summary per StsXyter
986  for (UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx) {
987  TCanvas* cStsSumm =
988  new TCanvas(Form("cStsSum_%03u", uXyterIdx),
989  Form("Summary plots for StsXyter %03u", uXyterIdx),
990  w,
991  h);
992  cStsSumm->Divide(2, 2);
993 
994  cStsSumm->cd(1);
995  gPad->SetLogy();
996  fhPulserChanCntRaw[uXyterIdx]->Draw();
997 
998  cStsSumm->cd(2);
999  gPad->SetLogz();
1000  fhPulserChanAdcRaw[uXyterIdx]->Draw("colz");
1001 
1002  cStsSumm->cd(3);
1003  gPad->SetLogz();
1004  fhPulserChanHitRateEvo[uXyterIdx]->Draw("colz");
1005 
1006  cStsSumm->cd(4);
1007  // gPad->SetLogy();
1008  fhPulserChanAdcRawProf[uXyterIdx]->Draw();
1009  } // for( UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx )
1010 
1011  //====================================================================//
1012 
1013  //====================================================================//
1014  TCanvas* cDtPerAsic =
1015  new TCanvas("cDtPerAsic", "Time Differences per ASIC", w, h);
1016  cDtPerAsic->Divide(fuNbStsXyters / 2 + fuNbStsXyters % 2, 2);
1017 
1018  for (UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx) {
1019  cDtPerAsic->cd(1 + uXyterIdx);
1020  gPad->SetGridx();
1021  gPad->SetGridy();
1022  gPad->SetLogz();
1023  fhPulserTimeDiffPerAsic[uXyterIdx]->Draw(" colz");
1024  } // for( UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx )
1025  //====================================================================//
1026 
1027  //====================================================================//
1028  TCanvas* cDtInAsic =
1029  new TCanvas("cDtInAsic", "Time Differences in ASIC", w, h);
1030  cDtInAsic->Divide(fuNbStsXyters / 2 + fuNbStsXyters % 2, 2);
1031 
1032  for (UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx) {
1033  cDtInAsic->cd(1 + uXyterIdx);
1034  gPad->SetGridx();
1035  gPad->SetLogy();
1036  // gStyle->SetOptStat("emrou");
1037  fhPulserTimeDiffPerAsicPair[uXyterIdx][uXyterIdx]->Draw("hist");
1038  } // for( UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx )
1039  //====================================================================//
1040 
1041  //====================================================================//
1042  TCanvas* cDtAsicPairs =
1043  new TCanvas("cDtAsicPairs", "Time Differences in ASIC", w, h);
1044  cDtAsicPairs->Divide(2, 3);
1045  UInt_t uHistoIdx = 0;
1046  for (UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters && uXyterIdx < 3;
1047  ++uXyterIdx) {
1048  for (UInt_t uXyterIdxB = uXyterIdx + 1; uXyterIdxB < fuNbStsXyters;
1049  ++uXyterIdxB) {
1050  cDtAsicPairs->cd(1 + uHistoIdx);
1051  gPad->SetGridx();
1052  gPad->SetLogy();
1053  // gStyle->SetOptStat("emrou");
1054  fhPulserTimeDiffPerAsicPair[uXyterIdx][uXyterIdxB]->Draw("hist");
1055 
1056  uHistoIdx++;
1057  } // for( UInt_t uXyterIdxB = 0; uXyterIdxB < fuNbStsXyters; ++uXyterIdxB )
1058  } // for( UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx )
1059  //====================================================================//
1060 
1061  //====================================================================//
1062  TCanvas* cDtClkAsicPairs =
1063  new TCanvas("cDtClkAsicPairs", "Time Differences in ASIC", w, h);
1064  cDtClkAsicPairs->Divide(fuNbStsXyters - 1);
1065  for (UInt_t uXyterIdxB = 1; uXyterIdxB < fuNbStsXyters; ++uXyterIdxB) {
1066  cDtClkAsicPairs->cd(uXyterIdxB);
1067  gPad->SetGridx();
1068  gPad->SetLogy();
1069  // gStyle->SetOptStat("emrou");
1070  fhPulserTimeDiffClkPerAsicPair[0][uXyterIdxB]->Draw("hist");
1071  } // for( UInt_t uXyterIdxB = 1; uXyterIdxB < fuNbStsXyters; ++uXyterIdxB )
1072  //====================================================================//
1073 
1074  //====================================================================//
1075  TCanvas* cDtAsicPairsEvo =
1076  new TCanvas("cDtAsicPairsEvo", "Time Differences Evo in ASIC", w, h);
1077  cDtAsicPairsEvo->Divide(2, 3);
1078  uHistoIdx = 0;
1079  for (UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters && uXyterIdx < 3;
1080  ++uXyterIdx) {
1081  for (UInt_t uXyterIdxB = uXyterIdx + 1; uXyterIdxB < fuNbStsXyters;
1082  ++uXyterIdxB) {
1083  cDtAsicPairsEvo->cd(1 + uHistoIdx);
1084  gPad->SetGridx();
1085  gPad->SetGridy();
1086  gPad->SetLogz();
1087  fhPulserTimeDiffEvoPerAsicPair[uXyterIdx][uXyterIdxB]->Draw("colz");
1088 
1089  uHistoIdx++;
1090  } // for( UInt_t uXyterIdxB = 0; uXyterIdxB < fuNbStsXyters; ++uXyterIdxB )
1091  } // for( UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx )
1092  //====================================================================//
1093 
1094  //====================================================================//
1095  TCanvas* cDtAsicPairsEvoProf =
1096  new TCanvas("cDtAsicPairsEvoProf", "Time Differences Evo in ASIC", w, h);
1097  cDtAsicPairsEvoProf->Divide(2, 3);
1098  uHistoIdx = 0;
1099  for (UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters && uXyterIdx < 3;
1100  ++uXyterIdx) {
1101  for (UInt_t uXyterIdxB = uXyterIdx + 1; uXyterIdxB < fuNbStsXyters;
1102  ++uXyterIdxB) {
1103  cDtAsicPairsEvoProf->cd(1 + uHistoIdx);
1104  gPad->SetGridx();
1105  gPad->SetGridy();
1106  gPad->SetLogz();
1107  fhPulserTimeDiffEvoPerAsicPairProf[uXyterIdx][uXyterIdxB]->Draw(
1108  "hist e0");
1109 
1110  uHistoIdx++;
1111  } // for( UInt_t uXyterIdxB = 0; uXyterIdxB < fuNbStsXyters; ++uXyterIdxB )
1112  } // for( UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx )
1113  //====================================================================//
1114 
1115  //====================================================================//
1116  TCanvas* cDtAsicPairsEvoProfRaw =
1117  new TCanvas("cDtAsicPairsEvoProfRaw", "Time Differences Evo in ASIC", w, h);
1118  cDtAsicPairsEvoProfRaw->Divide(2, 3);
1119  uHistoIdx = 0;
1120  for (UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters && uXyterIdx < 3;
1121  ++uXyterIdx) {
1122  for (UInt_t uXyterIdxB = uXyterIdx + 1; uXyterIdxB < fuNbStsXyters;
1123  ++uXyterIdxB) {
1124  cDtAsicPairsEvoProfRaw->cd(1 + uHistoIdx);
1125  gPad->SetGridx();
1126  gPad->SetGridy();
1127  gPad->SetLogz();
1128  fhPulserRawTimeDiffEvoPerAsicPairProf[uXyterIdx][uXyterIdxB]->Draw(
1129  "hist e0");
1130 
1131  uHistoIdx++;
1132  } // for( UInt_t uXyterIdxB = 0; uXyterIdxB < fuNbStsXyters; ++uXyterIdxB )
1133  } // for( UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx )
1134  //====================================================================//
1135 
1136  //====================================================================//
1137  TCanvas* cTsLsbAsicPairs =
1138  new TCanvas("cTsLsbAsicPairs", "Time Differences in ASIC", w, h);
1139  cTsLsbAsicPairs->Divide(2, 3);
1140  uHistoIdx = 0;
1141  for (UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters && uXyterIdx < 3;
1142  ++uXyterIdx) {
1143  for (UInt_t uXyterIdxB = uXyterIdx + 1; uXyterIdxB < fuNbStsXyters;
1144  ++uXyterIdxB) {
1145  cTsLsbAsicPairs->cd(1 + uHistoIdx);
1146  gPad->SetGridx();
1147  gPad->SetGridy();
1148  gPad->SetLogz();
1149  fhPulserTsLsbMatchPerAsicPair[uXyterIdx][uXyterIdxB]->Draw("colz");
1150 
1151  uHistoIdx++;
1152  } // for( UInt_t uXyterIdxB = 0; uXyterIdxB < fuNbStsXyters; ++uXyterIdxB )
1153  } // for( UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx )
1154  //====================================================================//
1155 
1156  //====================================================================//
1157  TCanvas* cTsMsbAsicPairs =
1158  new TCanvas("cTsMsbAsicPairs", "Time Differences in ASIC", w, h);
1159  // cDtAsicPairs->Divide( fuNbStsXyters / 3, 3 );
1160  cTsMsbAsicPairs->Divide(2, 3);
1161  uHistoIdx = 0;
1162  for (UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters && uXyterIdx < 3;
1163  ++uXyterIdx) {
1164  for (UInt_t uXyterIdxB = uXyterIdx + 1; uXyterIdxB < fuNbStsXyters;
1165  ++uXyterIdxB) {
1166  cTsMsbAsicPairs->cd(1 + uHistoIdx);
1167  gPad->SetGridx();
1168  gPad->SetGridy();
1169  gPad->SetLogz();
1170  fhPulserTsMsbMatchPerAsicPair[uXyterIdx][uXyterIdxB]->Draw("colz");
1171 
1172  uHistoIdx++;
1173  } // for( UInt_t uXyterIdxB = 0; uXyterIdxB < fuNbStsXyters; ++uXyterIdxB )
1174  } // for( UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx )
1175  //====================================================================//
1176 
1177  //====================================================================//
1178  TCanvas* cDlsbAsicPairsEvoProf =
1179  new TCanvas("cDlsbAsicPairsEvoProf", "Time Differences Evo in ASIC", w, h);
1180  cDlsbAsicPairsEvoProf->Divide(2, 3);
1181  uHistoIdx = 0;
1182  for (UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters && uXyterIdx < 3;
1183  ++uXyterIdx) {
1184  for (UInt_t uXyterIdxB = uXyterIdx + 1; uXyterIdxB < fuNbStsXyters;
1185  ++uXyterIdxB) {
1186  cDlsbAsicPairsEvoProf->cd(1 + uHistoIdx);
1187  gPad->SetGridx();
1188  gPad->SetGridy();
1189  gPad->SetLogz();
1190  fhPulserTsLsbDiffEvoPerAsicPairProf[uXyterIdx][uXyterIdxB]->Draw(
1191  "hist e0");
1192 
1193  uHistoIdx++;
1194  } // for( UInt_t uXyterIdxB = 0; uXyterIdxB < fuNbStsXyters; ++uXyterIdxB )
1195  } // for( UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx )
1196  //====================================================================//
1197 
1198  //====================================================================//
1199  TCanvas* cDmsbAsicPairsEvoProf =
1200  new TCanvas("cDmsbAsicPairsEvoProf", "Time Differences Evo in ASIC", w, h);
1201  cDmsbAsicPairsEvoProf->Divide(2, 3);
1202  uHistoIdx = 0;
1203  for (UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters && uXyterIdx < 3;
1204  ++uXyterIdx) {
1205  for (UInt_t uXyterIdxB = uXyterIdx + 1; uXyterIdxB < fuNbStsXyters;
1206  ++uXyterIdxB) {
1207  cDmsbAsicPairsEvoProf->cd(1 + uHistoIdx);
1208  gPad->SetGridx();
1209  gPad->SetGridy();
1210  gPad->SetLogz();
1211  fhPulserTsMsbDiffEvoPerAsicPairProf[uXyterIdx][uXyterIdxB]->Draw(
1212  "hist e0");
1213 
1214  uHistoIdx++;
1215  } // for( UInt_t uXyterIdxB = 0; uXyterIdxB < fuNbStsXyters; ++uXyterIdxB )
1216  } // for( UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx )
1217  //====================================================================//
1218 
1219  //====================================================================//
1221  // Try to recover canvas in case it was created already by another monitor
1222  // If not existing, create it
1223  fcMsSizeAll = dynamic_cast<TCanvas*>(gROOT->FindObject("cMsSizeAll"));
1224  if (NULL == fcMsSizeAll) {
1225  fcMsSizeAll =
1226  new TCanvas("cMsSizeAll", "Evolution of MS size in last 300 s", w, h);
1227  fcMsSizeAll->Divide(4, 4);
1228  LOG(info) << "Created MS size canvas in STS monitor";
1229  } // if( NULL == fcMsSizeAll )
1230  else
1231  LOG(info) << "Recovered MS size canvas in STS monitor";
1232  //====================================================================//
1233 
1234  /*****************************/
1235 }
1236 
1237 Bool_t CbmMcbm2018MonitorStsSync::DoUnpack(const fles::Timeslice& ts,
1238  size_t component) {
1239  if (bMcbm2018ResetStsSync) {
1240  ResetAllHistos();
1241  bMcbm2018ResetStsSync = kFALSE;
1242  } // if( bMcbm2018ResetStsSync )
1243  if (bMcbm2018WriteStsSync) {
1245  bMcbm2018WriteStsSync = kFALSE;
1246  } // if( bMcbm2018WriteStsSync )
1247 
1248  LOG(debug) << "Timeslice contains " << ts.num_microslices(component)
1249  << "microslices.";
1250  fulCurrentTsIdx = ts.index();
1251 
1252  // Ignore overlap ms if flag set by user
1253  UInt_t uNbMsLoop = fuNbCoreMsPerTs;
1254  if (kFALSE == fbIgnoreOverlapMs) uNbMsLoop += fuNbOverMsPerTs;
1255 
1256  // Loop over core microslices (and overlap ones if chosen)
1257  for (UInt_t uMsIdx = 0; uMsIdx < uNbMsLoop; uMsIdx++) {
1258  // Loop over registered components
1259  for (UInt_t uMsCompIdx = 0; uMsCompIdx < fvMsComponentsList.size();
1260  ++uMsCompIdx) {
1261  UInt_t uMsComp = fvMsComponentsList[uMsCompIdx];
1262  auto msDescriptor = ts.descriptor(uMsComp, uMsIdx);
1263  fuCurrentEquipmentId = msDescriptor.eq_id;
1264  const uint8_t* msContent =
1265  reinterpret_cast<const uint8_t*>(ts.content(uMsComp, uMsIdx));
1266 
1267  uint32_t uSize = msDescriptor.size;
1268  fulCurrentMsIdx = msDescriptor.idx;
1269  Double_t dMsTime = (1e-9) * static_cast<double>(fulCurrentMsIdx);
1270 
1271  fuCurrDpbId = static_cast<uint32_t>(fuCurrentEquipmentId & 0xFFFF);
1273 
1274  LOG(debug) << "Microslice: " << fulCurrentMsIdx << " from EqId "
1275  << std::hex << fuCurrentEquipmentId << std::dec << " (DPB Idx "
1276  << std::setw(2) << fuCurrDpbIdx << " )"
1277  << " has size: " << uSize;
1278 
1279  if (uMsComp < kiMaxNbFlibLinks) {
1280  if (fdStartTimeMsSz < 0) fdStartTimeMsSz = dMsTime;
1281  fhMsSz[uMsComp]->Fill(uSize);
1282  fhMsSzTime[uMsComp]->Fill(dMsTime - fdStartTimeMsSz, uSize);
1283  } // if( uMsComp < kiMaxNbFlibLinks )
1284 
1285  // Store MS time for coincidence plots
1286  fvdMsTime[uMsCompIdx] = dMsTime;
1287 
1289  uint16_t uMsHeaderFlags = msDescriptor.flags;
1290  for (UInt_t uBit = 0; uBit < 16; ++uBit)
1291  fhPulserMsStatusFieldType->Fill(uBit, (uMsHeaderFlags >> uBit) & 0x1);
1292 
1294  UInt_t uTsMsbCycleHeader =
1295  std::floor(fulCurrentMsIdx
1298  if (kFALSE == fvuInitialHeaderDone[fuCurrDpbIdx]) {
1299  fvuInitialTsMsbCycleHeader[fuCurrDpbIdx] = uTsMsbCycleHeader;
1301  } // if( kFALSE == fvuInitialHeaderDone[ fuCurrDpbIdx ] )
1302  else if (uTsMsbCycleHeader != fvuCurrentTsMsbCycle[fuCurrDpbIdx]
1303  && 4194303 != fvulCurrentTsMsb[fuCurrDpbIdx]) {
1304  LOG(warning) << "TS MSB cycle from MS header does not match current "
1305  "cycle from data "
1306  << "for TS " << std::setw(12) << fulCurrentTsIdx << " MS "
1307  << std::setw(12) << fulCurrentMsIdx << " MsInTs "
1308  << std::setw(3) << uMsIdx << " ====> "
1309  << fvuCurrentTsMsbCycle[fuCurrDpbIdx] << " VS "
1310  << uTsMsbCycleHeader;
1311  fvuCurrentTsMsbCycle[fuCurrDpbIdx] = uTsMsbCycleHeader;
1312  }
1313 
1314  // If not integer number of message in input buffer, print warning/error
1315  if (0 != (uSize % kuBytesPerMessage))
1316  LOG(error) << "The input microslice buffer does NOT "
1317  << "contain only complete nDPB messages!";
1318 
1319  // Compute the number of complete messages in the input microslice buffer
1320  uint32_t uNbMessages =
1321  (uSize - (uSize % kuBytesPerMessage)) / kuBytesPerMessage;
1322 
1323  // Prepare variables for the loop on contents
1324  const uint32_t* pInBuff = reinterpret_cast<const uint32_t*>(msContent);
1325 
1326 
1327  for (uint32_t uIdx = 0; uIdx < uNbMessages; ++uIdx) {
1328  // Fill message
1329  uint32_t ulData = static_cast<uint32_t>(pInBuff[uIdx]);
1330 
1331  stsxyter::Message mess(static_cast<uint32_t>(ulData & 0xFFFFFFFF));
1332 
1333  // Print message if requested
1334  if (fbPrintMessages) {
1335  std::cout << Form("DPB %2u TS %12llu MS %12llu mess %5u ",
1336  fuCurrDpbIdx,
1339  uIdx);
1340  mess.PrintMess(std::cout, fPrintMessCtrl);
1341  } // if( fbPrintMessages )
1342 
1343  stsxyter::MessType typeMess = mess.GetMessType();
1344  fmMsgCounter[typeMess]++;
1345  fhPulserMessType->Fill(static_cast<uint16_t>(typeMess));
1347  static_cast<uint16_t>(typeMess));
1348 
1349  switch (typeMess) {
1350  case stsxyter::MessType::Hit: {
1351  // Extract the eLink and Asic indices => Should GO IN the fill method now that obly hits are link/asic specific!
1352  UShort_t usElinkIdx = mess.GetLinkIndex();
1353  if (fuNbElinksPerDpb <= usElinkIdx) {
1354  LOG(fatal) << "CbmMcbm2018MonitorStsSync::DoUnpack => "
1355  << "eLink index out of bounds!" << usElinkIdx << " VS "
1356  << fuNbElinksPerDpb;
1357  } // if( fuNbElinksPerDpb <= usElinkIdx )
1359  + usElinkIdx,
1360  static_cast<uint16_t>(typeMess));
1361 
1362  UInt_t uAsicIdx = fvuElinkToAsic[fuCurrDpbIdx][usElinkIdx];
1363 
1364  FillHitInfo(mess, usElinkIdx, uAsicIdx, uMsIdx);
1365  break;
1366  } // case stsxyter::MessType::Hit :
1368  FillTsMsbInfo(mess, uIdx, uMsIdx);
1369  break;
1370  } // case stsxyter::MessType::TsMsb :
1372  // The first message in the TS is a special ones: EPOCH
1373  FillEpochInfo(mess);
1374 
1375  if (0 < uIdx)
1376  LOG(info)
1377  << "CbmMcbm2018MonitorStsSync::DoUnpack => "
1378  << "EPOCH message at unexpected position in MS: message "
1379  << uIdx << " VS message 0 expected!";
1380  break;
1381  } // case stsxyter::MessType::TsMsb :
1383  UShort_t usElinkIdx = mess.GetStatusLink();
1384  UShort_t usStatusField = mess.GetStatusStatus();
1385  fhPulserStatusMessType->Fill(
1386  fuCurrDpbIdx * fuNbElinksPerDpb + usElinkIdx, usStatusField);
1387 
1389  std::cout << Form("DPB %2u TS %12llu MS %12llu mess %5u ",
1390  fuCurrDpbIdx,
1393  uIdx);
1394  mess.PrintMess(std::cout, fPrintMessCtrl);
1395  // FillTsMsbInfo( mess );
1396  break;
1397  } // case stsxyter::MessType::Empty :
1399  // FillTsMsbInfo( mess );
1400  break;
1401  } // case stsxyter::MessType::Empty :
1403  break;
1404  } // case stsxyter::MessType::Dummy / ReadDataAck / Ack :
1405  default: {
1406  LOG(fatal)
1407  << "CbmMcbm2018MonitorStsSync::DoUnpack => "
1408  << "Unknown message type, should never happen, stopping here!";
1409  }
1410  } // switch( mess.GetMessType() )
1411  } // for( uint32_t uIdx = 0; uIdx < uNbMessages; ++uIdx )
1412  } // for( UInt_t uMsComp = 0; uMsComp < fvMsComponentsList.size(); ++uMsComp )
1413 
1415  if (0 < fvmHitsInMs.size()) {
1416  // Sort the buffer of hits
1417  std::sort(fvmHitsInMs.begin(), fvmHitsInMs.end());
1418 
1419  // Make sure we analyse only MS where all ASICs were detected (remove noise and MS borders)
1420  if (fuNbStsXyters != fvmHitsInMs.size())
1421  fvmHitsInMs.erase(fvmHitsInMs.begin(), fvmHitsInMs.end());
1422 
1423  // ULong64_t ulLastHitTime = ( *( fvmHitsInMs.rbegin() ) ).GetTs();
1424  std::vector<stsxyter::FinalHit>::iterator it;
1425  std::vector<stsxyter::FinalHit>::iterator itB;
1426 
1427  // std::chrono::steady_clock::time_point tNow = std::chrono::steady_clock::now();
1428  // Double_t dUnixTimeInRun = std::chrono::duration_cast< std::chrono::seconds >(tNow - ftStartTimeUnix).count();
1429 
1430  for (
1431  it = fvmHitsInMs.begin(); it != fvmHitsInMs.end();
1432  // it != fvmHitsInMs.end() && (*it).GetTs() < ulLastHitTime - 320; // 320 * 3.125 ns = 1000 ns
1433  ++it) {
1434  UShort_t usAsicIdx = (*it).GetAsic();
1435  // UShort_t usChanIdx = (*it).GetChan();
1436  // ULong64_t ulHitTs = (*it).GetTs();
1437  // UShort_t usHitAdc = (*it).GetAdc();
1438 
1439  // Double_t dTimeSinceStartSec = (ulHitTs * stsxyter::kdClockCycleNs - fdStartTime)* 1e-9;
1440 
1441  fvmAsicHitsInMs[usAsicIdx].push_back((*it));
1442  } // loop on time sorted hits and split per asic
1443 
1444  // Remove all hits which were already used
1445  fvmHitsInMs.erase(fvmHitsInMs.begin(), it);
1446 
1447  for (UInt_t uAsic = 0; uAsic < fuNbStsXyters; uAsic++) {
1448  for (it = fvmAsicHitsInMs[uAsic].begin();
1449  it != fvmAsicHitsInMs[uAsic].end();
1450  ++it) {
1451  // UShort_t usChanIdx = (*it).GetChan();
1452  if (0.0 == fdStartTs)
1453  fdStartTs = (*it).GetTs() * stsxyter::kdClockCycleNs;
1454  Double_t dTimeSinceStartSec =
1455  ((*it).GetTs() * stsxyter::kdClockCycleNs - fdStartTs) * 1e-9;
1456 
1457  for (UInt_t uAsicB = uAsic; uAsicB < fuNbStsXyters; uAsicB++) {
1458  for (itB = fvmAsicHitsInMs[uAsicB].begin();
1459  itB != fvmAsicHitsInMs[uAsicB].end();
1460  ++itB) {
1461  // UShort_t usChanIdxB = (*itB).GetChan();
1462  Double_t dDtClk = static_cast<Double_t>((*itB).GetTs())
1463  - static_cast<Double_t>((*it).GetTs());
1464  Double_t dDt = dDtClk * stsxyter::kdClockCycleNs;
1465  Double_t dDtRaw = (static_cast<Double_t>(
1466  (*itB).GetTs() % stsxyter::kulTsCycleNbBins)
1467  - static_cast<Double_t>(
1468  (*it).GetTs() % stsxyter::kulTsCycleNbBins))
1470 
1471  fhPulserTimeDiffPerAsic[uAsic]->Fill(dDt, uAsicB);
1472  fhPulserTimeDiffPerAsicPair[uAsic][uAsicB]->Fill(dDt);
1473  fhPulserTimeDiffClkPerAsicPair[uAsic][uAsicB]->Fill(dDtClk);
1474  fhPulserTimeDiffEvoPerAsicPair[uAsic][uAsicB]->Fill(
1475  dTimeSinceStartSec, dDt);
1476  fhPulserTimeDiffEvoPerAsicPairProf[uAsic][uAsicB]->Fill(
1477  dTimeSinceStartSec, dDt);
1478  fhPulserRawTimeDiffEvoPerAsicPairProf[uAsic][uAsicB]->Fill(
1479  dTimeSinceStartSec, dDtRaw);
1480 
1481  fhPulserTsLsbMatchPerAsicPair[uAsic][uAsicB]->Fill(
1482  (*it).GetTs() & 0x000FF, (*itB).GetTs() & 0x000FF);
1483  fhPulserTsMsbMatchPerAsicPair[uAsic][uAsicB]->Fill(
1484  ((*it).GetTs() & 0x03F00) >> 8,
1485  ((*itB).GetTs() & 0x03F00) >> 8);
1486  /*
1487  Int_t iDtLsb = static_cast< Int_t >( (*itB).GetTs() & 0x000FF )
1488  - static_cast< Int_t >( (*it ).GetTs() & 0x000FF );
1489 */
1490  Int_t iDtLsb =
1491  (((*itB).GetTs() & 0x000FF) > ((*it).GetTs() & 0x000FF)
1492  ? (*itB).GetTs() & 0x000FF
1493  : 255 + ((*itB).GetTs() & 0x000FF))
1494  - ((*it).GetTs() & 0x000FF);
1495  Int_t iDtMsb =
1496  static_cast<Int_t>(((*itB).GetTs() & 0x03F00) >> 8)
1497  - static_cast<Int_t>(((*it).GetTs() & 0x03F00) >> 8);
1498  fhPulserTsLsbDiffEvoPerAsicPairProf[uAsic][uAsicB]->Fill(
1499  dTimeSinceStartSec, iDtLsb);
1500  fhPulserTsMsbDiffEvoPerAsicPairProf[uAsic][uAsicB]->Fill(
1501  dTimeSinceStartSec, iDtMsb);
1502 
1503  if (
1504  (kdPulserPeriod * -0.5 < dDt && dDt < kdPulserPeriod * 0.5
1505  && 10 < (*it).GetAdc() && 10 < (*itB).GetAdc()) // &&
1506  // !( 2 == uAsic && 3 == uAsicB && 240 < dDt )
1507  ) {
1508  /*
1509  if( ( dDt < fvdMeanTimeDiffAsicPair[ uAsic ][ uAsicB ] - kdTimeDiffToMeanMargin ||
1510  dDt > fvdMeanTimeDiffAsicPair[ uAsic ][ uAsicB ] + kdTimeDiffToMeanMargin )
1511  && !( 3 == uAsicB )
1512 
1513  )
1514  {
1515  LOG(info) << "CbmCosy2018MonitorPulser::DoUnpack => "
1516  << " TS " << std::setw( 12 ) << fulCurrentTsIdx
1517  << " MS " << std::setw( 12 ) << fulCurrentMsIdx
1518  << " Potential jump in timestamp for ASIC "
1519  << uAsic << " and " << uAsicB
1520  << ": time diff is " << std::setw( 8 ) << dDt
1521  << " while mean time diff of last " << kuNbValuesForTimeDiffMean
1522  << " pairs is " << std::setw( 8 ) << fvdMeanTimeDiffAsicPair[ uAsic ][ uAsicB ];
1523  LOG(info) << "CbmCosy2018MonitorPulser::DoUnpack => "
1524  << " Buffer slot idx is " << std::setw( 3 ) << fvuLastTimeDiffSlotAsicPair[ uAsic ][ uAsicB ]
1525  << " Buffer size is " << std::setw( 3 ) << fvdLastTimeDiffValuesAsicPair[ uAsic ][ uAsicB ].size();
1526 
1527  } // if dDt outside of MeanTimeDiffPair +/- margin
1528 */
1529  UpdatePairMeanValue(uAsic, uAsicB, dDt);
1530  } // if( kdPulserPeriod * -0.5 < dDt && dDt < kdPulserPeriod * 0.5 )
1531  } // for( it = fvmAsicHitsInMs[ uAsicB ].begin(); it != fvmAsicHitsInMs[ uAsicB ].end(); ++it )
1532  } // for( UInt_t uAsic = 0; uAsic < fuNbStsXyters; uAsic++)
1533 
1534  Double_t dDtPulse =
1535  (static_cast<Double_t>((*it).GetTs())
1536  - static_cast<Double_t>(fvmLastHitAsic[uAsic].GetTs()))
1538  fhPulserIntervalAsic[uAsic]->Fill(dDtPulse);
1539  fhPulserIntervalLongAsic[uAsic]->Fill(dDtPulse);
1540  fvmLastHitAsic[uAsic] = (*it);
1541  } // for( it = fvmAsicHitsInMs[ uAsic ].begin(); it != fvmAsicHitsInMs[ uAsic ].end(); ++it )
1542 
1544  fvmAsicHitsInMs[uAsic].clear();
1545  } // for( UInt_t uAsic = 0; uAsic < fuNbStsXyters; uAsic++)
1546  } // if( 0 < fvmHitsInMs.size() )
1547  } // for( UInt_t uMsIdx = 0; uMsIdx < uNbMsLoop; uMsIdx ++ )
1548  for (UInt_t uMsIdx = 0; uMsIdx < fuMaxNbMicroslices; ++uMsIdx) {
1549  fvdMsTime[uMsIdx] = 0.0;
1550  } // for( UInt_t uMsIdx = 0; uMsIdx < fuMaxNbMicroslices; ++uMsIdx )
1551 
1552  if (0 == ts.index() % 1000) {
1553  for (UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb) {
1554  Double_t dTsMsbTime =
1555  static_cast<ULong64_t>(stsxyter::kuHitNbTsBins)
1556  * static_cast<ULong64_t>(fvulCurrentTsMsb[fuCurrDpbIdx])
1557  + static_cast<ULong64_t>(stsxyter::kulTsCycleNbBins)
1558  * static_cast<ULong64_t>(fvuCurrentTsMsbCycle[fuCurrDpbIdx]);
1559  dTsMsbTime *= stsxyter::kdClockCycleNs * 1e-9;
1560 
1561  LOG(info) << "End of TS " << std::setw(7) << ts.index() << " eDPB "
1562  << std::setw(2) << uDpb << " current TS MSB counter is "
1563  << std::setw(12) << fvulCurrentTsMsb[uDpb]
1564  << " current TS MSB cycle counter is " << std::setw(12)
1565  << fvuCurrentTsMsbCycle[uDpb] << " current TS MSB time is "
1566  << std::setw(12) << dTsMsbTime << " s";
1567  }
1568  } // if( 0 == ts.index() % 1000 )
1569 
1570  if (0 == ts.index() % 10000)
1571  SavePulserHistos("data/PulserPeriodicHistosSave.root");
1572 
1573  return kTRUE;
1574 }
1575 
1577  const UShort_t& /*usElinkIdx*/,
1578  const UInt_t& uAsicIdx,
1579  const UInt_t& uMsIdx) {
1580  UShort_t usChan = mess.GetHitChannel();
1581  UShort_t usRawAdc = mess.GetHitAdc();
1582  // UShort_t usFullTs = mess.GetHitTimeFull();
1583  // UShort_t usTsOver = mess.GetHitTimeOver();
1584  UShort_t usRawTs = mess.GetHitTime();
1585 
1586  fhPulserChanCntRaw[uAsicIdx]->Fill(usChan);
1587  fhPulserChanAdcRaw[uAsicIdx]->Fill(usChan, usRawAdc);
1588  fhPulserChanAdcRawProf[uAsicIdx]->Fill(usChan, usRawAdc);
1589  fhPulserChanRawTs[uAsicIdx]->Fill(usChan, usRawTs);
1590  fhPulserChanMissEvt[uAsicIdx]->Fill(usChan, mess.IsHitMissedEvts());
1591 
1592  // Compute the Full time stamp
1593  // Long64_t ulOldHitTime = fvulChanLastHitTime[ uAsicIdx ][ usChan ];
1594  // Double_t dOldHitTime = fvdChanLastHitTime[ uAsicIdx ][ usChan ];
1595 
1596  // Use TS w/o overlap bits as they will anyway come from the TS_MSB
1597  fvulChanLastHitTime[uAsicIdx][usChan] = usRawTs;
1598 
1599  fvulChanLastHitTime[uAsicIdx][usChan] +=
1600  static_cast<ULong64_t>(stsxyter::kuHitNbTsBins)
1601  * static_cast<ULong64_t>(fvulCurrentTsMsb[fuCurrDpbIdx])
1602  + static_cast<ULong64_t>(stsxyter::kulTsCycleNbBins)
1603  * static_cast<ULong64_t>(fvuCurrentTsMsbCycle[fuCurrDpbIdx]);
1604 
1605  // fvuElinkLastTsHit[fuCurrDpbIdx] = usRawTs;
1606 
1607  // Convert the Hit time in bins to Hit time in ns
1608  Double_t dHitTimeNs =
1609  fvulChanLastHitTime[uAsicIdx][usChan] * stsxyter::kdClockCycleNs;
1610  /*
1611  // If needed fill the hit interval plots
1612  if( fbChanHitDtEna )
1613  {
1614  Double_t dDeltaT = dHitTimeNs - fvdChanLastHitTime[ uAsicIdx ][ usChan ];
1615  if( 0 == dDeltaT )
1616  fhStsChanHitDtNeg[ uAsicIdx ]->Fill( 1, usChan );
1617  else if( 0 < dDeltaT )
1618  fhStsChanHitDt[ uAsicIdx ]->Fill( dDeltaT, usChan );
1619  else fhStsChanHitDtNeg[ uAsicIdx ]->Fill( -dDeltaT, usChan );
1620  } // if( fbChanHitDtEna )
1621 */
1622  // Store new value of Hit time in ns
1623  fvdChanLastHitTime[uAsicIdx][usChan] =
1624  fvulChanLastHitTime[uAsicIdx][usChan] * stsxyter::kdClockCycleNs;
1625  /*
1626  LOG(info) << " Asic " << std::setw( 2 ) << uAsicIdx
1627  << " Channel " << std::setw( 3 ) << usChan
1628  << " Diff to last hit " << std::setw( 12 ) << ( fvulChanLastHitTime[ uAsicIdx ][ usChan ] - ulOldHitTime)
1629  << " in s " << std::setw( 12 ) << ( fvdChanLastHitTime[ uAsicIdx ][ usChan ] - dOldHitTime) * 1e-9;
1630 */
1631  // Pulser and MS
1632  fvuChanNbHitsInMs[uAsicIdx][usChan][uMsIdx]++;
1633  fvdChanLastHitTimeInMs[uAsicIdx][usChan][uMsIdx] = dHitTimeNs;
1634  fvusChanLastHitAdcInMs[uAsicIdx][usChan][uMsIdx] = usRawAdc;
1635  /*
1636  fvmChanHitsInTs[ uAsicIdx ][ usChan ].insert( stsxyter::FinalHit( fvulChanLastHitTime[ uAsicIdx ][ usChan ],
1637  usRawAdc, uAsicIdx, usChan ) );
1638 */
1639  fvmHitsInMs.push_back(stsxyter::FinalHit(
1640  fvulChanLastHitTime[uAsicIdx][usChan], usRawAdc, uAsicIdx, usChan));
1641 
1642  /*
1643  if( ( 214514 < fulCurrentTsIdx && fulCurrentTsIdx < 214517 ) ||
1644  ( 260113 < fulCurrentTsIdx && fulCurrentTsIdx < 260116 ) ||
1645  ( 388109 < fulCurrentTsIdx && fulCurrentTsIdx < 388114 ) ||
1646  ( 573361 < fulCurrentTsIdx && fulCurrentTsIdx < 573364 ) ||
1647  ( 661731 < fulCurrentTsIdx && fulCurrentTsIdx < 661734 ) ||
1648  ( 712982 < fulCurrentTsIdx && fulCurrentTsIdx < 712985 ) ||
1649  ( 713857 < fulCurrentTsIdx && fulCurrentTsIdx < 713860 ) ||
1650  ( 739365 < fulCurrentTsIdx && fulCurrentTsIdx < 739368 ))
1651  {
1652  LOG(info) << " TS " << std::setw( 12 ) << fulCurrentTsIdx
1653  << " MS " << std::setw( 12 ) << fulCurrentMsIdx
1654  << " MsInTs " << std::setw( 3 ) << uMsIdx
1655  << " Asic " << std::setw( 2 ) << uAsicIdx
1656  << " Channel " << std::setw( 3 ) << usChan
1657  << " ADC " << std::setw( 3 ) << usRawAdc
1658  << " TS " << std::setw( 3 ) << usRawTs // 9 bits TS
1659  << " SX TsMsb " << std::setw( 2 ) << ( fvulCurrentTsMsb[fuCurrDpbIdx] & 0x1F ) // Total StsXyter TS = 14 bits => 9b Hit TS + lower 5b TS_MSB after DPB
1660  << " DPB TsMsb " << std::setw( 6 ) << ( fvulCurrentTsMsb[fuCurrDpbIdx] >> 5 ) // Total StsXyter TS = 14 bits => 9b Hit TS + lower 5b of TS_MSB after DPB
1661  << " TsMsb " << std::setw( 7 ) << fvulCurrentTsMsb[fuCurrDpbIdx]
1662  << " TS(b) " << std::bitset<9>(usRawTs)
1663  << " TSM(b) " << std::bitset<24>(fvulCurrentTsMsb[fuCurrDpbIdx])
1664  << " MsbCy " << std::setw( 4 ) << fvuCurrentTsMsbCycle[fuCurrDpbIdx]
1665  << " Time " << std::setw ( 12 ) << fvulChanLastHitTime[ uAsicIdx ][ usChan ];
1666  }
1667 */
1668  // Check Starting point of histos with time as X axis
1669  if (-1 == fdStartTime) fdStartTime = fvdChanLastHitTime[uAsicIdx][usChan];
1670 
1671  // Fill histos with time as X axis
1672  Double_t dTimeSinceStartSec =
1673  (fvdChanLastHitTime[uAsicIdx][usChan] - fdStartTime) * 1e-9;
1674  Double_t dTimeSinceStartMin = dTimeSinceStartSec / 60.0;
1675  fhPulserChanHitRateEvo[uAsicIdx]->Fill(dTimeSinceStartSec, usChan);
1676  fhPulserFebRateEvo[uAsicIdx]->Fill(dTimeSinceStartSec);
1677  fhPulserChanHitRateEvoLong[uAsicIdx]->Fill(
1678  dTimeSinceStartMin, usChan, 1.0 / 60.0);
1679  fhPulserFebRateEvoLong[uAsicIdx]->Fill(dTimeSinceStartMin, 1.0 / 60.0);
1680  if (mess.IsHitMissedEvts()) {
1681  fhPulserChanMissEvtEvo[uAsicIdx]->Fill(dTimeSinceStartSec, usChan);
1682  fhPulserFebMissEvtEvo[uAsicIdx]->Fill(dTimeSinceStartSec);
1683  } // if( mess.IsHitMissedEvts() )
1684  /*
1685  if( kTRUE == fbLongHistoEnable )
1686  {
1687  std::chrono::steady_clock::time_point tNow = std::chrono::steady_clock::now();
1688  Double_t dUnixTimeInRun = std::chrono::duration_cast< std::chrono::seconds >(tNow - ftStartTimeUnix).count();
1689  fhFebRateEvoLong[ uAsicIdx ]->Fill( dUnixTimeInRun , 1.0 / fuLongHistoBinSizeSec );
1690  fhFebChRateEvoLong[ uAsicIdx ]->Fill( dUnixTimeInRun , usChan, 1.0 / fuLongHistoBinSizeSec );
1691  } // if( kTRUE == fbLongHistoEnable )
1692 */
1693 }
1694 
1696  UInt_t uMessIdx,
1697  UInt_t uMsIdx) {
1698  UInt_t uVal = mess.GetTsMsbVal();
1699  /*
1700  if( ( 419369 < fulCurrentTsIdx && fulCurrentTsIdx < 419371 ) )
1701  LOG(info) << " TS " << std::setw( 12 ) << fulCurrentTsIdx
1702  << " MS " << std::setw( 12 ) << fulCurrentMsIdx
1703  << " MsInTs " << std::setw( 3 ) << uMsIdx
1704  << " DPB " << std::setw( 2 ) << fuCurrDpbIdx
1705  << " Mess " << std::setw( 5 ) << uMessIdx
1706  << " TsMsb " << std::setw( 5 ) << uVal;
1707 */
1708  /*
1709  if( (uVal != fvulCurrentTsMsb[fuCurrDpbIdx] + 1) && 0 < uVal &&
1710  !( 1 == uMessIdx && usVal == fvulCurrentTsMsb[fuCurrDpbIdx] ) ) // 1st TS_MSB in MS is always a repeat of the last one in previous MS!
1711  {
1712  LOG(info) << "TS MSB not increasing by 1! TS " << std::setw( 12 ) << fulCurrentTsIdx
1713  << " MS " << std::setw( 12 ) << fulCurrentMsIdx
1714  << " MsInTs " << std::setw( 3 ) << uMsIdx
1715  << " DPB " << std::setw( 2 ) << fuCurrDpbIdx
1716  << " Mess " << std::setw( 5 ) << uMessIdx
1717  << " Old TsMsb " << std::setw( 5 ) << fvulCurrentTsMsb[fuCurrDpbIdx]
1718  << " new TsMsb " << std::setw( 5 ) << uVal
1719  << " Diff " << std::setw( 5 ) << uVal - fvulCurrentTsMsb[fuCurrDpbIdx]
1720  << " Old MsbCy " << std::setw( 5 ) << fvuCurrentTsMsbCycle[fuCurrDpbIdx];
1721  } // if( (uVal != fvulCurrentTsMsb[fuCurrDpbIdx] + 1) && 0 < uVal )
1722 */
1723 
1724  // Update Status counters
1725  if (uVal < fvulCurrentTsMsb[fuCurrDpbIdx]) {
1726 
1727  LOG(info) << " TS " << std::setw(12) << fulCurrentTsIdx << " MS "
1728  << std::setw(12) << fulCurrentMsIdx << " MS Idx " << std::setw(4)
1729  << uMsIdx << " Msg Idx " << std::setw(5) << uMessIdx << " DPB "
1730  << std::setw(2) << fuCurrDpbIdx << " Old TsMsb " << std::setw(5)
1731  << fvulCurrentTsMsb[fuCurrDpbIdx] << " Old MsbCy " << std::setw(5)
1732  << fvuCurrentTsMsbCycle[fuCurrDpbIdx] << " new TsMsb "
1733  << std::setw(5) << uVal;
1734 
1736  } // if( uVal < fvulCurrentTsMsb[fuCurrDpbIdx] )
1737  if (uVal != fvulCurrentTsMsb[fuCurrDpbIdx] + 1 && 0 != uVal
1738  && 4194303 != fvulCurrentTsMsb[fuCurrDpbIdx] && 1 != uMessIdx) {
1739  LOG(info) << "TS MSb Jump in "
1740  << " TS " << std::setw(12) << fulCurrentTsIdx << " MS "
1741  << std::setw(12) << fulCurrentMsIdx << " MS Idx " << std::setw(4)
1742  << uMsIdx << " Msg Idx " << std::setw(5) << uMessIdx << " DPB "
1743  << std::setw(2) << fuCurrDpbIdx << " => Old TsMsb "
1744  << std::setw(5) << fvulCurrentTsMsb[fuCurrDpbIdx] << " new TsMsb "
1745  << std::setw(5) << uVal;
1746  } // if( uVal + 1 != fvulCurrentTsMsb[fuCurrDpbIdx] && 4194303 != uVal && 0 != fvulCurrentTsMsb[fuCurrDpbIdx] )
1748  /*
1749  if( 1 < uMessIdx )
1750  {
1751  fhStsDpbRawTsMsb->Fill( fuCurrDpbIdx, fvulCurrentTsMsb[fuCurrDpbIdx] );
1752  fhStsDpbRawTsMsbSx->Fill( fuCurrDpbIdx, ( fvulCurrentTsMsb[fuCurrDpbIdx] & 0x1F ) );
1753  fhStsDpbRawTsMsbDpb->Fill( fuCurrDpbIdx, ( fvulCurrentTsMsb[fuCurrDpbIdx] >> 5 ) );
1754  } // if( 0 < uMessIdx )
1755 */
1756  // fhStsAsicTsMsb->Fill( fvulCurrentTsMsb[fuCurrDpbIdx], uAsicIdx );
1757  /*
1758  ULong64_t ulNewTsMsbTime = static_cast< ULong64_t >( stsxyter::kuHitNbTsBins )
1759  * static_cast< ULong64_t >( fvulCurrentTsMsb[fuCurrDpbIdx])
1760  + static_cast< ULong64_t >( stsxyter::kulTsCycleNbBins )
1761  * static_cast< ULong64_t >( fvuCurrentTsMsbCycle[fuCurrDpbIdx] );
1762 */
1763 }
1764 
1766  // UInt_t uVal = mess.GetEpochVal();
1767  // UInt_t uCurrentCycle = uVal % stsxyter::kulTsCycleNbBins;
1768 
1769  /*
1770  // Update Status counters
1771  if( usVal < fvulCurrentTsMsb[fuCurrDpbIdx] )
1772  fvuCurrentTsMsbCycle[fuCurrDpbIdx] ++;
1773  fvulCurrentTsMsb[fuCurrDpbIdx] = usVal;
1774 
1775 // fhStsAsicTsMsb->Fill( fvulCurrentTsMsb[fuCurrDpbIdx], uAsicIdx );
1776 */
1777 }
1778 
1780 
1782 
1783  LOG(info) << "-------------------------------------";
1784  LOG(info) << "CbmMcbm2018MonitorStsSync statistics are ";
1785  LOG(info) << " Hit messages: " << fmMsgCounter[stsxyter::MessType::Hit]
1786  << "\n"
1787  << " Ts MSB messages: " << fmMsgCounter[stsxyter::MessType::TsMsb]
1788  << "\n"
1789  << " Dummy messages: " << fmMsgCounter[stsxyter::MessType::Dummy]
1790  << "\n"
1791  << " Epoch messages: " << fmMsgCounter[stsxyter::MessType::Epoch]
1792  << "\n"
1793  << " Empty messages: "
1795 
1796  LOG(info) << "-------------------------------------";
1797 
1799  SaveAllHistos();
1800 }
1801 
1803  TDirectory* oldDir = NULL;
1804  TFile* histoFile = NULL;
1805  if ("" != sFileName) {
1806  // Store current directory position to allow restore later
1807  oldDir = gDirectory;
1808  // open separate histo file in recreate mode
1809  histoFile = new TFile(sFileName, "RECREATE");
1810  histoFile->cd();
1811  } // if( "" != sFileName )
1812 
1813  /***************************/
1814  gDirectory->mkdir("Sts_Raw");
1815  gDirectory->cd("Sts_Raw");
1816 
1817  fhPulserMessType->Write();
1818  fhPulserSysMessType->Write();
1819  fhPulserMessTypePerDpb->Write();
1820  fhPulserSysMessTypePerDpb->Write();
1821  fhPulserMessTypePerElink->Write();
1822  fhPulserSysMessTypePerElink->Write();
1823  fhPulserStatusMessType->Write();
1824  fhPulserMsStatusFieldType->Write();
1825 
1826  for (UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx) {
1827  fhPulserChanCntRaw[uXyterIdx]->Write();
1828  fhPulserChanAdcRaw[uXyterIdx]->Write();
1829  fhPulserChanAdcRawProf[uXyterIdx]->Write();
1830  fhPulserChanRawTs[uXyterIdx]->Write();
1831  fhPulserChanMissEvt[uXyterIdx]->Write();
1832  fhPulserChanMissEvtEvo[uXyterIdx]->Write();
1833  fhPulserFebMissEvtEvo[uXyterIdx]->Write();
1834  fhPulserChanHitRateEvo[uXyterIdx]->Write();
1835  fhPulserFebRateEvo[uXyterIdx]->Write();
1836  fhPulserChanHitRateEvoLong[uXyterIdx]->Write();
1837  fhPulserFebRateEvoLong[uXyterIdx]->Write();
1838  /*
1839  if( kTRUE == fbLongHistoEnable )
1840  {
1841  fhFebRateEvoLong[ uXyterIdx ]->Write();
1842  fhFebChRateEvoLong[ uXyterIdx ]->Write();
1843  } // if( kTRUE == fbLongHistoEnable )
1844 */
1845  } // for( UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx )
1846 
1847  gDirectory->cd("..");
1848  /***************************/
1849 
1850  /***************************/
1851  gDirectory->mkdir("Sts_Pulser");
1852  gDirectory->cd("Sts_Pulser");
1853 
1854  for (UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx) {
1855  fhPulserTimeDiffPerAsic[uXyterIdx]->Write();
1856  for (UInt_t uXyterIdxB = 0; uXyterIdxB < fuNbStsXyters; ++uXyterIdxB) {
1857  fhPulserTimeDiffPerAsicPair[uXyterIdx][uXyterIdxB]->Write();
1858  fhPulserTimeDiffClkPerAsicPair[uXyterIdx][uXyterIdxB]->Write();
1859  fhPulserTimeDiffEvoPerAsicPair[uXyterIdx][uXyterIdxB]->Write();
1860  fhPulserTimeDiffEvoPerAsicPairProf[uXyterIdx][uXyterIdxB]->Write();
1861  fhPulserRawTimeDiffEvoPerAsicPairProf[uXyterIdx][uXyterIdxB]->Write();
1862  fhPulserTsLsbMatchPerAsicPair[uXyterIdx][uXyterIdxB]->Write();
1863  fhPulserTsMsbMatchPerAsicPair[uXyterIdx][uXyterIdxB]->Write();
1864  fhPulserTsLsbDiffEvoPerAsicPairProf[uXyterIdx][uXyterIdxB]->Write();
1865  fhPulserTsMsbDiffEvoPerAsicPairProf[uXyterIdx][uXyterIdxB]->Write();
1866  } // for( UInt_t uXyterIdxB = 0; uXyterIdxB < fuNbStsXyters; ++uXyterIdxB )
1867  fhPulserIntervalAsic[uXyterIdx]->Write();
1868  fhPulserIntervalLongAsic[uXyterIdx]->Write();
1869  } // for( UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx )
1870 
1871  gDirectory->cd("..");
1872  /***************************/
1873 
1874  /***************************/
1875  // Flib Histos
1876  gDirectory->mkdir("Flib_Raw");
1877  gDirectory->cd("Flib_Raw");
1878  for (UInt_t uLinks = 0; uLinks < kiMaxNbFlibLinks; uLinks++) {
1879  TString sMsSzName = Form("MsSz_link_%02u", uLinks);
1880  if (fHM->Exists(sMsSzName.Data())) fHM->H1(sMsSzName.Data())->Write();
1881 
1882  sMsSzName = Form("MsSzTime_link_%02u", uLinks);
1883  if (fHM->Exists(sMsSzName.Data())) fHM->P1(sMsSzName.Data())->Write();
1884  } // for( UInt_t uLinks = 0; uLinks < 16; uLinks ++)
1885 
1886  TH1* pMissedTsH1 = dynamic_cast<TH1*>(gROOT->FindObjectAny("Missed_TS"));
1887  if (NULL != pMissedTsH1) pMissedTsH1->Write();
1888 
1889  TProfile* pMissedTsEvoP =
1890  dynamic_cast<TProfile*>(gROOT->FindObjectAny("Missed_TS_Evo"));
1891  if (NULL != pMissedTsEvoP) pMissedTsEvoP->Write();
1892 
1893  gDirectory->cd("..");
1894  /***************************/
1895 
1896  if ("" != sFileName) {
1897  // Restore original directory position
1898  histoFile->Close();
1899  oldDir->cd();
1900  } // if( "" != sFileName )
1901 }
1903  TDirectory* oldDir = NULL;
1904  TFile* histoFile = NULL;
1905  if ("" != sFileName) {
1906  // Store current directory position to allow restore later
1907  oldDir = gDirectory;
1908  // open separate histo file in recreate mode
1909  histoFile = new TFile(sFileName, "RECREATE");
1910  histoFile->cd();
1911  } // if( "" != sFileName )
1912 
1913  /***************************/
1914  gDirectory->mkdir("Sts_Pulser");
1915  gDirectory->cd("Sts_Pulser");
1916 
1917  for (UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx) {
1918  for (UInt_t uXyterIdxB = 0; uXyterIdxB < fuNbStsXyters; ++uXyterIdxB) {
1919  fhPulserTimeDiffEvoPerAsicPairProf[uXyterIdx][uXyterIdxB]->Write();
1920  fhPulserRawTimeDiffEvoPerAsicPairProf[uXyterIdx][uXyterIdxB]->Write();
1921  } // for( UInt_t uXyterIdxB = 0; uXyterIdxB < fuNbStsXyters; ++uXyterIdxB )
1922  } // for( UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx )
1923 
1924  gDirectory->cd("..");
1925  /***************************/
1926 
1927  if ("" != sFileName) {
1928  // Restore original directory position
1929  histoFile->Close();
1930  oldDir->cd();
1931  } // if( "" != sFileName )
1932 }
1934  LOG(info) << "Reseting all STS histograms.";
1935 
1936  fhPulserMessType->Reset();
1937  fhPulserSysMessType->Reset();
1938  fhPulserMessTypePerDpb->Reset();
1939  fhPulserSysMessTypePerDpb->Reset();
1940  fhPulserMessTypePerElink->Reset();
1941  fhPulserSysMessTypePerElink->Reset();
1942  fhPulserStatusMessType->Reset();
1943  fhPulserMsStatusFieldType->Reset();
1944 
1945  for (UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx) {
1946  fhPulserChanCntRaw[uXyterIdx]->Reset();
1947  fhPulserChanAdcRaw[uXyterIdx]->Reset();
1948  fhPulserChanAdcRawProf[uXyterIdx]->Reset();
1949  fhPulserChanRawTs[uXyterIdx]->Reset();
1950  fhPulserChanMissEvt[uXyterIdx]->Reset();
1951  fhPulserChanMissEvtEvo[uXyterIdx]->Reset();
1952  fhPulserFebMissEvtEvo[uXyterIdx]->Reset();
1953  fhPulserChanHitRateEvo[uXyterIdx]->Reset();
1954  fhPulserFebRateEvo[uXyterIdx]->Reset();
1955  fhPulserChanHitRateEvoLong[uXyterIdx]->Reset();
1956  fhPulserFebRateEvoLong[uXyterIdx]->Reset();
1957  /*
1958  if( kTRUE == fbLongHistoEnable )
1959  {
1960  ftStartTimeUnix = std::chrono::steady_clock::now();
1961  fhFebRateEvoLong[ uXyterIdx ]->Reset();
1962  fhFebChRateEvoLong[ uXyterIdx ]->Reset();
1963  } // if( kTRUE == fbLongHistoEnable )
1964 */
1965 
1966  fhPulserTimeDiffPerAsic[uXyterIdx]->Reset();
1967  for (UInt_t uXyterIdxB = 0; uXyterIdxB < fuNbStsXyters; ++uXyterIdxB) {
1968  fhPulserTimeDiffPerAsicPair[uXyterIdx][uXyterIdxB]->Reset();
1969  fhPulserTimeDiffClkPerAsicPair[uXyterIdx][uXyterIdxB]->Reset();
1970  fhPulserTimeDiffEvoPerAsicPair[uXyterIdx][uXyterIdxB]->Reset();
1971  fhPulserTimeDiffEvoPerAsicPairProf[uXyterIdx][uXyterIdxB]->Reset();
1972  fhPulserRawTimeDiffEvoPerAsicPairProf[uXyterIdx][uXyterIdxB]->Reset();
1973  fhPulserTsLsbMatchPerAsicPair[uXyterIdx][uXyterIdxB]->Reset();
1974  fhPulserTsMsbMatchPerAsicPair[uXyterIdx][uXyterIdxB]->Reset();
1975  fhPulserTsLsbDiffEvoPerAsicPairProf[uXyterIdx][uXyterIdxB]->Reset();
1976  fhPulserTsMsbDiffEvoPerAsicPairProf[uXyterIdx][uXyterIdxB]->Reset();
1977  } // for( UInt_t uXyterIdxB = 0; uXyterIdxB < fuNbStsXyters; ++uXyterIdxB )
1978  fhPulserIntervalAsic[uXyterIdx]->Reset();
1979  fhPulserIntervalLongAsic[uXyterIdx]->Reset();
1980  } // for( UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx )
1981 
1982  for (UInt_t uLinks = 0; uLinks < kiMaxNbFlibLinks; ++uLinks) {
1983  TString sMsSzName = Form("MsSz_link_%02u", uLinks);
1984  if (fHM->Exists(sMsSzName.Data())) fHM->H1(sMsSzName.Data())->Reset();
1985 
1986  sMsSzName = Form("MsSzTime_link_%02u", uLinks);
1987  if (fHM->Exists(sMsSzName.Data())) fHM->P1(sMsSzName.Data())->Reset();
1988  } // for( UInt_t uLinks = 0; uLinks < kiMaxNbFlibLinks; ++uLinks )
1989 
1990  fdStartTime = -1;
1991  fdStartTimeMsSz = -1;
1992 }
1993 
1995  UInt_t uAsicB,
1996  Double_t dNewValue) {
1997  if (fvuLastTimeDiffSlotAsicPair.size() < uAsicA) {
1998  LOG(warning) << "CbmMcbm2018MonitorStsSync::UpdatePairMeanValue => wrong "
1999  "ASIC A value: "
2000  << uAsicA << " VS " << fvuLastTimeDiffSlotAsicPair.size();
2001  return;
2002  } // if( fvuLastTimeDiffSlotAsicPair.size() < uAsicA )
2003  if (fvuLastTimeDiffSlotAsicPair[uAsicA].size() < uAsicB) {
2004  LOG(warning) << "CbmMcbm2018MonitorStsSync::UpdatePairMeanValue => wrong "
2005  "ASIC B value: "
2006  << uAsicB << " VS "
2007  << fvuLastTimeDiffSlotAsicPair[uAsicA].size();
2008  return;
2009  } // if( fvuLastTimeDiffSlotAsicPair[ uAsicA ].size() < uAsicB )
2010 
2012  == fvdLastTimeDiffValuesAsicPair[uAsicA][uAsicB].size()) {
2013  fvdLastTimeDiffValuesAsicPair[uAsicA][uAsicB]
2014  [fvuLastTimeDiffSlotAsicPair[uAsicA][uAsicB]] =
2015  dNewValue;
2016  fvuLastTimeDiffSlotAsicPair[uAsicA][uAsicB] =
2017  (fvuLastTimeDiffSlotAsicPair[uAsicA][uAsicB] + 1)
2019  } // if( kuNbValuesForTimeDiffMean == fvdLastTimeDiffValuesAsicPair[ uAsicA ][ uAsicB ].size() )
2020  else
2021  fvdLastTimeDiffValuesAsicPair[uAsicA][uAsicB].push_back(dNewValue);
2022 
2023  Double_t dNewMean = 0.0;
2024  UInt_t uNbVal = fvdLastTimeDiffValuesAsicPair[uAsicA][uAsicB].size();
2025  for (UInt_t uIdx = 0; uIdx < uNbVal; ++uIdx)
2026  dNewMean += fvdLastTimeDiffValuesAsicPair[uAsicA][uAsicB][uIdx];
2027  dNewMean /= uNbVal;
2028 
2029  fvdMeanTimeDiffAsicPair[uAsicA][uAsicB] = dNewMean;
2030 }
2031 
2033  Int_t timeIn,
2034  Int_t iBinSize) {
2035  TDatime* fRunStartDateTime = new TDatime(dateIn, timeIn);
2036  fiRunStartDateTimeSec = fRunStartDateTime->Convert();
2037  fiBinSizeDatePlots = iBinSize;
2038 
2039  LOG(info) << "Assigned new MUCH Run Start Date-Time: "
2040  << fRunStartDateTime->AsString();
2041 }
2042 
2044  UInt_t uBinSize) {
2045  fbLongHistoEnable = kTRUE;
2046  fuLongHistoNbSeconds = uDurationSeconds;
2047  fuLongHistoBinSizeSec = uBinSize;
2048 }
2049 
CbmHistManager::P1
TProfile * P1(const std::string &name) const
Return pointer to TProfile.
Definition: CbmHistManager.h:263
CbmHistManager::Exists
Bool_t Exists(const std::string &name) const
Check existence of histogram in manager.
Definition: CbmHistManager.h:303
CbmMcbm2018MonitorStsSync::fiBinSizeDatePlots
Int_t fiBinSizeDatePlots
Start of run time since "epoch" in s, for the plots with date as X axis.
Definition: CbmMcbm2018MonitorStsSync.h:121
CbmMcbm2018MonitorStsSync::fvuLastTimeDiffSlotAsicPair
std::vector< std::vector< UInt_t > > fvuLastTimeDiffSlotAsicPair
Definition: CbmMcbm2018MonitorStsSync.h:226
CbmMcbm2018MonitorStsSync::fhPulserChanCntRawGood
std::vector< TH1 * > fhPulserChanCntRawGood
Definition: CbmMcbm2018MonitorStsSync.h:188
CbmMcbm2018MonitorStsSync::SetParContainers
void SetParContainers()
Definition: CbmMcbm2018MonitorStsSync.cxx:146
CbmMcbm2018MonitorStsSync::fvuCurrentTsMsbCycle
std::vector< UInt_t > fvuCurrentTsMsbCycle
Current TS MSB for each DPB.
Definition: CbmMcbm2018MonitorStsSync.h:125
CbmMcbm2018MonitorStsSync::fhPulserMsStatusFieldType
TH2 * fhPulserMsStatusFieldType
Definition: CbmMcbm2018MonitorStsSync.h:185
CbmMcbm2018MonitorStsSync::fuLongHistoBinSizeSec
UInt_t fuLongHistoBinSizeSec
Definition: CbmMcbm2018MonitorStsSync.h:162
CbmMcbm2018MonitorStsSync::FillTsMsbInfo
void FillTsMsbInfo(stsxyter::Message mess, UInt_t uMessIdx=0, UInt_t uMsIdx=0)
Definition: CbmMcbm2018MonitorStsSync.cxx:1695
CbmMcbm2018MonitorStsSync::fuLongHistoNbSeconds
UInt_t fuLongHistoNbSeconds
Definition: CbmMcbm2018MonitorStsSync.h:161
CbmMcbm2018MonitorStsSync::FillEpochInfo
void FillEpochInfo(stsxyter::Message mess)
Definition: CbmMcbm2018MonitorStsSync.cxx:1765
CbmMcbm2018MonitorStsSync::CbmMcbm2018MonitorStsSync
CbmMcbm2018MonitorStsSync()
Definition: CbmMcbm2018MonitorStsSync.cxx:44
CbmMcbm2018MonitorStsSync::fhPulserFebRateEvo
std::vector< TH1 * > fhPulserFebRateEvo
Definition: CbmMcbm2018MonitorStsSync.h:195
CbmMcbm2018MonitorStsSync::fhMsSz
TH1 * fhMsSz[kiMaxNbFlibLinks]
Definition: CbmMcbm2018MonitorStsSync.h:201
CbmMcbm2018MonitorStsSync::SetRunStart
void SetRunStart(Int_t dateIn, Int_t timeIn, Int_t iBinSize=5)
Definition: CbmMcbm2018MonitorStsSync.cxx:2032
CbmMcbm2018MonitorStsSync::fhPulserIntervalLongAsic
std::vector< TH1 * > fhPulserIntervalLongAsic
Definition: CbmMcbm2018MonitorStsSync.h:219
CbmMcbm2018MonitorStsSync::SetCoincidenceBorder
void SetCoincidenceBorder(Double_t dCenterPos, Double_t dBorderVal)
Definition: CbmMcbm2018MonitorStsSync.cxx:370
CbmMcbm2018MonitorStsSync::fhPulserTsLsbDiffEvoPerAsicPairProf
std::vector< std::vector< TProfile * > > fhPulserTsLsbDiffEvoPerAsicPairProf
Definition: CbmMcbm2018MonitorStsSync.h:216
stsxyter::Message
Definition: StsXyterMessage.h:165
gdpbv100::msg_print_Human
@ msg_print_Human
Definition: gDpbMessv100.h:91
stsxyter::MessType::Status
@ Status
CbmMcbm2018MonitorStsSync::fvusChanLastHitAdcInMs
std::vector< std::vector< std::vector< UShort_t > > > fvusChanLastHitAdcInMs
Last hit time in bins in each MS for each Channel.
Definition: CbmMcbm2018MonitorStsSync.h:142
CbmMcbm2018MonitorStsSync::fhPulserChanMissEvtEvo
std::vector< TH2 * > fhPulserChanMissEvtEvo
Definition: CbmMcbm2018MonitorStsSync.h:193
CbmMcbm2018MonitorStsSync::fhPulserSysMessTypePerElink
TH2 * fhPulserSysMessTypePerElink
Definition: CbmMcbm2018MonitorStsSync.h:183
CbmMcbm2018MonitorStsSync::kiMaxNbFlibLinks
static const Int_t kiMaxNbFlibLinks
Vector holding for each link the corresponding ASIC index [fuNrOfDpbs * fuNbElinksPerDpb].
Definition: CbmMcbm2018MonitorStsSync.h:99
CbmMcbm2018MonitorStsSync::fdCoincCenter
Double_t fdCoincCenter
Definition: CbmMcbm2018MonitorStsSync.h:166
CbmMcbm2018MonitorStsSync::fmMsgCounter
std::map< stsxyter::MessType, UInt_t > fmMsgCounter
Definition: CbmMcbm2018MonitorStsSync.h:112
CbmMcbm2018MonitorStsSync::fbIgnoreOverlapMs
Bool_t fbIgnoreOverlapMs
Definition: CbmMcbm2018MonitorStsSync.h:85
CbmMcbm2018MonitorStsSync::fPrintMessCtrl
stsxyter::MessagePrintMask fPrintMessCtrl
Definition: CbmMcbm2018MonitorStsSync.h:107
CbmMcbm2018MonitorStsSync::fhPulserChanRawTs
std::vector< TH2 * > fhPulserChanRawTs
Definition: CbmMcbm2018MonitorStsSync.h:191
CbmMcbm2018MonitorStsSync::fhPulserTimeDiffEvoPerAsicPair
std::vector< std::vector< TH2 * > > fhPulserTimeDiffEvoPerAsicPair
Definition: CbmMcbm2018MonitorStsSync.h:210
CbmMcbm2018MonitorStsSync::fvuElinkLastTsHit
std::vector< UInt_t > fvuElinkLastTsHit
TS MSB cycle from MS header in 1st MS for DPB.
Definition: CbmMcbm2018MonitorStsSync.h:130
CbmMcbm2018MonitorStsSync::fuCurrentEquipmentId
UInt_t fuCurrentEquipmentId
Definition: CbmMcbm2018MonitorStsSync.h:114
stsxyter::Message::GetTsMsbVal
uint32_t GetTsMsbVal() const
For TS MSB data: Returns the TS MSB 22 bit field)
Definition: StsXyterMessage.h:334
stsxyter::Message::GetLinkIndex
uint16_t GetLinkIndex() const
For all data: Returns the (global) index of the eLink on which the message was received (n bit field)
Definition: StsXyterMessage.h:249
CbmMcbm2018MonitorStsSync::fuNrOfDpbs
UInt_t fuNrOfDpbs
Definition: CbmMcbm2018MonitorStsSync.h:88
CbmMcbm2018MonitorStsSync::fvuChanNbHitsInMs
std::vector< std::vector< std::vector< UInt_t > > > fvuChanNbHitsInMs
Header time of each MS.
Definition: CbmMcbm2018MonitorStsSync.h:138
stsxyter::MessType
MessType
Message types.
Definition: StsXyterMessage.h:27
CbmMcbm2018MonitorStsSync::fhPulserTimeDiffPerAsic
std::vector< TH2 * > fhPulserTimeDiffPerAsic
Last hits in each ASIC.
Definition: CbmMcbm2018MonitorStsSync.h:207
CbmMcbm2018MonitorStsSync::fvmLastHitAsic
std::vector< stsxyter::FinalHit > fvmLastHitAsic
Last hits in each ASIC.
Definition: CbmMcbm2018MonitorStsSync.h:206
stsxyter::kulTsCycleNbBins
static const uint64_t kulTsCycleNbBins
Definition: StsXyterMessage.h:152
CbmMcbm2018MonitorStsSync
Definition: CbmMcbm2018MonitorStsSync.h:32
CbmMcbm2018MonitorStsSync::fulCurrentMsIdx
ULong64_t fulCurrentMsIdx
Definition: CbmMcbm2018MonitorStsSync.h:110
CbmMcbm2018MonitorStsSync::fhPulserTimeDiffPerAsicPair
std::vector< std::vector< TH1 * > > fhPulserTimeDiffPerAsicPair
Definition: CbmMcbm2018MonitorStsSync.h:208
CbmMcbm2018MonitorStsSync::Init
virtual Bool_t Init()
Definition: CbmMcbm2018MonitorStsSync.cxx:137
CbmMcbm2018MonitorStsSync::Reset
virtual void Reset()
Definition: CbmMcbm2018MonitorStsSync.cxx:1779
CbmMcbm2018MonitorStsSync::fcMsSizeAll
TCanvas * fcMsSizeAll
Definition: CbmMcbm2018MonitorStsSync.h:200
CbmMcbm2018MonitorStsSync::fhPulserChanHitRateEvoLong
std::vector< TH2 * > fhPulserChanHitRateEvoLong
Definition: CbmMcbm2018MonitorStsSync.h:197
CbmHistManager.h
Histogram manager.
bMcbm2018ResetStsSync
Bool_t bMcbm2018ResetStsSync
Definition: CbmMcbm2018MonitorStsSync.cxx:41
CbmMcbm2018MonitorStsSync::fhPulserMessTypePerElink
TH2 * fhPulserMessTypePerElink
Definition: CbmMcbm2018MonitorStsSync.h:182
stsxyter::Message::IsHitMissedEvts
bool IsHitMissedEvts() const
For Hit data: Returns Missed event flag (1 bit field)
Definition: StsXyterMessage.h:301
CbmMcbm2018MonitorStsSync::fhPulserChanAdcRaw
std::vector< TH2 * > fhPulserChanAdcRaw
Definition: CbmMcbm2018MonitorStsSync.h:189
CbmMcbm2018MonitorStsSync::fhPulserTsMsbMatchPerAsicPair
std::vector< std::vector< TH2 * > > fhPulserTsMsbMatchPerAsicPair
Definition: CbmMcbm2018MonitorStsSync.h:215
CbmMcbm2018MonitorStsSync::fhPulserStatusMessType
TH2 * fhPulserStatusMessType
Definition: CbmMcbm2018MonitorStsSync.h:184
stsxyter::Message::GetHitAdc
uint16_t GetHitAdc() const
For Hit data: Returns ADC value (5 bit field)
Definition: StsXyterMessage.h:277
CbmMcbm2018MonitorStsSync::fdCoincBorder
Double_t fdCoincBorder
Definition: CbmMcbm2018MonitorStsSync.h:167
CbmMcbm2018MonitorStsSync::fuMaxNbMicroslices
UInt_t fuMaxNbMicroslices
All hits (time in bins, ADC in bins, asic, channel) in last TS, per ASIC, sorted with "<" operator.
Definition: CbmMcbm2018MonitorStsSync.h:158
CbmMcbm2018MonitorStsSync::kdPulserPeriod
constexpr static const double kdPulserPeriod
Definition: CbmMcbm2018MonitorStsSync.h:222
CbmMcbm2018MonitorStsSync.h
CbmMcbm2018MonitorStsSync::fhPulserSysMessType
TH1 * fhPulserSysMessType
Definition: CbmMcbm2018MonitorStsSync.h:174
CbmMcbm2018MonitorStsSync::fHM
CbmHistManager * fHM
Definition: CbmMcbm2018MonitorStsSync.h:172
CbmHistManager
Histogram manager.
Definition: CbmHistManager.h:41
stsxyter::MessType::Empty
@ Empty
CbmMcbm2018MonitorStsSync::fiRunStartDateTimeSec
Int_t fiRunStartDateTimeSec
Index of the DPB from which the MS currently unpacked is coming.
Definition: CbmMcbm2018MonitorStsSync.h:120
CbmMcbm2018MonitorStsSync::fvuInitialHeaderDone
std::vector< UInt_t > fvuInitialHeaderDone
Current TS MSB cycle for DPB.
Definition: CbmMcbm2018MonitorStsSync.h:127
CbmMcbm2018MonitorStsSync::fhPulserMessType
TH1 * fhPulserMessType
Histogram manager.
Definition: CbmMcbm2018MonitorStsSync.h:173
h
Data class with information on a STS local track.
CbmMcbm2018MonitorStsSync::fhPulserIntervalAsic
std::vector< TH1 * > fhPulserIntervalAsic
Definition: CbmMcbm2018MonitorStsSync.h:218
CbmMcbm2018MonitorStsSync::fuCurrDpbIdx
UInt_t fuCurrDpbIdx
Temp holder until Current equipment ID is properly filled in MS.
Definition: CbmMcbm2018MonitorStsSync.h:118
CbmMcbm2018MonitorStsSync::FillHitInfo
void FillHitInfo(stsxyter::Message mess, const UShort_t &usElinkIdx, const UInt_t &uAsicIdx, const UInt_t &uMsIdx)
Definition: CbmMcbm2018MonitorStsSync.cxx:1576
CbmMcbm2018MonitorStsSync::fvuInitialTsMsbCycleHeader
std::vector< UInt_t > fvuInitialTsMsbCycleHeader
Flag set after seeing MS header in 1st MS for DPB.
Definition: CbmMcbm2018MonitorStsSync.h:129
CbmMcbm2018MonitorStsSync::fvdChanLastHitTime
std::vector< std::vector< Double_t > > fvdChanLastHitTime
Last hit time in bins for each Channel.
Definition: CbmMcbm2018MonitorStsSync.h:135
CbmMcbm2018MonitorStsSync::DoUnpack
virtual Bool_t DoUnpack(const fles::Timeslice &ts, size_t component)
Definition: CbmMcbm2018MonitorStsSync.cxx:1237
CbmMcbm2018MonitorStsSync::fuNbChanPerAsic
UInt_t fuNbChanPerAsic
Number of StsXyter ASICs.
Definition: CbmMcbm2018MonitorStsSync.h:94
stsxyter::FinalHit
Definition: StsXyterFinalHit.h:16
CbmMcbm2018MonitorStsSync::fbPrintMessages
Bool_t fbPrintMessages
Definition: CbmMcbm2018MonitorStsSync.h:106
CbmMcbm2018MonitorStsSync::SetLongDurationLimits
void SetLongDurationLimits(UInt_t uDurationSeconds=3600, UInt_t uBinSize=1)
Definition: CbmMcbm2018MonitorStsSync.cxx:2043
stsxyter::MessType::Hit
@ Hit
CbmMcbm2018MonitorStsSync::SetNbMsInTs
virtual void SetNbMsInTs(size_t uCoreMsNb, size_t uOverlapMsNb)
Definition: CbmMcbm2018MonitorStsSync.cxx:329
CbmMcbm2018MonitorStsSync::fvuElinkToAsic
std::vector< std::vector< UInt_t > > fvuElinkToAsic
Number of channels per StsXyter ASIC => should be constant somewhere!!!!
Definition: CbmMcbm2018MonitorStsSync.h:96
stsxyter::kuHitNbTsBins
static const uint32_t kuHitNbTsBins
Definition: StsXyterMessage.h:146
CbmMcbm2018MonitorStsSync::fhPulserTimeDiffEvoPerAsicPairProf
std::vector< std::vector< TProfile * > > fhPulserTimeDiffEvoPerAsicPairProf
Definition: CbmMcbm2018MonitorStsSync.h:211
CbmMcbm2018MonitorStsSync::fdCoincMin
Double_t fdCoincMin
Definition: CbmMcbm2018MonitorStsSync.h:168
CbmMcbm2018MonitorStsSync::fdStartTs
Double_t fdStartTs
Pulser time difference histos.
Definition: CbmMcbm2018MonitorStsSync.h:205
CbmMcbm2018MonitorStsSync::fhPulserFebMissEvtEvo
std::vector< TH1 * > fhPulserFebMissEvtEvo
Definition: CbmMcbm2018MonitorStsSync.h:196
stsxyter::Message::GetStatusStatus
uint16_t GetStatusStatus() const
For Status data: Returns the Status field from ACK frame (4 bit field)
Definition: StsXyterMessage.h:359
CbmMcbm2018MonitorStsSync::fvdMeanTimeDiffAsicPair
std::vector< std::vector< Double_t > > fvdMeanTimeDiffAsicPair
Definition: CbmMcbm2018MonitorStsSync.h:227
ClassImp
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
Definition: CbmConverterManager.cxx:12
CbmMcbm2018MonitorStsSync::fhPulserChanAdcRawProf
std::vector< TProfile * > fhPulserChanAdcRawProf
Definition: CbmMcbm2018MonitorStsSync.h:190
CbmMcbm2018MonitorStsSync::fvdMsTime
std::vector< Double_t > fvdMsTime
Last hit time in ns for each Channel.
Definition: CbmMcbm2018MonitorStsSync.h:136
CbmMcbm2018MonitorStsSync::fhPulserTsLsbMatchPerAsicPair
std::vector< std::vector< TH2 * > > fhPulserTsLsbMatchPerAsicPair
Definition: CbmMcbm2018MonitorStsSync.h:214
CbmMcbm2018MonitorStsSync::fuNbStsXyters
UInt_t fuNbStsXyters
Number of possible eLinks per DPB.
Definition: CbmMcbm2018MonitorStsSync.h:92
CbmMcbm2018MonitorStsSync::kuNbValuesForTimeDiffMean
static const UInt_t kuNbValuesForTimeDiffMean
Definition: CbmMcbm2018MonitorStsSync.h:221
CbmMcbm2018MonitorStsSync::fvdChanLastHitTimeInMs
std::vector< std::vector< std::vector< Double_t > > > fvdChanLastHitTimeInMs
Number of hits in each MS for each Channel.
Definition: CbmMcbm2018MonitorStsSync.h:140
CbmHistManager::H1
TH1 * H1(const std::string &name) const
Return pointer to TH1 histogram.
Definition: CbmHistManager.h:170
bMcbm2018WriteStsSync
Bool_t bMcbm2018WriteStsSync
Definition: CbmMcbm2018MonitorStsSync.cxx:42
CbmMcbm2018MonitorStsSync::fvulChanLastHitTime
std::vector< std::vector< ULong64_t > > fvulChanLastHitTime
TS from last hit for DPB.
Definition: CbmMcbm2018MonitorStsSync.h:133
CbmMcbm2018MonitorStsSync::SavePulserHistos
void SavePulserHistos(TString sFileName="")
Definition: CbmMcbm2018MonitorStsSync.cxx:1902
stsxyter::kdClockCycleNs
static const double kdClockCycleNs
Definition: StsXyterMessage.h:156
CbmMcbm2018MonitorStsSync::fhPulserTsMsbDiffEvoPerAsicPairProf
std::vector< std::vector< TProfile * > > fhPulserTsMsbDiffEvoPerAsicPairProf
Definition: CbmMcbm2018MonitorStsSync.h:217
CbmMcbm2018MonitorStsSync::fuNbElinksPerDpb
UInt_t fuNbElinksPerDpb
Map of DPB Identifier to DPB index.
Definition: CbmMcbm2018MonitorStsSync.h:91
CbmMcbm2018MonitorStsSync::UpdatePairMeanValue
void UpdatePairMeanValue(UInt_t uAsicA, UInt_t uAsicB, Double_t dNewValue)
Definition: CbmMcbm2018MonitorStsSync.cxx:1994
CbmMcbm2018MonitorStsSync::fhPulserChanCntRaw
std::vector< TH1 * > fhPulserChanCntRaw
Definition: CbmMcbm2018MonitorStsSync.h:187
CbmMcbm2018MonitorStsSync::fvmAsicHitsInMs
std::vector< std::vector< stsxyter::FinalHit > > fvmAsicHitsInMs
All hits (time in bins, ADC in bins, asic, channel) in last TS, sorted with "<" operator.
Definition: CbmMcbm2018MonitorStsSync.h:156
stsxyter::Message::GetMessType
MessType GetMessType() const
Returns the message type, see enum MessType.
Definition: StsXyterMessage.h:259
CbmMcbm2018MonitorStsSync::CreateHistograms
void CreateHistograms()
Definition: CbmMcbm2018MonitorStsSync.cxx:378
CbmMcbm2018MonitorStsSync::fuCurrDpbId
UInt_t fuCurrDpbId
Current equipment ID, tells from which DPB the current MS is originating.
Definition: CbmMcbm2018MonitorStsSync.h:116
gdpbv100::MessagePrintMask
MessagePrintMask
Definition: gDpbMessv100.h:87
CbmMcbm2018MonitorStsSync::fvulCurrentTsMsb
std::vector< ULong64_t > fvulCurrentTsMsb
Bin size in s for the plots with date as X axis.
Definition: CbmMcbm2018MonitorStsSync.h:124
CbmMcbm2018MonitorStsSync::SaveAllHistos
void SaveAllHistos(TString sFileName="")
Definition: CbmMcbm2018MonitorStsSync.cxx:1802
CbmMcbm2018MonitorStsSync::fdStartTimeMsSz
Double_t fdStartTimeMsSz
Definition: CbmMcbm2018MonitorStsSync.h:148
CbmMcbm2018MonitorStsSync::fvmHitsInMs
std::vector< stsxyter::FinalHit > fvmHitsInMs
Definition: CbmMcbm2018MonitorStsSync.h:154
stsxyter::Message::GetHitChannel
uint16_t GetHitChannel() const
For Hit data: Returns StsXYTER channel number (7 bit field)
Definition: StsXyterMessage.h:274
stsxyter::Message::GetStatusLink
uint16_t GetStatusLink() const
For Status data: Returns the Link Inedx (9 bit field)
Definition: StsXyterMessage.h:353
stsxyter::Message::PrintMess
bool PrintMess(std::ostream &os, MessagePrintMask ctrl=MessagePrintMask::msg_print_Human) const
Definition: StsXyterMessage.cxx:29
CbmMcbm2018MonitorStsSync::~CbmMcbm2018MonitorStsSync
virtual ~CbmMcbm2018MonitorStsSync()
Definition: CbmMcbm2018MonitorStsSync.cxx:135
CbmMcbm2018MonitorStsSync::Finish
virtual void Finish()
Definition: CbmMcbm2018MonitorStsSync.cxx:1781
CbmMcbm2018MonitorStsSync::fhPulserTimeDiffClkPerAsicPair
std::vector< std::vector< TH1 * > > fhPulserTimeDiffClkPerAsicPair
Definition: CbmMcbm2018MonitorStsSync.h:209
CbmMcbm2018MonitorStsSync::fUnpackParHodo
CbmCern2017UnpackParHodo * fUnpackParHodo
/‍** Ignore Overlap Ms: all fuOverlapMsNb MS at the end of timeslice **‍/
Definition: CbmMcbm2018MonitorStsSync.h:87
CbmMcbm2018MonitorStsSync::fhMsSzTime
TProfile * fhMsSzTime[kiMaxNbFlibLinks]
Definition: CbmMcbm2018MonitorStsSync.h:202
CbmMcbm2018MonitorStsSync::fhPulserSysMessTypePerDpb
TH2 * fhPulserSysMessTypePerDpb
Definition: CbmMcbm2018MonitorStsSync.h:176
CbmMcbm2018MonitorStsSync::fulCurrentTsIdx
ULong64_t fulCurrentTsIdx
Definition: CbmMcbm2018MonitorStsSync.h:109
CbmMcbm2018MonitorStsSync::fbLongHistoEnable
Bool_t fbLongHistoEnable
Definition: CbmMcbm2018MonitorStsSync.h:160
CbmMcbm2018MonitorStsSync::fuNbOverMsPerTs
size_t fuNbOverMsPerTs
Definition: CbmMcbm2018MonitorStsSync.h:83
stsxyter::MessType::TsMsb
@ TsMsb
CbmMcbm2018MonitorStsSync::AddMsComponentToList
virtual void AddMsComponentToList(size_t component, UShort_t usDetectorId)
Definition: CbmMcbm2018MonitorStsSync.cxx:286
CbmMcbm2018MonitorStsSync::fhPulserFebRateEvoLong
std::vector< TH1 * > fhPulserFebRateEvoLong
Definition: CbmMcbm2018MonitorStsSync.h:198
CbmMcbm2018MonitorStsSync::fdStartTime
Double_t fdStartTime
Last hit ADC in bins in each MS for each Channel.
Definition: CbmMcbm2018MonitorStsSync.h:146
stsxyter::Message::GetHitTime
uint16_t GetHitTime() const
For Hit data: Returns timestamp (8 bit field, 2 MSB bits overlap removed)
Definition: StsXyterMessage.h:286
stsxyter::MessType::Dummy
@ Dummy
CbmMcbm2018MonitorStsSync::fuNbCoreMsPerTs
size_t fuNbCoreMsPerTs
Definition: CbmMcbm2018MonitorStsSync.h:82
CbmMcbm2018MonitorStsSync::fhPulserMessTypePerDpb
TH2 * fhPulserMessTypePerDpb
Definition: CbmMcbm2018MonitorStsSync.h:175
stsxyter::MessType::Epoch
@ Epoch
CbmMcbm2018MonitorStsSync::fhPulserRawTimeDiffEvoPerAsicPairProf
std::vector< std::vector< TProfile * > > fhPulserRawTimeDiffEvoPerAsicPairProf
Definition: CbmMcbm2018MonitorStsSync.h:213
CbmMcbm2018MonitorStsSync::fhPulserChanMissEvt
std::vector< TH2 * > fhPulserChanMissEvt
Definition: CbmMcbm2018MonitorStsSync.h:192
stsxyter::kuHitNbAdcBins
static const uint32_t kuHitNbAdcBins
Status/properties constants.
Definition: StsXyterMessage.h:144
CbmMcbm2018MonitorStsSync::InitContainers
Bool_t InitContainers()
Definition: CbmMcbm2018MonitorStsSync.cxx:155
CbmMcbm2018MonitorStsSync::ReInitContainers
Bool_t ReInitContainers()
Definition: CbmMcbm2018MonitorStsSync.cxx:164
CbmMcbm2018MonitorStsSync::fvMsComponentsList
std::vector< size_t > fvMsComponentsList
Definition: CbmMcbm2018MonitorStsSync.h:76
CbmMcbmUnpack
Definition: CbmMcbmUnpack.h:15
CbmMcbm2018MonitorStsSync::fhPulserChanHitRateEvo
std::vector< TH2 * > fhPulserChanHitRateEvo
Definition: CbmMcbm2018MonitorStsSync.h:194
CbmMcbm2018MonitorStsSync::fdCoincMax
Double_t fdCoincMax
Definition: CbmMcbm2018MonitorStsSync.h:169
CbmMcbm2018MonitorStsSync::ResetAllHistos
void ResetAllHistos()
Definition: CbmMcbm2018MonitorStsSync.cxx:1933
CbmMcbm2018MonitorStsSync::fvdLastTimeDiffValuesAsicPair
std::vector< std::vector< std::vector< Double_t > > > fvdLastTimeDiffValuesAsicPair
Definition: CbmMcbm2018MonitorStsSync.h:225
stsxyter
Definition: StsXyterFinalHit.h:12
CbmMcbm2018MonitorStsSync::fuLongHistoBinNb
UInt_t fuLongHistoBinNb
Definition: CbmMcbm2018MonitorStsSync.h:163
CbmMcbm2018MonitorStsSync::fDpbIdIndexMap
std::map< UInt_t, UInt_t > fDpbIdIndexMap
Total number of Sts DPBs in system.
Definition: CbmMcbm2018MonitorStsSync.h:90
CbmMcbm2018MonitorStsSync::fsHistoFileFullname
TString fsHistoFileFullname
Definition: CbmMcbm2018MonitorStsSync.h:104
CbmHistManager::Add
void Add(const std::string &name, TNamed *object)
Add new named object to manager.
Definition: CbmHistManager.h:58
CbmMcbm2018MonitorStsSync::kuBytesPerMessage
static const UInt_t kuBytesPerMessage
Definition: CbmMcbm2018MonitorStsSync.h:100