13 #include "CbmCern2017UnpackParHodo.h"
17 #include "FairLogger.h"
18 #include "FairRootManager.h"
20 #include "FairRunOnline.h"
21 #include "FairRuntimeDb.h"
24 #include "TClonesArray.h"
26 #include "THttpServer.h"
46 , fvMsComponentsList()
49 , fbIgnoreOverlapMs(kFALSE)
50 , fUnpackParHodo(NULL)
57 , fsHistoFileFullname(
"data/SetupHistos.root")
58 , fbPrintMessages(kFALSE)
63 , fuCurrentEquipmentId(0)
66 , fiRunStartDateTimeSec(-1)
67 , fiBinSizeDatePlots(-1)
69 , fvuCurrentTsMsbCycle()
70 , fvuInitialHeaderDone()
71 , fvuInitialTsMsbCycleHeader()
73 , fvulChanLastHitTime()
74 , fvdChanLastHitTime()
77 , fvdChanLastHitTimeInMs()
78 , fvusChanLastHitAdcInMs()
82 , fdStartTimeMsSz(-1.0)
83 , ftStartTimeUnix(std::chrono::steady_clock::now())
86 , fuMaxNbMicroslices(100)
87 , fbLongHistoEnable(kFALSE)
88 , fuLongHistoNbSeconds(0)
89 , fuLongHistoBinSizeSec(0)
93 , fdCoincMin(fdCoincCenter - fdCoincBorder)
94 , fdCoincMax(fdCoincCenter + fdCoincBorder)
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()
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() {}
138 LOG(info) <<
"Initializing flib StsXyter unpacker for STS";
140 FairRootManager* ioman = FairRootManager::Instance();
141 if (ioman == NULL) { LOG(fatal) <<
"No FairRootManager instance"; }
147 LOG(info) <<
"Setting parameter containers for " << GetName();
149 (CbmCern2017UnpackParHodo*) (FairRun::Instance()
151 ->getContainer(
"CbmCern2017UnpackParHodo"));
156 LOG(info) <<
"Init parameter containers for " << GetName();
165 LOG(info) <<
"ReInit parameter containers for " << GetName();
173 LOG(info) <<
"Nr. of STS DPBs: " <<
fuNrOfDpbs;
177 for (UInt_t uDpb = 0; uDpb <
fuNrOfDpbs; ++uDpb) {
179 LOG(info) <<
"Eq. ID for DPB #" << std::setw(2) << uDpb <<
" = "
181 << std::dec <<
" => "
194 for (UInt_t uDpb = 0; uDpb <
fuNrOfDpbs; ++uDpb) {
195 LOG(info) <<
"ASIC ID for eLinks in DPB #" << std::setw(2) << uDpb <<
": ";
197 std::stringstream ss;
199 if (0 == uElink % 10) ss <<
"\n------> ";
203 LOG(info) << ss.str();
212 for (UInt_t uDpb = 0; uDpb <
fuNrOfDpbs; ++uDpb) {
243 for (UInt_t uXyterIdx = 0; uXyterIdx <
fuNbStsXyters; ++uXyterIdx) {
273 LOG(info) <<
"CbmMcbm2018MonitorStsSync::ReInitContainers => Changed "
274 "fvuChanNbHitsInMs size "
276 LOG(info) <<
"CbmMcbm2018MonitorStsSync::ReInitContainers => Changed "
277 "fvuChanNbHitsInMs size "
279 LOG(info) <<
"CbmMcbm2018MonitorStsSync::ReInitContainers => Changed "
280 "fvuChanNbHitsInMs size "
298 if (NULL ==
fhMsSz[component]) {
299 TString sMsSzName = Form(
"MsSz_link_%02lu", component);
301 Form(
"Size of MS for nDPB of link %02lu; Ms Size [bytes]", component);
303 new TH1F(sMsSzName.Data(), sMsSzTitle.Data(), 160000, 0., 20000.);
306 sMsSzName = Form(
"MsSzTime_link_%02lu", component);
308 "Size of MS vs time for gDPB of link %02lu; Time[s] ; Ms Size [bytes]",
311 new TProfile(sMsSzName.Data(), sMsSzTitle.Data(), 15000, 0., 300.);
319 LOG(info) <<
"Added MS size histo for component: " << component
322 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
324 server->Register(
"/FlibRaw",
fhMsSz[component]);
325 server->Register(
"/FlibRaw",
fhMsSzTime[component]);
330 size_t uOverlapMsNb) {
343 for (UInt_t uXyterIdx = 0; uXyterIdx <
fuNbStsXyters; ++uXyterIdx) {
358 LOG(info) <<
"CbmMcbm2018MonitorStsSync::DoUnpack => Changed "
359 "fvuChanNbHitsInMs size "
361 LOG(info) <<
"CbmMcbm2018MonitorStsSync::DoUnpack => Changed "
362 "fvuChanNbHitsInMs size "
364 LOG(info) <<
"CbmMcbm2018MonitorStsSync::DoUnpack => Changed "
365 "fvuChanNbHitsInMs size "
371 Double_t dBorderVal) {
379 TString sHistName {
""};
382 sHistName =
"hPulserMessageType";
383 title =
"Nb of message for each type; Type";
399 sHistName =
"hPulserSysMessType";
400 title =
"Nb of system message for each type; System Type";
408 sHistName =
"hPulserMessageTypePerDpb";
409 title =
"Nb of message of each type for each DPB; DPB; Type";
426 sHistName =
"hPulserSysMessTypePerDpb";
427 title =
"Nb of system message of each type for each DPB; DPB; System Type";
436 sHistName =
"hPulserMessageTypePerElink";
437 title =
"Nb of message of each type for each eLink; eLink; Type";
459 sHistName =
"hPulserSysMessTypePerElink";
461 "Nb of system message of each type for each eLink; eLink; System Type";
476 sHistName =
"hPulserStatusMessType";
477 title =
"Nb of status message of each type for each DPB; eLink; Status Type";
492 sHistName =
"hPulserMsStatusFieldType";
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);
539 UInt_t uAlignedLimit =
543 UInt_t uNbBinEvo = (32768 + 1) * 2;
544 Double_t dMaxEdgeEvo =
546 Double_t dMinEdgeEvo = dMaxEdgeEvo * -1.0;
550 for (UInt_t uXyterIdx = 0; uXyterIdx <
fuNbStsXyters; ++uXyterIdx) {
552 sHistName = Form(
"hPulserChanCntRaw_%03u", uXyterIdx);
553 title = Form(
"Hits Count per channel, StsXyter #%03u; Channel; Hits []",
558 sHistName = Form(
"hPulserChanCntRawGood_%03u", uXyterIdx);
560 "Hits Count per channel in good MS, StsXyter #%03u; Channel; Hits []",
566 sHistName = Form(
"hPulserChanAdcRaw_%03u", uXyterIdx);
567 title = Form(
"Raw Adc distribution per channel, StsXyter #%03u; Channel "
568 "[]; Adc []; Hits []",
580 sHistName = Form(
"hPulserChanAdcRawProfc_%03u", uXyterIdx);
582 Form(
"Raw Adc prodile per channel, StsXyter #%03u; Channel []; Adc []",
588 sHistName = Form(
"hPulserChanRawTs_%03u", uXyterIdx);
589 title = Form(
"Raw Timestamp distribution per channel, StsXyter #%03u; "
590 "Channel []; Ts []; Hits []",
602 sHistName = Form(
"hPulserChanMissEvt_%03u", uXyterIdx);
603 title = Form(
"Missed Event flags per channel, StsXyter #%03u; Channel []; "
604 "Miss Evt []; Hits []",
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 []",
632 sHistName = Form(
"hPulserFebMissEvtEvo%03u", uXyterIdx);
633 title = Form(
"Missed Evt flags per second in StsXyter #%03u; Time [s]; "
634 "Missed Evt flags []",
639 sHistName = Form(
"hPulserChanRateEvo_%03u", uXyterIdx);
640 title = Form(
"Hits per second & channel in StsXyter #%03u; Time [s]; "
641 "Channel []; Hits []",
653 sHistName = Form(
"hPulserFebRateEvo_%03u", uXyterIdx);
655 Form(
"Hits per second in StsXyter #%03u; Time [s]; Hits []", uXyterIdx);
659 sHistName = Form(
"hPulserChanRateEvoLong_%03u", uXyterIdx);
660 title = Form(
"Hits per second & channel in StsXyter #%03u; Time [min]; "
661 "Channel []; Hits []",
673 sHistName = Form(
"hPulserFebRateEvoLong_%03u", uXyterIdx);
675 Form(
"Hits per second in StsXyter #%03u; Time [min]; Hits []", uXyterIdx);
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",
694 for (UInt_t uXyterIdxB = 0; uXyterIdxB <
fuNbStsXyters; ++uXyterIdxB) {
695 if (uXyterIdxB == uXyterIdx) {
696 sHistName = Form(
"fhPulserTimeDiffSameAsic_%03u", uXyterIdx);
698 "Time diff for consecutive hits in ASIC %03u; tn - t [ns]; Counts",
703 Form(
"fhPulserTimeDiffPerAsicPair_%03u_%03u", uXyterIdx, uXyterIdxB);
704 title = Form(
"Time diff for pulser hits in ASIC %03u and %03u; tn - t "
710 new TH1I(sHistName, title, uNbBinEvo, dMinEdgeEvo, dMaxEdgeEvo));
712 if (uXyterIdxB == uXyterIdx) {
713 sHistName = Form(
"fhPulserTimeDiffClkSameAsic_%03u", uXyterIdx);
715 "Time diff for consecutive hits in ASIC %03u; tn - t [Clk]; Counts",
720 "fhPulserTimeDiffClkPerAsicPair_%03u_%03u", uXyterIdx, uXyterIdxB);
721 title = Form(
"Time diff for pulser hits in ASIC %03u and %03u; tn - t "
727 new TH1I(sHistName, title, 601, -300.5, 300.5));
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",
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",
753 if (uXyterIdxB == uXyterIdx) {
754 sHistName = Form(
"fhPulserTimeDiffEvoSameAsicProf_%03u", uXyterIdx);
755 title = Form(
"Time diff for consecutive hits in ASIC %03u; Time in run "
760 sHistName = Form(
"fhPulserTimeDiffEvoPerAsicPairProf_%03u_%03u",
763 title = Form(
"Time diff for pulser hits in ASIC %03u and %03u; Time in "
764 "run [s]; tn - t [ns]",
769 new TProfile(sHistName, title, 52000, 0, 52000));
771 if (uXyterIdxB == uXyterIdx) {
772 sHistName = Form(
"fhPulserRawTimeDiffEvoSameAsicProf_%03u", uXyterIdx);
773 title = Form(
"Time diff for consecutive hits in ASIC %03u; Time in run "
778 sHistName = Form(
"fhPulserRawTimeDiffEvoPerAsicPairProf_%03u_%03u",
781 title = Form(
"Time diff for pulser hits in ASIC %03u and %03u; Time in "
782 "run [s]; tn - t [ns]",
787 new TProfile(sHistName, title, 10400, 0, 52000));
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]",
798 new TH2I(sHistName, title, 256, -0.5, 255.5, 256, -0.5, 255.5));
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]",
809 new TH2I(sHistName, title, 64, -0.5, 63.5, 64, -0.5, 63.5));
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]",
818 sHistName = Form(
"fhPulserTsLsbDiffEvoPerAsicPairProf_%03u_%03u",
821 title = Form(
"TS LSB diff for pulser hits in ASIC %03u and %03u; Time "
822 "in run [s]; LSBn - LSB [Bins]",
827 new TProfile(sHistName, title, 52000, 0, 52000));
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]",
836 sHistName = Form(
"fhPulserTsMsbDiffEvoPerAsicPairProf_%03u_%03u",
839 title = Form(
"TS MSB diff for pulser hits in ASIC %03u and %03u; Time "
840 "in run [s]; MSBn - MSB [Bins]",
845 new TProfile(sHistName, title, 52000, 0, 52000));
849 sHistName = Form(
"fhPulserIntervalAsic_%03u", uXyterIdx);
851 Form(
"Time diff between consecutive hits in ASIC %03us; dt [ns]; Counts",
856 sHistName = Form(
"fhPulserIntervalLongAsic_%03u", uXyterIdx);
858 Form(
"Time diff between consecutive hits in ASIC %03us; dt [ns]; Counts",
896 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
906 for (UInt_t uXyterIdx = 0; uXyterIdx <
fuNbStsXyters; ++uXyterIdx) {
921 for (UInt_t uXyterIdxB = 0; uXyterIdxB <
fuNbStsXyters; ++uXyterIdxB) {
922 if (uXyterIdxB == uXyterIdx) {
923 server->Register(
"/DtChan",
943 server->Register(
"/DtAsicPair",
964 server->Register(
"/TsMatch",
966 server->Register(
"/TsMatch",
974 server->RegisterCommand(
"/Reset_All_Pulser",
"bMcbm2018ResetStsSync=kTRUE");
975 server->RegisterCommand(
"/Write_All_Pulser",
"bMcbm2018WriteStsSync=kTRUE");
977 server->Restrict(
"/Reset_All_Pulser",
"allow=admin");
978 server->Restrict(
"/Write_All_Pulser",
"allow=admin");
986 for (UInt_t uXyterIdx = 0; uXyterIdx <
fuNbStsXyters; ++uXyterIdx) {
988 new TCanvas(Form(
"cStsSum_%03u", uXyterIdx),
989 Form(
"Summary plots for StsXyter %03u", uXyterIdx),
992 cStsSumm->Divide(2, 2);
1014 TCanvas* cDtPerAsic =
1015 new TCanvas(
"cDtPerAsic",
"Time Differences per ASIC", w,
h);
1018 for (UInt_t uXyterIdx = 0; uXyterIdx <
fuNbStsXyters; ++uXyterIdx) {
1019 cDtPerAsic->cd(1 + uXyterIdx);
1028 TCanvas* cDtInAsic =
1029 new TCanvas(
"cDtInAsic",
"Time Differences in ASIC", w,
h);
1032 for (UInt_t uXyterIdx = 0; uXyterIdx <
fuNbStsXyters; ++uXyterIdx) {
1033 cDtInAsic->cd(1 + uXyterIdx);
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;
1048 for (UInt_t uXyterIdxB = uXyterIdx + 1; uXyterIdxB <
fuNbStsXyters;
1050 cDtAsicPairs->cd(1 + uHistoIdx);
1062 TCanvas* cDtClkAsicPairs =
1063 new TCanvas(
"cDtClkAsicPairs",
"Time Differences in ASIC", w,
h);
1065 for (UInt_t uXyterIdxB = 1; uXyterIdxB <
fuNbStsXyters; ++uXyterIdxB) {
1066 cDtClkAsicPairs->cd(uXyterIdxB);
1075 TCanvas* cDtAsicPairsEvo =
1076 new TCanvas(
"cDtAsicPairsEvo",
"Time Differences Evo in ASIC", w,
h);
1077 cDtAsicPairsEvo->Divide(2, 3);
1079 for (UInt_t uXyterIdx = 0; uXyterIdx <
fuNbStsXyters && uXyterIdx < 3;
1081 for (UInt_t uXyterIdxB = uXyterIdx + 1; uXyterIdxB <
fuNbStsXyters;
1083 cDtAsicPairsEvo->cd(1 + uHistoIdx);
1095 TCanvas* cDtAsicPairsEvoProf =
1096 new TCanvas(
"cDtAsicPairsEvoProf",
"Time Differences Evo in ASIC", w,
h);
1097 cDtAsicPairsEvoProf->Divide(2, 3);
1099 for (UInt_t uXyterIdx = 0; uXyterIdx <
fuNbStsXyters && uXyterIdx < 3;
1101 for (UInt_t uXyterIdxB = uXyterIdx + 1; uXyterIdxB <
fuNbStsXyters;
1103 cDtAsicPairsEvoProf->cd(1 + uHistoIdx);
1116 TCanvas* cDtAsicPairsEvoProfRaw =
1117 new TCanvas(
"cDtAsicPairsEvoProfRaw",
"Time Differences Evo in ASIC", w,
h);
1118 cDtAsicPairsEvoProfRaw->Divide(2, 3);
1120 for (UInt_t uXyterIdx = 0; uXyterIdx <
fuNbStsXyters && uXyterIdx < 3;
1122 for (UInt_t uXyterIdxB = uXyterIdx + 1; uXyterIdxB <
fuNbStsXyters;
1124 cDtAsicPairsEvoProfRaw->cd(1 + uHistoIdx);
1137 TCanvas* cTsLsbAsicPairs =
1138 new TCanvas(
"cTsLsbAsicPairs",
"Time Differences in ASIC", w,
h);
1139 cTsLsbAsicPairs->Divide(2, 3);
1141 for (UInt_t uXyterIdx = 0; uXyterIdx <
fuNbStsXyters && uXyterIdx < 3;
1143 for (UInt_t uXyterIdxB = uXyterIdx + 1; uXyterIdxB <
fuNbStsXyters;
1145 cTsLsbAsicPairs->cd(1 + uHistoIdx);
1157 TCanvas* cTsMsbAsicPairs =
1158 new TCanvas(
"cTsMsbAsicPairs",
"Time Differences in ASIC", w,
h);
1160 cTsMsbAsicPairs->Divide(2, 3);
1162 for (UInt_t uXyterIdx = 0; uXyterIdx <
fuNbStsXyters && uXyterIdx < 3;
1164 for (UInt_t uXyterIdxB = uXyterIdx + 1; uXyterIdxB <
fuNbStsXyters;
1166 cTsMsbAsicPairs->cd(1 + uHistoIdx);
1178 TCanvas* cDlsbAsicPairsEvoProf =
1179 new TCanvas(
"cDlsbAsicPairsEvoProf",
"Time Differences Evo in ASIC", w,
h);
1180 cDlsbAsicPairsEvoProf->Divide(2, 3);
1182 for (UInt_t uXyterIdx = 0; uXyterIdx <
fuNbStsXyters && uXyterIdx < 3;
1184 for (UInt_t uXyterIdxB = uXyterIdx + 1; uXyterIdxB <
fuNbStsXyters;
1186 cDlsbAsicPairsEvoProf->cd(1 + uHistoIdx);
1199 TCanvas* cDmsbAsicPairsEvoProf =
1200 new TCanvas(
"cDmsbAsicPairsEvoProf",
"Time Differences Evo in ASIC", w,
h);
1201 cDmsbAsicPairsEvoProf->Divide(2, 3);
1203 for (UInt_t uXyterIdx = 0; uXyterIdx <
fuNbStsXyters && uXyterIdx < 3;
1205 for (UInt_t uXyterIdxB = uXyterIdx + 1; uXyterIdxB <
fuNbStsXyters;
1207 cDmsbAsicPairsEvoProf->cd(1 + uHistoIdx);
1223 fcMsSizeAll =
dynamic_cast<TCanvas*
>(gROOT->FindObject(
"cMsSizeAll"));
1226 new TCanvas(
"cMsSizeAll",
"Evolution of MS size in last 300 s", w,
h);
1228 LOG(info) <<
"Created MS size canvas in STS monitor";
1231 LOG(info) <<
"Recovered MS size canvas in STS monitor";
1248 LOG(debug) <<
"Timeslice contains " << ts.num_microslices(component)
1257 for (UInt_t uMsIdx = 0; uMsIdx < uNbMsLoop; uMsIdx++) {
1262 auto msDescriptor = ts.descriptor(uMsComp, uMsIdx);
1264 const uint8_t* msContent =
1265 reinterpret_cast<const uint8_t*
>(ts.content(uMsComp, uMsIdx));
1267 uint32_t uSize = msDescriptor.size;
1277 <<
" has size: " << uSize;
1281 fhMsSz[uMsComp]->Fill(uSize);
1289 uint16_t uMsHeaderFlags = msDescriptor.flags;
1290 for (UInt_t uBit = 0; uBit < 16; ++uBit)
1294 UInt_t uTsMsbCycleHeader =
1304 LOG(warning) <<
"TS MSB cycle from MS header does not match current "
1308 << std::setw(3) << uMsIdx <<
" ====> "
1310 << uTsMsbCycleHeader;
1316 LOG(error) <<
"The input microslice buffer does NOT "
1317 <<
"contain only complete nDPB messages!";
1320 uint32_t uNbMessages =
1324 const uint32_t* pInBuff =
reinterpret_cast<const uint32_t*
>(msContent);
1327 for (uint32_t uIdx = 0; uIdx < uNbMessages; ++uIdx) {
1329 uint32_t ulData =
static_cast<uint32_t
>(pInBuff[uIdx]);
1335 std::cout << Form(
"DPB %2u TS %12llu MS %12llu mess %5u ",
1347 static_cast<uint16_t
>(typeMess));
1354 LOG(fatal) <<
"CbmMcbm2018MonitorStsSync::DoUnpack => "
1355 <<
"eLink index out of bounds!" << usElinkIdx <<
" VS "
1360 static_cast<uint16_t
>(typeMess));
1377 <<
"CbmMcbm2018MonitorStsSync::DoUnpack => "
1378 <<
"EPOCH message at unexpected position in MS: message "
1379 << uIdx <<
" VS message 0 expected!";
1389 std::cout << Form(
"DPB %2u TS %12llu MS %12llu mess %5u ",
1407 <<
"CbmMcbm2018MonitorStsSync::DoUnpack => "
1408 <<
"Unknown message type, should never happen, stopping here!";
1424 std::vector<stsxyter::FinalHit>::iterator it;
1425 std::vector<stsxyter::FinalHit>::iterator itB;
1434 UShort_t usAsicIdx = (*it).GetAsic();
1454 Double_t dTimeSinceStartSec =
1457 for (UInt_t uAsicB = uAsic; uAsicB <
fuNbStsXyters; uAsicB++) {
1462 Double_t dDtClk =
static_cast<Double_t
>((*itB).GetTs())
1463 -
static_cast<Double_t
>((*it).GetTs());
1465 Double_t dDtRaw = (
static_cast<Double_t
>(
1467 -
static_cast<Double_t
>(
1475 dTimeSinceStartSec, dDt);
1477 dTimeSinceStartSec, dDt);
1479 dTimeSinceStartSec, dDtRaw);
1482 (*it).GetTs() & 0x000FF, (*itB).GetTs() & 0x000FF);
1484 ((*it).GetTs() & 0x03F00) >> 8,
1485 ((*itB).GetTs() & 0x03F00) >> 8);
1491 (((*itB).GetTs() & 0x000FF) > ((*it).GetTs() & 0x000FF)
1492 ? (*itB).GetTs() & 0x000FF
1493 : 255 + ((*itB).GetTs() & 0x000FF))
1494 - ((*it).GetTs() & 0x000FF);
1496 static_cast<Int_t
>(((*itB).GetTs() & 0x03F00) >> 8)
1497 -
static_cast<Int_t
>(((*it).GetTs() & 0x03F00) >> 8);
1499 dTimeSinceStartSec, iDtLsb);
1501 dTimeSinceStartSec, iDtMsb);
1505 && 10 < (*it).GetAdc() && 10 < (*itB).GetAdc())
1535 (
static_cast<Double_t
>((*it).GetTs())
1552 if (0 == ts.index() % 1000) {
1553 for (UInt_t uDpb = 0; uDpb <
fuNrOfDpbs; ++uDpb) {
1554 Double_t dTsMsbTime =
1561 LOG(info) <<
"End of TS " << std::setw(7) << ts.index() <<
" eDPB "
1562 << std::setw(2) << uDpb <<
" current TS MSB counter is "
1564 <<
" current TS MSB cycle counter is " << std::setw(12)
1566 << std::setw(12) << dTsMsbTime <<
" s";
1570 if (0 == ts.index() % 10000)
1578 const UInt_t& uAsicIdx,
1579 const UInt_t& uMsIdx) {
1608 Double_t dHitTimeNs =
1672 Double_t dTimeSinceStartSec =
1674 Double_t dTimeSinceStartMin = dTimeSinceStartSec / 60.0;
1678 dTimeSinceStartMin, usChan, 1.0 / 60.0);
1729 << uMsIdx <<
" Msg Idx " << std::setw(5) << uMessIdx <<
" DPB "
1730 << std::setw(2) <<
fuCurrDpbIdx <<
" Old TsMsb " << std::setw(5)
1733 << std::setw(5) << uVal;
1739 LOG(info) <<
"TS MSb Jump in "
1742 << uMsIdx <<
" Msg Idx " << std::setw(5) << uMessIdx <<
" DPB "
1745 << std::setw(5) << uVal;
1783 LOG(info) <<
"-------------------------------------";
1784 LOG(info) <<
"CbmMcbm2018MonitorStsSync statistics are ";
1793 <<
" Empty messages: "
1796 LOG(info) <<
"-------------------------------------";
1803 TDirectory* oldDir = NULL;
1804 TFile* histoFile = NULL;
1805 if (
"" != sFileName) {
1807 oldDir = gDirectory;
1809 histoFile =
new TFile(sFileName,
"RECREATE");
1814 gDirectory->mkdir(
"Sts_Raw");
1815 gDirectory->cd(
"Sts_Raw");
1826 for (UInt_t uXyterIdx = 0; uXyterIdx <
fuNbStsXyters; ++uXyterIdx) {
1847 gDirectory->cd(
"..");
1851 gDirectory->mkdir(
"Sts_Pulser");
1852 gDirectory->cd(
"Sts_Pulser");
1854 for (UInt_t uXyterIdx = 0; uXyterIdx <
fuNbStsXyters; ++uXyterIdx) {
1856 for (UInt_t uXyterIdxB = 0; uXyterIdxB <
fuNbStsXyters; ++uXyterIdxB) {
1871 gDirectory->cd(
"..");
1876 gDirectory->mkdir(
"Flib_Raw");
1877 gDirectory->cd(
"Flib_Raw");
1879 TString sMsSzName = Form(
"MsSz_link_%02u", uLinks);
1880 if (
fHM->
Exists(sMsSzName.Data()))
fHM->
H1(sMsSzName.Data())->Write();
1882 sMsSzName = Form(
"MsSzTime_link_%02u", uLinks);
1883 if (
fHM->
Exists(sMsSzName.Data()))
fHM->
P1(sMsSzName.Data())->Write();
1886 TH1* pMissedTsH1 =
dynamic_cast<TH1*
>(gROOT->FindObjectAny(
"Missed_TS"));
1887 if (NULL != pMissedTsH1) pMissedTsH1->Write();
1889 TProfile* pMissedTsEvoP =
1890 dynamic_cast<TProfile*
>(gROOT->FindObjectAny(
"Missed_TS_Evo"));
1891 if (NULL != pMissedTsEvoP) pMissedTsEvoP->Write();
1893 gDirectory->cd(
"..");
1896 if (
"" != sFileName) {
1903 TDirectory* oldDir = NULL;
1904 TFile* histoFile = NULL;
1905 if (
"" != sFileName) {
1907 oldDir = gDirectory;
1909 histoFile =
new TFile(sFileName,
"RECREATE");
1914 gDirectory->mkdir(
"Sts_Pulser");
1915 gDirectory->cd(
"Sts_Pulser");
1917 for (UInt_t uXyterIdx = 0; uXyterIdx <
fuNbStsXyters; ++uXyterIdx) {
1918 for (UInt_t uXyterIdxB = 0; uXyterIdxB <
fuNbStsXyters; ++uXyterIdxB) {
1924 gDirectory->cd(
"..");
1927 if (
"" != sFileName) {
1934 LOG(info) <<
"Reseting all STS histograms.";
1945 for (UInt_t uXyterIdx = 0; uXyterIdx <
fuNbStsXyters; ++uXyterIdx) {
1967 for (UInt_t uXyterIdxB = 0; uXyterIdxB <
fuNbStsXyters; ++uXyterIdxB) {
1983 TString sMsSzName = Form(
"MsSz_link_%02u", uLinks);
1984 if (
fHM->
Exists(sMsSzName.Data()))
fHM->
H1(sMsSzName.Data())->Reset();
1986 sMsSzName = Form(
"MsSzTime_link_%02u", uLinks);
1987 if (
fHM->
Exists(sMsSzName.Data()))
fHM->
P1(sMsSzName.Data())->Reset();
1996 Double_t dNewValue) {
1998 LOG(warning) <<
"CbmMcbm2018MonitorStsSync::UpdatePairMeanValue => wrong "
2004 LOG(warning) <<
"CbmMcbm2018MonitorStsSync::UpdatePairMeanValue => wrong "
2023 Double_t dNewMean = 0.0;
2025 for (UInt_t uIdx = 0; uIdx < uNbVal; ++uIdx)
2035 TDatime* fRunStartDateTime =
new TDatime(dateIn, timeIn);
2039 LOG(info) <<
"Assigned new MUCH Run Start Date-Time: "
2040 << fRunStartDateTime->AsString();