50 , fUnpackParHodo(NULL)
57 , fsHistoFileFullname(
"data/SetupHistos.root")
58 , fbPrintMessages(kFALSE)
59 , fPrintMessCtrl(
stsxyter::MessagePrintMask::msg_print_Human)
63 , fuCurrentEquipmentId(0)
66 , fiRunStartDateTimeSec(-1)
67 , fiBinSizeDatePlots(-1)
69 , fvuCurrentTsMsbCycle()
71 , fvulChanLastHitTime()
72 , fvdChanLastHitTime()
75 , fvdChanLastHitTimeInMs()
76 , fvusChanLastHitAdcInMs()
80 , fdStartTimeMsSz(-1.0)
81 , ftStartTimeUnix(
std::chrono::steady_clock::now())
84 , fuMaxNbMicroslices(100)
85 , fbLongHistoEnable(kFALSE)
86 , fuLongHistoNbSeconds(0)
87 , fuLongHistoBinSizeSec(0)
91 , fdCoincMin(fdCoincCenter - fdCoincBorder)
92 , fdCoincMax(fdCoincCenter + fdCoincBorder)
94 , fhPulserMessType(NULL)
95 , fhPulserSysMessType(NULL)
96 , fhPulserMessTypePerDpb(NULL)
97 , fhPulserSysMessTypePerDpb(NULL)
98 , fhPulserMessTypePerElink(NULL)
99 , fhPulserSysMessTypePerElink(NULL)
100 , fhPulserChanCntRaw()
101 , fhPulserChanCntRawGood()
102 , fhPulserChanAdcRaw()
103 , fhPulserChanAdcRawProf()
104 , fhPulserChanRawTs()
105 , fhPulserChanMissEvt()
106 , fhPulserChanMissEvtEvo()
107 , fhPulserChanHitRateEvo()
108 , fhPulserFebRateEvo()
109 , fhPulserFebMissEvtEvo()
110 , fhPulserChanHitRateEvoLong()
111 , fhPulserFebRateEvoLong()
115 , fhPulserTimeDiffPerAsic()
116 , fhPulserTimeDiffPerAsicPair()
117 , fhPulserTimeDiffEvoPerAsicPair()
118 , fhPulserTsLsbMatchPerAsicPair()
119 , fhPulserTsMsbMatchPerAsicPair()
120 , fhPulserIntervalAsic()
121 , fhPulserIntervalLongAsic()
271 TString sHistName {
""};
274 sHistName =
"hPulserMessageType";
275 title =
"Nb of message for each type; Type";
290 sHistName =
"hPulserSysMessType";
291 title =
"Nb of system message for each type; System Type";
299 sHistName =
"hPulserMessageTypePerDpb";
300 title =
"Nb of message of each type for each DPB; DPB; Type";
315 sHistName =
"hPulserSysMessTypePerDpb";
316 title =
"Nb of system message of each type for each DPB; DPB; System Type";
324 sHistName =
"hPulserMessageTypePerElink";
325 title =
"Nb of message of each type for each eLink; eLink; Type";
341 sHistName =
"hPulserSysMessTypePerElink";
342 title =
"Nb of system message of each type for each eLink; eLink; System Type";
355 const Int_t iNbDecadesRate = 9;
356 const Int_t iNbStepsDecade = 9;
357 const Int_t iNbSubStepsInStep = 10;
358 const Int_t iNbBinsRate = iNbStepsDecade + iNbStepsDecade * iNbSubStepsInStep * iNbDecadesRate + 1;
359 Double_t dBinsRate[iNbBinsRate];
361 for (Int_t iSubU = 0; iSubU < iNbStepsDecade; iSubU++)
362 dBinsRate[iSubU] = 0.1 * (1 + iSubU);
363 std::cout << std::endl;
365 Double_t dSubstepSize = 1.0 / iNbSubStepsInStep;
366 for (Int_t iDecade = 0; iDecade < iNbDecadesRate; iDecade++) {
367 Double_t dBase = std::pow(10, iDecade);
368 Int_t iDecadeIdx = iNbStepsDecade + iDecade * iNbStepsDecade * iNbSubStepsInStep;
369 for (Int_t iStep = 0; iStep < iNbStepsDecade; iStep++) {
370 Int_t iStepIdx = iDecadeIdx + iStep * iNbSubStepsInStep;
371 for (Int_t iSubStep = 0; iSubStep < iNbSubStepsInStep; iSubStep++) {
372 dBinsRate[iStepIdx + iSubStep] = dBase * (1 + iStep) + dBase * dSubstepSize * iSubStep;
376 dBinsRate[iNbBinsRate - 1] = std::pow(10, iNbDecadesRate);
382 UInt_t uNbBinEvo = (32768 + 1) * 2;
384 Double_t dMinEdgeEvo = dMaxEdgeEvo * -1.0;
388 for (UInt_t uXyterIdx = 0; uXyterIdx <
fuNbStsXyters; ++uXyterIdx) {
390 sHistName = Form(
"hPulserChanCntRaw_%03u", uXyterIdx);
391 title = Form(
"Hits Count per channel, StsXyter #%03u; Channel; Hits []", uXyterIdx);
394 sHistName = Form(
"hPulserChanCntRawGood_%03u", uXyterIdx);
395 title = Form(
"Hits Count per channel in good MS, StsXyter #%03u; Channel; Hits []", uXyterIdx);
399 sHistName = Form(
"hPulserChanAdcRaw_%03u", uXyterIdx);
400 title = Form(
"Raw Adc distribution per channel, StsXyter #%03u; Channel "
401 "[]; Adc []; Hits []",
407 sHistName = Form(
"hPulserChanAdcRawProfc_%03u", uXyterIdx);
408 title = Form(
"Raw Adc prodile per channel, StsXyter #%03u; Channel []; Adc []", uXyterIdx);
412 sHistName = Form(
"hPulserChanRawTs_%03u", uXyterIdx);
413 title = Form(
"Raw Timestamp distribution per channel, StsXyter #%03u; "
414 "Channel []; Ts []; Hits []",
420 sHistName = Form(
"hPulserChanMissEvt_%03u", uXyterIdx);
421 title = Form(
"Missed Event flags per channel, StsXyter #%03u; Channel []; "
422 "Miss Evt []; Hits []",
429 sHistName = Form(
"hPulserChanMissEvtEvo_%03u", uXyterIdx);
430 title = Form(
"Missed Evt flags per second & channel in StsXyter #%03u; "
431 "Time [s]; Channel []; Missed Evt flags []",
438 sHistName = Form(
"hPulserFebMissEvtEvo%03u", uXyterIdx);
439 title = Form(
"Missed Evt flags per second in StsXyter #%03u; Time [s]; "
440 "Missed Evt flags []",
445 sHistName = Form(
"hPulserChanRateEvo_%03u", uXyterIdx);
446 title = Form(
"Hits per second & channel in StsXyter #%03u; Time [s]; "
447 "Channel []; Hits []",
453 sHistName = Form(
"hPulserFebRateEvo_%03u", uXyterIdx);
454 title = Form(
"Hits per second in StsXyter #%03u; Time [s]; Hits []", uXyterIdx);
458 sHistName = Form(
"hPulserChanRateEvoLong_%03u", uXyterIdx);
459 title = Form(
"Hits per second & channel in StsXyter #%03u; Time [min]; "
460 "Channel []; Hits []",
466 sHistName = Form(
"hPulserFebRateEvoLong_%03u", uXyterIdx);
467 title = Form(
"Hits per second in StsXyter #%03u; Time [min]; Hits []", uXyterIdx);
471 sHistName = Form(
"fhPulserTimeDiffPerAsic_%03u", uXyterIdx);
472 title = Form(
"Time diff for pulser hits between ASIC %03u and other ASICs; "
473 "tn - t%03u [ns]; ASIC n; Counts",
474 uXyterIdx, uXyterIdx);
478 for (UInt_t uXyterIdxB = 0; uXyterIdxB <
fuNbStsXyters; ++uXyterIdxB) {
479 if (uXyterIdxB == uXyterIdx) {
480 sHistName = Form(
"fhPulserTimeDiffSameAsic_%03u", uXyterIdx);
481 title = Form(
"Time diff for consecutive hits in ASIC %03u; tn - t [ns]; Counts", uXyterIdx);
484 sHistName = Form(
"fhPulserTimeDiffPerAsicPair_%03u_%03u", uXyterIdx, uXyterIdxB);
485 title = Form(
"Time diff for pulser hits in ASIC %03u and %03u; tn - t "
487 uXyterIdx, uXyterIdxB);
491 if (uXyterIdxB == uXyterIdx) {
492 sHistName = Form(
"fhPulserTimeDiffEvoSameAsic_%03u", uXyterIdx);
493 title = Form(
"Time diff for consecutive hits in ASIC %03u; Time in run "
494 "[s]; tn - t [ns]; Counts",
498 sHistName = Form(
"fhPulserTimeDiffEvoPerAsicPair_%03u_%03u", uXyterIdx, uXyterIdxB);
499 title = Form(
"Time diff for pulser hits in ASIC %03u and %03u; Time in "
500 "run [s]; tn - t [ns]; Counts",
501 uXyterIdx, uXyterIdxB);
506 sHistName = Form(
"fhPulserTsLsbMatchPerAsicPair_%03u_%03u", uXyterIdx, uXyterIdxB);
507 title = Form(
"TS LSB for pulser hits in ASIC %03u and %03u; TS LSB %03u "
508 "[bin]; TS LSB %03u [bin]",
509 uXyterIdx, uXyterIdxB, uXyterIdx, uXyterIdxB);
511 new TH2I(sHistName, title, 256, -0.5, 255.5, 256, -0.5, 255.5));
513 sHistName = Form(
"fhPulserTsMsbMatchPerAsicPair_%03u_%03u", uXyterIdx, uXyterIdxB);
514 title = Form(
"TS MSB for pulser hits in ASIC %03u and %03u; TS MSB %03u "
515 "[bin]; TS MSB %03u [bin]",
516 uXyterIdx, uXyterIdxB, uXyterIdx, uXyterIdxB);
520 sHistName = Form(
"fhPulserIntervalAsic_%03u", uXyterIdx);
521 title = Form(
"Time diff between consecutive hits in ASIC %03us; dt [ns]; Counts", uXyterIdx, uXyterIdx);
524 sHistName = Form(
"fhPulserIntervalLongAsic_%03u", uXyterIdx);
525 title = Form(
"Time diff between consecutive hits in ASIC %03us; dt [ns]; Counts", uXyterIdx, uXyterIdx);
549 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
557 for (UInt_t uXyterIdx = 0; uXyterIdx <
fuNbStsXyters; ++uXyterIdx) {
572 for (UInt_t uXyterIdxB = 0; uXyterIdxB <
fuNbStsXyters; ++uXyterIdxB) {
573 if (uXyterIdxB == uXyterIdx) {
589 server->RegisterCommand(
"/Reset_All_Pulser",
"bCosy2018ResetPulser=kTRUE");
590 server->RegisterCommand(
"/Write_All_Pulser",
"bCosy2018WritePulser=kTRUE");
592 server->Restrict(
"/Reset_All_Pulser",
"allow=admin");
593 server->Restrict(
"/Write_All_Pulser",
"allow=admin");
601 for (UInt_t uXyterIdx = 0; uXyterIdx <
fuNbStsXyters; ++uXyterIdx) {
603 new TCanvas(Form(
"cStsSum_%03u", uXyterIdx), Form(
"Summary plots for StsXyter %03u", uXyterIdx), w,
h);
604 cStsSumm->Divide(2, 2);
626 TCanvas* cDtPerAsic =
new TCanvas(
"cDtPerAsic",
"Time Differences per ASIC", w,
h);
629 for (UInt_t uXyterIdx = 0; uXyterIdx <
fuNbStsXyters; ++uXyterIdx) {
630 cDtPerAsic->cd(1 + uXyterIdx);
639 TCanvas* cDtInAsic =
new TCanvas(
"cDtInAsic",
"Time Differences in ASIC", w,
h);
642 for (UInt_t uXyterIdx = 0; uXyterIdx <
fuNbStsXyters; ++uXyterIdx) {
643 cDtInAsic->cd(1 + uXyterIdx);
651 TCanvas* cDtAsicPairs =
new TCanvas(
"cDtAsicPairs",
"Time Differences in ASIC", w,
h);
653 cDtAsicPairs->Divide(3);
655 for (UInt_t uXyterIdx = 0; uXyterIdx <
fuNbStsXyters && uXyterIdx < 3; ++uXyterIdx) {
656 for (UInt_t uXyterIdxB = uXyterIdx + 1; uXyterIdxB <
fuNbStsXyters; ++uXyterIdxB) {
657 cDtAsicPairs->cd(uXyterIdx + uXyterIdxB);
666 TCanvas* cTsLsbAsicPairs =
new TCanvas(
"cTsLsbAsicPairs",
"Time Differences in ASIC", w,
h);
668 cTsLsbAsicPairs->Divide(3);
670 for (UInt_t uXyterIdx = 0; uXyterIdx <
fuNbStsXyters && uXyterIdx < 3; ++uXyterIdx) {
671 for (UInt_t uXyterIdxB = uXyterIdx + 1; uXyterIdxB <
fuNbStsXyters; ++uXyterIdxB) {
672 cTsLsbAsicPairs->cd(uXyterIdx + uXyterIdxB);
682 TCanvas* cTsMsbAsicPairs =
new TCanvas(
"cTsMsbAsicPairs",
"Time Differences in ASIC", w,
h);
684 cTsMsbAsicPairs->Divide(3);
686 for (UInt_t uXyterIdx = 0; uXyterIdx <
fuNbStsXyters && uXyterIdx < 3; ++uXyterIdx) {
687 for (UInt_t uXyterIdxB = uXyterIdx + 1; uXyterIdxB <
fuNbStsXyters; ++uXyterIdxB) {
688 cTsMsbAsicPairs->cd(uXyterIdx + uXyterIdxB);
701 fcMsSizeAll =
dynamic_cast<TCanvas*
>(gROOT->FindObject(
"cMsSizeAll"));
703 fcMsSizeAll =
new TCanvas(
"cMsSizeAll",
"Evolution of MS size in last 300 s", w,
h);
705 LOG(info) <<
"Created MS size canvas in STS monitor";
708 LOG(info) <<
"Recovered MS size canvas in STS monitor";
716 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
727 LOG(debug) <<
"Timeslice contains " << ts.num_microslices(component) <<
"microslices.";
730 if (NULL ==
fhMsSz[component]) {
731 TString sMsSzName = Form(
"MsSz_link_%02lu", component);
732 TString sMsSzTitle = Form(
"Size of MS for nDPB of link %02lu; Ms Size [bytes]", component);
733 fhMsSz[component] =
new TH1F(sMsSzName.Data(), sMsSzTitle.Data(), 160000, 0., 20000.);
735 if (server) server->Register(
"/FlibRaw",
fhMsSz[component]);
736 sMsSzName = Form(
"MsSzTime_link_%02lu", component);
737 sMsSzTitle = Form(
"Size of MS vs time for gDPB of link %02lu; Time[s] ; Ms Size [bytes]", component);
738 fhMsSzTime[component] =
new TProfile(sMsSzName.Data(), sMsSzTitle.Data(), 15000, 0., 300.);
740 if (server) server->Register(
"/FlibRaw",
fhMsSzTime[component]);
746 LOG(info) <<
"Added MS size histo for component: " << component <<
" (DPB)";
751 size_t numCompMsInTs = ts.num_microslices(component);
766 for (UInt_t uXyterIdx = 0; uXyterIdx <
fuNbStsXyters; ++uXyterIdx) {
781 LOG(info) <<
"CbmCosy2018MonitorPulser::DoUnpack => Changed fvuChanNbHitsInMs size " <<
fvuChanNbHitsInMs.size()
783 LOG(info) <<
"CbmCosy2018MonitorPulser::DoUnpack => Changed "
784 "fvuChanNbHitsInMs size "
786 LOG(info) <<
"CbmCosy2018MonitorPulser::DoUnpack => Changed "
787 "fvuChanNbHitsInMs size "
791 for (
size_t m = 0; m < numCompMsInTs; ++m) {
795 auto msDescriptor = ts.descriptor(component, m);
797 const uint8_t* msContent =
reinterpret_cast<const uint8_t*
>(ts.content(component, m));
799 uint32_t
size = msDescriptor.size;
803 <<
" has size: " <<
size;
819 LOG(error) <<
"The input microslice buffer does NOT "
820 <<
"contain only complete nDPB messages!";
826 const uint32_t* pInBuff =
reinterpret_cast<const uint32_t*
>(msContent);
828 for (uint32_t uIdx = 0; uIdx < uNbMessages; ++uIdx) {
830 uint32_t ulData =
static_cast<uint32_t
>(pInBuff[uIdx]);
847 LOG(fatal) <<
"CbmCosy2018MonitorPulser::DoUnpack => "
848 <<
"eLink index out of bounds!" << usElinkIdx <<
" VS " <<
fuNbElinksPerDpb;
866 LOG(info) <<
"CbmCosy2018MonitorPulser::DoUnpack => "
867 <<
"EPOCH message at unexpected position in MS: message " << uIdx <<
" VS message 0 expected!";
878 LOG(fatal) <<
"CbmCosy2018MonitorPulser::DoUnpack => "
879 <<
"Unknown message type, should never happen, stopping here!";
895 ULong64_t ulLastHitTime = (*(
fvmHitsInTs.rbegin())).GetTs();
896 std::vector<stsxyter::FinalHit>::iterator it;
897 std::vector<stsxyter::FinalHit>::iterator itB;
899 std::chrono::steady_clock::time_point tNow = std::chrono::steady_clock::now();
900 Double_t dUnixTimeInRun = std::chrono::duration_cast<std::chrono::seconds>(tNow -
ftStartTimeUnix).count();
905 UShort_t usAsicIdx = (*it).GetAsic();
906 UShort_t usChanIdx = (*it).GetChan();
907 ULong64_t ulHitTs = (*it).GetTs();
908 UShort_t usHitAdc = (*it).GetAdc();
920 UShort_t usChanIdx = (*it).GetChan();
924 for (UInt_t uAsicB = uAsic; uAsicB <
fuNbStsXyters; uAsicB++) {
926 UShort_t usChanIdxB = (*itB).GetChan();
927 Double_t dDt = (
static_cast<Double_t
>((*itB).GetTs()) -
static_cast<Double_t
>((*it).GetTs()))
936 ((*itB).GetTs() & 0x03F00) >> 8);
941 (
static_cast<Double_t
>((*it).GetTs()) -
static_cast<Double_t
>(
fvmLastHitAsic[uAsic].GetTs()))
959 for (UInt_t uDpb = 0; uDpb <
fuNrOfDpbs; ++uDpb) {
960 Double_t dTsMsbTime =
966 LOG(info) <<
"End of TS " << std::setw(7) << ts.index() <<
" eDPB " << std::setw(2) << uDpb
969 <<
" current TS MSB time is " << std::setw(12) << dTsMsbTime <<
" s";