CbmRoot
Loading...
Searching...
No Matches
CbmMcbm2018MonitorMcbmSync.cxx
Go to the documentation of this file.
1/* Copyright (C) 2018-2021 Facility for Antiproton and Ion Research in Europe, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Pierre-Alain Loizeau [committer] */
4
5// -----------------------------------------------------------------------------
6// ----- -----
7// ----- CbmMcbm2018MonitorMcbmSync -----
8// ----- Created 11/05/18 by P.-A. Loizeau -----
9// ----- -----
10// -----------------------------------------------------------------------------
11
13
14// Data
15
16// CbmRoot
17#include "CbmMcbm2018StsPar.h"
18#include "CbmMcbm2018TofPar.h"
19
20// FairRoot
21#include "FairRootManager.h"
22#include "FairRun.h"
23#include "FairRunOnline.h"
24#include "FairRuntimeDb.h"
25#include <Logger.h>
26
27// Root
28#include "TClonesArray.h"
29#include "TF1.h"
30#include "THttpServer.h"
31#include "TMath.h"
32#include "TROOT.h"
33#include "TRandom.h"
34#include "TString.h"
35#include "TStyle.h"
36#include <TFile.h>
37
38// C++11
39
40// C/C++
41#include <iomanip>
42#include <iostream>
43
44#include <stdint.h>
45
46Bool_t bMcbm2018ResetSync = kFALSE;
47Bool_t bMcbm2018WriteSync = kFALSE;
48/*
49Bool_t bMcbm2018ResetSync = kFALSE;
50Bool_t bMcbm2018WriteSync = kFALSE;
51*/
52/*
53Bool_t bMcbm2018SyncResetHistosTof = kFALSE;
54Bool_t bMcbm2018SyncSaveHistosTof = kFALSE;
55Bool_t bMcbm2018SyncUpdateZoomedFit = kFALSE;
56*/
57
60 , fvMsComponentsListSts()
61 , fvMsComponentsListTof()
62 , fuNbCoreMsPerTs(0)
63 , fuNbOverMsPerTs(0)
64 , fbIgnoreOverlapMs(kFALSE)
65 , fUnpackParSts(nullptr)
66 , fuStsNrOfDpbs(0)
67 , fmStsDpbIdIndexMap()
68 , fuMuchDpbIdx(1)
69 , fUnpackParTof(nullptr)
70 , fuTofNrOfDpbs(0)
71 , fmTofDpbIdIndexMap()
72 , fuDiamondDpbIdx(2)
73 , fuTotalNrOfDpb(0)
74 , fdStsTofOffsetNs(0.0)
75 , fdMuchTofOffsetNs(0.0)
76 , fbUseBestPair(kFALSE)
77 , fbTsLevelAna(kFALSE)
78 , fsHistoFileFullname("data/mCBMsyncHistos.root")
79 , fbPrintMessages(kFALSE)
80 , fPrintMessCtrlSts(stsxyter::MessagePrintMask::msg_print_Human)
81 , fulCurrentTsIdx(0)
82 , fulCurrentMsIdx(0)
83 , fmMsgCounter()
84 , fuCurrentEquipmentId(0)
85 , fuCurrDpbId(0)
86 , fuCurrDpbIdx(0)
87 , fiRunStartDateTimeSec(-1)
88 , fiBinSizeDatePlots(-1)
89 , fvulStsCurrentTsMsb()
90 , fvuStsCurrentTsMsbCycle()
91 , fvmStsSdpbHitsInMs()
92 , fvmStsSdpbHitsInTs()
93 , fulTofCurrentTsIndex(0)
94 , fuTofCurrentMs(0)
95 , fdTofMsIndex(0)
96 , fuTofGdpbId(0)
97 , fuTofGdpbNr(0)
98 , fiTofEquipmentId(0)
99 , fviTofMsgCounter(1 + gdpbv100::MSG_STAR_TRI_D, 0)
100 , fvulTofCurrentEpoch()
101 , fvulTofCurrentEpochCycle()
102 , fvulTofCurrentEpochFull()
103 , fulTofCurrentEpochTime(0)
104 , fvmTofEpSupprBuffer()
105 , fvmTofGdpbHitsInMs()
106 , fvmTofGdpbHitsInTs()
107 , fhMcbmHitsNbPerMs()
108 , fhMcbmTimeDiffToDiamond()
109 , fhMcbmTimeDiffToDiamondWide()
110 , fhMcbmTimeDiffToDiamondTs()
111 , fhMcbmTimeDiffToMuch()
112 , fhMcbmTimeDiffToMuchWide()
113 , fhMcbmTimeDiffToMuchTs()
114 , fhMcbmStsTimeDiffToMuchVsAdc()
115 , fhMcbmStsTimeDiffToMuchWideVsAdc()
116 , fhMcbmStsTimeDiffToMuchTsVsAdc()
117 , fvhMcbmTimeDiffToDiamondEvoDpb()
118 , fvhMcbmTimeDiffToDiamondWideEvoDpb()
119 , fvhMcbmTimeDiffToDiamondTsEvoDpb()
120 , fdSpillStartA(0.0)
121 , fdSpillStartB(0.0)
122 , fdSpillStartC(-1.0)
123 , fvhHitsTimeEvoSpillA()
124 , fvhHitsTimeEvoSpillB()
125 , fvhMcbmTimeDiffToDiamondEvoSpillA()
126 , fvhMcbmTimeDiffToDiamondEvoSpillB()
127 , fvhMcbmTimeDiffToMuchEvoSpillA()
128 , fvhMcbmTimeDiffToMuchEvoSpillB()
129{
130}
131
133
135{
136 LOG(info) << "Initializing flib StsXyter unpacker for STS";
137
138 FairRootManager* ioman = FairRootManager::Instance();
139 if (ioman == nullptr) { LOG(fatal) << "No FairRootManager instance"; }
140
141 return kTRUE;
142}
143
145{
146 LOG(info) << "Setting parameter containers for " << GetName();
147 fUnpackParSts = (CbmMcbm2018StsPar*) (FairRun::Instance()->GetRuntimeDb()->getContainer("CbmMcbm2018StsPar"));
148 fUnpackParTof = (CbmMcbm2018TofPar*) (FairRun::Instance()->GetRuntimeDb()->getContainer("CbmMcbm2018TofPar"));
149}
150
151
153{
154 LOG(info) << "Init parameter containers for " << GetName();
155
156 Bool_t bReInit = ReInitContainers();
160
161 return bReInit;
162}
163
165{
166 LOG(info) << "ReInit parameter containers for " << GetName();
167
168 /***************** STS parameters *************************************/
170 LOG(info) << "Nr. of STS DPBs: " << fuStsNrOfDpbs;
171
172 fmStsDpbIdIndexMap.clear();
173 for (UInt_t uDpb = 0; uDpb < fuStsNrOfDpbs; ++uDpb) {
175 LOG(info) << "Eq. ID for DPB #" << std::setw(2) << uDpb << " = 0x" << std::setw(4) << std::hex
176 << fUnpackParSts->GetDpbId(uDpb) << std::dec << " => "
178 } // for( UInt_t uDpb = 0; uDpb < fuStsNrOfDpbs; ++uDpb )
179
184 /***************** STS parameters *************************************/
185
186 /***************** TOF parameters *************************************/
188 LOG(info) << "Nr. of Tof GDPBs: " << fuTofNrOfDpbs;
189
190 fmTofDpbIdIndexMap.clear();
191 for (UInt_t i = 0; i < fuTofNrOfDpbs; ++i) {
193 LOG(info) << "GDPB Id of TOF " << i << " : " << std::hex << fUnpackParTof->GetGdpbId(i) << std::dec;
194 } // for( UInt_t i = 0; i < fuTofNrOfDpbs; ++i )
195
203 /***************** TOF parameters *************************************/
204
205 return kTRUE;
206}
207
208void CbmMcbm2018MonitorMcbmSync::AddMsComponentToList(size_t component, UShort_t usDetectorId)
209{
210 switch (usDetectorId) {
211 case 0x10: //fles::Subsystem::STS:
212 {
213 AddMsComponentToListSts(component);
214 break;
215 } // case 0x10:
216 case 0x60: //fles::Subsystem::TOF:
217 {
218 AddMsComponentToListTof(component);
219 break;
220 } // case 0x60:
221 default: {
222 LOG(warning) << "CbmMcbm2018MonitorStsSync::AddMsComponentToList => "
223 << "Ignore component " << component << " as detector id " << usDetectorId
224 << " is not supported by this unpacker.";
225 break;
226 } // default:
227 } // switch( iDetectorId )
228}
230{
232 for (UInt_t uCompIdx = 0; uCompIdx < fvMsComponentsListSts.size(); ++uCompIdx)
233 if (component == fvMsComponentsListSts[uCompIdx]) return;
234
236 fvMsComponentsListSts.push_back(component);
237}
239{
241 for (UInt_t uCompIdx = 0; uCompIdx < fvMsComponentsListTof.size(); ++uCompIdx)
242 if (component == fvMsComponentsListTof[uCompIdx]) return;
243
245 fvMsComponentsListTof.push_back(component);
246}
247void CbmMcbm2018MonitorMcbmSync::SetNbMsInTs(size_t uCoreMsNb, size_t uOverlapMsNb)
248{
249 fuNbCoreMsPerTs = uCoreMsNb;
250 fuNbOverMsPerTs = uOverlapMsNb;
251
252 // UInt_t uNbMsTotal = fuNbCoreMsPerTs + fuNbOverMsPerTs;
253}
254
255/***************** STS Histograms *************************************/
257{
258 TString sHistName {""};
259 TString title {""};
260 /*
261 sHistName = "hPulserMessageType";
262 title = "Nb of message for each type; Type";
263 fhStsMessType = new TH1I(sHistName, title, 5, 0., 5.);
264 fhStsMessType->GetXaxis()->SetBinLabel( 1, "Dummy");
265 fhStsMessType->GetXaxis()->SetBinLabel( 2, "Hit");
266 fhStsMessType->GetXaxis()->SetBinLabel( 3, "TsMsb");
267 fhStsMessType->GetXaxis()->SetBinLabel( 4, "Epoch");
268 fhStsMessType->GetXaxis()->SetBinLabel( 5, "Empty");
269
270 // Online histo browser commands
271 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
272 if( server )
273 {
274 server->Register("/StsRaw", fhStsMessType );
275
276 server->RegisterCommand("/Reset_All_Pulser", "bMcbm2018ResetSync=kTRUE");
277 server->RegisterCommand("/Write_All_Pulser", "bMcbm2018WriteSync=kTRUE");
278
279 server->Restrict("/Reset_All_Pulser", "allow=admin");
280 server->Restrict("/Write_All_Pulser", "allow=admin");
281 } // if( server )
282*/
284 /*
285 Double_t w = 10;
286 Double_t h = 10;
287
288 // Summary per StsXyter
289 for( UInt_t uXyterIdx = 0; uXyterIdx < fuStsNbStsXyters; ++uXyterIdx )
290 {
291 TCanvas* cStsSumm = new TCanvas( Form("cStsSum_%03u", uXyterIdx ),
292 Form("Summary plots for StsXyter %03u", uXyterIdx ),
293 w, h);
294 cStsSumm->Divide( 2, 2 );
295
296 cStsSumm->cd(1);
297 gPad->SetLogy();
298 fhStsChanCntRaw[ uXyterIdx ]->Draw();
299
300 cStsSumm->cd(2);
301 gPad->SetLogz();
302 fhStsChanAdcRaw[ uXyterIdx ]->Draw( "colz" );
303
304 cStsSumm->cd(3);
305 gPad->SetLogz();
306 fhStsChanHitRateEvo[ uXyterIdx ]->Draw( "colz" );
307
308 cStsSumm->cd(4);
309// gPad->SetLogy();
310 fhStsChanAdcRawProf[ uXyterIdx ]->Draw();
311 } // for( UInt_t uXyterIdx = 0; uXyterIdx < fuStsNbStsXyters; ++uXyterIdx )
312
313//====================================================================//
314*/
315 /*****************************/
316 LOG(info) << "Done Creating STS Histograms";
317}
318/***************** STS Histograms *************************************/
319
320/***************** TOF Histograms *************************************/
322{
323 TString sHistName {""};
324 TString title {""};
325
326 /*******************************************************************/
327 /*
328
329 sHistName = "hMessageType";
330 title = "Nb of message for each type; Type";
331 // Test Big Data readout with plotting
332 fhTofMessType = new TH1I(sHistName, title, 1 + gdpbv100::MSG_STAR_TRI_A, 0., 1 + gdpbv100::MSG_STAR_TRI_A);
333 fhTofMessType->GetXaxis()->SetBinLabel(1 + gdpbv100::MSG_HIT, "HIT");
334 fhTofMessType->GetXaxis()->SetBinLabel(1 + gdpbv100::MSG_EPOCH, "EPOCH");
335 fhTofMessType->GetXaxis()->SetBinLabel(1 + gdpbv100::MSG_SLOWC, "SLOWC");
336 fhTofMessType->GetXaxis()->SetBinLabel(1 + gdpbv100::MSG_SYST, "SYST");
337 fhTofMessType->GetXaxis()->SetBinLabel(1 + gdpbv100::MSG_STAR_TRI_A, "MSG_STAR_TRI");
338*/
339 /*******************************************************************/
340 /*
341 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
342 if( server )
343 {
344 server->Register("/TofRaw", fhTofMessType );
345
346 server->RegisterCommand("/Reset_All_TOF", "bMcbm2018SyncResetHistosTof=kTRUE");
347 server->RegisterCommand("/Save_All_Tof", "bMcbm2018SyncSaveHistosTof=kTRUE");
348 server->RegisterCommand("/Update_PulsFit", "bMcbm2018SyncUpdateZoomedFit=kTRUE");
349
350 server->Restrict("/Reset_All_Tof", "allow=admin");
351 server->Restrict("/Save_All_Tof", "allow=admin");
352 server->Restrict("/Update_PulsFit", "allow=admin");
353 } // if( server )
354*/
356 /*
357 Double_t w = 10;
358 Double_t h = 10;
359 TCanvas* cSummary = new TCanvas("cSummary", "gDPB Monitoring Summary", w, h);
360 cSummary->Divide(2, 3);
361
362 // 1st Column: Messages types
363 cSummary->cd(1);
364 gPad->SetLogy();
365 fhTofMessType->Draw();
366
367 cSummary->cd(2);
368 gPad->SetLogy();
369 fhTofSysMessType->Draw();
370
371 cSummary->cd(3);
372 gPad->SetLogz();
373 fhTofGet4MessType->Draw("colz");
374
375 // 2nd Column: GET4 Errors + Epoch flags + SCm
376 cSummary->cd(4);
377 gPad->SetLogz();
378 fhTofGet4ChanErrors->Draw("colz");
379
380 cSummary->cd(5);
381 gPad->SetLogz();
382 fhTofGet4EpochFlags->Draw("colz");
383
384 cSummary->cd(6);
385 fhTofGet4ChanScm->Draw("colz");
386*/
387 /*****************************/
388
389 LOG(info) << "Done Creating TOF Histograms";
390}
391/***************** TOF Histograms *************************************/
392
393/***************** mCBM Histograms ************************************/
395{
396 TString sHistName {""};
397 TString sHistTitle {""};
398
400
401 sHistName = "hMcbmHitsNbPerMs";
402 sHistTitle = "Nb of hits per DPB; Nb of hits []; DPB []";
403 fhMcbmHitsNbPerMs = new TH2D(sHistName, sHistTitle, 1000.0, 0., 1000., fuTotalNrOfDpb, 0., fuTotalNrOfDpb);
404
405 sHistName = "hMcbmTimeDiffToDiamond";
406 sHistTitle = "Time difference for STS and TOF hits, per DPB, against any "
407 "Diamond hit; <tn - tDia> [ns]; DPB []";
408 fhMcbmTimeDiffToDiamond = new TH2D(sHistName, sHistTitle, 1001, -500.5 * stsxyter::kdClockCycleNs,
410 sHistName = "hMcbmTimeDiffToDiamondWide";
411 sHistTitle = "Time difference for STS and TOF hits, per DPB, against any "
412 "Diamond hit, wide range; <tn - tDia> [us]; DPB []";
414 new TH2D(sHistName, sHistTitle, 6000.0, -300., 300., fuTotalNrOfDpb, 0., fuTotalNrOfDpb);
415 sHistName = "hMcbmTimeDiffToDiamondTs";
416 sHistTitle = "Time difference for STS and TOF hits, per DPB, against any "
417 "Diamond hit, TS range; <tn - tDia> [ms]; DPB []";
418 fhMcbmTimeDiffToDiamondTs = new TH2D(sHistName, sHistTitle, 2000.0, -10., 10., fuTotalNrOfDpb, 0., fuTotalNrOfDpb);
419
420 sHistName = "hMcbmTimeDiffToMuch";
421 sHistTitle = "Time difference for STS and TOF hits, per DPB, against any "
422 "Much hit; <tn - tMuch> [ns]; DPB []";
423 fhMcbmTimeDiffToMuch = new TH2D(sHistName, sHistTitle, 1001, -500.5 * stsxyter::kdClockCycleNs,
425 sHistName = "hMcbmTimeDiffToMuchWide";
426 sHistTitle = "Time difference for STS and TOF hits, per DPB, against any "
427 "Much hit, wide range; <tn - tMuch> [us]; DPB []";
428 fhMcbmTimeDiffToMuchWide = new TH2D(sHistName, sHistTitle, 6000.0, -300., 300., fuTotalNrOfDpb, 0., fuTotalNrOfDpb);
429 sHistName = "hMcbmTimeDiffToMuchTs";
430 sHistTitle = "Time difference for STS and TOF hits, per DPB, against any "
431 "Much hit, TS range; <tn - tMuch> [ms]; DPB []";
432 fhMcbmTimeDiffToMuchTs = new TH2D(sHistName, sHistTitle, 2000.0, -10., 10., fuTotalNrOfDpb, 0., fuTotalNrOfDpb);
433
435 sHistName = "hMcbmStsTimeDiffToMuchVsAdc";
436 sHistTitle = "Time difference for STS hits against any Much hit vs STS hit "
437 "ADC; <tSts - tMuch> [ns]; ADC Sts [bin]";
439 new TH2D(sHistName, sHistTitle, 1001, -500.5 * stsxyter::kdClockCycleNs, 500.5 * stsxyter::kdClockCycleNs,
441 sHistName = "hMcbmStsTimeDiffToMuchWideVsAdc";
442 sHistTitle = "Time difference for STS hits against any Much hit vs STS hit "
443 "ADC, wide range; <tSts - tMuch> [us]; ADC Sts [bin]";
444 fhMcbmStsTimeDiffToMuchWideVsAdc = new TH2D(sHistName, sHistTitle, 6000.0, -300., 300., stsxyter::kuHitNbAdcBins,
445 -0.5, stsxyter::kuHitNbAdcBins - 0.5);
446 sHistName = "hMcbmStsTimeDiffToMuchTsVsAdc";
447 sHistTitle = "Time difference for STS hits against any Much hit vs STS hit "
448 "ADC, TS range; <tSts - tMuch> [ms]; ADC Sts [bin]";
450 new TH2D(sHistName, sHistTitle, 2000.0, -10., 10., stsxyter::kuHitNbAdcBins, -0.5, stsxyter::kuHitNbAdcBins - 0.5);
451
452 for (UInt_t uDpb = 0; uDpb < fuTotalNrOfDpb; ++uDpb) {
453
454 sHistName = Form("hMcbmTimeDiffToDiamondEvoDpb%02u", uDpb);
455 sHistTitle = Form("Evolution of time difference for STS or TOF hits from DPB %02u "
456 "against any Diamond hit; TS []; <tn - tDia> [ns]",
457 uDpb);
458 fvhMcbmTimeDiffToDiamondEvoDpb.push_back(new TH2D(sHistName, sHistTitle, 2000.0, 0., 200000., 1001,
460 500.5 * stsxyter::kdClockCycleNs));
461
462 sHistName = Form("hMcbmTimeDiffToDiamondWideEvoDpb%02u", uDpb);
463 sHistTitle = Form("Evolution of time difference for STS or TOF hits from DPB %02u "
464 "against any Diamond hit, wide range; TS []; <tn - tDia> [us]",
465 uDpb);
467 new TH2D(sHistName, sHistTitle, 2000.0, 0., 200000., 4000.0, -200., 200.));
468
469 sHistName = Form("hMcbmTimeDiffToDiamondTsEvoDpb%02u", uDpb);
470 sHistTitle = Form("Evolution of time difference for STS or TOF hits from DPB %02u "
471 "against any Diamond hit, TS range; TS []; <tn - tDia> [ms]",
472 uDpb);
473 fvhMcbmTimeDiffToDiamondTsEvoDpb.push_back(new TH2D(sHistName, sHistTitle, 2000.0, 0., 200000., 200.0, -10., 10.));
474
476 sHistName = Form("hHitsTimeEvoSpillADpb%02u", uDpb);
477 sHistTitle = Form("Evolution of hit counts VS time for DPB %02u in the "
478 "first spill; tHit [s]; counts",
479 uDpb);
480 fvhHitsTimeEvoSpillA.push_back(
481 new TH1D(sHistName, sHistTitle, (fdSpillStartB - fdSpillStartA) * 1e5, fdSpillStartA - 0.1, fdSpillStartB));
482
483 sHistName = Form("hHitsTimeEvoSpillBDpb%02u", uDpb);
484 sHistTitle = Form("Evolution of hit counts VS time for DPB %02u in the "
485 "second spill; tHit [s]; counts",
486 uDpb);
487 fvhHitsTimeEvoSpillB.push_back(
488 new TH1D(sHistName, sHistTitle, (fdSpillStartC - fdSpillStartB) * 1e5, fdSpillStartB - 0.1, fdSpillStartC));
489
490 sHistName = Form("hMcbmTimeDiffToDiamondEvoSpillADpb%02u", uDpb);
491 sHistTitle = Form("Evolution of Time Diff to diam VS time for DPB %02u "
492 "in the first spill; tHit [s]; <tn - tDia> [us]",
493 uDpb);
494 fvhMcbmTimeDiffToDiamondEvoSpillA.push_back(new TH2D(sHistName, sHistTitle, (fdSpillStartB - fdSpillStartA) * 1e2,
495 fdSpillStartA - 0.1, fdSpillStartB, 6000.0, -300., 300.));
496
497 sHistName = Form("hMcbmTimeDiffToDiamondEvoSpillBDpb%02u", uDpb);
498 sHistTitle = Form("Evolution of Time Diff to diam VS time for DPB %02u "
499 "in the second spill; tHit [s]; <tn - tDia> [us]",
500 uDpb);
501 fvhMcbmTimeDiffToDiamondEvoSpillB.push_back(new TH2D(sHistName, sHistTitle, (fdSpillStartC - fdSpillStartB) * 1e2,
502 fdSpillStartB - 0.1, fdSpillStartC, 6000.0, -300., 300.));
503
504 sHistName = Form("hMcbmTimeDiffToMuchEvoSpillADpb%02u", uDpb);
505 sHistTitle = Form("Evolution of Time Diff to MUCH VS time for DPB %02u "
506 "in the first spill; tHit [s]; <tn - tDia> [us]",
507 uDpb);
508 fvhMcbmTimeDiffToMuchEvoSpillA.push_back(new TH2D(sHistName, sHistTitle, (fdSpillStartB - fdSpillStartA) * 1e2,
509 fdSpillStartA - 0.1, fdSpillStartB, 6000.0, -300., 300.));
510
511 sHistName = Form("hMcbmTimeDiffToMuchEvoSpillBDpb%02u", uDpb);
512 sHistTitle = Form("Evolution of Time Diff to MUCH VS time for DPB %02u "
513 "in the second spill; tHit [s]; <tn - tDia> [us]",
514 uDpb);
515 fvhMcbmTimeDiffToMuchEvoSpillB.push_back(new TH2D(sHistName, sHistTitle, (fdSpillStartC - fdSpillStartB) * 1e2,
516 fdSpillStartB - 0.1, fdSpillStartC, 6000.0, -300., 300.));
517 } // if( fdSpillStartA < fdSpillStartC )
518 } // for( UInt_t uDpb = 0; uDpb < fuTotalNrOfDpb; ++uDpb )
519 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
520 if (server) {
521 server->Register("/mCbmDt", fhMcbmTimeDiffToDiamond);
522 server->Register("/mCbmDt", fhMcbmTimeDiffToDiamondWide);
523 server->Register("/mCbmDt", fhMcbmTimeDiffToDiamondTs);
524
525 server->Register("/mCbmDt", fhMcbmTimeDiffToMuch);
526 server->Register("/mCbmDt", fhMcbmTimeDiffToMuchWide);
527 server->Register("/mCbmDt", fhMcbmTimeDiffToMuchTs);
528
529 server->Register("/mCbmDt", fhMcbmStsTimeDiffToMuchVsAdc);
530 server->Register("/mCbmDt", fhMcbmStsTimeDiffToMuchWideVsAdc);
531 server->Register("/mCbmDt", fhMcbmStsTimeDiffToMuchTsVsAdc);
532
533 for (UInt_t uDpb = 0; uDpb < fuTotalNrOfDpb; ++uDpb) {
534 server->Register("/mCbmDt", fvhMcbmTimeDiffToDiamondEvoDpb[uDpb]);
535 server->Register("/mCbmDt", fvhMcbmTimeDiffToDiamondWideEvoDpb[uDpb]);
536 server->Register("/mCbmDt", fvhMcbmTimeDiffToDiamondTsEvoDpb[uDpb]);
537 } // for( UInt_t uDpb = 0; uDpb < fuTotalNrOfDpb; ++uDpb )
538
539 server->RegisterCommand("/Reset_All", "bMcbm2018ResetSync=kTRUE");
540 server->RegisterCommand("/Save_All", "bMcbm2018WriteSync=kTRUE");
541
542 server->Restrict("/Reset_All", "allow=admin");
543 server->Restrict("/Save_All", "allow=admin");
544 } // if( server )
545
546 Double_t w = 10;
547 Double_t h = 10;
549 TCanvas* cSyncMcbm =
550 new TCanvas("cSyncMcbm", "Time difference for STS and TOF hits, per DPB, against any Diamond hit", w, h);
551 cSyncMcbm->Divide(2);
552
553 cSyncMcbm->cd(1);
554 gPad->SetGridx();
555 gPad->SetGridy();
556 gPad->SetLogz();
557 fhMcbmTimeDiffToDiamond->Draw("colz");
558
559 cSyncMcbm->cd(2);
560 gPad->SetGridx();
561 gPad->SetGridy();
562 gPad->SetLogz();
563 fhMcbmTimeDiffToDiamondWide->Draw("colz");
564 /*****************************/
565 LOG(info) << "Done Creating mCBM Histograms";
566}
567/***************** mCBM Histograms ************************************/
568
569Bool_t CbmMcbm2018MonitorMcbmSync::DoUnpack(const fles::Timeslice& ts, size_t component)
570{
572 if (bMcbm2018ResetSync) {
574 bMcbm2018ResetSync = kFALSE;
575 } // if( bMcbm2018ResetSync )
576 if (bMcbm2018WriteSync) {
578 bMcbm2018WriteSync = kFALSE;
579 } // if( bMcbm2018WriteSync )
580
581 LOG(debug) << "Timeslice contains " << ts.num_microslices(component) << "microslices.";
582 fulCurrentTsIdx = ts.index();
583
585 if (0 == fulCurrentTsIdx) return kTRUE;
586
587 if (fulCurrentTsIdx < 30) LOG(info) << Form("TS %2llu", fulCurrentTsIdx);
588
589 // Ignore overlap ms if flag set by user
590 UInt_t uNbMsLoop = fuNbCoreMsPerTs;
591 if (kFALSE == fbIgnoreOverlapMs) uNbMsLoop += fuNbOverMsPerTs;
592
593 // Loop over core microslices (and overlap ones if chosen)
594 for (UInt_t uMsIdx = 0; uMsIdx < uNbMsLoop; uMsIdx++) {
595 // Loop over registered STS components
596 for (UInt_t uMsCompIdx = 0; uMsCompIdx < fvMsComponentsListSts.size(); ++uMsCompIdx) {
597 UInt_t uMsComp = fvMsComponentsListSts[uMsCompIdx];
598
599 if (kFALSE == ProcessStsMs(ts, uMsComp, uMsIdx)) return kFALSE;
600 } // for( UInt_t uMsComp = 0; uMsComp < fvMsComponentsListSts.size(); ++uMsComp )
601
602 // Loop over registered TOF components
603 for (UInt_t uMsCompIdx = 0; uMsCompIdx < fvMsComponentsListTof.size(); ++uMsCompIdx) {
604 UInt_t uMsComp = fvMsComponentsListTof[uMsCompIdx];
605
606 if (kFALSE == ProcessTofMs(ts, uMsComp, uMsIdx)) return kFALSE;
607 } // for( UInt_t uMsComp = 0; uMsComp < fvMsComponentsListSts.size(); ++uMsComp )
608
611 if (fulCurrentMsIdx * 1e-9 < fdSpillStartA - 0.2) {
613 for (UInt_t uSdpb = 0; uSdpb < fuStsNrOfDpbs; ++uSdpb) {
614 fhMcbmHitsNbPerMs->Fill(fvmStsSdpbHitsInMs[uSdpb].size(), uSdpb);
615 fvmStsSdpbHitsInMs[uSdpb].clear();
616 } // for( UInt_t uSdpb = 0; uSdpb < fuStsNrOfDpbs; ++uSdpb )
617 for (UInt_t uGdpb = 0; uGdpb < fuTofNrOfDpbs; ++uGdpb) {
619 fvmTofGdpbHitsInMs[uGdpb].clear();
620 } // for( UInt_t uGdpb = 0; uGdpb < fuTofNrOfDpbs; ++uGdpb )
621 continue;
622 } // if( fulCurrentMsIdx * 1e-9 < fdSpillStartA - 0.2 )
623 } // if( fdSpillStartA < fdSpillStartC )
624
625 /****************** STS Sync ******************************************/
627 for (UInt_t uSdpb = 0; uSdpb < fuStsNrOfDpbs; ++uSdpb)
628 std::sort(fvmStsSdpbHitsInMs[uSdpb].begin(), fvmStsSdpbHitsInMs[uSdpb].end());
629 /****************** STS Sync ******************************************/
630
631 /****************** TOF Sync ******************************************/
633 for (UInt_t uGdpb = 0; uGdpb < fuTofNrOfDpbs; ++uGdpb)
634 std::sort(fvmTofGdpbHitsInMs[uGdpb].begin(), fvmTofGdpbHitsInMs[uGdpb].end());
635 /****************** TOF Sync ******************************************/
636
637 /****************** mCBM Sync *****************************************/
639 UInt_t uNbDiaHits = fvmTofGdpbHitsInMs[fuDiamondDpbIdx].size();
640 for (UInt_t uHitDia = 0; uHitDia < uNbDiaHits; uHitDia++) {
641 Double_t dDiaTime = fvmTofGdpbHitsInMs[fuDiamondDpbIdx][uHitDia].GetFullTimeNs();
642
644 fvhHitsTimeEvoSpillA[fuDiamondDpbIdx + fuStsNrOfDpbs]->Fill(dDiaTime * 1e-9);
645 fvhHitsTimeEvoSpillB[fuDiamondDpbIdx + fuStsNrOfDpbs]->Fill(dDiaTime * 1e-9);
646 } // if( fdSpillStartA < fdSpillStartC )
647
648 for (UInt_t uSdpb = 0; uSdpb < fuStsNrOfDpbs; ++uSdpb) {
649 UInt_t uNbHits = fvmStsSdpbHitsInMs[uSdpb].size();
650 Double_t dBestDt = 1e9;
651 UInt_t uNbIncrDt = 0;
652
653 for (UInt_t uHit = 0; uHit < uNbHits; ++uHit) {
654 Double_t dHitTime = stsxyter::kdClockCycleNs * fvmStsSdpbHitsInMs[uSdpb][uHit].GetTs();
655 if (fuMuchDpbIdx == uSdpb) dHitTime -= fdMuchTofOffsetNs;
656 else
657 dHitTime -= fdStsTofOffsetNs;
658
660 fvhHitsTimeEvoSpillA[uSdpb]->Fill(dHitTime * 1e-9);
661 fvhHitsTimeEvoSpillB[uSdpb]->Fill(dHitTime * 1e-9);
662 } // if( fdSpillStartA < fdSpillStartC )
663
664 Double_t dDt = dHitTime - dDiaTime;
665
666 if (kTRUE == fbUseBestPair) {
668 if (TMath::Abs(dDt) < TMath::Abs(dBestDt)) dBestDt = dDt;
669 else if (dBestDt < dDt)
670 uNbIncrDt++;
671
673 if (5 == dBestDt) break;
674 } // if( kTRUE == fbUseBestPair )
675 else {
676 fhMcbmTimeDiffToDiamond->Fill(dDt, uSdpb);
677 fhMcbmTimeDiffToDiamondWide->Fill(dDt / 1000.0, uSdpb);
678
680 fvhMcbmTimeDiffToDiamondWideEvoDpb[uSdpb]->Fill(fulCurrentTsIdx, dDt / 1000.0);
681 } // else of if( kTRUE == fbUseBestPair )
682 } // for( UInt_t uHit = 0; uHit < uNbHits; ++uHit )
683
684 if (kTRUE == fbUseBestPair) {
685 fhMcbmTimeDiffToDiamond->Fill(dBestDt, uSdpb);
686 fhMcbmTimeDiffToDiamondWide->Fill(dBestDt / 1000.0, uSdpb);
687
688 fvhMcbmTimeDiffToDiamondEvoDpb[uSdpb]->Fill(fulCurrentTsIdx, dBestDt);
689 fvhMcbmTimeDiffToDiamondWideEvoDpb[uSdpb]->Fill(fulCurrentTsIdx, dBestDt / 1000.0);
690 } // if( kTRUE == fbUseBestPair )
691 } // for( UInt_t uSdpb = 0; uSdpb < fuStsNrOfDpbs; ++uSdpb )
692
693 for (UInt_t uGdpb = 0; uGdpb < fuTofNrOfDpbs; ++uGdpb) {
694 if (fuDiamondDpbIdx == uGdpb) continue;
695
696 UInt_t uNbHits = fvmTofGdpbHitsInMs[uGdpb].size();
697 Double_t dBestDt = 1e9;
698 UInt_t uNbIncrDt = 0;
699
700 for (UInt_t uHit = 0; uHit < uNbHits; ++uHit) {
701 Double_t dHitTime = fvmTofGdpbHitsInMs[uGdpb][uHit].GetFullTimeNs();
702
704 fvhHitsTimeEvoSpillA[uGdpb + fuStsNrOfDpbs]->Fill(dHitTime * 1e-9);
705 fvhHitsTimeEvoSpillB[uGdpb + fuStsNrOfDpbs]->Fill(dHitTime * 1e-9);
706 } // if( fdSpillStartA < fdSpillStartC )
707
708 Double_t dDt = dHitTime - dDiaTime;
709
710 if (kTRUE == fbUseBestPair) {
712 if (TMath::Abs(dDt) < TMath::Abs(dBestDt)) dBestDt = dDt;
713 else if (dBestDt < dDt)
714 uNbIncrDt++;
715
717 if (5 == dBestDt) break;
718 } // if( kTRUE == fbUseBestPair )
719 else {
720 fhMcbmTimeDiffToDiamond->Fill(dDt, uGdpb + fuStsNrOfDpbs);
721 fhMcbmTimeDiffToDiamondWide->Fill(dDt / 1000.0, uGdpb + fuStsNrOfDpbs);
722
725 } // else of if( kTRUE == fbUseBestPair )
726 } // for( UInt_t uHit = 0; uHit < uNbHits; ++uHit )
727
728 if (kTRUE == fbUseBestPair) {
729 fhMcbmTimeDiffToDiamond->Fill(dBestDt, uGdpb + fuStsNrOfDpbs);
730 fhMcbmTimeDiffToDiamondWide->Fill(dBestDt / 1000.0, uGdpb + fuStsNrOfDpbs);
731
733 fvhMcbmTimeDiffToDiamondWideEvoDpb[uGdpb + fuStsNrOfDpbs]->Fill(fulCurrentTsIdx, dBestDt / 1000.0);
734 } // if( kTRUE == fbUseBestPair )
735 } // for( UInt_t uGdpb = 0; uGdpb < fuTofNrOfDpbs; ++uGdpb )
736 } // for( UInt_t uHitDia = 0; uHitDia < uNbDiaHits; uHitDia++)
737
739 UInt_t uNbMuchHits = fvmStsSdpbHitsInMs[fuMuchDpbIdx].size();
740 for (UInt_t uHitMuch = 0; uHitMuch < uNbMuchHits; uHitMuch++) {
741 Double_t dMuchTime =
743
744 for (UInt_t uSdpb = 0; uSdpb < fuStsNrOfDpbs; ++uSdpb) {
745 if (fuMuchDpbIdx == uSdpb) continue;
746
747 UInt_t uNbHits = fvmStsSdpbHitsInMs[uSdpb].size();
748 Double_t dBestDt = 1e9;
749 UInt_t uBestAdc = 0;
750 UInt_t uNbIncrDt = 0;
751
752 for (UInt_t uHit = 0; uHit < uNbHits; ++uHit) {
753 Double_t dHitTime = stsxyter::kdClockCycleNs * fvmStsSdpbHitsInMs[uSdpb][uHit].GetTs();
754 if (fuMuchDpbIdx == uSdpb) dHitTime -= fdMuchTofOffsetNs;
755 else
756 dHitTime -= fdStsTofOffsetNs;
757
758 Double_t dDt = dHitTime - dMuchTime;
759
760 if (kTRUE == fbUseBestPair) {
762 if (TMath::Abs(dDt) < TMath::Abs(dBestDt)) {
763 dBestDt = dDt;
764 uBestAdc = fvmStsSdpbHitsInMs[uSdpb][uHit].GetAdc();
765 } // if( TMath::Abs( dDt ) < TMath::Abs( dBestDt ) )
766 else if (dBestDt < dDt)
767 uNbIncrDt++;
768
770 if (5 == dBestDt) break;
771 } // if( kTRUE == fbUseBestPair )
772 else {
773 fhMcbmTimeDiffToMuch->Fill(dDt, uSdpb);
774 fhMcbmTimeDiffToMuchWide->Fill(dDt / 1000.0, uSdpb);
775
776 fhMcbmStsTimeDiffToMuchVsAdc->Fill(dDt, fvmStsSdpbHitsInMs[uSdpb][uHit].GetAdc());
777 fhMcbmStsTimeDiffToMuchWideVsAdc->Fill(dDt / 1000.0, fvmStsSdpbHitsInMs[uSdpb][uHit].GetAdc());
778 } // else of if( kTRUE == fbUseBestPair )
779 } // for( UInt_t uHit = 0; uHit < uNbHits; ++uHit )
780
781 if (kTRUE == fbUseBestPair) {
782 fhMcbmTimeDiffToMuch->Fill(dBestDt, uSdpb);
783 fhMcbmTimeDiffToMuchWide->Fill(dBestDt / 1000.0, uSdpb);
784
785 fhMcbmStsTimeDiffToMuchVsAdc->Fill(dBestDt, uBestAdc);
786 fhMcbmStsTimeDiffToMuchWideVsAdc->Fill(dBestDt / 1000.0, uBestAdc);
787 } // if( kTRUE == fbUseBestPair )
788 } // for( UInt_t uSdpb = 0; uSdpb < fuStsNrOfDpbs; ++uSdpb )
789
790 for (UInt_t uGdpb = 0; uGdpb < fuTofNrOfDpbs; ++uGdpb) {
791 UInt_t uNbHits = fvmTofGdpbHitsInMs[uGdpb].size();
792 Double_t dBestDt = 1e9;
793 UInt_t uNbIncrDt = 0;
794
795 for (UInt_t uHit = 0; uHit < uNbHits; ++uHit) {
796 Double_t dHitTime = fvmTofGdpbHitsInMs[uGdpb][uHit].GetFullTimeNs();
797
798 Double_t dDt = dHitTime - dMuchTime;
799
800 if (kTRUE == fbUseBestPair) {
802 if (TMath::Abs(dDt) < TMath::Abs(dBestDt)) dBestDt = dDt;
803 else if (dBestDt < dDt)
804 uNbIncrDt++;
805
807 if (5 == dBestDt) break;
808 } // if( kTRUE == fbUseBestPair )
809 else {
810 fhMcbmTimeDiffToMuch->Fill(dDt, uGdpb + fuStsNrOfDpbs);
811 fhMcbmTimeDiffToMuchWide->Fill(dDt / 1000.0, uGdpb + fuStsNrOfDpbs);
812 } // else of if( kTRUE == fbUseBestPair )
813 } // for( UInt_t uHit = 0; uHit < uNbHits; ++uHit )
814
815 if (kTRUE == fbUseBestPair) {
816 fhMcbmTimeDiffToMuch->Fill(dBestDt, uGdpb + fuStsNrOfDpbs);
817 fhMcbmTimeDiffToMuchWide->Fill(dBestDt / 1000.0, uGdpb + fuStsNrOfDpbs);
818 } // if( kTRUE == fbUseBestPair )
819 } // for( UInt_t uGdpb = 0; uGdpb < fuTofNrOfDpbs; ++uGdpb )
820 } // for( UInt_t uHitMuch = 0; uHitMuch < uNbMuchHits; uHitMuch++)
821
823 for (UInt_t uSdpb = 0; uSdpb < fuStsNrOfDpbs; ++uSdpb) {
824 fhMcbmHitsNbPerMs->Fill(fvmStsSdpbHitsInMs[uSdpb].size(), uSdpb);
825
826 if (fbTsLevelAna)
827 fvmStsSdpbHitsInTs[uSdpb].insert(fvmStsSdpbHitsInTs[uSdpb].end(), fvmStsSdpbHitsInMs[uSdpb].begin(),
828 fvmStsSdpbHitsInMs[uSdpb].end());
829
830 fvmStsSdpbHitsInMs[uSdpb].clear();
831 } // for( UInt_t uSdpb = 0; uSdpb < fuStsNrOfDpbs; ++uSdpb )
832 for (UInt_t uGdpb = 0; uGdpb < fuTofNrOfDpbs; ++uGdpb) {
834
835 if (fbTsLevelAna)
836 fvmTofGdpbHitsInTs[uGdpb].insert(fvmTofGdpbHitsInTs[uGdpb].end(), fvmTofGdpbHitsInMs[uGdpb].begin(),
837 fvmTofGdpbHitsInMs[uGdpb].end());
838
839 fvmTofGdpbHitsInMs[uGdpb].clear();
840 } // for( UInt_t uGdpb = 0; uGdpb < fuTofNrOfDpbs; ++uGdpb )
841 /****************** mCBM Sync *****************************************/
842
845 if (fdSpillStartC < fulCurrentMsIdx * 1e-9) {
847 LOG(fatal) << "Done with the spills";
848 } // if( fdSpillStartC < fulCurrentMsIdx * 1e-9 )
849 } // if( fdSpillStartA < fdSpillStartC )
850
851 } // for( UInt_t uMsIdx = 0; uMsIdx < uNbMsLoop; uMsIdx ++ )
852
853 /****************** mCBM Sync *****************************************/
854
856 UInt_t uNbDiaHits = fvmTofGdpbHitsInTs[fuDiamondDpbIdx].size();
857 for (UInt_t uHitDia = 0; uHitDia < uNbDiaHits; uHitDia++) {
858 Double_t dDiaTime = fvmTofGdpbHitsInTs[fuDiamondDpbIdx][uHitDia].GetFullTimeNs();
859
860 for (UInt_t uSdpb = 0; uSdpb < fuStsNrOfDpbs; ++uSdpb) {
861 UInt_t uNbHits = fvmStsSdpbHitsInTs[uSdpb].size();
862 for (UInt_t uHit = 0; uHit < uNbHits; ++uHit) {
863 Double_t dHitTime = stsxyter::kdClockCycleNs * fvmStsSdpbHitsInTs[uSdpb][uHit].GetTs();
864
865 Double_t dDt = dHitTime - dDiaTime;
866
868 if (300e3 < dDt) break;
869
870 fhMcbmTimeDiffToDiamondTs->Fill(dDt / 1e6, uSdpb);
871
872 fvhMcbmTimeDiffToDiamondTsEvoDpb[uSdpb]->Fill(fulCurrentTsIdx, dDt / 1e6);
873
875 Double_t dDiaTimeSec = dDiaTime * 1e-9;
876 if (fdSpillStartA - 0.1 < dDiaTimeSec && dDiaTimeSec < fdSpillStartC + 0.1) {
877 fvhMcbmTimeDiffToDiamondEvoSpillA[uSdpb]->Fill(dDiaTimeSec, dDt / 1e3);
878 fvhMcbmTimeDiffToDiamondEvoSpillB[uSdpb]->Fill(dDiaTimeSec, dDt / 1e3);
879 } // if( fdSpillStartA - 0.1 < dDiaTimeSec && dDiaTimeSec < fdSpillStartC + 0.1 )
880 } // if( fdSpillStartA < fdSpillStartC )
881 } // for( UInt_t uHit = 0; uHit < uNbHits; ++uHit )
882 } // for( UInt_t uSdpb = 0; uSdpb < fuStsNrOfDpbs; ++uSdpb )
883
884 for (UInt_t uGdpb = 0; uGdpb < fuTofNrOfDpbs; ++uGdpb) {
885 if (fuDiamondDpbIdx == uGdpb) continue;
886
887 UInt_t uNbHits = fvmTofGdpbHitsInTs[uGdpb].size();
888 for (UInt_t uHit = 0; uHit < uNbHits; ++uHit) {
889 Double_t dHitTime = fvmTofGdpbHitsInTs[uGdpb][uHit].GetFullTimeNs();
890
891 Double_t dDt = dHitTime - dDiaTime;
892
894 if (300e3 < dDt) break;
895
896 fhMcbmTimeDiffToDiamondTs->Fill(dDt / 1e6, uGdpb + fuStsNrOfDpbs);
897
899
901 Double_t dDiaTimeSec = dDiaTime * 1e-9;
902 if (fdSpillStartA - 0.1 < dDiaTimeSec && dDiaTimeSec < fdSpillStartC + 0.1) {
903 fvhMcbmTimeDiffToDiamondEvoSpillA[uGdpb + fuStsNrOfDpbs]->Fill(dDiaTimeSec, dDt / 1e3);
904 fvhMcbmTimeDiffToDiamondEvoSpillB[uGdpb + fuStsNrOfDpbs]->Fill(dDiaTimeSec, dDt / 1e3);
905 } // if( fdSpillStartA - 0.1 < dDiaTimeSec && dDiaTimeSec < fdSpillStartC + 0.1 )
906 } // if( fdSpillStartA < fdSpillStartC )
907 } // for( UInt_t uHit = 0; uHit < uNbHits; ++uHit )
908 } // for( UInt_t uGdpb = 0; uGdpb < fuTofNrOfDpbs; ++uGdpb )
909 } // for( UInt_t uHitDia = 0; uHitDia < uNbDiaHits; uHitDia++)
910
912 UInt_t uNbMuchHits = fvmStsSdpbHitsInTs[fuMuchDpbIdx].size();
913 for (UInt_t uHitMuch = 0; uHitMuch < uNbMuchHits; uHitMuch++) {
914 Double_t dMuchTime =
916
917 for (UInt_t uSdpb = 0; uSdpb < fuStsNrOfDpbs; ++uSdpb) {
918 if (fuMuchDpbIdx == uSdpb) continue;
919
920 UInt_t uNbHits = fvmStsSdpbHitsInTs[uSdpb].size();
921 // Double_t dBestDt = 1e9;
922 // UInt_t uBestAdc = 0;
923 // UInt_t uNbIncrDt = 0;
924
925 for (UInt_t uHit = 0; uHit < uNbHits; ++uHit) {
926 Double_t dHitTime = stsxyter::kdClockCycleNs * fvmStsSdpbHitsInTs[uSdpb][uHit].GetTs();
927 if (fuMuchDpbIdx == uSdpb) dHitTime -= fdMuchTofOffsetNs;
928 else
929 dHitTime -= fdStsTofOffsetNs;
930
931 Double_t dDt = dHitTime - dMuchTime;
932
934 if (300e3 < dDt) break;
935
936 fhMcbmTimeDiffToMuchTs->Fill(dDt / 1e6, uSdpb);
937 fhMcbmStsTimeDiffToMuchTsVsAdc->Fill(dDt / 1e6, fvmStsSdpbHitsInTs[uSdpb][uHit].GetAdc());
938
940 Double_t dMuchTimeSec = dMuchTime * 1e-9;
941 if (fdSpillStartA - 0.1 < dMuchTimeSec && dMuchTimeSec < fdSpillStartC + 0.1) {
942 fvhMcbmTimeDiffToMuchEvoSpillA[uSdpb]->Fill(dMuchTimeSec, dDt / 1e3);
943 fvhMcbmTimeDiffToMuchEvoSpillB[uSdpb]->Fill(dMuchTimeSec, dDt / 1e3);
944 } // if( fdSpillStartA - 0.1 < dDiaTimeSec && dDiaTimeSec < fdSpillStartC + 0.1 )
945 } // if( fdSpillStartA < fdSpillStartC )
946 } // for( UInt_t uHit = 0; uHit < uNbHits; ++uHit )
947 } // for( UInt_t uSdpb = 0; uSdpb < fuStsNrOfDpbs; ++uSdpb )
948
949 for (UInt_t uGdpb = 0; uGdpb < fuTofNrOfDpbs; ++uGdpb) {
950 UInt_t uNbHits = fvmTofGdpbHitsInTs[uGdpb].size();
951 // Double_t dBestDt = 1e9;
952 // UInt_t uNbIncrDt = 0;
953
954 for (UInt_t uHit = 0; uHit < uNbHits; ++uHit) {
955 Double_t dHitTime = fvmTofGdpbHitsInTs[uGdpb][uHit].GetFullTimeNs();
956
957 Double_t dDt = dHitTime - dMuchTime;
958
960 if (300e3 < dDt) break;
961
962 fhMcbmTimeDiffToMuchTs->Fill(dDt / 1e6, uGdpb + fuStsNrOfDpbs);
964 Double_t dMuchTimeSec = dMuchTime * 1e-9;
965 if (fdSpillStartA - 0.1 < dMuchTimeSec && dMuchTimeSec < fdSpillStartC + 0.1) {
966 fvhMcbmTimeDiffToMuchEvoSpillA[uGdpb + fuStsNrOfDpbs]->Fill(dMuchTimeSec, dDt / 1e3);
967 fvhMcbmTimeDiffToMuchEvoSpillB[uGdpb + fuStsNrOfDpbs]->Fill(dMuchTimeSec, dDt / 1e3);
968 } // if( fdSpillStartA - 0.1 < dDiaTimeSec && dDiaTimeSec < fdSpillStartC + 0.1 )
969 } // if( fdSpillStartA < fdSpillStartC )
970 } // for( UInt_t uHit = 0; uHit < uNbHits; ++uHit )
971 } // for( UInt_t uGdpb = 0; uGdpb < fuTofNrOfDpbs; ++uGdpb )
972 } // for( UInt_t uHitMuch = 0; uHitMuch < uNbMuchHits; uHitMuch++)
973
975 for (UInt_t uSdpb = 0; uSdpb < fuStsNrOfDpbs; ++uSdpb) {
976 fvmStsSdpbHitsInTs[uSdpb].clear();
977 } // for( UInt_t uSdpb = 0; uSdpb < fuStsNrOfDpbs; ++uSdpb )
978 for (UInt_t uGdpb = 0; uGdpb < fuTofNrOfDpbs; ++uGdpb) {
979 fvmTofGdpbHitsInTs[uGdpb].clear();
980 } // for( UInt_t uGdpb = 0; uGdpb < fuTofNrOfDpbs; ++uGdpb )
981
982 /****************** mCBM Sync *****************************************/
983
984 if (0 == ts.index() % 1000) {
985 LOG(info) << "End of TS " << std::setw(7) << ts.index();
986 } // if( 0 == ts.index() % 1000 )
987
988 return kTRUE;
989}
990
991/****************** STS Sync ******************************************/
992Bool_t CbmMcbm2018MonitorMcbmSync::ProcessStsMs(const fles::Timeslice& ts, size_t uMsComp, UInt_t uMsIdx)
993{
994 auto msDescriptor = ts.descriptor(uMsComp, uMsIdx);
995 fuCurrentEquipmentId = msDescriptor.eq_id;
996 const uint8_t* msContent = reinterpret_cast<const uint8_t*>(ts.content(uMsComp, uMsIdx));
997
998 uint32_t uSize = msDescriptor.size;
999 fulCurrentMsIdx = msDescriptor.idx;
1000 // Double_t dMsTime = (1e-9) * static_cast<double>(fulCurrentMsIdx);
1001 LOG(debug) << "Microslice: " << fulCurrentMsIdx << " from EqId " << std::hex << fuCurrentEquipmentId << std::dec
1002 << " has size: " << uSize;
1003
1004 fuCurrDpbId = static_cast<uint32_t>(fuCurrentEquipmentId & 0xFFFF);
1006
1008 UInt_t uTsMsbCycleHeader = std::floor(fulCurrentMsIdx / (stsxyter::kulTsCycleNbBins * stsxyter::kdClockCycleNs));
1009
1010 if (0 == uMsIdx) {
1011 fvuStsCurrentTsMsbCycle[fuCurrDpbIdx] = uTsMsbCycleHeader;
1013 } // if( 0 == uMsIdx )
1014 else if (uTsMsbCycleHeader != fvuStsCurrentTsMsbCycle[fuCurrDpbIdx] && 4194303 != fvulStsCurrentTsMsb[fuCurrDpbIdx]) {
1015 LOG(warning) << "TS MSB cycle from MS header does not match current cycle from data "
1016 << "for TS " << std::setw(12) << fulCurrentTsIdx << " MS " << std::setw(12) << fulCurrentMsIdx
1017 << " MsInTs " << std::setw(3) << uMsIdx << " ====> " << fvuStsCurrentTsMsbCycle[fuCurrDpbIdx] << " VS "
1018 << uTsMsbCycleHeader;
1019 fvuStsCurrentTsMsbCycle[fuCurrDpbIdx] = uTsMsbCycleHeader;
1020 }
1021
1022 // If not integer number of message in input buffer, print warning/error
1023 if (0 != (uSize % kuStsBytesPerMessage))
1024 LOG(error) << "The input microslice buffer does NOT "
1025 << "contain only complete nDPB messages!";
1026
1027 // Compute the number of complete messages in the input microslice buffer
1028 uint32_t uNbMessages = (uSize - (uSize % kuStsBytesPerMessage)) / kuStsBytesPerMessage;
1029
1030 // Prepare variables for the loop on contents
1031 const uint32_t* pInBuff = reinterpret_cast<const uint32_t*>(msContent);
1032
1033 for (uint32_t uIdx = 0; uIdx < uNbMessages; ++uIdx) {
1034 // Fill message
1035 uint32_t ulData = static_cast<uint32_t>(pInBuff[uIdx]);
1036
1037 stsxyter::Message mess(static_cast<uint32_t>(ulData & 0xFFFFFFFF));
1038
1039 // Print message if requested
1040 if (fbPrintMessages) mess.PrintMess(std::cout, fPrintMessCtrlSts);
1041
1042 stsxyter::MessType typeMess = mess.GetMessType();
1043 fmMsgCounter[typeMess]++;
1044
1045 switch (typeMess) {
1047
1048 FillStsHitInfo(mess, uMsIdx);
1049 break;
1050 } // case stsxyter::MessType::Hit :
1052 FillStsTsMsbInfo(mess, uIdx, uMsIdx);
1053 break;
1054 } // case stsxyter::MessType::TsMsb :
1056 // The first message in the TS is a special ones: EPOCH
1057 FillStsEpochInfo(mess);
1058
1059 if (0 < uIdx)
1060 LOG(info) << "CbmMcbm2018MonitorMcbmSync::DoUnpack => "
1061 << "EPOCH message at unexpected position in MS: message " << uIdx << " VS message 0 expected!";
1062 break;
1063 } // case stsxyter::MessType::TsMsb :
1067 break;
1068 } // case stsxyter::MessType::Dummy / ReadDataAck / Ack :
1069 default: {
1070 LOG(fatal) << "CbmMcbm2018MonitorMcbmSync::DoUnpack => "
1071 << "Unknown message type, should never happen, stopping here!";
1072 }
1073 } // switch( mess.GetMessType() )
1074 } // for( uint32_t uIdx = 0; uIdx < uNbMessages; ++uIdx )
1075 return kTRUE;
1076}
1077
1079{
1080 UShort_t usChan = mess.GetHitChannel();
1081 UShort_t usRawAdc = mess.GetHitAdc();
1082 // UShort_t usFullTs = mess.GetHitTimeFull();
1083 // UShort_t usTsOver = mess.GetHitTimeOver();
1084 UShort_t usRawTs = mess.GetHitTime();
1085
1086 UInt_t uAsicIdx = 0;
1087
1088 if (fuCurrDpbIdx == fuMuchDpbIdx) {
1090 switch (usChan) {
1091 case 101:
1092 case 99:
1093 case 91:
1094 case 89:
1095 case 88:
1096 case 86:
1097 case 84:
1098 case 83:
1099 case 80:
1100 case 78:
1101 case 76:
1102 case 50:
1103 case 39:
1104 case 37:
1105 case 35:
1106 case 20: {
1107 return;
1108 break;
1109 } // if bad channel
1110 default: break;
1111 } // switch( usChan )
1112 } // if( fuCurrDpbIdx == fuMuchDpbIdx )
1113 else {
1115 if (usRawAdc < 15) return;
1116
1118 uAsicIdx = fUnpackParSts->ElinkIdxToAsicIdx(kFALSE, mess.GetLinkIndex());
1119 UInt_t uChanIdx = usChan + fUnpackParSts->GetNbChanPerAsic() * uAsicIdx;
1120 switch (uChanIdx) {
1121 case 781:
1122 case 270:
1123 case 411:
1124 case 518: {
1125 return;
1126 break;
1127 } // if bad channel
1128 default: break;
1129 } // switch( mess.GetLinkIndex() )
1130 if ((0 == uChanIdx % 2) && (543 < uChanIdx) && (uChanIdx < 633)) { return; } // if bad channel
1131 } // else of if( fuCurrDpbIdx == fuMuchDpbIdx )
1132
1133 // Compute the Full time stamp
1134 // Use TS w/o overlap bits as they will anyway come from the TS_MSB
1135 Long64_t ulStsHitTime = usRawTs;
1136
1137 ulStsHitTime +=
1138 static_cast<ULong64_t>(stsxyter::kuHitNbTsBins) * static_cast<ULong64_t>(fvulStsCurrentTsMsb[fuCurrDpbIdx])
1139 + static_cast<ULong64_t>(stsxyter::kulTsCycleNbBins)
1140 * static_cast<ULong64_t>(fvuStsCurrentTsMsbCycle[fuCurrDpbIdx]);
1141
1142 // Convert the Hit time in bins to Hit time in ns
1143 // Double_t dHitTimeNs = ulStsHitTime * stsxyter::kdClockCycleNs;
1144
1145
1146 // Pulser and MS
1147 fvmStsSdpbHitsInMs[fuCurrDpbIdx].push_back(stsxyter::FinalHit(ulStsHitTime, usRawAdc, uAsicIdx, usChan));
1148}
1149
1150void CbmMcbm2018MonitorMcbmSync::FillStsTsMsbInfo(stsxyter::Message mess, UInt_t uMessIdx, UInt_t uMsIdx)
1151{
1152 UInt_t uVal = mess.GetTsMsbVal();
1153
1154 // Update Status counters
1155 if (uVal < fvulStsCurrentTsMsb[fuCurrDpbIdx]) {
1156
1157 LOG(info) << " TS " << std::setw(12) << fulCurrentTsIdx << " MS " << std::setw(12) << fulCurrentMsIdx << " DPB "
1158 << std::setw(2) << fuCurrDpbIdx << " Old TsMsb " << std::setw(5) << fvulStsCurrentTsMsb[fuCurrDpbIdx]
1159 << " Old MsbCy " << std::setw(5) << fvuStsCurrentTsMsbCycle[fuCurrDpbIdx] << " new TsMsb " << std::setw(5)
1160 << uVal;
1161
1163 } // if( uVal < fvulStsCurrentTsMsb[fuCurrDpbIdx] )
1164 if (uVal != fvulStsCurrentTsMsb[fuCurrDpbIdx] + 1 && 0 != uVal && 4194303 != fvulStsCurrentTsMsb[fuCurrDpbIdx]
1165 && 1 != uMessIdx) {
1166 LOG(info) << "TS MSb Jump in "
1167 << " TS " << std::setw(12) << fulCurrentTsIdx << " MS " << std::setw(12) << fulCurrentMsIdx << " MS Idx "
1168 << std::setw(4) << uMsIdx << " Msg Idx " << std::setw(5) << uMessIdx << " DPB " << std::setw(2)
1169 << fuCurrDpbIdx << " => Old TsMsb " << std::setw(5) << fvulStsCurrentTsMsb[fuCurrDpbIdx] << " new TsMsb "
1170 << std::setw(5) << uVal;
1171 } // if( uVal + 1 != fvulStsCurrentTsMsb[fuCurrDpbIdx] && 4194303 != uVal && 0 != fvulStsCurrentTsMsb[fuCurrDpbIdx] )
1173 /*
1174 ULong64_t ulNewTsMsbTime = static_cast< ULong64_t >( stsxyter::kuHitNbTsBins )
1175 * static_cast< ULong64_t >( fvulStsCurrentTsMsb[fuCurrDpbIdx])
1176 + static_cast< ULong64_t >( stsxyter::kulTsCycleNbBins )
1177 * static_cast< ULong64_t >( fvuStsCurrentTsMsbCycle[fuCurrDpbIdx] );
1178*/
1179}
1180
1182{
1183 // UInt_t uVal = mess.GetTsMsbVal();
1184}
1185/****************** STS Sync ******************************************/
1186
1187/****************** TOF Sync ******************************************/
1188
1189Bool_t CbmMcbm2018MonitorMcbmSync::ProcessTofMs(const fles::Timeslice& ts, size_t uMsComp, UInt_t uMsIdx)
1190{
1191 auto msDescriptor = ts.descriptor(uMsComp, uMsIdx);
1192 fuCurrentEquipmentId = msDescriptor.eq_id;
1193 fdTofMsIndex = static_cast<double>(msDescriptor.idx);
1194 const uint8_t* msContent = reinterpret_cast<const uint8_t*>(ts.content(uMsComp, uMsIdx));
1195
1196 uint32_t size = msDescriptor.size;
1197 // fulLastMsIdx = msDescriptor.idx;
1198 if (size > 0) LOG(debug) << "Microslice: " << msDescriptor.idx << " has size: " << size;
1199
1200 Int_t messageType = -111;
1201
1202 // If not integer number of message in input buffer, print warning/error
1203 if (0 != (size % kuTofBytesPerMessage))
1204 LOG(error) << "The input microslice buffer does NOT "
1205 << "contain only complete nDPB messages!";
1206
1207 // Compute the number of complete messages in the input microslice buffer
1208 uint32_t uNbMessages = (size - (size % kuTofBytesPerMessage)) / kuTofBytesPerMessage;
1209
1210 // Get the gDPB ID from the MS header
1213
1214 // Prepare variables for the loop on contents
1215 const uint64_t* pInBuff = reinterpret_cast<const uint64_t*>(msContent);
1216 for (uint32_t uIdx = 0; uIdx < uNbMessages; uIdx++) {
1217 // Fill message
1218 uint64_t ulData = static_cast<uint64_t>(pInBuff[uIdx]);
1219 gdpbv100::Message mess(ulData);
1220
1222 if (0 == uIdx) {
1223 FillTofEpochCycle(ulData);
1224 continue;
1225 } // if( 0 == uIdx )
1226
1227 if (fair::Logger::Logging(fair::Severity::debug2)) {
1228 mess.printDataCout();
1229 } // if (fair::Logger::Logging( fair::Severity::debug2 ))
1230
1231 // Increment counter for different message types
1232 // and fill the corresponding histogram
1233 messageType = mess.getMessageType();
1234 fviTofMsgCounter[messageType]++;
1235
1236 switch (messageType) {
1237 case gdpbv100::MSG_HIT: {
1238 if (!mess.getGdpbHitIs24b()) { fvmTofEpSupprBuffer[fuTofGdpbNr].push_back(mess); } // if( !getGdpbHitIs24b() )
1239 break;
1240 } // case gdpbv100::MSG_HIT:
1241 case gdpbv100::MSG_EPOCH: {
1243 FillTofEpochInfo(mess);
1244 } // if this epoch message is a merged one valiud for all chips
1245 else
1246 LOG(fatal) << "Bad epoch: " << mess.getGdpbGenChipId();
1247 break;
1248 } // case gdpbv100::MSG_EPOCH:
1250 case gdpbv100::MSG_SYST:
1254 case gdpbv100::MSG_STAR_TRI_D: break;
1255 default:
1256 LOG(error) << "Message type " << std::hex << std::setw(2) << static_cast<uint16_t>(messageType)
1257 << " not included in Get4 unpacker.";
1258 } // switch( mess.getMessageType() )
1259 } // for (uint32_t uIdx = 0; uIdx < uNbMessages; uIdx ++)
1260
1261 return kTRUE;
1262}
1263
1265{
1266 uint64_t ulEpochCycleVal = ulCycleData & gdpbv100::kulEpochCycleFieldSz;
1267 fvulTofCurrentEpochCycle[fuTofGdpbNr] = ulEpochCycleVal;
1268
1269 return;
1270}
1271
1273{
1274 // UInt_t uChannel = mess.getGdpbHitChanId();
1275 // UInt_t uTot = mess.getGdpbHit32Tot();
1276 // UInt_t uFts = mess.getGdpbHitFineTs();
1277
1278 ULong64_t ulCurEpochGdpbGet4 = fvulTofCurrentEpochFull[fuTofGdpbNr];
1279
1280 // In Ep. Suppr. Mode, receive following epoch instead of previous
1281 if (0 < ulCurEpochGdpbGet4) ulCurEpochGdpbGet4--;
1282 else
1283 ulCurEpochGdpbGet4 = gdpbv100::kuEpochCounterSz; // Catch epoch cycle!
1284
1285 // ULong_t ulHitTime = mess.getMsgFullTime(ulCurEpochGdpbGet4);
1286 // Double_t dHitTime = mess.getMsgFullTimeD(ulCurEpochGdpbGet4);
1287
1288 // In 32b mode the coarse counter is already computed back to 112 FTS bins
1289 // => need to hide its contribution from the Finetime
1290 // => FTS = Fullt TS modulo 112
1291 // uFts = mess.getGdpbHitFullTs() % 112;
1292
1294 fvmTofGdpbHitsInMs[fuTofGdpbNr].push_back(gdpbv100::FullMessage(mess, ulCurEpochGdpbGet4));
1295}
1296
1298{
1299 ULong64_t ulEpochNr = mess.getGdpbEpEpochNb();
1300
1301 fvulTofCurrentEpoch[fuTofGdpbNr] = ulEpochNr;
1304
1305 fulTofCurrentEpochTime = mess.getMsgFullTime(ulEpochNr);
1306
1309 if (0 < ulEpochNr) mess.setGdpbEpEpochNb(ulEpochNr - 1);
1310 else
1312
1313 Int_t iBufferSize = fvmTofEpSupprBuffer[fuTofGdpbNr].size();
1314 if (0 < iBufferSize) {
1315 LOG(debug) << "Now processing stored messages for for gDPB " << fuTofGdpbNr << " with epoch number "
1317
1320 std::stable_sort(fvmTofEpSupprBuffer[fuTofGdpbNr].begin(), fvmTofEpSupprBuffer[fuTofGdpbNr].begin());
1321
1322 for (Int_t iMsgIdx = 0; iMsgIdx < iBufferSize; iMsgIdx++) {
1324 } // for( Int_t iMsgIdx = 0; iMsgIdx < iBufferSize; iMsgIdx++ )
1325
1327 } // if( 0 < fvmTofEpSupprBuffer[fuTofGdpbNr] )
1328}
1329/****************** TOF Sync ******************************************/
1330
1331/****************** STS histos ****************************************/
1332/****************** STS histos ****************************************/
1333
1334/****************** TOF histos ****************************************/
1335/****************** TOF Histos ****************************************/
1336
1338
1340{
1341 /*
1342 LOG(info) << "-------------------------------------";
1343 LOG(info) << "CbmMcbm2018MonitorMcbmSync statistics are ";
1344 LOG(info) << " Hit messages: " << fmMsgCounter[ stsxyter::MessType::Hit ] << "\n"
1345 << " Ts MSB messages: " << fmMsgCounter[ stsxyter::MessType::TsMsb ] << "\n"
1346 << " Dummy messages: " << fmMsgCounter[ stsxyter::MessType::Dummy ] << "\n"
1347 << " Epoch messages: " << fmMsgCounter[ stsxyter::MessType::Epoch ] << "\n"
1348 << " Empty messages: " << fmMsgCounter[ stsxyter::MessType::Empty ];
1349*/
1350 LOG(info) << "-------------------------------------";
1351
1353 SaveAllHistos();
1354}
1355
1356
1358{
1360 TFile* oldFile = gFile;
1361 TDirectory* oldDir = gDirectory;
1362
1363 TFile* histoFile = nullptr;
1364 if ("" != sFileName) {
1365 // open separate histo file in recreate mode
1366 histoFile = new TFile(sFileName, "RECREATE");
1367 histoFile->cd();
1368 } // if( "" != sFileName )
1369
1370 /****************** STS Sync ******************************************/
1371 /****************** STS Sync ******************************************/
1372
1373 /****************** TOF Sync ******************************************/
1374 /****************** TOF Sync ******************************************/
1375
1376 /****************** mCBM Sync *****************************************/
1377 gDirectory->mkdir("mcbmDt");
1378 gDirectory->cd("mcbmDt");
1379 fhMcbmHitsNbPerMs->Write();
1380 fhMcbmTimeDiffToDiamond->Write();
1383
1384 fhMcbmTimeDiffToMuch->Write();
1385 fhMcbmTimeDiffToMuchWide->Write();
1386 fhMcbmTimeDiffToMuchTs->Write();
1387
1391
1392 for (UInt_t uDpb = 0; uDpb < fuTotalNrOfDpb; ++uDpb) {
1393 fvhMcbmTimeDiffToDiamondEvoDpb[uDpb]->Write();
1395 fvhMcbmTimeDiffToDiamondTsEvoDpb[uDpb]->Write();
1396
1398 fvhHitsTimeEvoSpillA[uDpb]->Write();
1399 fvhHitsTimeEvoSpillB[uDpb]->Write();
1400
1401 fvhMcbmTimeDiffToDiamondEvoSpillA[uDpb]->Write();
1402 fvhMcbmTimeDiffToDiamondEvoSpillB[uDpb]->Write();
1403
1404 fvhMcbmTimeDiffToMuchEvoSpillA[uDpb]->Write();
1405 fvhMcbmTimeDiffToMuchEvoSpillB[uDpb]->Write();
1406 } // if( fdSpillStartA < fdSpillStartC )
1407 } // for( UInt_t uDpb = 0; uDpb < fuTotalNrOfDpb; ++uDpb )
1408
1409 gDirectory->cd("..");
1410 /****************** mCBM Sync *****************************************/
1411
1412 if ("" != sFileName) {
1413 // Restore original directory position
1414 histoFile->Close();
1415 } // if( "" != sFileName )
1416
1418 gFile = oldFile;
1419 gDirectory = oldDir;
1420}
1422{
1423 /****************** STS Sync ******************************************/
1424 /****************** STS Sync ******************************************/
1425
1426 /****************** TOF Sync ******************************************/
1427
1428 /****************** TOF Sync ******************************************/
1429
1430 /****************** mCBM Sync *****************************************/
1431 fhMcbmHitsNbPerMs->Reset();
1432 fhMcbmTimeDiffToDiamond->Reset();
1435
1436 fhMcbmTimeDiffToMuch->Reset();
1437 fhMcbmTimeDiffToMuchWide->Reset();
1438 fhMcbmTimeDiffToMuchTs->Reset();
1439
1443
1444 for (UInt_t uDpb = 0; uDpb < fuTotalNrOfDpb; ++uDpb) {
1445 fvhMcbmTimeDiffToDiamondEvoDpb[uDpb]->Reset();
1447 fvhMcbmTimeDiffToDiamondTsEvoDpb[uDpb]->Reset();
1448
1450 fvhHitsTimeEvoSpillA[uDpb]->Reset();
1451 fvhHitsTimeEvoSpillB[uDpb]->Reset();
1452
1453 fvhMcbmTimeDiffToDiamondEvoSpillA[uDpb]->Reset();
1454 fvhMcbmTimeDiffToDiamondEvoSpillB[uDpb]->Reset();
1455
1456 fvhMcbmTimeDiffToMuchEvoSpillA[uDpb]->Reset();
1457 fvhMcbmTimeDiffToMuchEvoSpillB[uDpb]->Reset();
1458 } // if( fdSpillStartA < fdSpillStartC )
1459 } // for( UInt_t uDpb = 0; uDpb < fuTotalNrOfDpb; ++uDpb )
1460 /****************** mCBM Sync *****************************************/
1461}
1462
ClassImp(CbmConverterManager)
Bool_t bMcbm2018WriteSync
Bool_t bMcbm2018ResetSync
static constexpr size_t size()
Definition KfSimdPseudo.h:2
void SaveAllHistos(TString sFileName="")
void CreateStsHistograms()
All hits (time in bins, ADC in bins, asic, channel) in last TS, sorted with "<" operator.
UInt_t fuCurrDpbIdx
Temp holder until Current equipment ID is properly filled in MS.
std::vector< size_t > fvMsComponentsListTof
std::map< UInt_t, UInt_t > fmStsDpbIdIndexMap
Total number of Sts DPBs in system.
UInt_t fuCurrDpbId
Current equipment ID, tells from which DPB the current MS is originating.
virtual void SetNbMsInTs(size_t uCoreMsNb, size_t uOverlapMsNb)
virtual void AddMsComponentToList(size_t component, UShort_t usDetectorId)
std::map< UInt_t, UInt_t > fmTofDpbIdIndexMap
Total number of GDPBs in the system.
std::vector< TH2 * > fvhMcbmTimeDiffToDiamondEvoSpillB
Bool_t ProcessStsMs(const fles::Timeslice &ts, size_t uMsComp, UInt_t uMsIdx)
std::vector< std::vector< stsxyter::FinalHit > > fvmStsSdpbHitsInMs
Current TS MSB cycle for DPB.
std::vector< ULong64_t > fvulTofCurrentEpochCycle
UInt_t fuTotalNrOfDpb
Global parameters.
std::vector< TH2 * > fvhMcbmTimeDiffToMuchEvoSpillA
std::vector< size_t > fvMsComponentsListSts
void AddMsComponentToListTof(size_t component)
std::vector< ULong64_t > fvulTofCurrentEpochFull
std::vector< TH2 * > fvhMcbmTimeDiffToDiamondEvoDpb
virtual Bool_t DoUnpack(const fles::Timeslice &ts, size_t component)
void AddMsComponentToListSts(size_t component)
CbmMcbm2018TofPar * fUnpackParTof
Unpacking and mapping parameters for TOF.
std::vector< UInt_t > fvuStsCurrentTsMsbCycle
Current TS MSB for each DPB.
Bool_t ProcessTofMs(const fles::Timeslice &ts, size_t uMsComp, UInt_t uMsIdx)
void FillTofEpochCycle(uint64_t ulCycleData)
std::vector< TH2 * > fvhMcbmTimeDiffToDiamondEvoSpillA
std::vector< TH2 * > fvhMcbmTimeDiffToMuchEvoSpillB
UInt_t fuMuchDpbIdx
Map of DPB Identifier to DPB index.
std::vector< std::vector< gdpbv100::FullMessage > > fvmTofGdpbHitsInTs
std::vector< ULong64_t > fvulTofCurrentEpoch
std::vector< ULong64_t > fvulStsCurrentTsMsb
Bin size in s for the plots with date as X axis.
std::vector< std::vector< gdpbv100::FullMessage > > fvmTofGdpbHitsInMs
Buffer for system sync check.
void FillStsTsMsbInfo(stsxyter::Message mess, UInt_t uMessIdx=0, UInt_t uMsIdx=0)
void FillStsEpochInfo(stsxyter::Message mess)
void FillStsHitInfo(stsxyter::Message mess, const UInt_t &uMsIdx)
std::vector< std::vector< stsxyter::FinalHit > > fvmStsSdpbHitsInTs
All hits (time in bins, ADC in bins, asic, channel) in last TS, sorted with "<" operator.
static const UInt_t kuTofBytesPerMessage
TODO => move to the message class!!
stsxyter::MessagePrintMask fPrintMessCtrlSts
std::map< stsxyter::MessType, UInt_t > fmMsgCounter
std::vector< TH2 * > fvhMcbmTimeDiffToDiamondWideEvoDpb
std::vector< std::vector< gdpbv100::Message > > fvmTofEpSupprBuffer
Buffer for suppressed epoch processing.
void CreateTofHistograms()
Processing methods.
std::vector< TH2 * > fvhMcbmTimeDiffToDiamondTsEvoDpb
UInt_t GetDpbId(UInt_t uDpbIdx)
UInt_t ElinkIdxToAsicIdx(Bool_t bFebType, UInt_t uElink)
static constexpr UInt_t GetNbChanPerAsic()
Int_t GetNrOfGdpbs()
FIXME: replace with method returning the correspondign constants! see Star2019 parameter.
Int_t GetGdpbId(Int_t i)
Data class with information on a STS local track.
uint16_t getGdpbHitIs24b() const
uint32_t getGdpbEpEpochNb() const
void setGdpbEpEpochNb(uint32_t v)
uint16_t getGdpbGenChipId() const
void printDataCout(unsigned kind=msg_print_Prefix|msg_print_Data, uint32_t epoch=0) const
Print message in human readable format to cout.
uint8_t getMessageType() const
Returns the message type. Valid for all message types. 4 bit.
uint64_t getMsgFullTime(uint64_t epoch) const
Returns expanded and adjusted time of message (in ns)
XPU_D uint16_t GetHitAdc() const
For Hit data: Returns ADC value (5 bit field)
XPU_D uint16_t GetHitChannel() const
For Hit data: Returns StsXYTER channel number (7 bit field)
bool PrintMess(std::ostream &os, MessagePrintMask ctrl=MessagePrintMask::msg_print_Human, bool bBinning=true) const
XPU_D uint16_t GetLinkIndex() const
For all data: Returns the (global) index of the eLink on which the message was received (n bit field)
XPU_D MessType GetMessType() const
Returns the message type, see enum MessType.
XPU_D uint16_t GetHitTime() const
For Hit data: Returns timestamp (8 bit field, 2 MSB bits overlap removed)
XPU_D uint32_t GetTsMsbVal() const
For TS MSB data: Returns the TS MSB 22 bit field)
const uint64_t kulEpochCycleBins
const uint32_t kuChipIdMergedEpoch
const uint32_t kuEpochCounterSz
const uint64_t kulEpochCycleFieldSz
static constexpr uint64_t kulTsCycleNbBins
static constexpr uint32_t kuHitNbTsBins
static constexpr uint32_t kuHitNbAdcBins
Status/properties constants.
static constexpr double kdClockCycleNs
MessType
Message types.