22#include "FairRootManager.h"
24#include "FairRunOnline.h"
25#include "FairRuntimeDb.h"
29#include "TClonesArray.h"
30#include "THttpServer.h"
54 , fvMsComponentsList()
59 fbIgnoreOverlapMs(kFALSE)
60 , fUnpackParMuch(NULL)
76 fsHistoFileFullname(
"data/SetupHistos.root")
77 , fbPrintMessages(kFALSE)
78 , fPrintMessCtrl(
stsxyter::MessagePrintMask::msg_print_Human)
79 , fbEnableCoincidenceMaps(kFALSE)
83 , fuCurrentEquipmentId(0)
86 , fiRunStartDateTimeSec(-1)
87 , fiBinSizeDatePlots(-1)
89 , fvuCurrentTsMsbCycle()
90 , fvuInitialHeaderDone()
91 , fvuInitialTsMsbCycleHeader()
93 , fvulChanLastHitTime()
94 , fvdChanLastHitTime()
98 , fvdChanLastHitTimeInMs()
99 , fvusChanLastHitAdcInMs()
104 , fdStartTimeMsSz(-1.0)
105 , ftStartTimeUnix(
std::chrono::steady_clock::now())
109 , fuMaxNbMicroslices(100)
110 , fiTimeIntervalRateUpdate(10)
111 , fviFebTimeSecLastRateUpdate()
112 , fviFebCountsSinceLastRateUpdate()
113 , fvdFebChanCountsSinceLastRateUpdate()
114 , fbLongHistoEnable(kFALSE)
115 , fuLongHistoNbSeconds(0)
116 , fuLongHistoBinSizeSec(0)
117 , fuLongHistoBinNb(0)
121 , fdCoincBorder(50.0)
122 , fdCoincMin(fdCoincCenter - fdCoincBorder)
123 , fdCoincMax(fdCoincCenter + fdCoincBorder)
125 , fhStsMessType(NULL)
126 , fhStsSysMessType(NULL)
127 , fhStsFebChanAdcRaw_combined(NULL)
128 , fhStsMessTypePerDpb(NULL)
129 , fhStsSysMessTypePerDpb(NULL)
130 , fhPulserStatusMessType(NULL)
131 , fhPulserMsStatusFieldType(NULL)
132 , fhStsHitsElinkPerDpb(NULL)
136 , fRealHistPadDistr()
137 , fdFebChanCoincidenceLimit(100.0)
138 , fhStsFebChanCntRaw()
139 , fhStsFebChanCntRawGood()
140 , fhStsFebChanAdcRaw()
141 , fhStsFebChanAdcRawProf()
142 , fhStsFebChanAdcCal()
143 , fhStsFebChanAdcCalProf()
144 , fhStsFebChanRawTs()
145 , fhStsFebChanMissEvt()
146 , fhStsFebChanMissEvtEvo()
147 , fhStsFebAsicMissEvtEvo()
148 , fhStsFebMissEvtEvo()
149 , fhStsFebChanHitRateEvo()
150 , fhStsFebChanHitRateProf()
151 , fhStsFebAsicHitRateEvo()
152 , fhStsFebHitRateEvo()
153 , fhStsFebHitRateEvo_mskch()
154 , fhStsFebHitRateEvo_mskch_adccut()
155 , fhStsFebChanHitRateEvoLong()
156 , fhStsFebAsicHitRateEvoLong()
157 , fhStsFebHitRateEvoLong()
158 , fdStsFebChanLastTimeForDist()
159 , fhStsFebChanDistT()
160 , fhStsFebChanDtCoinc()
161 , fhStsFebChanCoinc()
162 , fbSmx2ErrorUseNoiseLevels(kFALSE)
163 , fdSmxErrCoincWinM07(kdSmxErrCoincWinMainM07)
164 , fdSmxErrCoincWinM08(kdSmxErrCoincWinMainM08)
165 , fdSmxErrCoincWinM09(kdSmxErrCoincWinMainM09)
166 , fdSmxErrCoincWinM10(kdSmxErrCoincWinMainM10)
167 , fdSmxErrCoincWinM11(kdSmxErrCoincWinMainM11)
168 , fvdSmxErrTimeLastHits()
169 , fvuSmxErrIdxFirstHitM07()
170 , fvuSmxErrIdxFirstHitM08()
171 , fvuSmxErrIdxFirstHitM09()
172 , fvuSmxErrIdxFirstHitM10()
173 , fvuSmxErrIdxFirstHitM11()
174 , fvuSmxErrIdxLastHit()
175 , fhStsFebSmxErrRatioEvo()
176 , fhStsFebSmxErrRatioEvoAsic()
177 , fhStsFebSmxErrRatioCopyEvo()
178 , fhStsFebSmxErrRatioCopyEvoAsic()
179 , fhStsFebSmxErrRatioCopySameAdcEvo()
180 , fhStsFebSmxErrRatioCopySameAdcEvoAsic()
189 LOG(info) <<
"Initializing flib StsXyter unpacker for STS";
191 FairRootManager* ioman = FairRootManager::Instance();
192 if (ioman == NULL) { LOG(fatal) <<
"No FairRootManager instance"; }
199 LOG(info) <<
"Setting parameter containers for " << GetName();
206 LOG(info) <<
"Init parameter containers for " << GetName();
216 LOG(info) <<
"ReInit parameter containers for " << GetName();
225 LOG(info) <<
"Nr. of MUCH DPBs: " <<
fuNrOfDpbs;
228 for (UInt_t uDpb = 0; uDpb <
fuNrOfDpbs; ++uDpb) {
230 LOG(info) <<
"Eq. ID for DPB #" << std::setw(2) << uDpb <<
" = 0x" << std::setw(4) << std::hex
235 LOG(info) <<
"Nr. of FEBs: " <<
fuNbFebs;
243 for (UInt_t uDpb = 0; uDpb <
fuNrOfDpbs; ++uDpb) {
254 for (UInt_t uDpb = 0; uDpb <
fuNrOfDpbs; ++uDpb) {
256 LOG(info) << Form(
"DPB #%02u CROB #%02u Active: ", uDpb, uCrobIdx) <<
fvbCrobActiveFlag[uDpb][uCrobIdx];
266 for (UInt_t uDpb = 0; uDpb <
fuNrOfDpbs; ++uDpb) {
283 for (UInt_t uXyterIdx = 0; uXyterIdx <
fuNbStsXyters; ++uXyterIdx) {
306 LOG(info) <<
"CbmMcbm2018MonitorMuch::ReInitContainers => Changed "
307 "fvuChanNbHitsInMs size "
309 LOG(info) <<
"CbmMcbm2018MonitorMuch::ReInitContainers => Changed "
310 "fvuChanNbHitsInMs size "
312 LOG(info) <<
"CbmMcbm2018MonitorMuch::ReInitContainers => Changed "
313 "fvuChanNbHitsInMs size "
321 for (UInt_t uFebIdx = 0; uFebIdx <
fuNbFebs; ++uFebIdx) {
342 LOG(error) <<
"CbmMcbm2018MonitorMuch::AddMsComponentToList => "
343 <<
"Ignored the addition of component " << component <<
" as it is above the hadcoded limit of "
346 <<
" To change this behavior check kiMaxNbFlibLinks in "
347 "CbmMcbm2018MonitorMuch.cxx";
354 LOG(info) <<
"CbmMcbm2018MonitorMuch::AddMsComponentToList => Added component: " << component;
357 if (NULL ==
fhMsSz[component]) {
358 TString sMsSzName = Form(
"MsSz_link_%02lu", component);
359 TString sMsSzTitle = Form(
"Size of MS for nDPB of link %02lu; Ms Size [bytes]", component);
360 fhMsSz[component] =
new TH1F(sMsSzName.Data(), sMsSzTitle.Data(), 160000, 0., 20000.);
363 sMsSzName = Form(
"MsSzTime_link_%02lu", component);
364 sMsSzTitle = Form(
"Size of MS vs time for gDPB of link %02lu; Time[s] ; Ms Size [bytes]", component);
365 fhMsSzTime[component] =
new TProfile(sMsSzName.Data(), sMsSzTitle.Data(), 15000, 0., 300.);
373 LOG(info) <<
"Added MS size histo for component: " << component <<
" (DPB)";
375#ifdef USE_HTTP_SERVER
376 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
378 server->Register(
"/FlibRaw",
fhMsSz[component]);
379 server->Register(
"/FlibRaw",
fhMsSzTime[component]);
398 for (UInt_t uXyterIdx = 0; uXyterIdx <
fuNbStsXyters; ++uXyterIdx) {
413 LOG(info) <<
"CbmMcbm2018MonitorMuch::DoUnpack => Changed fvuChanNbHitsInMs size " <<
fvuChanNbHitsInMs.size()
415 LOG(info) <<
"CbmMcbm2018MonitorMuch::DoUnpack => Changed fvuChanNbHitsInMs size " <<
fvuChanNbHitsInMs[0].size()
417 LOG(info) <<
"CbmMcbm2018MonitorMuch::DoUnpack => Changed fvuChanNbHitsInMs size "
432 TString sHistName {
""};
435 sHistName =
"hPulserMessageType";
436 title =
"Nb of message for each type; Type";
453 sHistName =
"hPulserSysMessType";
454 title =
"Nb of system message for each type; System Type";
461 sHistName =
"hStsFebChanAdcRaw_combined";
462 title =
"ADC hist combined";
466 LOG(debug) <<
"Initialized 1st Histo";
467 sHistName =
"hPulserMessageTypePerDpb";
468 title =
"Nb of message of each type for each DPB; DPB; Type";
485 for (UInt_t uModuleId = 0; uModuleId < 2; ++uModuleId) {
487 sHistName = Form(
"HistPadDistr_Module_%01u", uModuleId);
488 title = Form(
"Pad distribution for, Module #%01u; ", uModuleId);
491 fHistPadDistr.push_back(
new TH2I(sHistName, title, 23, -0.5, 22.5, 97, -0.5, 96.5));
493 sHistName = Form(
"RealHistPadDistr_Module_%01u", uModuleId);
494 title = Form(
"Progressive Pad distribution for, Module #%01u; ", uModuleId);
496 fRealHistPadDistr.push_back(
new TH2D(sHistName, title, 500, -0.5, 499.5, 1000, -0.5, 999.5));
500 title =
"Rate in kHz";
501 fhRate =
new TH1I(sHistName, title, 10000, -0.5, 9999.5);
503 sHistName =
"hRateAdcCut";
504 title =
"Rate in kHz with Adc cut";
505 fhRateAdcCut =
new TH1I(sHistName, title, 10000, -0.5, 9999.5);
507 sHistName =
"hPulserSysMessTypePerDpb";
508 title =
"Nb of system message of each type for each DPB; DPB; System Type";
516 sHistName =
"hPulserStatusMessType";
517 title =
"Nb of status message of each type for each DPB; ASIC; Status Type";
526 sHistName =
"hPulserMsStatusFieldType";
527 title =
"For each flag in the MS header, ON/OFF counts; Flag bit []; ON/OFF; MS []";
536 sHistName =
"hStsHitsElinkPerDpb";
537 title =
"Nb of hit messages per eLink for each DPB; DPB; eLink; Hits nb []";
540 LOG(debug) <<
"Initialized 2nd Histo";
577 LOG(debug) <<
"Initialized 3rd Histo";
581 UInt_t uAlignedLimit = 0;
596 for (UInt_t uFebIdx = 0; uFebIdx <
fuNbFebs; ++uFebIdx) {
598 sHistName = Form(
"hStsFebChanCntRaw_%03u", uFebIdx);
599 title = Form(
"Hits Count per channel, FEB #%03u; Channel; Hits []", uFebIdx);
603 sHistName = Form(
"hStsFebChanCntRawGood_%03u", uFebIdx);
604 title = Form(
"Hits Count per channel in good MS (SX2 bug flag off), FEB "
605 "#%03u; Channel; Hits []",
611 sHistName = Form(
"hStsFebChanAdcRaw_%03u", uFebIdx);
612 title = Form(
"Raw Adc distribution per channel, FEB #%03u; Channel []; Adc "
620 sHistName = Form(
"hStsFebChanAdcRawProfc_%03u", uFebIdx);
621 title = Form(
"Raw Adc prodile per channel, FEB #%03u; Channel []; Adc []", uFebIdx);
626 sHistName = Form(
"hStsFebChanAdcCal_%03u", uFebIdx);
627 title = Form(
"Cal. Adc distribution per channel, FEB #%03u; Channel []; "
634 sHistName = Form(
"hStsFebChanAdcCalProfc_%03u", uFebIdx);
635 title = Form(
"Cal. Adc prodile per channel, FEB #%03u; Channel []; Adc [e-]", uFebIdx);
640 sHistName = Form(
"hStsFebChanRawTs_%03u", uFebIdx);
641 title = Form(
"Raw Timestamp distribution per channel, FEB #%03u; Channel "
642 "[]; Ts []; Hits []",
649 sHistName = Form(
"hStsFebChanMissEvt_%03u", uFebIdx);
650 title = Form(
"Missed Event flags per channel, FEB #%03u; Channel []; Miss "
657 sHistName = Form(
"hStsFebChanMissEvtEvo_%03u", uFebIdx);
658 title = Form(
"Missed Evt flags per second & channel in FEB #%03u; Time "
659 "[s]; Channel []; Missed Evt flags []",
665 sHistName = Form(
"hStsFebAsicMissEvtEvo_%03u", uFebIdx);
666 title = Form(
"Missed Evt flags per second & StsXyter in FEB #%03u; Time "
667 "[s]; Asic []; Missed Evt flags []",
673 sHistName = Form(
"hStsFebMissEvtEvo_%03u", uFebIdx);
674 title = Form(
"Missed Evt flags per second & channel in FEB #%03u; Time "
675 "[s]; Missed Evt flags []",
680 sHistName = Form(
"hStsFebChanRateEvo_%03u", uFebIdx);
681 title = Form(
"Hits per second & channel in FEB #%03u; Time [s]; Channel []; Hits []", uFebIdx);
686 sHistName = Form(
"hStsFebChanRateProf_%03u", uFebIdx);
687 title = Form(
"Hits per second for each channel in FEB #%03u; Channel []; Hits/s []", uFebIdx);
692 sHistName = Form(
"hStsFebAsicRateEvo_%03u", uFebIdx);
693 title = Form(
"Hits per second & StsXyter in FEB #%03u; Time [s]; Asic []; Hits []", uFebIdx);
698 sHistName = Form( "hStsFebRateEvo_%03u", uFebIdx );
699 title = Form( "Hits per second in FEB #%03u; Time [s]; Hits []", uFebIdx );
700 fhStsFebHitRateEvo.push_back( new TH1I(sHistName, title, 1800, 0, 1800 ) );
703 sHistName = Form(
"hStsFebRateEvo_%03u", uFebIdx);
704 title = Form(
"Hits per second in FEB #%03u; Time [s]; Hits []", uFebIdx);
717 sHistName = Form(
"hStsFebRateEvo_mskch_%03u", uFebIdx);
718 title = Form(
"Hits per second in FEB #%03u; Time [s]; Hits []", uFebIdx);
722 sHistName = Form(
"hStsFebRateEvo_mskch_adcut_%03u", uFebIdx);
723 title = Form(
"Hits per second in FEB #%03u; Time [s]; Hits []", uFebIdx);
727 sHistName = Form(
"hStsFebChanRateEvoLong_%03u", uFebIdx);
728 title = Form(
"Hits per second & channel in FEB #%03u; Time [min]; Channel []; Hits []", uFebIdx);
734 sHistName = Form(
"hStsFebAsicRateEvoLong_%03u", uFebIdx);
735 title = Form(
"Hits per second & StsXyter in FEB #%03u; Time [min]; Asic []; Hits []", uFebIdx);
741 sHistName = Form(
"hStsFebRateEvoLong_%03u", uFebIdx);
742 title = Form(
"Hits per second in FEB #%03u; Time [min]; Hits []", uFebIdx);
746 sHistName = Form(
"hStsFebChanDistT_%03u", uFebIdx);
747 title = Form(
"Time distance between hits on same channel in between FEB "
748 "#%03u; Time difference [ns]; Channel []; ",
756 for (UInt_t uFebIdxB = uFebIdx; uFebIdxB <
fuNbFebs; ++uFebIdxB) {
757 sHistName = Form(
"hStsFebChanDtCoinc_%03u_%03u", uFebIdx, uFebIdxB);
758 title = Form(
"Channel coincidences Time diff between FEB #%03u and FEB "
759 "#%03u; Time difference [ns]",
763 sHistName = Form(
"hStsFebChanCoinc_%03u_%03u", uFebIdx, uFebIdxB);
764 title = Form(
"Channel coincidences between FEB #%03u and FEB #%03u; "
765 "Channel FEB #%03u []; Channel FEB #%03u []; Coinc. []",
766 uFebIdx, uFebIdxB, uFebIdx, uFebIdxB);
776 LOG(debug) <<
"Initialized 4th Histo before SXM 2.0 Logic Error";
779 for (UInt_t uFebIdx = 0; uFebIdx <
fuNbFebs; ++uFebIdx) {
781 sHistName = Form(
"hStsFebSmxErrRatioEvo_%03u", uFebIdx);
782 title = Form(
"Proportion of uS with SMX logic error in FEB #%03u; Time "
783 "[s]; Error MS fract. []",
788 sHistName = Form(
"hStsFebSmxErrRatioEvoAsic_%03u", uFebIdx);
789 title = Form(
"Proportion of uS with SMX logic error per ASIC in FEB #%03u; "
790 "Time [s]; ASIC []; Error MS fract. []",
797 sHistName = Form(
"hStsFebSmxErrRatioCopyEvo_%03u", uFebIdx);
798 title = Form(
"Proportion of uS with hit copies in FEB #%03u; Time [s]; "
799 "Copies MS fract. []",
804 sHistName = Form(
"hStsFebSmxErrRatioCopyEvoAsic_%03u", uFebIdx);
805 title = Form(
"Proportion of uS with hit copies per ASIC in FEB #%03u; Time "
806 "[s]; ASIC []; Copies MS fract. []",
813 sHistName = Form(
"hStsFebSmxErrRatioCopySameAdcEvo_%03u", uFebIdx);
814 title = Form(
"Proportion of uS with hit full copies in FEB #%03u; Time "
815 "[s]; Copies MS fract. []",
820 sHistName = Form(
"hStsFebSmxErrRatioCopySameAdcEvoAsic_%03u", uFebIdx);
821 title = Form(
"Proportion of uS with hit full copies per ASIC in FEB #%03u; "
822 "Time [s]; ASIC []; Copies MS fract. []",
837 LOG(debug) <<
"Initialized 6th Histo before FairRunOnlne Instance";
840#ifdef USE_HTTP_SERVER
841 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
843 for (UInt_t uModuleId = 0; uModuleId < 2; ++uModuleId) {
848 server->Register(
"/StsRaw",
fhRate);
860 for (UInt_t uFebIdx = 0; uFebIdx <
fuNbFebs; ++uFebIdx) {
883 for (UInt_t uFebIdxB = uFebIdx; uFebIdxB <
fuNbFebs; ++uFebIdxB) {
897 server->RegisterCommand(
"/Reset_All",
"bMcbm2018ResetMuch=kTRUE");
898 server->RegisterCommand(
"/Write_All",
"bMcbm2018WriteMuch=kTRUE");
899 server->RegisterCommand(
"/ScanNoisyCh",
"bMcbm2018ScanNoisyMuch=kTRUE");
902 server->Restrict(
"/Reset_All",
"allow=admin");
903 server->Restrict(
"/Write_All",
"allow=admin");
904 server->Restrict(
"/ScanNoisyCh",
"allow=admin");
911 LOG(debug) <<
"Initialized 7th Histo before Summary per FEB";
913 for (UInt_t uFebIdx = 0; uFebIdx <
fuNbFebs; ++uFebIdx) {
915 TCanvas* cStsSumm =
new TCanvas(Form(
"cStsSum_%03u", uFebIdx), Form(
"Summary plots for FEB %03u", uFebIdx), w,
h);
916 cStsSumm->Divide(2, 3);
955 TCanvas* cStsSmxErr =
956 new TCanvas(Form(
"cStsSmxErr_%03u", uFebIdx), Form(
"SMX logic error plots for FEB %03u", uFebIdx), w,
h);
957 cStsSmxErr->Divide(2, 3);
998 LOG(debug) <<
"Initialized Last Histo before exiting CreateHistograms";
1003 fcMsSizeAll =
dynamic_cast<TCanvas*
>(gROOT->FindObject(
"cMsSizeAll"));
1005 fcMsSizeAll =
new TCanvas(
"cMsSizeAll",
"Evolution of MS size in last 300 s", w,
h);
1007 LOG(info) <<
"Created MS size canvas in STS monitor";
1010 LOG(info) <<
"Recovered MS size canvas in STS monitor";
1031 LOG(debug) <<
"Timeslice contains " << ts.num_microslices(component) <<
" microslices.";
1040 for (UInt_t uMsIdx = 0; uMsIdx < uNbMsLoop; uMsIdx++) {
1041 Double_t dMsTime = (1e-9) *
static_cast<double>(ts.descriptor(
fvMsComponentsList[0], uMsIdx).idx);
1047 if (kFALSE ==
ProcessStsMs(ts, uMsComp, uMsIdx))
return kFALSE;
1058 std::vector<stsxyter::FinalHit>::iterator itA;
1059 std::vector<stsxyter::FinalHit>::iterator itB;
1067 UShort_t usAsicIdx = (*itA).GetAsic();
1096 bHitCopyInThisMs[uAsic] = kFALSE;
1097 bHitCopySameAdcInThisMs[uAsic] = kFALSE;
1098 bFlagOnInThisMs[uAsic] = kFALSE;
1111 UShort_t usChanIdx = (*itA).GetChan();
1112 ULong64_t ulHitTs = (*itA).GetTs();
1113 UShort_t usHitAdc = (*itA).GetAdc();
1119 Bool_t bIsNotCopy = kTRUE;
1120 if (vulLastHitTs[usChanIdx] == ulHitTs) {
1121 bIsNotCopy = kFALSE;
1122 bHitCopyInThisMs[uAsic] = kTRUE;
1123 if (vusLastHitAdc[usChanIdx] == usHitAdc) bHitCopySameAdcInThisMs[uAsic] = kTRUE;
1126 vulLastHitTs[usChanIdx] = ulHitTs;
1127 vusLastHitAdc[usChanIdx] = usHitAdc;
1141 std::vector<Bool_t> vbCopyOnAnyAsicMs(
fuNbFebs, kFALSE);
1142 std::vector<Bool_t> vbCopySameAdcOnAnyAsicMs(
fuNbFebs, kFALSE);
1143 std::vector<Bool_t> vbFlagOnAnyAsicMs(
fuNbFebs, kFALSE);
1152 bHitCopyInThisMs[uAsic] ? 1.0 : 0.0);
1155 bHitCopySameAdcInThisMs[uAsic] ? 1.0 : 0.0);
1158 bFlagOnInThisMs[uAsic] ? 1.0 : 0.0);
1160 vbCopyOnAnyAsicMs[uFebIdx] = vbCopyOnAnyAsicMs[uFebIdx] || bHitCopyInThisMs[uAsic];
1161 vbCopySameAdcOnAnyAsicMs[uFebIdx] = vbCopySameAdcOnAnyAsicMs[uFebIdx] || bHitCopySameAdcInThisMs[uAsic];
1162 vbFlagOnAnyAsicMs[uFebIdx] = vbFlagOnAnyAsicMs[uFebIdx] || bFlagOnInThisMs[uAsic];
1169 for (UInt_t uFebIdx = 0; uFebIdx <
fuNbFebs; ++uFebIdx) {
1172 vbCopySameAdcOnAnyAsicMs[uFebIdx] ? 1.0 : 0.0);
1177 for (UInt_t uFebIdx = 0; uFebIdx <
fuNbFebs; ++uFebIdx) {
1184 UShort_t usAsicIdxA = (*itA).GetAsic();
1186 UShort_t usChanIdxA = (*itA).GetChan();
1188 ULong64_t ulHitTsA = (*itA).GetTs();
1198 for (UInt_t uFebIdxB = uFebIdx; uFebIdxB <
fuNbFebs; ++uFebIdxB) {
1211 UShort_t usAsicIdxB = (*itB).GetAsic();
1212 UShort_t usChanIdxB = (*itB).GetChan();
1213 UInt_t uChanInFebB =
1216 if (uFebIdx == uFebIdxB && uChanInFebA == uChanInFebB)
continue;
1218 ULong64_t ulHitTsB = (*itB).GetTs();
1220 Double_t dDtClk =
static_cast<Double_t
>(ulHitTsB) -
static_cast<Double_t
>(ulHitTsA);
1248 if (0 == ts.index() % 1000) {
1249 for (UInt_t uDpb = 0; uDpb <
fuNrOfDpbs; ++uDpb) {
1250 Double_t dTsMsbTime =
1256 LOG(info) <<
"End of TS " << std::setw(7) << ts.index() <<
" eDPB " << std::setw(2) << uDpb
1257 <<
" current TS MSB counter is " << std::setw(12) <<
fvulCurrentTsMsb[uDpb]
1259 <<
" current TS MSB time is " << std::setw(12) << dTsMsbTime <<
" s";
1271 auto msDescriptor = ts.descriptor(uMsComp, uMsIdx);
1274 const uint8_t* msContent =
reinterpret_cast<const uint8_t*
>(ts.content(uMsComp, uMsIdx));
1276 uint32_t uSize = msDescriptor.size;
1280 <<
" has size: " << uSize;
1288 fhMsSz[uMsComp]->Fill(uSize);
1293 if (
static_cast<Int_t
>(
fvdPrevMsTime[uMsComp]) <
static_cast<Int_t
>(dMsTime)) {
1297 UInt_t uFebIdxInSyst = uFebIdxOffset + uFebIdx;
1332 uint16_t uMsHeaderFlags = msDescriptor.flags;
1333 for (UInt_t uBit = 0; uBit < 16; ++uBit)
1357 LOG(error) <<
"The input microslice buffer does NOT "
1358 <<
"contain only complete nDPB messages!";
1364 const uint32_t* pInBuff =
reinterpret_cast<const uint32_t*
>(msContent);
1366 for (uint32_t uIdx = 0; uIdx < uNbMessages; ++uIdx) {
1368 uint32_t ulData =
static_cast<uint32_t
>(pInBuff[uIdx]);
1393 if (kTRUE ==
fbMuchMode) uFebIdx = usElinkIdx;
1395 if (-1 == uFebIdx) {
1396 LOG(warning) <<
"CbmMcbm2018MonitorMuch::DoUnpack => "
1397 <<
"Wrong elink Idx! Elink raw " << Form(
"%d remap %d", usElinkIdx, uFebIdx);
1417 LOG(info) <<
"CbmMcbm2018MonitorMuch::DoUnpack => "
1418 <<
"EPOCH message at unexpected position in MS: message " << uIdx <<
" VS message 0 expected!";
1449 LOG(fatal) <<
"CbmMcbm2018MonitorMuch::DoUnpack => "
1450 <<
"Unknown message type, should never happen, stopping "
1451 "here! Type found was: "
1452 <<
static_cast<int>(typeMess);
1461 const UInt_t& uMsIdx)
1563 if (constime < 1000000) {
1580 Double_t dTimeSinceStartMin = dTimeSinceStartSec / 60.0;
1680 LOG(info) <<
"-------------------------------------";
1681 LOG(info) <<
"CbmMcbm2018MonitorMuch statistics are ";
1688 LOG(info) <<
"-------------------------------------";
1698 TFile* oldFile = gFile;
1699 TDirectory* oldDir = gDirectory;
1701 TFile* histoFile = NULL;
1702 if (
"" != sFileName) {
1704 histoFile =
new TFile(sFileName,
"RECREATE");
1709 gDirectory->mkdir(
"Sts_Raw");
1710 gDirectory->cd(
"Sts_Raw");
1712 for (UInt_t uModuleId = 0; uModuleId < 2; ++uModuleId) {
1726 gDirectory->cd(
"..");
1730 gDirectory->mkdir(
"Sts_Feb");
1731 gDirectory->cd(
"Sts_Feb");
1732 for (UInt_t uFebIdx = 0; uFebIdx <
fuNbFebs; ++uFebIdx) {
1755 for (UInt_t uFebIdxB = uFebIdx; uFebIdxB <
fuNbFebs; ++uFebIdxB) {
1761 gDirectory->cd(
"..");
1766 gDirectory->mkdir(
"Sts_SmxErr");
1767 gDirectory->cd(
"Sts_SmxErr");
1768 for (UInt_t uFebIdx = 0; uFebIdx <
fuNbFebs; ++uFebIdx) {
1778 gDirectory->cd(
"..");
1783 gDirectory->mkdir(
"Flib_Raw");
1784 gDirectory->cd(
"Flib_Raw");
1786 TString sMsSzName = Form(
"MsSz_link_%02u", uLinks);
1787 if (
fHM->
Exists(sMsSzName.Data()))
fHM->
H1(sMsSzName.Data())->Write();
1789 sMsSzName = Form(
"MsSzTime_link_%02u", uLinks);
1790 if (
fHM->
Exists(sMsSzName.Data()))
fHM->
P1(sMsSzName.Data())->Write();
1793 TH1* pMissedTsH1 =
dynamic_cast<TH1*
>(gROOT->FindObjectAny(
"Missed_TS"));
1794 if (NULL != pMissedTsH1) pMissedTsH1->Write();
1796 TProfile* pMissedTsEvoP =
dynamic_cast<TProfile*
>(gROOT->FindObjectAny(
"Missed_TS_Evo"));
1797 if (NULL != pMissedTsEvoP) pMissedTsEvoP->Write();
1799 gDirectory->cd(
"..");
1802 if (
"" != sFileName) {
1809 gDirectory = oldDir;
1813 LOG(info) <<
"Reseting all STS histograms.";
1815 for (UInt_t uModuleId = 0; uModuleId < 2; ++uModuleId) {
1831 for (UInt_t uFebIdx = 0; uFebIdx <
fuNbFebs; ++uFebIdx) {
1854 for (UInt_t uFebIdxB = uFebIdx; uFebIdxB <
fuNbFebs; ++uFebIdxB) {
1871 TString sMsSzName = Form(
"MsSz_link_%02u", uLinks);
1872 if (
fHM->
Exists(sMsSzName.Data()))
fHM->
H1(sMsSzName.Data())->Reset();
1874 sMsSzName = Form(
"MsSzTime_link_%02u", uLinks);
1875 if (
fHM->
Exists(sMsSzName.Data()))
fHM->
P1(sMsSzName.Data())->Reset();
1884 TDatime* fRunStartDateTime =
new TDatime(dateIn, timeIn);
1888 LOG(info) <<
"Assigned new MUCH Run Start Date-Time: " << fRunStartDateTime->AsString();
1918 for (UInt_t uFebIdx = 0; uFebIdx <
fuNbFebs; ++uFebIdx) {
2013 for (UInt_t uFebIdx = 0; uFebIdx <
fuNbFebs; ++uFebIdx) {
2015 LOG(info) << Form(
" ------------------ Noisy channels scan for FEB %2d ------------", uFebIdx);
2020 LOG(info) << Form(
"Noisy Channel ASIC %d channel %3d (%4d) level %6.0f", uAsicIdx, uChanIdx, uChanInFeb,
2025 LOG(info) <<
" ---------------------------------------------------------------";
ClassImp(CbmConverterManager)
Bool_t bMcbm2018ScanNoisyMuch
Bool_t bMcbm2018WriteMuch
Bool_t bMcbm2018ResetMuch
TProfile * P1(const std::string &name) const
Return pointer to TProfile.
Bool_t Exists(const std::string &name) const
Check existence of object in manager.
void Add(const std::string &name, TNamed *object)
Add new named object to manager.
TH1 * H1(const std::string &name) const
Return pointer to TH1 histogram.
Bool_t SmxErrCheckCoinc(UInt_t uFebIdx, UInt_t uAsicIdx, Double_t dNewHitTime)
virtual ~CbmMcbm2018MonitorMuch()
std::vector< TH2 * > fhStsFebChanHitRateEvo
virtual void SetNbMsInTs(size_t uCoreMsNb, size_t uOverlapMsNb)
Bool_t fbEnableCoincidenceMaps
void FillTsMsbInfo(stsxyter::Message mess, UInt_t uMessIdx=0, UInt_t uMsIdx=0)
std::vector< TProfile * > fhStsFebSmxErrRatioCopySameAdcEvo
stsxyter::MessagePrintMask fPrintMessCtrl
Int_t fiBinSizeDatePlots
Start of run time since "epoch" in s, for the plots with date as X axis.
std::vector< TH1 * > fhStsFebChanCntRawGood
std::vector< std::vector< UInt_t > > fvuSmxErrIdxFirstHitM11
[ NbFebs ][ NbSmxPerFeb ]
std::vector< stsxyter::FinalHit > fvmHitsInMs
Hits time-sorting.
std::vector< std::vector< UInt_t > > fvuSmxErrIdxLastHit
[ NbFebs ][ NbSmxPerFeb ]
std::vector< std::vector< UInt_t > > fvuSmxErrIdxFirstHitM10
[ NbFebs ][ NbSmxPerFeb ]
std::vector< TH2 * > fHistPadDistr
Plots per FEB-8.
std::vector< TH2 * > fhStsFebChanAdcCal
TString fsHistoFileFullname
std::vector< std::vector< std::vector< Double_t > > > fvdFebAdcGain
Number of StsXyter ASICs.
std::vector< UInt_t > fvuInitialHeaderDone
Current TS MSB cycle for DPB.
std::vector< TProfile * > fhStsFebSmxErrRatioCopyEvo
std::vector< size_t > fvMsComponentsList
TH2 * fhStsMessTypePerDpb
std::vector< std::vector< UInt_t > > fvuSmxErrIdxFirstHitM08
[ NbFebs ][ NbSmxPerFeb ]
std::vector< TProfile * > fhStsFebSmxErrRatioEvo
Histograms.
std::vector< TH2 * > fRealHistPadDistr
std::vector< std::vector< Double_t > > fvdChanLastHitTime
Last hit time in bins for each Channel.
std::vector< TH1 * > fhStsFebHitRateEvo
Bool_t fbPrintMessages
Task configuration values.
Int_t fiRunStartDateTimeSec
Index of the DPB from which the MS currently unpacked is coming.
void SetRunStart(Int_t dateIn, Int_t timeIn, Int_t iBinSize=5)
Bool_t ScanForNoisyChannels(Double_t dNoiseThreshold=1e3)
---------------------------------------------------------------—///
virtual Bool_t DoUnpack(const fles::Timeslice &ts, size_t component)
Bool_t ProcessStsMs(const fles::Timeslice &ts, size_t uMsComp, UInt_t uMsIdx)
static constexpr const Double_t kdSmxErrCoincWinNoiseM10
std::vector< std::vector< UInt_t > > fvuSmxErrIdxFirstHitM09
[ NbFebs ][ NbSmxPerFeb ]
Int_t fiTimeIntervalRateUpdate
Mean Rate per channel plots.
std::vector< ULong64_t > fvulCurrentTsMsb
Bin size in s for the plots with date as X axis.
UInt_t fuCurrDpbId
Current equipment ID, tells from which DPB the current MS is originating.
std::vector< TH2 * > fhStsFebChanDistT
std::vector< TH2 * > fhStsFebChanAdcRaw
UInt_t fuCurrentEquipmentId
std::vector< std::vector< ULong64_t > > fvulChanLastHitTime
TH1 * fhStsMessType
Histogram manager.
UInt_t fuNbStsXyters
Number of StsXyter ASICs.
Bool_t InitStsParameters()
Long64_t fdStartTime
Last hit ADC in bins in each MS for each Channel.
std::vector< TProfile * > fhStsFebChanAdcCalProf
std::vector< std::vector< std::vector< Double_t > > > fvdSmxErrTimeLastHits
std::vector< Double_t > fvdMsTime
Header time of previous MS per link.
std::vector< std::vector< Double_t > > fvdFebChanCountsSinceLastRateUpdate
std::vector< Double_t > fvdPrevMsTime
Last hit time in ns for each Channel.
std::vector< TH1 * > fhStsFebMissEvtEvo
void SaveAllHistos(TString sFileName="")
Bool_t fbSmx2ErrorUseNoiseLevels
SXM 2.0 logic error detection and tagging, 1 eLink case.
UInt_t fuNbFebs
Array to hold the active flag for all CROBs, [ NbDpb ][ NbCrobPerDpb ].
std::map< UInt_t, UInt_t > fDpbIdIndexMap
Total number of STS DPBs in system.
TH2 * fhStsSysMessTypePerDpb
static constexpr const Double_t kdSmxErrCoincWinNoiseM07
Coincidence windows 99.9% tagging (up to 0.1% of corruption not detected)
static const Int_t kiMaxNbFlibLinks
ADC offset in e-, [ NbDpb ][ NbCrobPerDpb ][ NbFebsPerCrob ].
Bool_t fbLongHistoEnable
Rate evolution histos.
Double_t fdSmxErrCoincWinM07
Tagging variables.
CbmMcbm2018MuchPar * fUnpackParMuch
/** Ignore Overlap Ms: all fuOverlapMsNb MS at the end of timeslice **/
Bool_t ReInitContainers()
std::vector< TH2 * > fhStsFebChanMissEvt
std::vector< TH2 * > fhStsFebAsicMissEvtEvo
Double_t fdSmxErrCoincWinM08
static constexpr const Double_t kdSmxErrCoincWinBeg
std::vector< std::vector< std::vector< UInt_t > > > fvuChanNbHitsInMs
Header time of each MS.
TProfile * fhMsSzTime[kiMaxNbFlibLinks]
void FillHitInfo(stsxyter::Message mess, const UShort_t &usElinkIdx, const UInt_t &uAsicIdx, const UInt_t &uMsIdx)
std::vector< std::vector< TH1 * > > fhStsFebChanDtCoinc
CbmHistManager * fHM
Histograms.
std::map< stsxyter::MessType, UInt_t > fmMsgCounter
Current data properties.
TH2 * fhPulserStatusMessType
Double_t fdFebChanCoincidenceLimit
std::vector< UInt_t > fvuCurrentTsMsbCycle
Current TS MSB for each DPB.
std::vector< TH2 * > fhStsFebAsicHitRateEvoLong
static constexpr const Double_t kdSmxErrCoincWinNoiseM11
static constexpr const Double_t kdSmxErrCoincWinNoiseM08
Double_t fdSmxErrCoincWinM11
Double_t fdSmxErrCoincWinM09
std::vector< TProfile * > fhStsFebChanAdcRawProf
std::vector< TH1 * > fhStsFebHitRateEvo_mskch
ULong64_t fulCurrentMsIdx
std::vector< Int_t > fviFebCountsSinceLastRateUpdate
UInt_t fuMaxNbMicroslices
Double_t fdCoincCenter
Coincidences in sorted hits.
std::vector< std::vector< std::vector< Double_t > > > fvdChanLastHitTimeInMs
Number of hits in each MS for each Channel.
TH2 * fhPulserMsStatusFieldType
static const UInt_t kuSmxErrCoincWinNbHits
std::vector< std::vector< Double_t > > fdStsFebChanLastTimeForDist
TH1 * fhStsFebChanAdcRaw_combined
void FillEpochInfo(stsxyter::Message mess)
std::vector< UInt_t > fvuInitialTsMsbCycleHeader
Flag set after seeing MS header in 1st MS for DPB.
TH1 * fhMsSz[kiMaxNbFlibLinks]
UInt_t fuCurrDpbIdx
Temp holder until Current equipment ID is properly filled in MS.
std::vector< std::vector< stsxyter::FinalHit > > fvmFebHitsInMs
All hits (time in bins, ADC in bins, asic, channel) in last TS, per ASIC, sorted with "<" operator.
std::vector< TH1 * > fhStsFebHitRateEvoLong
void SetLongDurationLimits(UInt_t uDurationSeconds=3600, UInt_t uBinSize=1)
std::vector< std::vector< UInt_t > > fvuSmxErrIdxFirstHitM07
[ NbFebs ][ NbSmxPerFeb ][ kuSmxErrCoincWinNbHits ]
std::vector< Int_t > fviFebTimeSecLastRateUpdate
std::vector< TProfile2D * > fhStsFebSmxErrRatioCopySameAdcEvoAsic
UInt_t fuLongHistoBinSizeSec
std::vector< TH2 * > fhStsFebChanMissEvtEvo
static const UInt_t kuBytesPerMessage
std::vector< TH1 * > fhStsFebChanCntRaw
std::vector< TH2 * > fhStsFebChanRawTs
Double_t fdSmxErrCoincWinM10
virtual void AddMsComponentToList(size_t component, UShort_t usDetectorId)
void SetCoincidenceBorder(Double_t dCenterPos, Double_t dBorderVal)
std::vector< std::vector< stsxyter::FinalHit > > fvmAsicHitsInMs
All hits (time in bins, ADC in bins, asic, channel) in last TS, sorted with "<" operator.
std::vector< std::vector< Bool_t > > fvbCrobActiveFlag
Map of DPB Identifier to DPB index.
std::vector< TH2 * > fhStsFebAsicHitRateEvo
std::vector< TProfile2D * > fhStsFebSmxErrRatioCopyEvoAsic
std::vector< std::vector< std::vector< Double_t > > > fvdFebAdcOffs
ADC gain in e-/b, [ NbDpb ][ NbCrobPerDpb ][ NbFebsPerCrob ].
std::vector< TProfile * > fhStsFebChanHitRateProf
std::vector< TH2 * > fhStsFebChanHitRateEvoLong
TH2 * fhStsHitsElinkPerDpb
std::vector< std::vector< std::vector< UShort_t > > > fvusChanLastHitAdcInMs
Last hit time in bins in each MS for each Channel.
std::vector< UInt_t > fvuElinkLastTsHit
TS MSB cycle from MS header in 1st MS for DPB.
static constexpr const Double_t kdSmxErrCoincWinNoiseM09
ULong64_t fulCurrentTsIdx
TS/MS info.
UInt_t fuLongHistoNbSeconds
std::vector< TH1 * > fhStsFebHitRateEvo_mskch_adccut
std::vector< std::vector< TH2 * > > fhStsFebChanCoinc
void SmxErrInitializeVariables()
Methods.
std::vector< TProfile2D * > fhStsFebSmxErrRatioEvoAsic
Int_t ElinkIdxToFebIdx(UInt_t uElink)
static constexpr UInt_t GetNbElinkPerCrob()
Double_t GetRealPadSize(Int_t)
static constexpr UInt_t GetNbFebsPerCrob()
Short_t GetPadXA(UShort_t febid, UShort_t channelid)
static constexpr UInt_t GetNbChanPerAsic()
static constexpr UInt_t GetNbAsicsPerCrob()
static constexpr UInt_t GetNbChanPerFeb()
UInt_t GetDpbId(UInt_t uDpbIdx)
UInt_t ElinkIdxToAsicIdx(UInt_t uElink)
Short_t GetPadYA(UShort_t febid, UShort_t channelid)
Bool_t IsCrobActive(UInt_t uDpbIdx, UInt_t uCrobIdx)
Bool_t IsFebActive(UInt_t uFebInSystIdx)
static constexpr UInt_t GetNbFebsPerDpb()
static constexpr UInt_t GetNbCrobsPerDpb()
static constexpr UInt_t GetNbAsicsPerFeb()
Data class with information on a STS local track.
XPU_D bool IsHitMissedEvts() const
For Hit data: Returns Missed event flag (1 bit field)
XPU_D uint16_t GetHitAdc() const
For Hit data: Returns ADC value (5 bit field)
XPU_D uint16_t GetHitChannel() const
For Hit data: Returns StsXYTER channel number (7 bit field)
bool PrintMess(std::ostream &os, MessagePrintMask ctrl=MessagePrintMask::msg_print_Human, bool bBinning=true) const
XPU_D uint16_t GetLinkIndex() const
For all data: Returns the (global) index of the eLink on which the message was received (n bit field)
XPU_D uint16_t GetStatusStatus() const
For Status data: Returns the Status field from ACK frame (4 bit field)
XPU_D MessType GetMessType() const
Returns the message type, see enum MessType.
XPU_D uint16_t GetHitTime() const
For Hit data: Returns timestamp (8 bit field, 2 MSB bits overlap removed)
XPU_D uint32_t GetTsMsbVal() const
For TS MSB data: Returns the TS MSB 22 bit field)
XPU_D uint16_t GetStatusLink() const
For Status data: Returns the Link Inedx (9 bit field)
static constexpr uint64_t kulTsCycleNbBins
static constexpr uint32_t kuHitNbTsBins
static constexpr uint32_t kuHitNbAdcBins
Status/properties constants.
static constexpr double kdClockCycleNs