16 #include "FairLogger.h"
17 #include "FairRootManager.h"
19 #include "FairRunOnline.h"
20 #include "FairRuntimeDb.h"
24 #include "TClonesArray.h"
29 #include "THttpServer.h"
31 #include "TPaveStats.h"
33 #include "TProfile2D.h"
54 , fvMsComponentsList()
57 , fbIgnoreOverlapMs(kFALSE)
58 , fuMsAcceptsPercent(100)
63 , fdTsCoreSizeInNs(0.0)
70 , fuNrOfChannelsPerGet4(0)
71 , fuNrOfChannelsPerFee(0)
73 , fuNrOfGet4PerGdpb(0)
74 , fuNrOfChannelsPerGdpb(0)
75 , fuRawDataPrintMsgNb(100000)
76 , fuRawDataPrintMsgIdx(fuRawDataPrintMsgNb)
77 , fbPrintAllHitsEnable(kFALSE)
78 , fbPrintAllEpochsEnable(kFALSE)
79 , fbPulserModeEnable(kFALSE)
80 , fbCoincMapsEnable(kFALSE)
82 , fuDiamondDpbIdx(10000)
84 fsHistoFilename(
"data/HistosMonitorTof.root")
85 , fulCurrentTsIndex(0)
94 , fviMsgCounter(11, 0)
100 , fvulGdpbTsFullLast()
101 , fvulStarTsFullLast()
103 , fvuStarDaqCmdLast()
104 , fvuStarTrigCmdLast()
106 , fvbFirstEpochSeen()
107 , fvulCurrentEpochCycle()
108 , fvulCurrentEpochFull()
109 , fulCurrentEpochTime(0)
112 , fvuFeeNbHitsLastMs()
113 , fdTsLastPulserHit()
114 , fvuCoincNbHitsLastMs()
115 , fvdCoincTsLastHit()
121 , fuNbFeePlotsPerGdpb(0)
123 , fdStartTimeLong(-1.)
124 , fdStartTimeMsSz(-1.)
125 , fuHistoryHistoSize(1800)
126 , fuHistoryHistoSizeLong(600)
127 , fdLastRmsUpdateTime(0.0)
128 , fdFitZoomWidthPs(0.0)
130 , fvhMsSzPerLink(12, NULL)
131 , fvhMsSzTimePerLink(12, NULL)
133 , fhSysMessType(NULL)
134 , fhGet4MessType(NULL)
135 , fhGet4ChanScm(NULL)
136 , fhGet4ChanErrors(NULL)
137 , fhGet4EpochFlags(NULL)
138 , fhGdpbMessType(NULL)
139 , fhGdpbSysMessType(NULL)
140 , fhGdpbSysMessPattType(NULL)
141 , fhGdpbEpochFlags(NULL)
142 , fhGdpbEpochSyncEvo(NULL)
143 , fhGdpbEpochMissEvo(NULL)
144 , fvhGdpbGet4MessType()
145 , fvhGdpbGet4ChanScm()
146 , fvhGdpbGet4ChanErrors()
147 , fhScmScalerCounters(NULL)
148 , fhScmDeadtimeCounters(NULL)
149 , fhScmSeuCounters(NULL)
150 , fhScmSeuCountersEvo(NULL)
151 , fhPatternMissmatch(NULL)
152 , fhPatternEnable(NULL)
153 , fhPatternResync(NULL)
154 , fvhGdpbPatternMissmatchEvo()
155 , fvhGdpbPatternEnableEvo()
156 , fvhGdpbPatternResyncEvo()
157 , fvvbGdpbLastMissmatchPattern()
158 , fvvbGdpbLastEnablePattern()
159 , fvvbGdpbLastResyncPattern()
160 , fvhGdpbMissmatchEvoPerTs()
161 , fvhGdpbMissmatchEnaEvoPerTs()
162 , fvhGdpbEnableEvoPerTs()
163 , fvhGdpbResyncEvoPerTs()
164 , fvhGdpbResyncEnaEvoPerTs()
165 , fvhGdpbStateEvoPerTs()
169 , fvhChannelRate_gDPB()
171 , fvhRemapChCount_gDPB()
172 , fvhRemapChRate_gDPB()
174 , fvhFeeErrorRate_gDPB()
175 , fvhFeeErrorRatio_gDPB()
176 , fvhFeeRateLong_gDPB()
177 , fvhFeeErrorRateLong_gDPB()
178 , fvhFeeErrorRatioLong_gDPB()
187 fvvuChanNbHitsPerMs()
188 , fhHitsPerMsFirstChan_gDPB()
189 , fvhChannelRatePerMs_gDPB()
194 , fvhStarTrigGdpbTsEvo()
195 , fvhStarTrigStarTsEvo()
196 , fvhTimeDiffPulser()
197 , fhTimeMeanPulser(NULL)
198 , fhTimeRmsPulser(NULL)
199 , fhTimeRmsZoomFitPuls(NULL)
200 , fhTimeResFitPuls(NULL)
201 , fvhPulserTimeDiffEvoGbtxGbtx()
202 , fvvhPulserTimeDiffEvoGdpbGdpb()
207 , fTimeLastHistoSaving() {}
212 LOG(info) <<
"Initializing Get4 monitor";
214 FairRootManager* ioman = FairRootManager::Instance();
216 LOG(fatal) <<
"No FairRootManager instance";
223 LOG(info) <<
"Setting parameter containers for " << GetName();
226 "CbmMcbm2018TofPar"));
230 LOG(info) <<
"Init parameter containers for " << GetName();
251 LOG(info) <<
"ReInit parameter containers for " << GetName();
281 LOG(info) <<
"GDPB Id of TOF " <<
i <<
" : " << std::hex
295 for (UInt_t uGbtx = 0; uGbtx <
fuNrOfGbtx; ++uGbtx) {
302 TString sPrintoutLine =
"Nr. of RPCs per GBTx: ";
303 for (UInt_t uGbtx = 0; uGbtx <
fuNrOfGbtx; ++uGbtx)
304 sPrintoutLine += Form(
" %2d",
fviNrOfRpc[uGbtx]);
305 LOG(info) << sPrintoutLine;
307 sPrintoutLine =
"RPC type per GBTx: ";
308 for (UInt_t uGbtx = 0; uGbtx <
fuNrOfGbtx; ++uGbtx)
309 sPrintoutLine += Form(
" %2d",
fviRpcType[uGbtx]);
310 LOG(info) << sPrintoutLine;
312 sPrintoutLine =
"RPC side per GBTx: ";
313 for (UInt_t uGbtx = 0; uGbtx <
fuNrOfGbtx; ++uGbtx)
314 sPrintoutLine += Form(
" %2d",
fviRpcSide[uGbtx]);
315 LOG(info) << sPrintoutLine;
317 sPrintoutLine =
"Module ID per GBTx: ";
318 for (UInt_t uGbtx = 0; uGbtx <
fuNrOfGbtx; ++uGbtx)
320 LOG(info) << sPrintoutLine;
327 LOG(info) <<
"Timeslice parameters: " <<
fuTotalMsNb
341 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
365 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
387 UInt_t uGet4topadi[32] = {4, 3, 2, 1,
388 8, 7, 6, 5, 12, 11, 10, 9, 16, 15,
389 14, 13, 20, 19, 18, 17, 24, 23, 22, 21,
390 28, 27, 26, 25, 32, 31, 30, 29};
393 UInt_t uPaditoget4[32] = {4, 3, 2, 1,
394 12, 11, 10, 9, 20, 19, 18, 17, 28, 27,
395 26, 25, 32, 31, 30, 29, 8, 7, 6, 5,
396 16, 15, 14, 13, 24, 23, 22, 21};
408 27, 2, 7, 3, 31, 26, 30, 1, 33, 37, 32, 13, 9, 14,
409 10, 15, 17, 21, 16, 35, 34, 38, 25, 24, 0, 6, 20, 23,
410 18, 22, 28, 4, 29, 5, 19, 36, 39, 8, 12, 11};
412 24, 7, 1, 3, 31, 33, 25, 2, 37, 12, 14, 39, 38, 11,
413 13, 15, 18, 16, 28, 34, 26, 17, 29, 27, 23, 22, 5, 0,
414 30, 32, 6, 4, 10, 8, 20, 19, 35, 9, 21, 36};
436 TString sMsSzName = Form(
"MsSz_link_%02lu", component);
438 Form(
"Size of MS from link %02lu; Ms Size [bytes]", component);
440 new TH1F(sMsSzName.Data(), sMsSzTitle.Data(), 160000, 0., 20000.);
442 sMsSzName = Form(
"MsSzTime_link_%02lu", component);
444 "Size of MS vs time for gDPB of link %02lu; Time[s] ; Ms Size [bytes]",
451 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
461 LOG(info) <<
"Added MS size histo for component (link): " << component;
472 LOG(info) <<
"create Histos for " <<
fuNrOfGdpbs <<
" gDPBs ";
474 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
486 Double_t dBinSzG4v2 = (6250. / 112.);
491 name =
"hMessageType";
492 title =
"Nb of message for each type; Type";
509 name =
"hSysMessType";
510 title =
"Nb of system message for each type; System Type";
518 "SYS_GET4_SYNC_MISS");
523 name =
"hGet4MessType";
524 title =
"Nb of message for each type per GET4; GET4 chip # ; Type";
534 name =
"hGet4ChanScm";
535 title =
"SC messages per GET4 channel; GET4 channel # ; SC type";
551 name =
"hGet4ChanErrors";
552 title =
"Error messages per GET4 channel; GET4 channel # ; Error";
573 12,
"0x0b: DLL Lock error ");
575 13,
"0x0c: DLL Reset invoc.");
580 17,
"0x14: Add. Rising edge");
582 18,
"0x15: Unpaired Falling");
584 19,
"0x16: Sequence error ");
589 name =
"hGet4EpochFlags";
590 title =
"Epoch flags per GET4; GET4 chip # ; Type";
599 name =
"hGdpbMessageType";
600 title =
"Nb of message for each type per Gdpb; Type; Gdpb Idx []";
624 name =
"hGdpbSysMessType";
626 "Nb of system message for each type per Gdpb; System Type; Gdpb Idx []";
640 "SYS_GET4_SYNC_MISS");
645 name =
"hGdpbSysMessPattType";
647 "Nb of pattern message for each type per Gdpb; Pattern Type; Gdpb Idx []";
664 name =
"hGdpbEpochFlags";
665 title =
"Epoch flags per gDPB; gDPB # ; Type";
674 name = Form(
"hGdpbEpochSyncEvo");
675 title = Form(
"Epoch SYNC per second and gDPB; Time[s]; gDPB #; SYNC Nb");
686 name = Form(
"hGdpbEpochMissEvo");
688 Form(
"Epoch Missmatch per second and gDPB; Time[s]; gDPB #; Missmatch Nb");
700 name =
"hScmScalerCounters";
702 "Content of Scaler counter SC messages; Scaler counter [hit]; Channel []";
712 name =
"hScmDeadtimeCounters";
713 title =
"Content of Deadtime counter SC messages; Deadtime [Clk Cycles]; "
724 name =
"hScmSeuCounters";
725 title =
"Content of SEU counter SC messages; SEU []; Channel []";
735 name =
"hScmSeuCountersEvo";
737 "SEU counter rate from SC messages; Time in Run [s]; Channel []; SEU []";
748 name =
"hPatternMissmatch";
749 title =
"Missmatch pattern integral per Gdpb; ASIC Pattern []; Gdpb Idx []";
758 name =
"hPatternEnable";
759 title =
"Enable pattern integral per Gdpb; ASIC Pattern []; Gdpb Idx []";
768 name =
"hPatternResync";
769 title =
"Resync pattern integral per Gdpb; ASIC Pattern []; Gdpb Idx []";
786 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
789 name = Form(
"hGdpbGet4MessType_%02u", uGdpb);
791 "Nb of message for each type per GET4 in gDPB %02u; GET4 chip # ; Type",
801 name = Form(
"hGdpbGet4ChanScm_%02u", uGdpb);
803 "SC messages per GET4 channel in gDPB %02u; GET4 channel # ; SC type",
820 name = Form(
"hGdpbGet4ChanErrors_%02u", uGdpb);
822 "Error messages per GET4 channel in gDPB %02u; GET4 channel # ; Error",
833 1,
"0x00: Readout Init ");
837 3,
"0x02: Epoch count sync");
841 5,
"0x04: FIFO Write ");
843 6,
"0x05: Lost event ");
845 7,
"0x06: Channel state ");
847 8,
"0x07: Token Ring state");
851 10,
"0x09: Error Readout ");
855 12,
"0x0b: DLL Lock error ");
857 13,
"0x0c: DLL Reset invoc.");
859 14,
"0x11: Overwrite ");
861 15,
"0x12: ToT out of range");
863 16,
"0x13: Event Discarded ");
865 17,
"0x14: Add. Rising edge");
867 18,
"0x15: Unpaired Falling");
869 19,
"0x16: Sequence error ");
871 20,
"0x17: Epoch Overflow ");
873 21,
"0x7f: Unknown ");
875 22,
"Corrupt/unsuprtd error");
878 name = Form(
"hGdpbPatternMissmatchEvo_%02u", uGdpb);
880 Form(
"Missmatch pattern vs TS index in gDPB %02u; TS # ; ASIC Pattern []",
891 name = Form(
"hGdpbPatternEnableEvo_%02u", uGdpb);
893 "Enable pattern vs TS index in gDPB %02u; TS # ; ASIC Pattern []", uGdpb);
903 name = Form(
"hGdpbPatternResyncEvo%02u", uGdpb);
905 "Resync pattern vs TS index in gDPB %02u; TS # ; ASIC Pattern []", uGdpb);
919 name = Form(
"hGdpbMissmatchEvoPerTs%02u", uGdpb);
921 Form(
"Missmatch vs TS index in gDPB %02u; TS # ; Asic []; Missmatch? []",
931 name = Form(
"hGdpbMissmatchEnaEvoPerTs%02u", uGdpb);
932 title = Form(
"Enable+Missmatch vs TS index in gDPB %02u; TS # ; Asic []; "
933 "Enabled & Missmatch? []",
944 name = Form(
"hGdpbEnableEvoPerTs%02u", uGdpb);
945 title = Form(
"Enable vs TS index in gDPB %02u; TS # ; Asic []; Enabled? []",
956 name = Form(
"hGdpbResyncEvoPerTs%02u", uGdpb);
957 title = Form(
"Resync vs TS index in gDPB %02u; TS # ; Asic []; Resync? []",
967 name = Form(
"hGdpbResyncEnaEvoPerTs%02u", uGdpb);
968 title = Form(
"Enable+Resync vs TS index in gDPB %02u; TS # ; Asic []; "
969 "Enabled & Resync? []",
980 name = Form(
"hGdpbStateEvoPerTs%02u", uGdpb);
981 title = Form(
"ASIC State vs TS index in gDPB %02u; TS # ; Asic []; 0 = "
982 "Off, 1 = OK, 2 = Miss, 3 = Resync, 4 = Miss + Resync []",
994 name = Form(
"RawFt_gDPB_%02u", uGdpb);
996 Form(
"Raw FineTime gDPB %02u Plot 0; channel; FineTime [bin]", uGdpb);
1007 name = Form(
"RawTot_gDPB_%02u", uGdpb);
1008 title = Form(
"Raw TOT gDPB %02u; channel; TOT [bin]", uGdpb);
1019 name = Form(
"ChCount_gDPB_%02u", uGdpb);
1020 title = Form(
"Channel counts gDPB %02u; channel; Hits", uGdpb);
1022 new TH1I(name.Data(),
1029 name = Form(
"ChRate_gDPB_%02u", uGdpb);
1030 title = Form(
"Channel rate gDPB %02u; Time in run [s]; channel; Rate [1/s]",
1033 new TH2D(name.Data(),
1043 name = Form(
"RemapTot_gDPB_%02u", uGdpb);
1044 title = Form(
"Raw TOT gDPB %02u remapped; PADI channel; TOT [bin]", uGdpb);
1055 name = Form(
"RemapChCount_gDPB_%02u", uGdpb);
1057 Form(
"Channel counts gDPB %02u remapped; PADI channel; Hits", uGdpb);
1059 new TH1I(name.Data(),
1066 name = Form(
"RemapChRate_gDPB_%02u", uGdpb);
1068 "PADI channel rate gDPB %02u; Time in run [s]; PADI channel; Rate [1/s]",
1071 new TH2D(name.Data(),
1082 name = Form(
"FeeRate_gDPB_g%02u_f%1u", uGdpb, uFee);
1084 Form(
"Counts per second in Fee %1u of gDPB %02u; Time[s] ; Counts",
1090 name = Form(
"FeeErrorRate_gDPB_g%02u_f%1u", uGdpb, uFee);
1091 title = Form(
"Error Counts per second in Fee %1u of gDPB %02u; Time[s] ; "
1098 name = Form(
"FeeErrorRatio_gDPB_g%02u_f%1u", uGdpb, uFee);
1099 title = Form(
"Error to data ratio per second in Fee %1u of gDPB %02u; "
1100 "Time[s] ; Error ratio[]",
1106 name = Form(
"FeeRateLong_gDPB_g%02u_f%1u", uGdpb, uFee);
1108 Form(
"Counts per minutes in Fee %1u of gDPB %02u; Time[min] ; Counts",
1117 name = Form(
"FeeErrorRateLong_gDPB_g%02u_f%1u", uGdpb, uFee);
1118 title = Form(
"Error Counts per minutes in Fee %1u of gDPB %02u; "
1119 "Time[min] ; Error Counts",
1128 name = Form(
"FeeErrorRatioLong_gDPB_g%02u_f%1u", uGdpb, uFee);
1129 title = Form(
"Error to data ratio per minutes in Fee %1u of gDPB %02u; "
1130 "Time[min] ; Error ratio[]",
1142 new TH2D(Form(
"hHitsPerMsFirstChan_gDPB%02u", uGdpb),
1143 Form(
"Hit Counts per MS in first channel in gDPB %02u; TS []; "
1144 "Hits/MS []; MS nb[]",
1153 new TProfile2D(Form(
"hChannelRatePerMs_gDPB%02u", uGdpb),
1154 Form(
"Mean Hit count per MS and channel vs Time in gDPB "
1155 "%02u; TS []; Channel []; <Hits/Ms> []",
1165 name = Form(
"hTokenMsgType_gDPB_%02u", uGdpb);
1167 title = Form(
"STAR trigger Messages type gDPB %02u; Type ; Counts", uGdpb);
1177 name = Form(
"hTriggerRate_gDPB_%02u", uGdpb);
1178 title = Form(
"STAR trigger signals per second gDPB %02u; Time[s] ; Counts",
1184 name = Form(
"hCmdDaqVsTrig_gDPB_%02u", uGdpb);
1186 Form(
"STAR daq command VS STAR trigger command gDPB %02u; DAQ ; TRIGGER",
1188 fvhCmdDaqVsTrig.push_back(
new TH2I(name, title, 16, 0, 16, 16, 0, 16));
1190 1,
"0x0: no-trig ");
1194 3,
"0x2: mast-rst");
1198 5,
"0x4: trigg. 0");
1247 name = Form(
"hStarTokenEvo_gDPB_%02u", uGdpb);
1248 title = Form(
"STAR token value VS time gDPB %02u; Time in Run [s] ; STAR "
1255 name = Form(
"hStarTrigGdpbTsEvo_gDPB_%02u", uGdpb);
1257 "gDPB TS in STAR triger tokens for gDPB %02u; Time in Run [s] ; gDPB TS;",
1262 name = Form(
"hStarTrigStarTsEvo_gDPB_%02u", uGdpb);
1264 "STAR TS in STAR triger tokens for gDPB %02u; Time in Run [s] ; STAR TS;",
1308 if (uFeeA < uFeeB) {
1314 new TH1I(Form(
"hTimeDiffPulser_g%02u_f%1u_g%02u_f%1u",
1319 Form(
"Time difference for pulser on gDPB %02u FEE %1u and "
1320 "gDPB %02u FEE %1u; DeltaT [ps]; Counts",
1334 name =
"hTimeMeanPulser";
1337 "Time difference Mean for each FEE pairs; FEE A; FEE B ; Mean [ps]",
1345 name =
"hTimeRmsPulser";
1348 "Time difference RMS for each FEE pairs; FEE A; FEE B ; RMS [ps]",
1356 name =
"hTimeRmsZoomFitPuls";
1358 "Time difference RMS after zoom for each "
1359 "FEE pairs; FEE A; FEE B ; RMS [ps]",
1367 name =
"hTimeResFitPuls";
1369 "Time difference Res from fit for each FEE "
1370 "pairs; FEE A; FEE B ; Sigma [ps]",
1380 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
1383 Form(
"hPulserTimeDiffEvoGdpb%02uGbtx00Gbtx%02u", uGdpb, uGbtx + 1);
1387 Form(
"Time difference of the 1st FEE in the 1st GBTx of gDPB %02u "
1388 "vs GBTx %02u; time in run [min]; dt [ps]",
1397 for (UInt_t uGdpbB = uGdpb + 1; uGdpbB <
fuNrOfGdpbs; ++uGdpbB) {
1398 name = Form(
"hPulserTimeDiffEvoGdpb%02uGdpb%02u", uGdpb, uGdpbB);
1400 new TProfile(name.Data(),
1401 Form(
"Time difference of the 1st FEE in the 1st GBTx of "
1402 "gDPB %02u vs %02u; time in run [min]; dt [ps]",
1414 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
1415 name = Form(
"hCoincMapAllChanGdpb%02u", uGdpb);
1417 new TH2D(name.Data(),
1418 Form(
"Coincidence map of all channels of gDPB %02u; Chan A "
1419 "[]; Chan B[]; Coinc. []",
1428 name = Form(
"hCoincMeanAllChanGdpb%02u", uGdpb);
1430 new TProfile2D(name.Data(),
1431 Form(
"Coincidence mean of all channels of gDPB %02u; "
1432 "Chan A []; Chan B[]; Mean dt [ps]",
1467 for (UInt_t uTotPlot = 0; uTotPlot <
fvhRawTot_gDPB.size(); ++uTotPlot)
1482 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
1505 server->Register(
"/TofRates",
1507 server->Register(
"/TofRates",
1511 server->Register(
"/TofRates",
1543 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
1553 for (UInt_t uGdpbB = uGdpb + 1; uGdpbB <
fuNrOfGdpbs; ++uGdpbB)
1555 server->Register(
"/TofDtEvo",
1560 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
1566 server->RegisterCommand(
"/Reset_All_eTOF",
"bMcbmMoniTofResetHistos=kTRUE");
1567 server->RegisterCommand(
"/Save_All_eTof",
"bMcbmMoniTofSaveHistos=kTRUE");
1568 server->RegisterCommand(
"/Update_PulsFit",
1569 "bMcbmMoniTofUpdateZoomedFit=kTRUE");
1570 server->RegisterCommand(
"/Print_Raw_Data",
1571 "bMcbmMoniTofRawDataPrint=kTRUE");
1572 server->RegisterCommand(
"/Print_AllHits",
1573 "bMcbmMoniTofPrintAllHitsEna=kTRUE");
1574 server->RegisterCommand(
"/Print_AllEps",
1575 "bMcbmMoniTofPrintAllEpochsEna=kTRUE");
1577 server->Restrict(
"/Reset_All_eTof",
"allow=admin");
1578 server->Restrict(
"/Save_All_eTof",
"allow=admin");
1579 server->Restrict(
"/Update_PulsFit",
"allow=admin");
1580 server->Restrict(
"/Print_Raw_Data",
"allow=admin");
1581 server->Restrict(
"/Print_AllHits",
"allow=admin");
1582 server->Restrict(
"/Print_AllEps",
"allow=admin");
1588 fcSummary =
new TCanvas(
"cSummary",
"gDPB Monitoring Summary");
1616 server->Register(
"/canvases",
fcSummary);
1620 fcSummaryGdpb =
new TCanvas(
"cSummaryGdpb",
"gDPB Monitoring Summary");
1646 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
1647 TCanvas* cSumGdpbGet4 =
1648 new TCanvas(Form(
"cSumGdpbGet4_g%02u", uGdpb),
1649 Form(
"Summary per GET4 or channel for gDPB %02u", uGdpb),
1652 cSumGdpbGet4->Divide(2, 2);
1654 cSumGdpbGet4->cd(1);
1658 cSumGdpbGet4->cd(2);
1662 cSumGdpbGet4->cd(3);
1666 server->Register(
"/canvases", cSumGdpbGet4);
1671 TCanvas* cFeeRates =
1672 new TCanvas(
"cFeeRates",
"gDPB Monitoring FEE rates", w,
h);
1675 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
1686 server->Register(
"/canvases", cFeeRates);
1690 TCanvas* cFeeErrRatio =
1691 new TCanvas(
"cFeeErrRatio",
"gDPB Monitoring FEE error ratios", w,
h);
1694 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
1702 server->Register(
"/canvases", cFeeErrRatio);
1707 TCanvas* cFeeRatesLong =
1708 new TCanvas(
"cFeeRatesLong",
"gDPB Monitoring FEE rates", w,
h);
1711 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
1724 server->Register(
"/canvases", cFeeRatesLong);
1728 TCanvas* cFeeErrRatioLong =
1729 new TCanvas(
"cFeeErrRatioLong",
"gDPB Monitoring FEE error ratios", w,
h);
1732 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
1741 server->Register(
"/canvases", cFeeErrRatioLong);
1746 new TCanvas(
"cGdpbChannelCount",
"Integrated Get4 channel counts per gDPB");
1748 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
1761 new TCanvas(
"cGdpbRemapChCount",
"Integrated PADI channel counts per gDPB");
1763 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
1776 new TCanvas(
"cGdpbChannelRate",
"Get4 channel rate per gDPB");
1778 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
1791 new TCanvas(
"cGdpbRemapChRate",
"PADI channel rate per gDPB");
1793 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
1805 TCanvas* cTotPnt = NULL;
1806 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
1807 cTotPnt =
new TCanvas(Form(
"cTot_g%02u", uGdpb),
1808 Form(
"gDPB %02u TOT distributions", uGdpb),
1819 server->Register(
"/canvases", cTotPnt);
1822 cTotPnt =
new TCanvas(
"cTot_all",
"TOT distributions", w,
h);
1824 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
1825 cTotPnt->cd(1 + uGdpb);
1833 server->Register(
"/canvases", cTotPnt);
1838 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
1839 cTotPnt =
new TCanvas(Form(
"cTotRemap_g%02u", uGdpb),
1840 Form(
"PADI ch gDPB %02u TOT distributions", uGdpb),
1851 server->Register(
"/canvases", cTotPnt);
1853 cTotPnt =
new TCanvas(
"cTotRemap_all",
"TOT distributions", w,
h);
1855 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
1856 cTotPnt->cd(1 + uGdpb);
1864 server->Register(
"/canvases", cTotPnt);
1896 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; uGdpb++) {
1897 TCanvas* cStarToken =
1898 new TCanvas(Form(
"cStarToken_g%02u", uGdpb),
1899 Form(
"STAR token detection info for gDPB %02u", uGdpb),
1902 cStarToken->Divide(2, 2);
1922 TCanvas* cPulser =
new TCanvas(
1924 "Time difference RMS for pulser channels when FEE pulser mode is ON",
1927 cPulser->Divide(2, 2);
1949 server->Register(
"/canvases", cPulser);
1953 TCanvas* cPulserEvo =
new TCanvas(
1955 "Time difference evolution between 1st FEE of 1st GBTx of gDPB pairs",
1959 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs - 1; uGdpb++) {
1960 cPulserEvo->cd(1 + uGdpb);
1968 server->Register(
"/canvases", cPulserEvo);
1971 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; uGdpb++) {
1972 TCanvas* cPulserEvoGbtx =
1973 new TCanvas(Form(
"cPulserEvoGbtx%02u", uGdpb),
1974 Form(
"Time difference evolution between 1st FEE of GBTx "
1975 "pairs in gDPB %02u",
1982 cPulserEvoGbtx->cd(1 + uGbtx);
1993 server->Register(
"/canvases", cPulserEvoGbtx);
2020 fcMsSizeAll =
dynamic_cast<TCanvas*
>(gROOT->FindObject(
"cMsSizeAll"));
2023 new TCanvas(
"cMsSizeAll",
"Evolution of MS size in last 300 s", w,
h);
2025 LOG(info) <<
"Created MS size canvas in TOF monitor";
2028 LOG(info) <<
"Recovered MS size canvas in TOF monitor";
2032 LOG(info) <<
"Leaving CreateHistograms";
2038 LOG(info) <<
"Reset eTOF STAR histos ";
2043 LOG(info) <<
"Start saving eTOF STAR histos ";
2083 LOG(debug1) <<
"Timeslice contains " << ts.num_microslices(component)
2087 if (0 == ts.index())
return kTRUE;
2093 Int_t messageType = -111;
2094 Double_t dTsStartTime = -1;
2097 for (UInt_t uMsIdx = 0; uMsIdx < uNbMsLoop; uMsIdx++) {
2106 auto msDescriptor = ts.descriptor(uMsComp, uMsIdx);
2123 constexpr uint32_t kuBytesPerMessage = 8;
2126 auto msDescriptor = ts.descriptor(uMsComp, uMsIdx);
2128 fdMsIndex =
static_cast<double>(msDescriptor.idx);
2130 const uint8_t* msContent =
2131 reinterpret_cast<const uint8_t*
>(ts.content(uMsComp, uMsIdx));
2133 uint32_t size = msDescriptor.size;
2136 LOG(debug) <<
"Microslice: " << msDescriptor.idx
2137 <<
" has size: " << size;
2145 if (0 == uMsIdx && 0 == uMsCompIdx) dTsStartTime = (1e-9) *
fdMsIndex;
2158 if (0 != (size % kuBytesPerMessage))
2159 LOG(error) <<
"The input microslice buffer does NOT "
2160 <<
"contain only complete nDPB messages!";
2163 uint32_t uNbMessages =
2164 (size - (size % kuBytesPerMessage)) / kuBytesPerMessage;
2173 <<
"---------------------------------------------------------------";
2184 LOG(error) <<
"Could not find the gDPB index for AFCK id 0x" << std::hex
2185 <<
fuGdpbId << std::dec <<
" in timeslice "
2187 <<
" component " << uMsCompIdx <<
"\n"
2188 <<
"If valid this index has to be added in the TOF "
2189 "parameter file in the RocIdArray field";
2196 const uint64_t* pInBuff =
reinterpret_cast<const uint64_t*
>(msContent);
2197 for (uint32_t uIdx = 0; uIdx < uNbMessages; uIdx++) {
2199 uint64_t ulData =
static_cast<uint64_t
>(pInBuff[uIdx]);
2210 || gLogger->IsLogNeeded(fair::Severity::debug2)) {
2231 LOG(warning) <<
"Message with Get4 ID too high: " <<
fuGet4Id
2234 switch (messageType) {
2281 LOG(info) <<
"Epoch: " << Form(
"0x%08x ",
fuGdpbId) <<
", Merg"
2283 <<
", epoch " << std::setw(8)
2286 <<
", Data loss " << std::setw(1)
2289 <<
", Epoch miss " << std::setw(1)
2299 LOG(info) <<
"Epoch: " << Form(
"0x%08x ",
fuGdpbId) <<
", "
2300 << std::setw(4) <<
fuGet4Nr <<
", Link "
2302 <<
", epoch " << std::setw(8)
2305 <<
", Data loss " << std::setw(1)
2308 <<
", Epoch miss " << std::setw(1)
2474 LOG(error) <<
"Message type " << std::hex << std::setw(2)
2475 <<
static_cast<uint16_t
>(messageType)
2476 <<
" not included in Get4 unpacker.";
2499 Double_t dTimeDiff =
2541 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
2555 Double_t dTimeDiff = 1e3
2574 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
2586 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb)
2653 || gLogger->IsLogNeeded(fair::Severity::debug2)) {
2655 <<
"CbmMcbm2018MonitorTof::ProcessEpochCyle => "
2688 if (0 < ulCurEpochGdpbGet4)
2689 ulCurEpochGdpbGet4--;
2694 UInt_t uChannelNrInFee =
2698 UInt_t uRemappedChannelNr =
2702 uRemappedChannelNr = uChannelNr;
2844 && 0 == uChannelNrInFee) {
2860 uRemappedChannelNr);
2880 LOG(info) <<
"Hit: " << Form(
"0x%08x ",
fuGdpbId) <<
", " << std::setw(2)
2881 <<
fuGet4Nr <<
", " << std::setw(3) << uChannel <<
", "
2882 << std::setw(3) << uTot <<
", epoch " << std::setw(3)
2883 << ulCurEpochGdpbGet4 <<
", FullTime Clk "
2884 << Form(
"%12lu ", ulHitTime) <<
", FullTime s "
2885 << Form(
"%12.9f ", dHitTime / 1e9) <<
", FineTime " << uFts;
2914 if (0 < iBufferSize) {
2915 LOG(debug) <<
"Now processing stored messages for for get4 " <<
fuGet4Nr
2923 for (Int_t iMsgIdx = 0; iMsgIdx < iBufferSize; iMsgIdx++) {
3028 dMessTime -
fdStartTime * 1.e-9, uData, dFullChId);
3041 uint64_t uData = mess.
getData();
3043 LOG(debug) <<
"Get4 MSG type " << mType <<
" from gdpbId " <<
fuGdpbId
3044 <<
", getId " <<
fuGet4Id <<
", (hit channel) " << channel
3045 <<
" data " << std::hex << uData;
3050 LOG(debug) <<
"GET4 System message, epoch "
3052 << std::setprecision(9) << std::fixed
3054 <<
" for board ID " << std::hex << std::setw(4) <<
fuGdpbId
3066 LOG(debug) <<
" +++++++ > gDPB: " << std::hex << std::setw(4)
3067 <<
fuGdpbId << std::dec <<
", Chip = " << std::setw(2)
3072 << std::setw(2) << uData << std::dec
3073 <<
" -- GET4 V1 Error Event";
3075 LOG(debug) <<
" +++++++ >gDPB: " << std::hex << std::setw(4) <<
fuGdpbId
3076 << std::dec <<
", Chip = " << std::setw(2)
3081 << std::setw(2) << uData << std::dec
3082 <<
" -- GET4 V1 Error Event ";
3086 LOG(debug) <<
"Unknown GET4 message, data: " << std::hex << std::setw(8)
3088 <<
" Full message: " << std::hex << std::setw(16)
3089 << mess.
getData() << std::dec;
3094 LOG(info) << Form(
"GET4 Resynchronization: Get4:0x%04x ",
3096 << std::hex << std::setw(4) <<
fuGdpbId << std::dec;
3098 LOG(info) <<
"GET4 synchronization pulse missing in gDPB " << std::hex
3099 << std::setw(4) <<
fuGdpbId << std::dec;
3103 LOG(debug) <<
"ASIC pattern for missmatch, disable or resync";
3107 LOG(debug) <<
"Crazy system message, subtype "
3123 "Missmatch pattern message => Type %d, Index %2d, Pattern 0x%08X",
3127 for (UInt_t uBit = 0; uBit < 32; ++uBit) {
3131 uBadAsic = 32 * usIndex + uBit;
3133 if ((uPattern >> uBit) & 0x1) {
3146 for (UInt_t uBit = 0; uBit < 32; ++uBit) {
3150 uAsic = 32 * usIndex + uBit;
3152 if ((uPattern >> uBit) & 0x1) {
3165 "RESYNC pattern message => Type %d, Index %2d, Pattern 0x%08X",
3170 for (UInt_t uBit = 0; uBit < 32; ++uBit) {
3174 uBadAsic = 32 * usIndex + uBit;
3176 if ((uPattern >> uBit) & 0x1) {
3188 LOG(debug) <<
"Crazy pattern message, subtype " << usType;
3199 switch (iMsgIndex) {
3216 ULong64_t ulNewGdpbTsFull =
3233 LOG(warning) <<
"Possible error: identical STAR tokens found twice in "
3234 "a row => ignore 2nd! "
3241 << Form(
"TRG Wrd = %5x ", uTrigWord);
3258 LOG(debug) <<
"Probable reset of the STAR TS: old = "
3260 <<
" new = " << Form(
"%16llu", ulNewStarTsFull)
3319 default: LOG(error) <<
"Unknown Star Trigger messageindex: " << iMsgIndex;
3327 TString message_type;
3330 case 0: message_type =
"NOP";
break;
3331 case 1: message_type =
"HIT";
break;
3332 case 2: message_type =
"EPOCH";
break;
3333 case 3: message_type =
"SYNC";
break;
3334 case 4: message_type =
"AUX";
break;
3335 case 5: message_type =
"EPOCH2";
break;
3336 case 6: message_type =
"GET4";
break;
3337 case 7: message_type =
"SYS";
break;
3338 case 8: message_type =
"GET4_SLC";
break;
3339 case 9: message_type =
"GET4_32B";
break;
3340 case 10: message_type =
"GET4_SYS";
break;
3341 default: message_type =
"UNKNOWN";
break;
3346 LOG(info) <<
"-------------------------------------";
3349 LOG(info) <<
"Last epoch for gDPB: " << std::hex << std::setw(4) <<
i
3350 << std::dec <<
" , GET4 " << std::setw(4) << j <<
" => "
3354 LOG(info) <<
"-------------------------------------";
3380 TDirectory* oldDir = NULL;
3381 TFile* histoFile = NULL;
3382 if (
"" != sFileName) {
3384 oldDir = gDirectory;
3386 histoFile =
new TFile(sFileName,
"RECREATE");
3390 gDirectory->mkdir(
"Tof_Raw_gDPB");
3391 gDirectory->cd(
"Tof_Raw_gDPB");
3416 for (UInt_t uTotPlot = 0; uTotPlot <
fvhRawTot_gDPB.size(); ++uTotPlot)
3432 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
3463 gDirectory->cd(
"..");
3465 gDirectory->mkdir(
"Tof_Chan_FineCount");
3466 gDirectory->cd(
"Tof_Chan_FineCount");
3467 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
3471 gDirectory->cd(
"..");
3473 gDirectory->mkdir(
"Tof_Ena");
3474 gDirectory->cd(
"Tof_Ena");
3475 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
3483 gDirectory->cd(
"..");
3486 gDirectory->mkdir(
"Star_Raw");
3487 gDirectory->cd(
"Star_Raw");
3488 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
3496 gDirectory->cd(
"..");
3500 gDirectory->mkdir(
"TofDt");
3501 gDirectory->cd(
"TofDt");
3506 gDirectory->cd(
"..");
3509 gDirectory->mkdir(
"TofDtEvo");
3510 gDirectory->cd(
"TofDtEvo");
3511 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
3516 for (UInt_t uGdpbB = uGdpb + 1; uGdpbB <
fuNrOfGdpbs; ++uGdpbB)
3519 gDirectory->cd(
"..");
3524 gDirectory->mkdir(
"TofCoinc");
3525 gDirectory->cd(
"TofCoinc");
3526 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
3530 gDirectory->cd(
"..");
3533 gDirectory->mkdir(
"Flib_Raw");
3534 gDirectory->cd(
"Flib_Raw");
3535 for (UInt_t uLinks = 0; uLinks <
fvhMsSzPerLink.size(); uLinks++) {
3542 TH1* pMissedTsH1 =
dynamic_cast<TH1*
>(gROOT->FindObjectAny(
"Missed_TS"));
3543 if (NULL != pMissedTsH1) pMissedTsH1->Write();
3545 TProfile* pMissedTsEvoP =
3546 dynamic_cast<TProfile*
>(gROOT->FindObjectAny(
"Missed_TS_Evo"));
3547 if (NULL != pMissedTsEvoP) pMissedTsEvoP->Write();
3549 gDirectory->cd(
"..");
3551 gDirectory->mkdir(
"canvases");
3552 gDirectory->cd(
"canvases");
3559 gDirectory->cd(
"..");
3562 if (
"" != sFileName) {
3567 if (
"" != sFileName) {
3575 LOG(info) <<
"Reseting all TOF histograms.";
3600 for (UInt_t uTotPlot = 0; uTotPlot <
fvhRawTot_gDPB.size(); ++uTotPlot)
3616 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
3642 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
3648 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
3669 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
3674 for (UInt_t uGdpbB = uGdpb + 1; uGdpbB <
fuNrOfGdpbs; ++uGdpbB)
3681 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
3687 for (UInt_t uLinks = 0; uLinks <
fvhMsSzPerLink.size(); uLinks++) {
3699 for (UInt_t uGdpbLoop = 0; uGdpbLoop <
fuNrOfGdpbs; ++uGdpbLoop) {
3723 for (UInt_t uGdpbLoop = 0; uGdpbLoop <
fuNrOfGdpbs; uGdpbLoop++) {
3738 LOG(error) <<
"CbmMcbm2018MonitorTof::UpdateZoomedFit => "
3739 <<
"Pulser mode not enabled in root macro, doinb nothing !!! ";
3761 <<
"CbmMcbm2018MonitorTof::UpdateZoomedFit => Empty input "
3762 <<
"for FEE pair " << uFeeA <<
" and " << uFeeB <<
" !!! ";
3779 if ((dZoomCounts / dNbCounts) < 0.99) {
3783 <<
"CbmMcbm2018MonitorTof::UpdateZoomedFit => Zoom too strong, "
3784 <<
"more than 1% loss for FEE pair " << uFeeA <<
" and " << uFeeB
3796 fitFuncPairs[uFeeA][uFeeB] =
3797 new TF1(Form(
"fPair_%02d_%02d", uFeeA, uFeeB),
3802 fitFuncPairs[uFeeA][uFeeB]->SetParameter(0, dZoomCounts);
3803 fitFuncPairs[uFeeA][uFeeB]->SetParameter(1, dPeakPos);
3804 fitFuncPairs[uFeeA][uFeeB]->SetParameter(
3808 Form(
"fPair_%02d_%02d", uFeeA, uFeeB),
"QRM0");
3810 dRes = fitFuncPairs[uFeeA][uFeeB]->GetParameter(2);
3812 delete fitFuncPairs[uFeeA][uFeeB];
3817 LOG(info) <<
"CbmMcbm2018MonitorTof::UpdateZoomedFit => "
3818 <<
"For FEE pair " << uFeeA <<
" and " << uFeeB
3819 <<
" we have zoomed RMS = "
3821 <<
" and a resolution of " << dRes / TMath::Sqrt2();
3829 <<
"CbmMcbm2018MonitorTof::UpdateZoomedFit => Zoom width not defined, "
3830 <<
"please use SetFitZoomWidthPs, e.g. in macro, before trying this "