13 #include "FairLogger.h"
14 #include "FairRootManager.h"
16 #include "FairRunOnline.h"
17 #include "FairRuntimeDb.h"
21 #include "TClonesArray.h"
26 #include "THttpServer.h"
28 #include "TPaveStats.h"
30 #include "TProfile2D.h"
50 , fvMsComponentsList()
53 , fbIgnoreOverlapMs(kFALSE)
54 , fuMsAcceptsPercent(100)
59 , fdTsCoreSizeInNs(0.0)
66 , fuNrOfChannelsPerGet4(0)
67 , fuNrOfChannelsPerFee(0)
69 , fuNrOfGet4PerGdpb(0)
70 , fuNrOfChannelsPerGdpb(0)
71 , fuRawDataPrintMsgNb(100000)
72 , fuRawDataPrintMsgIdx(fuRawDataPrintMsgNb)
73 , fbPrintAllHitsEnable(kFALSE)
74 , fbPrintAllEpochsEnable(kFALSE)
75 , fbPulserModeEnable(kFALSE)
76 , fbCoincMapsEnable(kFALSE)
77 , fulCurrentTsIndex(0)
85 , fviMsgCounter(11, 0)
91 , fvulGdpbTsFullLast()
92 , fvulStarTsFullLast()
95 , fvuStarTrigCmdLast()
98 , fvulCurrentEpochCycle()
99 , fvulCurrentEpochFull()
100 , fulCurrentEpochTime(0)
103 , fvuFeeNbHitsLastMs()
104 , fdTsLastPulserHit()
105 , fvuCoincNbHitsLastMs()
106 , fvdCoincTsLastHit()
112 , fuNbFeePlotsPerGdpb(0)
114 , fdStartTimeLong(-1.)
115 , fdStartTimeMsSz(-1.)
116 , fuHistoryHistoSize(1800)
117 , fuHistoryHistoSizeLong(600)
118 , fdLastRmsUpdateTime(0.0)
119 , fdFitZoomWidthPs(0.0)
121 , fvhMsSzPerLink(12, NULL)
122 , fvhMsSzTimePerLink(12, NULL)
124 , fhSysMessType(NULL)
125 , fhGet4MessType(NULL)
126 , fhGet4ChanScm(NULL)
127 , fhGet4ChanErrors(NULL)
128 , fhGet4EpochFlags(NULL)
129 , fhGdpbMessType(NULL)
130 , fhGdpbSysMessType(NULL)
131 , fhGdpbSysMessPattType(NULL)
132 , fhGdpbEpochFlags(NULL)
133 , fhGdpbEpochSyncEvo(NULL)
134 , fhGdpbEpochMissEvo(NULL)
135 , fvhGdpbGet4MessType()
136 , fvhGdpbGet4ChanScm()
137 , fvhGdpbGet4ChanErrors()
138 , fhScmScalerCounters(NULL)
139 , fhScmDeadtimeCounters(NULL)
140 , fhScmSeuCounters(NULL)
141 , fhScmSeuCountersEvo(NULL)
142 , fhPatternMissmatch(NULL)
143 , fhPatternEnable(NULL)
144 , fhPatternResync(NULL)
145 , fvhGdpbPatternMissmatchEvo()
146 , fvhGdpbPatternEnableEvo()
147 , fvhGdpbPatternResyncEvo()
151 , fvhChannelRate_gDPB()
153 , fvhRemapChCount_gDPB()
154 , fvhRemapChRate_gDPB()
156 , fvhFeeErrorRate_gDPB()
157 , fvhFeeErrorRatio_gDPB()
158 , fvhFeeRateLong_gDPB()
159 , fvhFeeErrorRateLong_gDPB()
160 , fvhFeeErrorRatioLong_gDPB()
161 , fvhRemapTotSideA_mod()
162 , fvhRemapTotSideB_mod()
170 , fvhStarTrigGdpbTsEvo()
171 , fvhStarTrigStarTsEvo()
172 , fvhTimeDiffPulser()
173 , fhTimeMeanPulser(NULL)
174 , fhTimeRmsPulser(NULL)
175 , fhTimeRmsZoomFitPuls(NULL)
176 , fhTimeResFitPuls(NULL)
177 , fvhPulserTimeDiffEvoGbtxGbtx()
178 , fvvhPulserTimeDiffEvoGdpbGdpb()
183 , fTimeLastHistoSaving() {}
188 LOG(info) <<
"Initializing Get4 monitor";
190 FairRootManager* ioman = FairRootManager::Instance();
192 LOG(fatal) <<
"No FairRootManager instance";
199 LOG(info) <<
"Setting parameter containers for " << GetName();
202 "CbmStar2019TofPar"));
206 LOG(info) <<
"Init parameter containers for " << GetName();
227 LOG(info) <<
"ReInit parameter containers for " << GetName();
257 LOG(info) <<
"GDPB Id of TOF " <<
i <<
" : " << std::hex
271 for (UInt_t uGbtx = 0; uGbtx <
fuNrOfGbtx; ++uGbtx) {
278 LOG(info) <<
"Nr. of RPCs per GBTx: ";
279 std::stringstream ss;
280 for (UInt_t uGbtx = 0; uGbtx <
fuNrOfGbtx; ++uGbtx)
282 LOG(info) << ss.str();
284 LOG(info) <<
"RPC type per GBTx: ";
285 std::stringstream ss;
286 for (UInt_t uGbtx = 0; uGbtx <
fuNrOfGbtx; ++uGbtx)
288 LOG(info) << ss.str();
290 LOG(info) <<
"RPC side per GBTx: ";
291 std::stringstream ss;
292 for (UInt_t uGbtx = 0; uGbtx <
fuNrOfGbtx; ++uGbtx)
294 LOG(info) << ss.str();
296 LOG(info) <<
"Module ID per GBTx: ";
297 std::stringstream ss;
298 for (UInt_t uGbtx = 0; uGbtx <
fuNrOfGbtx; ++uGbtx)
300 LOG(info) << ss.str();
307 LOG(info) <<
"Timeslice parameters: " <<
fuTotalMsNb
321 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
345 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
366 UInt_t uGet4topadi[32] = {4, 3, 2, 1,
367 8, 7, 6, 5, 12, 11, 10, 9, 16, 15,
368 14, 13, 20, 19, 18, 17, 24, 23, 22, 21,
369 28, 27, 26, 25, 32, 31, 30, 29};
371 UInt_t uPaditoget4[32] = {4, 3, 2, 1,
372 12, 11, 10, 9, 20, 19, 18, 17, 28, 27,
373 26, 25, 32, 31, 30, 29, 8, 7, 6, 5,
374 16, 15, 14, 13, 24, 23, 22, 21};
386 27, 2, 7, 3, 31, 26, 30, 1, 33, 37, 32, 13, 9, 14,
387 10, 15, 17, 21, 16, 35, 34, 38, 25, 24, 0, 6, 20, 23,
388 18, 22, 28, 4, 29, 5, 19, 36, 39, 8, 12, 11};
390 24, 7, 1, 3, 31, 33, 25, 2, 37, 12, 14, 39, 38, 11,
391 13, 15, 18, 16, 28, 34, 26, 17, 29, 27, 23, 22, 5, 0,
392 30, 32, 6, 4, 10, 8, 20, 19, 35, 9, 21, 36};
404 UShort_t usDetectorId) {
414 TString sMsSzName = Form(
"MsSz_link_%02lu", component);
416 Form(
"Size of MS from link %02lu; Ms Size [bytes]", component);
418 new TH1F(sMsSzName.Data(), sMsSzTitle.Data(), 160000, 0., 20000.);
420 sMsSzName = Form(
"MsSzTime_link_%02lu", component);
422 "Size of MS vs time for gDPB of link %02lu; Time[s] ; Ms Size [bytes]",
429 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
439 LOG(info) <<
"Added MS size histo for component (link): " << component;
450 LOG(info) <<
"create Histos for " <<
fuNrOfGdpbs <<
" gDPBs ";
452 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
464 Double_t dBinSzG4v2 = (6250. / 112.);
469 name =
"hMessageType";
470 title =
"Nb of message for each type; Type";
487 name =
"hSysMessType";
488 title =
"Nb of system message for each type; System Type";
496 "SYS_GET4_SYNC_MISS");
501 name =
"hGet4MessType";
502 title =
"Nb of message for each type per GET4; GET4 chip # ; Type";
512 name =
"hGet4ChanScm";
513 title =
"SC messages per GET4 channel; GET4 channel # ; SC type";
529 name =
"hGet4ChanErrors";
530 title =
"Error messages per GET4 channel; GET4 channel # ; Error";
551 12,
"0x0b: DLL Lock error ");
553 13,
"0x0c: DLL Reset invoc.");
558 17,
"0x14: Add. Rising edge");
560 18,
"0x15: Unpaired Falling");
562 19,
"0x16: Sequence error ");
567 name =
"hGet4EpochFlags";
568 title =
"Epoch flags per GET4; GET4 chip # ; Type";
577 name =
"hGdpbMessageType";
578 title =
"Nb of message for each type per Gdpb; Type; Gdpb Idx []";
602 name =
"hGdpbSysMessType";
604 "Nb of system message for each type per Gdpb; System Type; Gdpb Idx []";
618 "SYS_GET4_SYNC_MISS");
623 name =
"hGdpbSysMessPattType";
625 "Nb of pattern message for each type per Gdpb; Pattern Type; Gdpb Idx []";
642 name =
"hGdpbEpochFlags";
643 title =
"Epoch flags per gDPB; gDPB # ; Type";
652 name = Form(
"hGdpbEpochSyncEvo");
653 title = Form(
"Epoch SYNC per second and gDPB; Time[s]; gDPB #; SYNC Nb");
664 name = Form(
"hGdpbEpochMissEvo");
666 Form(
"Epoch Missmatch per second and gDPB; Time[s]; gDPB #; Missmatch Nb");
678 name =
"hScmScalerCounters";
680 "Content of Scaler counter SC messages; Scaler counter [hit]; Channel []";
690 name =
"hScmDeadtimeCounters";
691 title =
"Content of Deadtime counter SC messages; Deadtime [Clk Cycles]; "
702 name =
"hScmSeuCounters";
703 title =
"Content of SEU counter SC messages; SEU []; Channel []";
713 name =
"hScmSeuCountersEvo";
715 "SEU counter rate from SC messages; Time in Run [s]; Channel []; SEU []";
726 name =
"hPatternMissmatch";
727 title =
"Missmatch pattern integral per Gdpb; ASIC Pattern []; Gdpb Idx []";
736 name =
"hPatternEnable";
737 title =
"Enable pattern integral per Gdpb; ASIC Pattern []; Gdpb Idx []";
746 name =
"hPatternResync";
747 title =
"Resync pattern integral per Gdpb; ASIC Pattern []; Gdpb Idx []";
759 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
762 name = Form(
"hGdpbGet4MessType_%02u", uGdpb);
764 "Nb of message for each type per GET4 in gDPB %02u; GET4 chip # ; Type",
774 name = Form(
"hGdpbGet4ChanScm_%02u", uGdpb);
776 "SC messages per GET4 channel in gDPB %02u; GET4 channel # ; SC type",
793 name = Form(
"hGdpbGet4ChanErrors_%02u", uGdpb);
795 "Error messages per GET4 channel in gDPB %02u; GET4 channel # ; Error",
806 1,
"0x00: Readout Init ");
810 3,
"0x02: Epoch count sync");
814 5,
"0x04: FIFO Write ");
816 6,
"0x05: Lost event ");
818 7,
"0x06: Channel state ");
820 8,
"0x07: Token Ring state");
824 10,
"0x09: Error Readout ");
828 12,
"0x0b: DLL Lock error ");
830 13,
"0x0c: DLL Reset invoc.");
832 14,
"0x11: Overwrite ");
834 15,
"0x12: ToT out of range");
836 16,
"0x13: Event Discarded ");
838 17,
"0x14: Add. Rising edge");
840 18,
"0x15: Unpaired Falling");
842 19,
"0x16: Sequence error ");
844 20,
"0x17: Epoch Overflow ");
846 21,
"0x7f: Unknown ");
848 22,
"Corrupt/unsuprtd error");
851 name = Form(
"hGdpbPatternMissmatchEvo_%02u", uGdpb);
853 Form(
"Missmatch pattern vs TS index in gDPB %02u; TS # ; ASIC Pattern []",
864 name = Form(
"hGdpbPatternEnableEvo_%02u", uGdpb);
866 "Enable pattern vs TS index in gDPB %02u; TS # ; ASIC Pattern []", uGdpb);
876 name = Form(
"hGdpbPatternResyncEvo%02u", uGdpb);
878 "Resync pattern vs TS index in gDPB %02u; TS # ; ASIC Pattern []", uGdpb);
889 name = Form(
"RawFt_gDPB_%02u", uGdpb);
891 Form(
"Raw FineTime gDPB %02u Plot 0; channel; FineTime [bin]", uGdpb);
902 name = Form(
"RawTot_gDPB_%02u", uGdpb);
903 title = Form(
"Raw TOT gDPB %02u; channel; TOT [bin]", uGdpb);
914 name = Form(
"ChCount_gDPB_%02u", uGdpb);
915 title = Form(
"Channel counts gDPB %02u; channel; Hits", uGdpb);
917 new TH1I(name.Data(),
924 name = Form(
"ChRate_gDPB_%02u", uGdpb);
925 title = Form(
"Channel rate gDPB %02u; Time in run [s]; channel; Rate [1/s]",
928 new TH2D(name.Data(),
938 name = Form(
"RemapTot_gDPB_%02u", uGdpb);
939 title = Form(
"Raw TOT gDPB %02u remapped; PADI channel; TOT [bin]", uGdpb);
950 name = Form(
"RemapChCount_gDPB_%02u", uGdpb);
952 Form(
"Channel counts gDPB %02u remapped; PADI channel; Hits", uGdpb);
954 new TH1I(name.Data(),
961 name = Form(
"RemapChRate_gDPB_%02u", uGdpb);
963 "PADI channel rate gDPB %02u; Time in run [s]; PADI channel; Rate [1/s]",
966 new TH2D(name.Data(),
977 name = Form(
"FeeRate_gDPB_g%02u_f%1u", uGdpb, uFee);
979 Form(
"Counts per second in Fee %1u of gDPB %02u; Time[s] ; Counts",
985 name = Form(
"FeeErrorRate_gDPB_g%02u_f%1u", uGdpb, uFee);
986 title = Form(
"Error Counts per second in Fee %1u of gDPB %02u; Time[s] ; "
993 name = Form(
"FeeErrorRatio_gDPB_g%02u_f%1u", uGdpb, uFee);
994 title = Form(
"Error to data ratio per second in Fee %1u of gDPB %02u; "
995 "Time[s] ; Error ratio[]",
1001 name = Form(
"FeeRateLong_gDPB_g%02u_f%1u", uGdpb, uFee);
1003 Form(
"Counts per minutes in Fee %1u of gDPB %02u; Time[min] ; Counts",
1012 name = Form(
"FeeErrorRateLong_gDPB_g%02u_f%1u", uGdpb, uFee);
1013 title = Form(
"Error Counts per minutes in Fee %1u of gDPB %02u; "
1014 "Time[min] ; Error Counts",
1023 name = Form(
"FeeErrorRatioLong_gDPB_g%02u_f%1u", uGdpb, uFee);
1024 title = Form(
"Error to data ratio per minutes in Fee %1u of gDPB %02u; "
1025 "Time[min] ; Error ratio[]",
1036 name = Form(
"hTokenMsgType_gDPB_%02u", uGdpb);
1038 title = Form(
"STAR trigger Messages type gDPB %02u; Type ; Counts", uGdpb);
1048 name = Form(
"hTriggerRate_gDPB_%02u", uGdpb);
1049 title = Form(
"STAR trigger signals per second gDPB %02u; Time[s] ; Counts",
1055 name = Form(
"hCmdDaqVsTrig_gDPB_%02u", uGdpb);
1057 Form(
"STAR daq command VS STAR trigger command gDPB %02u; DAQ ; TRIGGER",
1059 fvhCmdDaqVsTrig.push_back(
new TH2I(name, title, 16, 0, 16, 16, 0, 16));
1061 1,
"0x0: no-trig ");
1065 3,
"0x2: mast-rst");
1069 5,
"0x4: trigg. 0");
1118 name = Form(
"hStarTokenEvo_gDPB_%02u", uGdpb);
1119 title = Form(
"STAR token value VS time gDPB %02u; Time in Run [s] ; STAR "
1126 name = Form(
"hStarTrigGdpbTsEvo_gDPB_%02u", uGdpb);
1128 "gDPB TS in STAR triger tokens for gDPB %02u; Time in Run [s] ; gDPB TS;",
1133 name = Form(
"hStarTrigStarTsEvo_gDPB_%02u", uGdpb);
1135 "STAR TS in STAR triger tokens for gDPB %02u; Time in Run [s] ; STAR TS;",
1144 name = Form(
"RemapTotSideA_mod_%02u", uMod);
1145 title = Form(
"Raw TOT module %02u Side A; PADI channel; TOT [bin]", uMod);
1154 name = Form(
"RemapTotSideB_mod_%02u", uMod);
1155 title = Form(
"Raw TOT module %02u Side B; PADI channel; TOT [bin]", uMod);
1165 name = Form(
"ModRate_gDPB_m%02u", uMod);
1166 title = Form(
"Counts per second in Module %02u; Time[s] ; Counts", uMod);
1170 name = Form(
"ModErrorRate_m%02u", uMod);
1172 "Error Counts per second in Module %02u; Time[s] ; Error Counts", uMod);
1176 name = Form(
"ModErrorRatio_m%02u", uMod);
1178 "Error to data ratio per second in Module %02u; Time[s] ; Error ratio[]",
1191 if (uFeeA < uFeeB) {
1197 new TH1I(Form(
"hTimeDiffPulser_g%02u_f%1u_g%02u_f%1u",
1202 Form(
"Time difference for pulser on gDPB %02u FEE %1u and "
1203 "gDPB %02u FEE %1u; DeltaT [ps]; Counts",
1217 name =
"hTimeMeanPulser";
1220 "Time difference Mean for each FEE pairs; FEE A; FEE B ; Mean [ps]",
1228 name =
"hTimeRmsPulser";
1231 "Time difference RMS for each FEE pairs; FEE A; FEE B ; RMS [ps]",
1239 name =
"hTimeRmsZoomFitPuls";
1241 "Time difference RMS after zoom for each "
1242 "FEE pairs; FEE A; FEE B ; RMS [ps]",
1250 name =
"hTimeResFitPuls";
1252 "Time difference Res from fit for each FEE "
1253 "pairs; FEE A; FEE B ; Sigma [ps]",
1263 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
1266 Form(
"hPulserTimeDiffEvoGdpb%02uGbtx00Gbtx%02u", uGdpb, uGbtx + 1);
1270 Form(
"Time difference of the 1st FEE in the 1st GBTx of gDPB %02u "
1271 "vs GBTx %02u; time in run [min]; dt [ps]",
1280 for (UInt_t uGdpbB = uGdpb + 1; uGdpbB <
fuNrOfGdpbs; ++uGdpbB) {
1281 name = Form(
"hPulserTimeDiffEvoGdpb%02uGdpb%02u", uGdpb, uGdpbB);
1283 new TProfile(name.Data(),
1284 Form(
"Time difference of the 1st FEE in the 1st GBTx of "
1285 "gDPB %02u vs %02u; time in run [min]; dt [ps]",
1297 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
1298 name = Form(
"hCoincMapAllChanGdpb%02u", uGdpb);
1300 new TH2D(name.Data(),
1301 Form(
"Coincidence map of all channels of gDPB %02u; Chan A "
1302 "[]; Chan B[]; Coinc. []",
1311 name = Form(
"hCoincMeanAllChanGdpb%02u", uGdpb);
1313 new TProfile2D(name.Data(),
1314 Form(
"Coincidence mean of all channels of gDPB %02u; "
1315 "Chan A []; Chan B[]; Mean dt [ps]",
1350 for (UInt_t uTotPlot = 0; uTotPlot <
fvhRawTot_gDPB.size(); ++uTotPlot)
1359 server->Register(
"/TofMod",
fvhModRate[uMod]);
1364 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
1380 server->Register(
"/TofRates",
1382 server->Register(
"/TofRates",
1386 server->Register(
"/TofRates",
1415 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
1425 for (UInt_t uGdpbB = uGdpb + 1; uGdpbB <
fuNrOfGdpbs; ++uGdpbB)
1427 server->Register(
"/TofDtEvo",
1432 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
1438 server->RegisterCommand(
"/Reset_All_eTOF",
"bMcbmMoniTofResetHistos=kTRUE");
1439 server->RegisterCommand(
"/Save_All_eTof",
"bMcbmMoniTofSaveHistos=kTRUE");
1440 server->RegisterCommand(
"/Update_PulsFit",
1441 "bMcbmMoniTofUpdateZoomedFit=kTRUE");
1442 server->RegisterCommand(
"/Print_Raw_Data",
1443 "bMcbmMoniTofRawDataPrint=kTRUE");
1444 server->RegisterCommand(
"/Print_AllHits",
1445 "bMcbmMoniTofPrintAllHitsEna=kTRUE");
1446 server->RegisterCommand(
"/Print_AllEps",
1447 "bMcbmMoniTofPrintAllEpochsEna=kTRUE");
1449 server->Restrict(
"/Reset_All_eTof",
"allow=admin");
1450 server->Restrict(
"/Save_All_eTof",
"allow=admin");
1451 server->Restrict(
"/Update_PulsFit",
"allow=admin");
1452 server->Restrict(
"/Print_Raw_Data",
"allow=admin");
1453 server->Restrict(
"/Print_AllHits",
"allow=admin");
1454 server->Restrict(
"/Print_AllEps",
"allow=admin");
1460 TCanvas* cSummary =
new TCanvas(
"cSummary",
"gDPB Monitoring Summary", w,
h);
1461 cSummary->Divide(2, 3);
1490 TCanvas* cSummaryGdpb =
1491 new TCanvas(
"cSummaryGdpb",
"gDPB Monitoring Summary", w,
h);
1492 cSummaryGdpb->Divide(2, 3);
1494 cSummaryGdpb->cd(1);
1498 cSummaryGdpb->cd(3);
1502 cSummaryGdpb->cd(5);
1506 cSummaryGdpb->cd(4);
1509 cSummaryGdpb->cd(6);
1515 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
1516 TCanvas* cSumGdpbGet4 =
1517 new TCanvas(Form(
"cSumGdpbGet4_g%02u", uGdpb),
1518 Form(
"Summary per GET4 or channel for gDPB %02u", uGdpb),
1521 cSumGdpbGet4->Divide(2, 2);
1523 cSumGdpbGet4->cd(1);
1527 cSumGdpbGet4->cd(2);
1531 cSumGdpbGet4->cd(3);
1538 TCanvas* cFeeRates =
1539 new TCanvas(
"cFeeRates",
"gDPB Monitoring FEE rates", w,
h);
1542 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
1555 TCanvas* cFeeErrRatio =
1556 new TCanvas(
"cFeeErrRatio",
"gDPB Monitoring FEE error ratios", w,
h);
1559 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
1570 TCanvas* cFeeRatesLong =
1571 new TCanvas(
"cFeeRatesLong",
"gDPB Monitoring FEE rates", w,
h);
1574 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
1589 TCanvas* cFeeErrRatioLong =
1590 new TCanvas(
"cFeeErrRatioLong",
"gDPB Monitoring FEE error ratios", w,
h);
1593 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
1604 TCanvas* cGdpbChannelCount =
new TCanvas(
1605 "cGdpbChannelCount",
"Integrated Get4 channel counts per gDPB", w,
h);
1607 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
1608 cGdpbChannelCount->cd(1 + uGdpb);
1617 TCanvas* cGdpbRemapChCount =
new TCanvas(
1618 "cGdpbRemapChCount",
"Integrated PADI channel counts per gDPB", w,
h);
1620 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
1621 cGdpbRemapChCount->cd(1 + uGdpb);
1630 TCanvas* cGdpbChannelRate =
1631 new TCanvas(
"cGdpbChannelRate",
"Get4 channel rate per gDPB", w,
h);
1633 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
1634 cGdpbChannelRate->cd(1 + uGdpb);
1643 TCanvas* cGdpbRemapChRate =
1644 new TCanvas(
"cGdpbRemapChRate",
"PADI channel rate per gDPB", w,
h);
1646 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
1647 cGdpbRemapChRate->cd(1 + uGdpb);
1656 TCanvas* cTotPnt = NULL;
1657 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
1658 cTotPnt =
new TCanvas(Form(
"cTot_g%02u", uGdpb),
1659 Form(
"gDPB %02u TOT distributions", uGdpb),
1670 cTotPnt =
new TCanvas(
"cTot_all",
"TOT distributions", w,
h);
1672 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
1673 cTotPnt->cd(1 + uGdpb);
1685 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
1686 cTotPnt =
new TCanvas(Form(
"cTotRemap_g%02u", uGdpb),
1687 Form(
"PADI ch gDPB %02u TOT distributions", uGdpb),
1698 cTotPnt =
new TCanvas(
"cTotRemap_all",
"TOT distributions", w,
h);
1700 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
1701 cTotPnt->cd(1 + uGdpb);
1714 cTotPnt =
new TCanvas(Form(
"cTotRemapSides_m%02u", uMod),
1715 Form(
"Sides ch module %02u TOT distributions", uMod),
1718 cTotPnt->Divide(1, 2);
1737 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; uGdpb++) {
1738 TCanvas* cStarToken =
1739 new TCanvas(Form(
"cStarToken_g%02u", uGdpb),
1740 Form(
"STAR token detection info for gDPB %02u", uGdpb),
1743 cStarToken->Divide(2, 2);
1763 TCanvas* cPulser =
new TCanvas(
1765 "Time difference RMS for pulser channels when FEE pulser mode is ON",
1768 cPulser->Divide(2, 2);
1792 TCanvas* cPulserEvo =
new TCanvas(
1794 "Time difference evolution between 1st FEE of 1st GBTx of gDPB pairs",
1798 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs - 1; uGdpb++) {
1799 cPulserEvo->cd(1 + uGdpb);
1808 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; uGdpb++) {
1809 TCanvas* cPulserEvoGbtx =
1810 new TCanvas(Form(
"cPulserEvoGbtx%02u", uGdpb),
1811 Form(
"Time difference evolution between 1st FEE of GBTx "
1812 "pairs in gDPB %02u",
1819 cPulserEvoGbtx->cd(1 + uGbtx);
1835 TCanvas* cModRates =
1836 new TCanvas(Form(
"cModRate_m%02u", uMod),
1837 Form(
"Hit and error Rates for module %02u", uMod),
1852 fcMsSizeAll =
dynamic_cast<TCanvas*
>(gROOT->FindObject(
"cMsSizeAll"));
1855 new TCanvas(
"cMsSizeAll",
"Evolution of MS size in last 300 s", w,
h);
1857 LOG(info) <<
"Created MS size canvas in TOF monitor";
1860 LOG(info) <<
"Recovered MS size canvas in TOF monitor";
1862 LOG(info) <<
"Leaving CreateHistograms";
1868 LOG(info) <<
"Reset eTOF STAR histos ";
1873 LOG(info) <<
"Start saving eTOF STAR histos ";
1895 std::chrono::time_point<std::chrono::system_clock> timeCurrent =
1896 std::chrono::system_clock::now();
1897 std::chrono::duration<double> elapsed_seconds =
1904 else if (300 < elapsed_seconds.count()) {
1905 std::time_t cTimeCurrent =
1906 std::chrono::system_clock::to_time_t(timeCurrent);
1908 std::strftime(tempBuff, 80,
"%F %T", localtime(&cTimeCurrent));
1921 LOG(debug1) <<
"Timeslice contains " << ts.num_microslices(component)
1928 Int_t messageType = -111;
1929 Double_t dTsStartTime = -1;
1932 for (UInt_t uMsIdx = 0; uMsIdx < uNbMsLoop; uMsIdx++) {
1941 auto msDescriptor = ts.descriptor(uMsComp, uMsIdx);
1943 <<
"hi hv eqid flag si sv idx/start crc size offset";
1945 "%02x %02x %04x %04x %02x %02x %016lx %08x %08x %016lx",
1946 static_cast<unsigned int>(msDescriptor.hdr_id),
1947 static_cast<unsigned int>(msDescriptor.hdr_ver),
1950 static_cast<unsigned int>(msDescriptor.sys_id),
1951 static_cast<unsigned int>(msDescriptor.sys_ver),
1955 msDescriptor.offset);
1962 constexpr uint32_t kuBytesPerMessage = 8;
1965 auto msDescriptor = ts.descriptor(uMsComp, uMsIdx);
1967 fdMsIndex =
static_cast<double>(msDescriptor.idx);
1968 const uint8_t* msContent =
1969 reinterpret_cast<const uint8_t*
>(ts.content(uMsComp, uMsIdx));
1971 uint32_t size = msDescriptor.size;
1974 LOG(debug) <<
"Microslice: " << msDescriptor.idx
1975 <<
" has size: " << size;
1983 if (0 == uMsIdx && 0 == uMsCompIdx) dTsStartTime = (1e-9) *
fdMsIndex;
1996 if (0 != (size % kuBytesPerMessage))
1997 LOG(error) <<
"The input microslice buffer does NOT "
1998 <<
"contain only complete nDPB messages!";
2001 uint32_t uNbMessages =
2002 (size - (size % kuBytesPerMessage)) / kuBytesPerMessage;
2011 <<
"---------------------------------------------------------------";
2013 <<
"hi hv eqid flag si sv idx/start crc size offset";
2015 "%02x %02x %04x %04x %02x %02x %016lx %08x %08x %016lx",
2016 static_cast<unsigned int>(msDescriptor.hdr_id),
2017 static_cast<unsigned int>(msDescriptor.hdr_ver),
2020 static_cast<unsigned int>(msDescriptor.sys_id),
2021 static_cast<unsigned int>(msDescriptor.sys_ver),
2025 msDescriptor.offset);
2026 LOG(fatal) <<
"Could not find the gDPB index for AFCK id 0x" << std::hex
2027 <<
fuGdpbId << std::dec <<
" in timeslice "
2029 <<
" component " << uMsCompIdx <<
"\n"
2030 <<
"If valid this index has to be added in the TOF "
2031 "parameter file in the RocIdArray field";
2038 const uint64_t* pInBuff =
reinterpret_cast<const uint64_t*
>(msContent);
2039 for (uint32_t uIdx = 0; uIdx < uNbMessages; uIdx++) {
2041 uint64_t ulData =
static_cast<uint64_t
>(pInBuff[uIdx]);
2044 if (0 == uIdx && kFALSE == fbOldFwData) {
2052 || gLogger->IsLogNeeded(fair::Severity::debug2)) {
2072 LOG(warning) <<
"Message with Get4 ID too high: " <<
fuGet4Id
2075 switch (messageType) {
2122 LOG(info) <<
"Epoch: " << Form(
"0x%08x ",
fuGdpbId) <<
", Merg"
2124 <<
", epoch " << std::setw(8)
2127 <<
", Data loss " << std::setw(1)
2130 <<
", Epoch miss " << std::setw(1)
2141 LOG(info) <<
"Epoch: " << Form(
"0x%08x ",
fuGdpbId) <<
", "
2142 << std::setw(4) <<
fuGet4Nr <<
", Link "
2144 <<
", epoch " << std::setw(8)
2147 <<
", Data loss " << std::setw(1)
2150 <<
", Epoch miss " << std::setw(1)
2320 LOG(error) <<
"Message type " << std::hex << std::setw(2)
2321 <<
static_cast<uint16_t
>(messageType)
2322 <<
" not included in Get4 unpacker.";
2345 Double_t dTimeDiff =
2387 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
2401 Double_t dTimeDiff = 1e3
2447 || gLogger->IsLogNeeded(fair::Severity::debug2)) {
2448 LOG(info) <<
"CbmMcbm2018MonitorTof::ProcessEpochCyle => "
2449 << Form(
" TS %5lu MS %3lu In data 0x%016lX Cycle 0x%016lX",
2480 if (0 < ulCurEpochGdpbGet4)
2481 ulCurEpochGdpbGet4--;
2486 UInt_t uChannelNrInFee =
2490 UInt_t uRemappedChannelNr =
2516 uRemappedChannelNr - uOffset, uTot);
2519 uRemappedChannelNr - uOffset, uTot);
2631 else if (
fuGdpbNr == fuDiamondDpbIdx && 0 == uChannelNrInFee) {
2647 uRemappedChannelNr);
2667 LOG(info) <<
"Hit: " << Form(
"0x%08x ",
fuGdpbId) <<
", " << std::setw(2)
2668 <<
fuGet4Nr <<
", " << std::setw(3) << uChannel <<
", "
2669 << std::setw(3) << uTot <<
", epoch " << std::setw(3)
2670 << ulCurEpochGdpbGet4 <<
", FullTime Clk "
2671 << Form(
"%12lu ", ulHitTime) <<
", FullTime s "
2672 << Form(
"%12.9f ", dHitTime / 1e9) <<
", FineTime " << uFts;
2701 if (0 < iBufferSize) {
2702 LOG(debug) <<
"Now processing stored messages for for get4 " <<
fuGet4Nr
2710 for (Int_t iMsgIdx = 0; iMsgIdx < iBufferSize; iMsgIdx++) {
2815 dMessTime -
fdStartTime * 1.e-9, uData, dFullChId);
2828 uint64_t uData = mess.
getData();
2830 LOG(debug) <<
"Get4 MSG type " << mType <<
" from gdpbId " <<
fuGdpbId
2831 <<
", getId " <<
fuGet4Id <<
", (hit channel) " << channel
2832 <<
" data " << std::hex << uData;
2837 LOG(debug) <<
"GET4 System message, epoch "
2839 << std::setprecision(9) << std::fixed
2841 <<
" for board ID " << std::hex << std::setw(4) <<
fuGdpbId
2853 LOG(debug) <<
" +++++++ > gDPB: " << std::hex << std::setw(4)
2854 <<
fuGdpbId << std::dec <<
", Chip = " << std::setw(2)
2859 << std::setw(2) << uData << std::dec
2860 <<
" -- GET4 V1 Error Event";
2862 LOG(debug) <<
" +++++++ >gDPB: " << std::hex << std::setw(4) <<
fuGdpbId
2863 << std::dec <<
", Chip = " << std::setw(2)
2868 << std::setw(2) << uData << std::dec
2869 <<
" -- GET4 V1 Error Event ";
2873 LOG(debug) <<
"Unknown GET4 message, data: " << std::hex << std::setw(8)
2875 <<
" Full message: " << std::hex << std::setw(16)
2876 << mess.
getData() << std::dec;
2880 LOG(debug) <<
"GET4 synchronization pulse missing";
2884 LOG(debug) <<
"ASIC pattern for missmatch, disable or resync";
2888 LOG(debug) <<
"Crazy system message, subtype "
2904 "Missmatch pattern message => Type %d, Index %2d, Pattern 0x%08X",
2908 for (UInt_t uBit = 0; uBit < 32; ++uBit)
2909 if ((uPattern >> uBit) & 0x1) {
2912 if (
fuGdpbNr == fuDiamondDpbIdx) uBadAsic = 32 * usIndex + uBit;
2921 for (UInt_t uBit = 0; uBit < 32; ++uBit)
2922 if ((uPattern >> uBit) & 0x1) {
2925 if (
fuGdpbNr == fuDiamondDpbIdx) uBadAsic = 32 * usIndex + uBit;
2934 "RESYNC pattern message => Type %d, Index %2d, Pattern 0x%08X",
2939 for (UInt_t uBit = 0; uBit < 32; ++uBit)
2940 if ((uPattern >> uBit) & 0x1) {
2943 if (
fuGdpbNr == fuDiamondDpbIdx) uBadAsic = 32 * usIndex + uBit;
2951 LOG(debug) <<
"Crazy pattern message, subtype " << usType;
2962 switch (iMsgIndex) {
2979 ULong64_t ulNewGdpbTsFull =
2996 LOG(warning) <<
"Possible error: identical STAR tokens found twice in "
2997 "a row => ignore 2nd! "
3004 << Form(
"TRG Wrd = %5x ", uTrigWord);
3021 LOG(debug) <<
"Probable reset of the STAR TS: old = "
3023 <<
" new = " << Form(
"%16llu", ulNewStarTsFull)
3082 default: LOG(error) <<
"Unknown Star Trigger messageindex: " << iMsgIndex;
3090 TString message_type;
3093 case 0: message_type =
"NOP";
break;
3094 case 1: message_type =
"HIT";
break;
3095 case 2: message_type =
"EPOCH";
break;
3096 case 3: message_type =
"SYNC";
break;
3097 case 4: message_type =
"AUX";
break;
3098 case 5: message_type =
"EPOCH2";
break;
3099 case 6: message_type =
"GET4";
break;
3100 case 7: message_type =
"SYS";
break;
3101 case 8: message_type =
"GET4_SLC";
break;
3102 case 9: message_type =
"GET4_32B";
break;
3103 case 10: message_type =
"GET4_SYS";
break;
3104 default: message_type =
"UNKNOWN";
break;
3109 LOG(info) <<
"-------------------------------------";
3112 LOG(info) <<
"Last epoch for gDPB: " << std::hex << std::setw(4) <<
i
3113 << std::dec <<
" , GET4 " << std::setw(4) << j <<
" => "
3117 LOG(info) <<
"-------------------------------------";
3143 TDirectory* oldDir = NULL;
3144 TFile* histoFile = NULL;
3145 if (
"" != sFileName) {
3147 oldDir = gDirectory;
3149 histoFile =
new TFile(sFileName,
"RECREATE");
3153 gDirectory->mkdir(
"Tof_Raw_gDPB");
3154 gDirectory->cd(
"Tof_Raw_gDPB");
3179 for (UInt_t uTotPlot = 0; uTotPlot <
fvhRawTot_gDPB.size(); ++uTotPlot)
3194 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
3225 gDirectory->cd(
"..");
3228 gDirectory->mkdir(
"Star_Raw");
3229 gDirectory->cd(
"Star_Raw");
3230 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
3238 gDirectory->cd(
"..");
3242 gDirectory->mkdir(
"TofDt");
3243 gDirectory->cd(
"TofDt");
3248 gDirectory->cd(
"..");
3251 gDirectory->mkdir(
"TofDtEvo");
3252 gDirectory->cd(
"TofDtEvo");
3253 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
3258 for (UInt_t uGdpbB = uGdpb + 1; uGdpbB <
fuNrOfGdpbs; ++uGdpbB)
3261 gDirectory->cd(
"..");
3266 gDirectory->mkdir(
"TofCoinc");
3267 gDirectory->cd(
"TofCoinc");
3268 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
3272 gDirectory->cd(
"..");
3275 gDirectory->mkdir(
"Flib_Raw");
3276 gDirectory->cd(
"Flib_Raw");
3277 for (UInt_t uLinks = 0; uLinks <
fvhMsSzPerLink.size(); uLinks++) {
3284 TH1* pMissedTsH1 =
dynamic_cast<TH1*
>(gROOT->FindObjectAny(
"Missed_TS"));
3285 if (NULL != pMissedTsH1) pMissedTsH1->Write();
3287 TProfile* pMissedTsEvoP =
3288 dynamic_cast<TProfile*
>(gROOT->FindObjectAny(
"Missed_TS_Evo"));
3289 if (NULL != pMissedTsEvoP) pMissedTsEvoP->Write();
3291 gDirectory->cd(
"..");
3294 if (
"" != sFileName) {
3299 if (
"" != sFileName) {
3307 LOG(info) <<
"Reseting all TOF histograms.";
3332 for (UInt_t uTotPlot = 0; uTotPlot <
fvhRawTot_gDPB.size(); ++uTotPlot)
3347 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
3374 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
3395 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
3400 for (UInt_t uGdpbB = uGdpb + 1; uGdpbB <
fuNrOfGdpbs; ++uGdpbB)
3407 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
3413 for (UInt_t uLinks = 0; uLinks <
fvhMsSzPerLink.size(); uLinks++) {
3425 for (UInt_t uGdpbLoop = 0; uGdpbLoop <
fuNrOfGdpbs; ++uGdpbLoop) {
3448 for (UInt_t uGdpbLoop = 0; uGdpbLoop <
fuNrOfGdpbs; uGdpbLoop++) {
3463 LOG(error) <<
"CbmStar2019MonitorTof::UpdateZoomedFit => "
3464 <<
"Pulser mode not enabled in root macro, doinb nothing !!! ";
3486 <<
"CbmStar2019MonitorTof::UpdateZoomedFit => Empty input "
3487 <<
"for FEE pair " << uFeeA <<
" and " << uFeeB <<
" !!! ";
3504 if ((dZoomCounts / dNbCounts) < 0.99) {
3508 <<
"CbmStar2019MonitorTof::UpdateZoomedFit => Zoom too strong, "
3509 <<
"more than 1% loss for FEE pair " << uFeeA <<
" and " << uFeeB
3521 fitFuncPairs[uFeeA][uFeeB] =
3522 new TF1(Form(
"fPair_%02d_%02d", uFeeA, uFeeB),
3527 fitFuncPairs[uFeeA][uFeeB]->SetParameter(0, dZoomCounts);
3528 fitFuncPairs[uFeeA][uFeeB]->SetParameter(1, dPeakPos);
3529 fitFuncPairs[uFeeA][uFeeB]->SetParameter(
3533 Form(
"fPair_%02d_%02d", uFeeA, uFeeB),
"QRM0");
3535 dRes = fitFuncPairs[uFeeA][uFeeB]->GetParameter(2);
3537 delete fitFuncPairs[uFeeA][uFeeB];
3542 LOG(info) <<
"CbmStar2019MonitorTof::UpdateZoomedFit => "
3543 <<
"For FEE pair " << uFeeA <<
" and " << uFeeB
3544 <<
" we have zoomed RMS = "
3546 <<
" and a resolution of " << dRes / TMath::Sqrt2();
3554 <<
"CbmStar2019MonitorTof::UpdateZoomedFit => Zoom width not defined, "
3555 <<
"please use SetFitZoomWidthPs, e.g. in macro, before trying this "