18 #include "FairLogger.h"
19 #include "FairRootManager.h"
21 #include "FairRunOnline.h"
22 #include "FairRuntimeDb.h"
25 #include "TClonesArray.h"
26 #include "THttpServer.h"
49 , fvMsComponentsList()
54 fbIgnoreOverlapMs(kFALSE)
55 , fUnpackParMuch(NULL)
71 fsHistoFileFullname(
"data/SetupHistos.root")
72 , fbPrintMessages(kFALSE)
74 , fbEnableCoincidenceMaps(kFALSE)
78 , fuCurrentEquipmentId(0)
81 , fiRunStartDateTimeSec(-1)
82 , fiBinSizeDatePlots(-1)
84 , fvuCurrentTsMsbCycle()
85 , fvuInitialHeaderDone()
86 , fvuInitialTsMsbCycleHeader()
88 , fvulChanLastHitTime()
89 , fvdChanLastHitTime()
93 , fvdChanLastHitTimeInMs()
94 , fvusChanLastHitAdcInMs()
99 , fdStartTimeMsSz(-1.0)
100 , ftStartTimeUnix(std::chrono::steady_clock::now())
104 , fuMaxNbMicroslices(100)
105 , fiTimeIntervalRateUpdate(10)
106 , fviFebTimeSecLastRateUpdate()
107 , fviFebCountsSinceLastRateUpdate()
108 , fvdFebChanCountsSinceLastRateUpdate()
109 , fbLongHistoEnable(kFALSE)
110 , fuLongHistoNbSeconds(0)
111 , fuLongHistoBinSizeSec(0)
112 , fuLongHistoBinNb(0)
116 , fdCoincBorder(50.0)
117 , fdCoincMin(fdCoincCenter - fdCoincBorder)
118 , fdCoincMax(fdCoincCenter + fdCoincBorder)
120 , fhStsMessType(NULL)
121 , fhStsSysMessType(NULL)
122 , fhStsFebChanAdcRaw_combined(NULL)
123 , fhStsMessTypePerDpb(NULL)
124 , fhStsSysMessTypePerDpb(NULL)
125 , fhPulserStatusMessType(NULL)
126 , fhPulserMsStatusFieldType(NULL)
127 , fhStsHitsElinkPerDpb(NULL)
131 , fRealHistPadDistr()
132 , fdFebChanCoincidenceLimit(100.0)
133 , fhStsFebChanCntRaw()
134 , fhStsFebChanCntRawGood()
135 , fhStsFebChanAdcRaw()
136 , fhStsFebChanAdcRawProf()
137 , fhStsFebChanAdcCal()
138 , fhStsFebChanAdcCalProf()
139 , fhStsFebChanRawTs()
140 , fhStsFebChanMissEvt()
141 , fhStsFebChanMissEvtEvo()
142 , fhStsFebAsicMissEvtEvo()
143 , fhStsFebMissEvtEvo()
144 , fhStsFebChanHitRateEvo()
145 , fhStsFebChanHitRateProf()
146 , fhStsFebAsicHitRateEvo()
147 , fhStsFebHitRateEvo()
148 , fhStsFebHitRateEvo_mskch()
149 , fhStsFebHitRateEvo_mskch_adccut()
150 , fhStsFebChanHitRateEvoLong()
151 , fhStsFebAsicHitRateEvoLong()
152 , fhStsFebHitRateEvoLong()
153 , fdStsFebChanLastTimeForDist()
154 , fhStsFebChanDistT()
155 , fhStsFebChanDtCoinc()
156 , fhStsFebChanCoinc()
157 , fbSmx2ErrorUseNoiseLevels(kFALSE)
158 , fdSmxErrCoincWinM07(kdSmxErrCoincWinMainM07)
159 , fdSmxErrCoincWinM08(kdSmxErrCoincWinMainM08)
160 , fdSmxErrCoincWinM09(kdSmxErrCoincWinMainM09)
161 , fdSmxErrCoincWinM10(kdSmxErrCoincWinMainM10)
162 , fdSmxErrCoincWinM11(kdSmxErrCoincWinMainM11)
163 , fvdSmxErrTimeLastHits()
164 , fvuSmxErrIdxFirstHitM07()
165 , fvuSmxErrIdxFirstHitM08()
166 , fvuSmxErrIdxFirstHitM09()
167 , fvuSmxErrIdxFirstHitM10()
168 , fvuSmxErrIdxFirstHitM11()
169 , fvuSmxErrIdxLastHit()
170 , fhStsFebSmxErrRatioEvo()
171 , fhStsFebSmxErrRatioEvoAsic()
172 , fhStsFebSmxErrRatioCopyEvo()
173 , fhStsFebSmxErrRatioCopyEvoAsic()
174 , fhStsFebSmxErrRatioCopySameAdcEvo()
175 , fhStsFebSmxErrRatioCopySameAdcEvoAsic()
176 , fcMsSizeAll(NULL) {}
181 LOG(info) <<
"Initializing flib StsXyter unpacker for STS";
183 FairRootManager* ioman = FairRootManager::Instance();
184 if (ioman == NULL) { LOG(fatal) <<
"No FairRootManager instance"; }
190 LOG(info) <<
"Setting parameter containers for " << GetName();
193 "CbmMcbm2018MuchPar"));
198 LOG(info) <<
"Init parameter containers for " << GetName();
207 LOG(info) <<
"ReInit parameter containers for " << GetName();
215 LOG(info) <<
"Nr. of MUCH DPBs: " <<
fuNrOfDpbs;
218 for (UInt_t uDpb = 0; uDpb <
fuNrOfDpbs; ++uDpb) {
220 LOG(info) <<
"Eq. ID for DPB #" << std::setw(2) << uDpb <<
" = 0x"
222 << std::dec <<
" => "
227 LOG(info) <<
"Nr. of FEBs: " <<
fuNbFebs;
235 for (UInt_t uDpb = 0; uDpb <
fuNrOfDpbs; ++uDpb) {
250 for (UInt_t uDpb = 0; uDpb <
fuNrOfDpbs; ++uDpb) {
253 LOG(info) << Form(
"DPB #%02u CROB #%02u Active: ", uDpb, uCrobIdx)
264 for (UInt_t uDpb = 0; uDpb <
fuNrOfDpbs; ++uDpb) {
281 for (UInt_t uXyterIdx = 0; uXyterIdx <
fuNbStsXyters; ++uXyterIdx) {
307 LOG(info) <<
"CbmMcbm2018MonitorMuch::ReInitContainers => Changed "
308 "fvuChanNbHitsInMs size "
310 LOG(info) <<
"CbmMcbm2018MonitorMuch::ReInitContainers => Changed "
311 "fvuChanNbHitsInMs size "
314 LOG(info) <<
"CbmMcbm2018MonitorMuch::ReInitContainers => Changed "
315 "fvuChanNbHitsInMs size "
323 for (UInt_t uFebIdx = 0; uFebIdx <
fuNbFebs; ++uFebIdx) {
346 LOG(error) <<
"CbmMcbm2018MonitorMuch::AddMsComponentToList => "
347 <<
"Ignored the addition of component " << component
348 <<
" as it is above the hadcoded limit of "
351 <<
" To change this behavior check kiMaxNbFlibLinks in "
352 "CbmMcbm2018MonitorMuch.cxx";
360 <<
"CbmMcbm2018MonitorMuch::AddMsComponentToList => Added component: "
364 if (NULL ==
fhMsSz[component]) {
365 TString sMsSzName = Form(
"MsSz_link_%02lu", component);
367 Form(
"Size of MS for nDPB of link %02lu; Ms Size [bytes]", component);
369 new TH1F(sMsSzName.Data(), sMsSzTitle.Data(), 160000, 0., 20000.);
372 sMsSzName = Form(
"MsSzTime_link_%02lu", component);
374 "Size of MS vs time for gDPB of link %02lu; Time[s] ; Ms Size [bytes]",
377 new TProfile(sMsSzName.Data(), sMsSzTitle.Data(), 15000, 0., 300.);
385 LOG(info) <<
"Added MS size histo for component: " << component <<
" (DPB)";
387 #ifdef USE_HTTP_SERVER
388 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
390 server->Register(
"/FlibRaw",
fhMsSz[component]);
391 server->Register(
"/FlibRaw",
fhMsSzTime[component]);
397 size_t uOverlapMsNb) {
410 for (UInt_t uXyterIdx = 0; uXyterIdx <
fuNbStsXyters; ++uXyterIdx) {
429 <<
"CbmMcbm2018MonitorMuch::DoUnpack => Changed fvuChanNbHitsInMs size "
432 <<
"CbmMcbm2018MonitorMuch::DoUnpack => Changed fvuChanNbHitsInMs size "
436 <<
"CbmMcbm2018MonitorMuch::DoUnpack => Changed fvuChanNbHitsInMs size "
442 Double_t dBorderVal) {
450 TString sHistName {
""};
453 sHistName =
"hPulserMessageType";
454 title =
"Nb of message for each type; Type";
471 sHistName =
"hPulserSysMessType";
472 title =
"Nb of system message for each type; System Type";
479 sHistName =
"hStsFebChanAdcRaw_combined";
480 title =
"ADC hist combined";
487 LOG(debug) <<
"Initialized 1st Histo";
488 sHistName =
"hPulserMessageTypePerDpb";
489 title =
"Nb of message of each type for each DPB; DPB; Type";
507 for (UInt_t uModuleId = 0; uModuleId < 2; ++uModuleId) {
509 sHistName = Form(
"HistPadDistr_Module_%01u", uModuleId);
510 title = Form(
"Pad distribution for, Module #%01u; ", uModuleId);
514 new TH2I(sHistName, title, 23, -0.5, 22.5, 97, -0.5, 96.5));
516 sHistName = Form(
"RealHistPadDistr_Module_%01u", uModuleId);
517 title = Form(
"Progressive Pad distribution for, Module #%01u; ", uModuleId);
520 new TH2D(sHistName, title, 500, -0.5, 499.5, 1000, -0.5, 999.5));
524 title =
"Rate in kHz";
525 fhRate =
new TH1I(sHistName, title, 10000, -0.5, 9999.5);
527 sHistName =
"hRateAdcCut";
528 title =
"Rate in kHz with Adc cut";
529 fhRateAdcCut =
new TH1I(sHistName, title, 10000, -0.5, 9999.5);
531 sHistName =
"hPulserSysMessTypePerDpb";
532 title =
"Nb of system message of each type for each DPB; DPB; System Type";
541 sHistName =
"hPulserStatusMessType";
542 title =
"Nb of status message of each type for each DPB; ASIC; Status Type";
552 sHistName =
"hPulserMsStatusFieldType";
554 "For each flag in the MS header, ON/OFF counts; Flag bit []; ON/OFF; MS []";
556 new TH2I(sHistName, title, 16, -0.5, 15.5, 2, -0.5, 1.5);
564 sHistName =
"hStsHitsElinkPerDpb";
565 title =
"Nb of hit messages per eLink for each DPB; DPB; eLink; Hits nb []";
569 LOG(debug) <<
"Initialized 2nd Histo";
606 LOG(debug) <<
"Initialized 3rd Histo";
610 UInt_t uAlignedLimit = 0;
625 for (UInt_t uFebIdx = 0; uFebIdx <
fuNbFebs; ++uFebIdx) {
627 sHistName = Form(
"hStsFebChanCntRaw_%03u", uFebIdx);
629 Form(
"Hits Count per channel, FEB #%03u; Channel; Hits []", uFebIdx);
637 sHistName = Form(
"hStsFebChanCntRawGood_%03u", uFebIdx);
638 title = Form(
"Hits Count per channel in good MS (SX2 bug flag off), FEB "
639 "#%03u; Channel; Hits []",
649 sHistName = Form(
"hStsFebChanAdcRaw_%03u", uFebIdx);
650 title = Form(
"Raw Adc distribution per channel, FEB #%03u; Channel []; Adc "
664 sHistName = Form(
"hStsFebChanAdcRawProfc_%03u", uFebIdx);
665 title = Form(
"Raw Adc prodile per channel, FEB #%03u; Channel []; Adc []",
668 new TProfile(sHistName,
675 sHistName = Form(
"hStsFebChanAdcCal_%03u", uFebIdx);
676 title = Form(
"Cal. Adc distribution per channel, FEB #%03u; Channel []; "
690 sHistName = Form(
"hStsFebChanAdcCalProfc_%03u", uFebIdx);
692 "Cal. Adc prodile per channel, FEB #%03u; Channel []; Adc [e-]", uFebIdx);
694 new TProfile(sHistName,
701 sHistName = Form(
"hStsFebChanRawTs_%03u", uFebIdx);
702 title = Form(
"Raw Timestamp distribution per channel, FEB #%03u; Channel "
703 "[]; Ts []; Hits []",
716 sHistName = Form(
"hStsFebChanMissEvt_%03u", uFebIdx);
717 title = Form(
"Missed Event flags per channel, FEB #%03u; Channel []; Miss "
731 sHistName = Form(
"hStsFebChanMissEvtEvo_%03u", uFebIdx);
732 title = Form(
"Missed Evt flags per second & channel in FEB #%03u; Time "
733 "[s]; Channel []; Missed Evt flags []",
746 sHistName = Form(
"hStsFebAsicMissEvtEvo_%03u", uFebIdx);
747 title = Form(
"Missed Evt flags per second & StsXyter in FEB #%03u; Time "
748 "[s]; Asic []; Missed Evt flags []",
761 sHistName = Form(
"hStsFebMissEvtEvo_%03u", uFebIdx);
762 title = Form(
"Missed Evt flags per second & channel in FEB #%03u; Time "
763 "[s]; Missed Evt flags []",
768 sHistName = Form(
"hStsFebChanRateEvo_%03u", uFebIdx);
770 "Hits per second & channel in FEB #%03u; Time [s]; Channel []; Hits []",
783 sHistName = Form(
"hStsFebChanRateProf_%03u", uFebIdx);
785 "Hits per second for each channel in FEB #%03u; Channel []; Hits/s []",
788 new TProfile(sHistName,
795 sHistName = Form(
"hStsFebAsicRateEvo_%03u", uFebIdx);
797 "Hits per second & StsXyter in FEB #%03u; Time [s]; Asic []; Hits []",
815 sHistName = Form(
"hStsFebRateEvo_%03u", uFebIdx);
816 title = Form(
"Hits per second in FEB #%03u; Time [s]; Hits []", uFebIdx);
819 new TH1I(sHistName, title, 250000, 0., 1000000.));
830 sHistName = Form(
"hStsFebRateEvo_mskch_%03u", uFebIdx);
831 title = Form(
"Hits per second in FEB #%03u; Time [s]; Hits []", uFebIdx);
833 new TH1I(sHistName, title, 1800, 0, 1800));
836 sHistName = Form(
"hStsFebRateEvo_mskch_adcut_%03u", uFebIdx);
837 title = Form(
"Hits per second in FEB #%03u; Time [s]; Hits []", uFebIdx);
839 new TH1I(sHistName, title, 1800, 0, 1800));
842 sHistName = Form(
"hStsFebChanRateEvoLong_%03u", uFebIdx);
844 "Hits per second & channel in FEB #%03u; Time [min]; Channel []; Hits []",
857 sHistName = Form(
"hStsFebAsicRateEvoLong_%03u", uFebIdx);
859 "Hits per second & StsXyter in FEB #%03u; Time [min]; Asic []; Hits []",
872 sHistName = Form(
"hStsFebRateEvoLong_%03u", uFebIdx);
873 title = Form(
"Hits per second in FEB #%03u; Time [min]; Hits []", uFebIdx);
878 sHistName = Form(
"hStsFebChanDistT_%03u", uFebIdx);
879 title = Form(
"Time distance between hits on same channel in between FEB "
880 "#%03u; Time difference [ns]; Channel []; ",
895 for (UInt_t uFebIdxB = uFebIdx; uFebIdxB <
fuNbFebs; ++uFebIdxB) {
896 sHistName = Form(
"hStsFebChanDtCoinc_%03u_%03u", uFebIdx, uFebIdxB);
897 title = Form(
"Channel coincidences Time diff between FEB #%03u and FEB "
898 "#%03u; Time difference [ns]",
902 new TH1I(sHistName, title, 400, -1250., 1250.);
904 sHistName = Form(
"hStsFebChanCoinc_%03u_%03u", uFebIdx, uFebIdxB);
905 title = Form(
"Channel coincidences between FEB #%03u and FEB #%03u; "
906 "Channel FEB #%03u []; Channel FEB #%03u []; Coinc. []",
926 LOG(debug) <<
"Initialized 4th Histo before SXM 2.0 Logic Error";
929 for (UInt_t uFebIdx = 0; uFebIdx <
fuNbFebs; ++uFebIdx) {
931 sHistName = Form(
"hStsFebSmxErrRatioEvo_%03u", uFebIdx);
932 title = Form(
"Proportion of uS with SMX logic error in FEB #%03u; Time "
933 "[s]; Error MS fract. []",
936 new TProfile(sHistName, title, 1800, 0, 1800));
939 sHistName = Form(
"hStsFebSmxErrRatioEvoAsic_%03u", uFebIdx);
940 title = Form(
"Proportion of uS with SMX logic error per ASIC in FEB #%03u; "
941 "Time [s]; ASIC []; Error MS fract. []",
944 new TProfile2D(sHistName,
954 sHistName = Form(
"hStsFebSmxErrRatioCopyEvo_%03u", uFebIdx);
955 title = Form(
"Proportion of uS with hit copies in FEB #%03u; Time [s]; "
956 "Copies MS fract. []",
959 new TProfile(sHistName, title, 1800, 0, 1800));
962 sHistName = Form(
"hStsFebSmxErrRatioCopyEvoAsic_%03u", uFebIdx);
963 title = Form(
"Proportion of uS with hit copies per ASIC in FEB #%03u; Time "
964 "[s]; ASIC []; Copies MS fract. []",
967 new TProfile2D(sHistName,
977 sHistName = Form(
"hStsFebSmxErrRatioCopySameAdcEvo_%03u", uFebIdx);
978 title = Form(
"Proportion of uS with hit full copies in FEB #%03u; Time "
979 "[s]; Copies MS fract. []",
982 new TProfile(sHistName, title, 1800, 0, 1800));
985 sHistName = Form(
"hStsFebSmxErrRatioCopySameAdcEvoAsic_%03u", uFebIdx);
986 title = Form(
"Proportion of uS with hit full copies per ASIC in FEB #%03u; "
987 "Time [s]; ASIC []; Copies MS fract. []",
990 new TProfile2D(sHistName,
1004 fhMsSz[component] = NULL;
1008 LOG(debug) <<
"Initialized 6th Histo before FairRunOnlne Instance";
1011 #ifdef USE_HTTP_SERVER
1012 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
1014 for (UInt_t uModuleId = 0; uModuleId < 2; ++uModuleId) {
1019 server->Register(
"/StsRaw",
fhRate);
1031 for (UInt_t uFebIdx = 0; uFebIdx <
fuNbFebs; ++uFebIdx) {
1054 for (UInt_t uFebIdxB = uFebIdx; uFebIdxB <
fuNbFebs; ++uFebIdxB) {
1063 server->Register(
"/StsSmxErr",
1065 server->Register(
"/StsSmxErr",
1070 server->RegisterCommand(
"/Reset_All",
"bMcbm2018ResetMuch=kTRUE");
1071 server->RegisterCommand(
"/Write_All",
"bMcbm2018WriteMuch=kTRUE");
1072 server->RegisterCommand(
"/ScanNoisyCh",
"bMcbm2018ScanNoisyMuch=kTRUE");
1075 server->Restrict(
"/Reset_All",
"allow=admin");
1076 server->Restrict(
"/Write_All",
"allow=admin");
1077 server->Restrict(
"/ScanNoisyCh",
"allow=admin");
1084 LOG(debug) <<
"Initialized 7th Histo before Summary per FEB";
1086 for (UInt_t uFebIdx = 0; uFebIdx <
fuNbFebs; ++uFebIdx) {
1089 new TCanvas(Form(
"cStsSum_%03u", uFebIdx),
1090 Form(
"Summary plots for FEB %03u", uFebIdx),
1093 cStsSumm->Divide(2, 3);
1132 TCanvas* cStsSmxErr =
1133 new TCanvas(Form(
"cStsSmxErr_%03u", uFebIdx),
1134 Form(
"SMX logic error plots for FEB %03u", uFebIdx),
1137 cStsSmxErr->Divide(2, 3);
1178 LOG(debug) <<
"Initialized Last Histo before exiting CreateHistograms";
1183 fcMsSizeAll =
dynamic_cast<TCanvas*
>(gROOT->FindObject(
"cMsSizeAll"));
1186 new TCanvas(
"cMsSizeAll",
"Evolution of MS size in last 300 s", w,
h);
1188 LOG(info) <<
"Created MS size canvas in STS monitor";
1191 LOG(info) <<
"Recovered MS size canvas in STS monitor";
1212 LOG(debug) <<
"Timeslice contains " << ts.num_microslices(component)
1222 for (UInt_t uMsIdx = 0; uMsIdx < uNbMsLoop; uMsIdx++) {
1232 if (kFALSE ==
ProcessStsMs(ts, uMsComp, uMsIdx))
return kFALSE;
1243 std::vector<stsxyter::FinalHit>::iterator itA;
1244 std::vector<stsxyter::FinalHit>::iterator itB;
1253 UShort_t usAsicIdx = (*itA).GetAsic();
1282 bHitCopyInThisMs[uAsic] = kFALSE;
1283 bHitCopySameAdcInThisMs[uAsic] = kFALSE;
1284 bFlagOnInThisMs[uAsic] = kFALSE;
1301 UShort_t usChanIdx = (*itA).GetChan();
1302 ULong64_t ulHitTs = (*itA).GetTs();
1303 UShort_t usHitAdc = (*itA).GetAdc();
1310 Bool_t bIsNotCopy = kTRUE;
1311 if (vulLastHitTs[usChanIdx] == ulHitTs) {
1312 bIsNotCopy = kFALSE;
1313 bHitCopyInThisMs[uAsic] = kTRUE;
1314 if (vusLastHitAdc[usChanIdx] == usHitAdc)
1315 bHitCopySameAdcInThisMs[uAsic] = kTRUE;
1318 vulLastHitTs[usChanIdx] = ulHitTs;
1319 vusLastHitAdc[usChanIdx] = usHitAdc;
1334 std::vector<Bool_t> vbCopyOnAnyAsicMs(
fuNbFebs, kFALSE);
1335 std::vector<Bool_t> vbCopySameAdcOnAnyAsicMs(
fuNbFebs, kFALSE);
1336 std::vector<Bool_t> vbFlagOnAnyAsicMs(
fuNbFebs, kFALSE);
1337 Bool_t bCopyOnAnyMs = kFALSE;
1338 Bool_t bCopySameAdcOnAnyMs = kFALSE;
1339 Bool_t bFlagOnAnyMs = kFALSE;
1347 bHitCopyInThisMs[uAsic] ? 1.0 : 0.0);
1352 bHitCopySameAdcInThisMs[uAsic] ? 1.0 : 0.0);
1356 bFlagOnInThisMs[uAsic] ? 1.0
1359 vbCopyOnAnyAsicMs[uFebIdx] =
1360 vbCopyOnAnyAsicMs[uFebIdx] || bHitCopyInThisMs[uAsic];
1361 vbCopySameAdcOnAnyAsicMs[uFebIdx] =
1362 vbCopySameAdcOnAnyAsicMs[uFebIdx] || bHitCopySameAdcInThisMs[uAsic];
1363 vbFlagOnAnyAsicMs[uFebIdx] =
1364 vbFlagOnAnyAsicMs[uFebIdx] || bFlagOnInThisMs[uAsic];
1366 bCopyOnAnyMs |= bHitCopyInThisMs[uAsic];
1367 bCopySameAdcOnAnyMs |= bHitCopySameAdcInThisMs[uAsic];
1368 bFlagOnAnyMs |= bFlagOnInThisMs[uAsic];
1371 for (UInt_t uFebIdx = 0; uFebIdx <
fuNbFebs; ++uFebIdx) {
1376 vbCopySameAdcOnAnyAsicMs[uFebIdx] ? 1.0 : 0.0);
1382 for (UInt_t uFebIdx = 0; uFebIdx <
fuNbFebs; ++uFebIdx) {
1391 UShort_t usAsicIdxA = (*itA).GetAsic();
1392 UShort_t usAsicInFebA =
1394 UShort_t usChanIdxA = (*itA).GetChan();
1395 UInt_t uChanInFebA =
1397 ULong64_t ulHitTsA = (*itA).GetTs();
1408 for (UInt_t uFebIdxB = uFebIdx; uFebIdxB <
fuNbFebs; ++uFebIdxB) {
1412 std::vector<stsxyter::FinalHit>::iterator itBestMatch;
1423 UShort_t usAsicIdxB = (*itB).GetAsic();
1424 UShort_t usChanIdxB = (*itB).GetChan();
1425 UInt_t uChanInFebB =
1430 if (uFebIdx == uFebIdxB && uChanInFebA == uChanInFebB)
continue;
1432 ULong64_t ulHitTsB = (*itB).GetTs();
1434 Double_t dDtClk =
static_cast<Double_t
>(ulHitTsB)
1435 -
static_cast<Double_t
>(ulHitTsA);
1464 if (0 == ts.index() % 1000) {
1465 for (UInt_t uDpb = 0; uDpb <
fuNrOfDpbs; ++uDpb) {
1466 Double_t dTsMsbTime =
1473 LOG(info) <<
"End of TS " << std::setw(7) << ts.index() <<
" eDPB "
1474 << std::setw(2) << uDpb <<
" current TS MSB counter is "
1476 <<
" current TS MSB cycle counter is " << std::setw(12)
1478 << std::setw(12) << dTsMsbTime <<
" s";
1491 auto msDescriptor = ts.descriptor(uMsComp, uMsIdx);
1494 const uint8_t* msContent =
1495 reinterpret_cast<const uint8_t*
>(ts.content(uMsComp, uMsIdx));
1497 uint32_t uSize = msDescriptor.size;
1500 LOG(debug) <<
"Microslice: " <<
fulCurrentMsIdx <<
" from EqId " << std::hex
1509 fhMsSz[uMsComp]->Fill(uSize);
1515 <
static_cast<Int_t
>(dMsTime)) {
1520 UInt_t uFebIdxInSyst = uFebIdxOffset + uFebIdx;
1525 static_cast<Int_t
>(dMsTime);
1533 Int_t iTimeInt =
static_cast<Int_t
>(dMsTime)
1539 static_cast<Int_t
>(dMsTime);
1553 static_cast<Int_t
>(dMsTime);
1563 uint16_t uMsHeaderFlags = msDescriptor.flags;
1564 for (UInt_t uBit = 0; uBit < 16; ++uBit)
1568 UInt_t uTsMsbCycleHeader =
1591 LOG(error) <<
"The input microslice buffer does NOT "
1592 <<
"contain only complete nDPB messages!";
1595 uint32_t uNbMessages =
1599 const uint32_t* pInBuff =
reinterpret_cast<const uint32_t*
>(msContent);
1601 for (uint32_t uIdx = 0; uIdx < uNbMessages; ++uIdx) {
1603 uint32_t ulData =
static_cast<uint32_t
>(pInBuff[uIdx]);
1628 if (kTRUE ==
fbMuchMode) uFebIdx = usElinkIdx;
1630 if (-1 == uFebIdx) {
1631 LOG(warning) <<
"CbmMcbm2018MonitorMuch::DoUnpack => "
1632 <<
"Wrong elink Idx! Elink raw "
1633 << Form(
"%d remap %d", usElinkIdx, uFebIdx);
1654 LOG(info) <<
"CbmMcbm2018MonitorMuch::DoUnpack => "
1655 <<
"EPOCH message at unexpected position in MS: message "
1656 << uIdx <<
" VS message 0 expected!";
1673 std::cout << Form(
"DPB %2u TS %12llu MS %12llu mess %5u ",
1691 LOG(fatal) <<
"CbmMcbm2018MonitorMuch::DoUnpack => "
1692 <<
"Unknown message type, should never happen, stopping "
1693 "here! Type found was: "
1694 <<
static_cast<int>(typeMess);
1703 const UShort_t& usElinkIdx,
1704 const UInt_t& uAsicIdx,
1705 const UInt_t& uMsIdx) {
1728 UInt_t uChanInFeb = usChan
1773 Long64_t dHitTimeNs =
1814 if (constime < 1000000) {
1827 Double_t dTimeSinceStartSec =
1831 Double_t dTimeSinceStartMin = dTimeSinceStartSec / 60.0;
1847 dTimeSinceStartMin, uChanInFeb, 1.0 / 60.0);
1849 dTimeSinceStartMin, uAsicInFeb, 1.0 / 60.0);
1933 LOG(info) <<
"-------------------------------------";
1934 LOG(info) <<
"CbmMcbm2018MonitorMuch statistics are ";
1943 <<
" Empty messages: "
1946 LOG(info) <<
"-------------------------------------";
1954 TDirectory* oldDir = NULL;
1955 TFile* histoFile = NULL;
1956 if (
"" != sFileName) {
1958 oldDir = gDirectory;
1960 histoFile =
new TFile(sFileName,
"RECREATE");
1965 gDirectory->mkdir(
"Sts_Raw");
1966 gDirectory->cd(
"Sts_Raw");
1968 for (UInt_t uModuleId = 0; uModuleId < 2; ++uModuleId) {
1982 gDirectory->cd(
"..");
1986 gDirectory->mkdir(
"Sts_Feb");
1987 gDirectory->cd(
"Sts_Feb");
1988 for (UInt_t uFebIdx = 0; uFebIdx <
fuNbFebs; ++uFebIdx) {
2011 for (UInt_t uFebIdxB = uFebIdx; uFebIdxB <
fuNbFebs; ++uFebIdxB) {
2017 gDirectory->cd(
"..");
2022 gDirectory->mkdir(
"Sts_SmxErr");
2023 gDirectory->cd(
"Sts_SmxErr");
2024 for (UInt_t uFebIdx = 0; uFebIdx <
fuNbFebs; ++uFebIdx) {
2034 gDirectory->cd(
"..");
2039 gDirectory->mkdir(
"Flib_Raw");
2040 gDirectory->cd(
"Flib_Raw");
2042 TString sMsSzName = Form(
"MsSz_link_%02u", uLinks);
2043 if (
fHM->
Exists(sMsSzName.Data()))
fHM->
H1(sMsSzName.Data())->Write();
2045 sMsSzName = Form(
"MsSzTime_link_%02u", uLinks);
2046 if (
fHM->
Exists(sMsSzName.Data()))
fHM->
P1(sMsSzName.Data())->Write();
2049 TH1* pMissedTsH1 =
dynamic_cast<TH1*
>(gROOT->FindObjectAny(
"Missed_TS"));
2050 if (NULL != pMissedTsH1) pMissedTsH1->Write();
2052 TProfile* pMissedTsEvoP =
2053 dynamic_cast<TProfile*
>(gROOT->FindObjectAny(
"Missed_TS_Evo"));
2054 if (NULL != pMissedTsEvoP) pMissedTsEvoP->Write();
2056 gDirectory->cd(
"..");
2059 if (
"" != sFileName) {
2066 LOG(info) <<
"Reseting all STS histograms.";
2068 for (UInt_t uModuleId = 0; uModuleId < 2; ++uModuleId) {
2084 for (UInt_t uFebIdx = 0; uFebIdx <
fuNbFebs; ++uFebIdx) {
2107 for (UInt_t uFebIdxB = uFebIdx; uFebIdxB <
fuNbFebs; ++uFebIdxB) {
2124 TString sMsSzName = Form(
"MsSz_link_%02u", uLinks);
2125 if (
fHM->
Exists(sMsSzName.Data()))
fHM->
H1(sMsSzName.Data())->Reset();
2127 sMsSzName = Form(
"MsSzTime_link_%02u", uLinks);
2128 if (
fHM->
Exists(sMsSzName.Data()))
fHM->
P1(sMsSzName.Data())->Reset();
2138 TDatime* fRunStartDateTime =
new TDatime(dateIn, timeIn);
2142 LOG(info) <<
"Assigned new MUCH Run Start Date-Time: "
2143 << fRunStartDateTime->AsString();
2172 for (UInt_t uFebIdx = 0; uFebIdx <
fuNbFebs; ++uFebIdx) {
2197 Double_t dNewHitTime) {
2250 Double_t dTimeDiff07 =
2255 Double_t dTimeDiff08 =
2260 Double_t dTimeDiff09 =
2265 Double_t dTimeDiff10 =
2270 Double_t dTimeDiff11 =
2295 for (UInt_t uFebIdx = 0; uFebIdx <
fuNbFebs; ++uFebIdx) {
2298 " ------------------ Noisy channels scan for FEB %2d ------------",
2309 "Noisy Channel ASIC %d channel %3d (%4d) level %6.0f",
2318 <<
" ---------------------------------------------------------------";