54 , fvbMaskedComponents()
55 , fvMsComponentsList()
58 , fbIgnoreOverlapMs(kFALSE)
81 fsHistoFileFullname(
"data/SetupHistos.root")
82 , fbPrintMessages(kFALSE)
83 , fPrintMessCtrl(
stsxyter::MessagePrintMask::msg_print_Human)
86 fbEnableCheckBugSmx20(kFALSE)
90 , fuCurrentEquipmentId(0)
93 , fiRunStartDateTimeSec(-1)
94 , fiBinSizeDatePlots(-1)
96 , fvuCurrentTsMsbCycle()
97 , fvuInitialHeaderDone()
98 , fvuInitialTsMsbCycleHeader()
100 , fvulChanLastHitTime()
101 , fvdChanLastHitTime()
104 , fvuChanNbHitsInMs()
105 , fvdChanLastHitTimeInMs()
106 , fvusChanLastHitAdcInMs()
110 , fdStartTimeMsSz(-1.0)
111 , ftStartTimeUnix(
std::chrono::steady_clock::now())
115 , fuMaxNbMicroslices(100)
116 , fiTimeIntervalRateUpdate(10)
117 , fvdFebTimeSecLastRateUpdate()
118 , fviFebCountsSinceLastRateUpdate()
119 , fvdFebChanCountsSinceLastRateUpdate()
120 , fbLongHistoEnable(kFALSE)
121 , fuLongHistoNbSeconds(0)
122 , fuLongHistoBinSizeSec(0)
123 , fuLongHistoBinNb(0)
125 , fdCoincBorder(50.0)
126 , fdCoincMin(fdCoincCenter - fdCoincBorder)
127 , fdCoincMax(fdCoincCenter + fdCoincBorder)
129 , fhStsMessType(NULL)
130 , fhStsSysMessType(NULL)
131 , fhStsMessTypePerDpb(NULL)
132 , fhStsSysMessTypePerDpb(NULL)
133 , fhStsStatusMessType(NULL)
134 , fhStsMsStatusFieldType(NULL)
135 , fhStsMessTypePerElink(NULL)
136 , fhStsHitsElinkPerDpb(NULL)
137 , fhStsAllFebsHitRateEvo(nullptr)
138 , fhStsAllAsicsHitRateEvo(nullptr)
139 , fhStsFebAsicHitCounts(nullptr)
140 , fdFebChanCoincidenceLimit(100.0)
141 , fhStsFebChanCntRaw()
142 , fhStsFebChanCntRawGood()
143 , fhStsFebChanAdcRaw()
144 , fhStsFebChanAdcRawProf()
149 , fhStsFebChanMissEvt()
150 , fhStsFebChanMissEvtEvo()
151 , fhStsFebAsicMissEvtEvo()
152 , fhStsFebMissEvtEvo()
153 , fhStsFebChanHitRateEvo()
154 , fhStsFebChanHitRateProf()
155 , fhStsFebAsicHitRateEvo()
156 , fhStsFebHitRateEvo()
157 , fhStsFebChanHitRateEvoLong()
158 , fhStsFebAsicHitRateEvoLong()
159 , fhStsFebHitRateEvoLong()
160 , fdStsFebChanLastTimeForDist()
161 , fhStsFebChanDistT()
162 , fhStsFebChanCloseHitsCounts()
163 , fhStsFebChanCloseHitsRatio()
177 fbSmx2ErrorUseNoiseLevels(kFALSE)
178 , fdSmxErrCoincWinM07(kdSmxErrCoincWinMainM07)
179 , fdSmxErrCoincWinM08(kdSmxErrCoincWinMainM08)
180 , fdSmxErrCoincWinM09(kdSmxErrCoincWinMainM09)
181 , fdSmxErrCoincWinM10(kdSmxErrCoincWinMainM10)
182 , fdSmxErrCoincWinM11(kdSmxErrCoincWinMainM11)
183 , fvdSmxErrTimeLastHits()
184 , fvuSmxErrIdxFirstHitM07()
185 , fvuSmxErrIdxFirstHitM08()
186 , fvuSmxErrIdxFirstHitM09()
187 , fvuSmxErrIdxFirstHitM10()
188 , fvuSmxErrIdxFirstHitM11()
189 , fvuSmxErrIdxLastHit()
190 , fhStsFebSmxErrRatioEvo()
191 , fhStsFebSmxErrRatioEvoAsic()
192 , fhStsFebSmxErrRatioCopyEvo()
193 , fhStsFebSmxErrRatioCopyEvoAsic()
194 , fhStsFebSmxErrRatioCopySameAdcEvo()
195 , fhStsFebSmxErrRatioCopySameAdcEvoAsic()
515 TString sHistName {
""};
518 sHistName =
"hPulserMessageType";
519 title =
"Nb of message for each type; Type";
536 sHistName =
"hPulserSysMessType";
537 title =
"Nb of system message for each type; System Type";
545 sHistName =
"hPulserMessageTypePerDpb";
546 title =
"Nb of message of each type for each DPB; DPB; Type";
562 sHistName =
"hPulserSysMessTypePerDpb";
563 title =
"Nb of system message of each type for each DPB; DPB; System Type";
571 sHistName =
"hStsStatusMessType";
572 title =
"Nb of status message of each type for each DPB; ASIC; Status Type";
581 sHistName =
"hStsMsStatusFieldType";
582 title =
"For each flag in the MS header, ON/OFF counts; Flag bit []; ON/OFF; MS []";
591 sHistName =
"hStsMessTypePerElink";
592 title =
"Nb of message of each type for each DPB; DPB; Type";
602 sHistName =
"hStsHitsElinkPerDpb";
603 title =
"Nb of hit messages per eLink for each DPB; DPB; eLink; Hits nb []";
607 sHistName =
"hStsAllFebsHitRateEvo";
608 title =
"Hits per second & FEB; Time [s]; FEB []; Hits []";
612 sHistName =
"hStsAllAsicsHitRateEvo";
613 title =
"Hits per second & ASIC; Time [s]; ASIC []; Hits []";
617 sHistName =
"hStsFebAsicHitCounts";
618 title =
"Hits per FEB & ASIC; FEB []; ASIC in FEB[]; Hits []";
672 for (UInt_t uFebIdx = 0; uFebIdx <
fuNbFebs; ++uFebIdx) {
674 sHistName = Form(
"hStsFebChanCntRaw_%03u", uFebIdx);
675 title = Form(
"Hits Count per channel, FEB #%03u; Channel; Hits []", uFebIdx);
679 sHistName = Form(
"hStsFebChanCntRawGood_%03u", uFebIdx);
680 title = Form(
"Hits Count per channel in good MS (SX2 bug flag off), FEB "
681 "#%03u; Channel; Hits []",
687 sHistName = Form(
"hStsFebChanAdcRaw_%03u", uFebIdx);
688 title = Form(
"Raw Adc distribution per channel, FEB #%03u; Channel []; Adc "
696 sHistName = Form(
"hStsFebChanAdcRawProfc_%03u", uFebIdx);
697 title = Form(
"Raw Adc prodile per channel, FEB #%03u; Channel []; Adc []", uFebIdx);
702 sHistName = Form( "hStsFebChanAdcCal_%03u", uFebIdx );
703 title = Form( "Cal. Adc distribution per channel, FEB #%03u; Channel []; Adc [e-]; Hits []", uFebIdx );
704 fhStsFebChanAdcCal.push_back( new TH2I(sHistName, title,
705 fUnpackParSts->GetNbChanPerFeb(), -0.5, fUnpackParSts->GetNbChanPerFeb() - 0.5,
709 sHistName = Form( "hStsFebChanAdcCalProfc_%03u", uFebIdx );
710 title = Form( "Cal. Adc prodile per channel, FEB #%03u; Channel []; Adc [e-]", uFebIdx );
711 fhStsFebChanAdcCalProf.push_back( new TProfile(sHistName, title,
712 fUnpackParSts->GetNbChanPerFeb(), -0.5, fUnpackParSts->GetNbChanPerFeb() - 0.5 ) );
715 sHistName = Form(
"hStsFebChanRawTs_%03u", uFebIdx);
716 title = Form(
"Raw Timestamp distribution per channel, FEB #%03u; Channel "
717 "[]; Ts []; Hits []",
724 sHistName = Form(
"hStsFebChanMissEvt_%03u", uFebIdx);
725 title = Form(
"Missed Event flags per channel, FEB #%03u; Channel []; Miss "
732 sHistName = Form(
"hStsFebChanMissEvtEvo_%03u", uFebIdx);
733 title = Form(
"Missed Evt flags per second & channel in FEB #%03u; Time "
734 "[s]; Channel []; Missed Evt flags []",
740 sHistName = Form(
"hStsFebAsicMissEvtEvo_%03u", uFebIdx);
741 title = Form(
"Missed Evt flags per second & StsXyter in FEB #%03u; Time "
742 "[s]; Asic []; Missed Evt flags []",
748 sHistName = Form(
"hStsFebMissEvtEvo_%03u", uFebIdx);
749 title = Form(
"Missed Evt flags per second & channel in FEB #%03u; Time "
750 "[s]; Missed Evt flags []",
755 sHistName = Form(
"hStsFebChanRateEvo_%03u", uFebIdx);
756 title = Form(
"Hits per second & channel in FEB #%03u; Time [s]; Channel []; Hits []", uFebIdx);
761 sHistName = Form(
"hStsFebChanRateProf_%03u", uFebIdx);
762 title = Form(
"Hits per second for each channel in FEB #%03u; Channel []; Hits/s []", uFebIdx);
767 sHistName = Form(
"hStsFebAsicRateEvo_%03u", uFebIdx);
768 title = Form(
"Hits per second & StsXyter in FEB #%03u; Time [s]; Asic []; Hits []", uFebIdx);
773 sHistName = Form(
"hStsFebRateEvo_%03u", uFebIdx);
774 title = Form(
"Hits per second in FEB #%03u; Time [s]; Hits []", uFebIdx);
778 sHistName = Form(
"hStsFebChanRateEvoLong_%03u", uFebIdx);
779 title = Form(
"Hits per second & channel in FEB #%03u; Time [min]; Channel []; Hits []", uFebIdx);
785 sHistName = Form(
"hStsFebAsicRateEvoLong_%03u", uFebIdx);
786 title = Form(
"Hits per second & StsXyter in FEB #%03u; Time [min]; Asic []; Hits []", uFebIdx);
792 sHistName = Form(
"hStsFebRateEvoLong_%03u", uFebIdx);
793 title = Form(
"Hits per second in FEB #%03u; Time [min]; Hits []", uFebIdx);
797 sHistName = Form(
"hStsFebChanDistT_%03u", uFebIdx);
798 title = Form(
"Time distance between hits on same channel in FEB #%03u; "
799 "Time difference [ns]; Channel []; ",
805 sHistName = Form(
"hStsFebChanCloseHitsCounts_%03u", uFebIdx);
806 title = Form(
"Hits with too small dt on same channel in FEB #%03u; Channel "
811 sHistName = Form(
"hStsFebChanCloseHitsRatio_%03u", uFebIdx);
812 title = Form(
"Ratio of Hits with too small dt on same channel in FEB "
820 fhStsFebChanDtCoinc[ uFebIdx ].resize( fuNbFebs, nullptr );
821 fhStsFebChanCoinc[ uFebIdx ].resize( fuNbFebs, nullptr );
822 for( UInt_t uFebIdxB = uFebIdx; uFebIdxB < fuNbFebs; ++uFebIdxB )
824 sHistName = Form( "hStsFebChanDtCoinc_%03u_%03u", uFebIdx, uFebIdxB );
825 title = Form( "Channel coincidences Time diff between FEB #%03u and FEB #%03u; Time difference [ns]",
827 fhStsFebChanDtCoinc[ uFebIdx ][ uFebIdxB ] = new TH1I( sHistName, title, 400, -1250., 1250.);
829 sHistName = Form( "hStsFebChanCoinc_%03u_%03u", uFebIdx, uFebIdxB );
830 title = Form( "Channel coincidences between FEB #%03u and FEB #%03u; Channel FEB #%03u []; Channel FEB #%03u []; Coinc. []",
831 uFebIdx, uFebIdxB, uFebIdx, uFebIdxB );
832 fhStsFebChanCoinc[ uFebIdx ][ uFebIdxB ] = new TH2I( sHistName, title,
833 fUnpackParSts->GetNbChanPerFeb(), -0.5, fUnpackParSts->GetNbChanPerFeb() - 0.5,
834 fUnpackParSts->GetNbChanPerFeb(), -0.5, fUnpackParSts->GetNbChanPerFeb() - 0.5 );
835 } // for( UInt_t uFebIdxB = uFebIdx; uFebIdxB < fuNbFebs; ++uFebIdxB )
842 Double_t dSensorMinX = - fUnpackParSts->GetSensorSzX() / 2.0;
843 Double_t dSensorMaxX = fUnpackParSts->GetSensorSzX() / 2.0;
844 Double_t dSensorMinY = - fUnpackParSts->GetSensorSzY() / 2.0;
845 Double_t dSensorMaxY = fUnpackParSts->GetSensorSzY() / 2.0;
846 for( UInt_t uModIdx = 0; uModIdx < fuNbModules; ++ uModIdx )
849 sHistName = Form( "hStsModulePNCoincDt_%03u", uModIdx );
850 title = Form( "Channel coincidences Time diff between P and N sides on module #%03u; Time difference [ns]",
852 fhStsModulePNCoincDt.push_back( new TH1I( sHistName, title, 400, -1250., 1250.) );
854 sHistName = Form( "hStsModulePNCoincDtAsicP_%03u", uModIdx );
855 title = Form( "Channel coincidences Time diff between P and N sides on module #%03u; Time difference [ns]; Asic on P FEB []",
857 fhStsModulePNCoincDtAsicP.push_back( new TH2I( sHistName, title,
859 fUnpackParSts->GetNbAsicsPerFeb(), -0.5, fUnpackParSts->GetNbAsicsPerFeb() - 0.5) );
861 sHistName = Form( "hStsModulePNCoincDtAsicN_%03u", uModIdx );
862 title = Form( "Channel coincidences Time diff between P and N sides on module #%03u; Time difference [ns]; Asic on P FEB []",
864 fhStsModulePNCoincDtAsicN.push_back( new TH2I( sHistName, title,
866 fUnpackParSts->GetNbAsicsPerFeb(), -0.5, fUnpackParSts->GetNbAsicsPerFeb() - 0.5) );
870 sHistName = Form( "hStsModulePNCoincChan_%03u", uModIdx );
871 title = Form( "P-N channel coincidences in module #%03u; Channel P []; Channel N []; Cnt []", uModIdx );
872 fhStsModulePNCoincChan.push_back( new TH2D( sHistName, title,
873 fUnpackParSts->GetNbChanPerFeb(), -0.5, fUnpackParSts->GetNbChanPerFeb() - 0.5,
874 fUnpackParSts->GetNbChanPerFeb(), -0.5, fUnpackParSts->GetNbChanPerFeb() - 0.5 ) );
877 sHistName = Form( "hStsModulePNCoincAdc_%03u", uModIdx );
878 title = Form( "Adc values of P-N coincidences in module #%03u; ADC Channel P [bin]; ADC Channel N [bin]; Cnt []", uModIdx );
879 fhStsModulePNCoincAdc.push_back( new TH2D( sHistName, title,
880 stsxyter::kuHitNbAdcBins, -0.5, stsxyter::kuHitNbAdcBins - 0.5,
881 stsxyter::kuHitNbAdcBins, -0.5, stsxyter::kuHitNbAdcBins - 0.5 ) );
883 sHistName = Form( "hStsModuleCoincAdcChanP_%03u", uModIdx );
884 title = Form( "Adc values of P chan in P-N coincidences in module #%03u; Channel P [bin]; ADC val. [bin]; Cnt []", uModIdx );
885 fhStsModuleCoincAdcChanP.push_back( new TH2D( sHistName, title,
886 fUnpackParSts->GetNbChanPerFeb(), -0.5, fUnpackParSts->GetNbChanPerFeb() - 0.5,
887 stsxyter::kuHitNbAdcBins, -0.5, stsxyter::kuHitNbAdcBins - 0.5 ) );
889 sHistName = Form( "hStsModuleCoincAdcChanN_%03u", uModIdx );
890 title = Form( "Adc values of N chan in P-N coincidences in module #%03u; Channel N [bin]; ADC val. [bin]; Cnt []", uModIdx );
891 fhStsModuleCoincAdcChanN.push_back( new TH2D( sHistName, title,
892 fUnpackParSts->GetNbChanPerFeb(), -0.5, fUnpackParSts->GetNbChanPerFeb() - 0.5,
893 stsxyter::kuHitNbAdcBins, -0.5, stsxyter::kuHitNbAdcBins - 0.5 ) );
896 sHistName = Form( "hStsModuleCoincMap_%03u", uModIdx );
897 title = Form( "X-Y map of P-N coincidences in module #%03u; Pos. X [mm]; Pos. Y [mm]; Cnt []", uModIdx );
898 fhStsModuleCoincMap.push_back( new TH2D( sHistName, title,
899 2*fUnpackParSts->GetSensorSzX(), 2*dSensorMinX, 2*dSensorMaxX,
900 2*fUnpackParSts->GetSensorSzY(), 2*dSensorMinY, 2*dSensorMaxY ) );
901 } // for( UInt_t uModIdx = 0; uModIdx < fuNbModules; ++ uModIdx )
908 for (UInt_t uFebIdx = 0; uFebIdx <
fuNbFebs; ++uFebIdx) {
910 sHistName = Form(
"hStsFebSmxErrRatioEvo_%03u", uFebIdx);
911 title = Form(
"Proportion of uS with SMX logic error in FEB #%03u; Time "
912 "[s]; Error MS fract. []",
917 sHistName = Form(
"hStsFebSmxErrRatioEvoAsic_%03u", uFebIdx);
918 title = Form(
"Proportion of uS with SMX logic error per ASIC in FEB "
919 "#%03u; Time [s]; ASIC []; Error MS fract. []",
926 sHistName = Form(
"hStsFebSmxErrRatioCopyEvo_%03u", uFebIdx);
927 title = Form(
"Proportion of uS with hit copies in FEB #%03u; Time [s]; "
928 "Copies MS fract. []",
933 sHistName = Form(
"hStsFebSmxErrRatioCopyEvoAsic_%03u", uFebIdx);
934 title = Form(
"Proportion of uS with hit copies per ASIC in FEB #%03u; "
935 "Time [s]; ASIC []; Copies MS fract. []",
942 sHistName = Form(
"hStsFebSmxErrRatioCopySameAdcEvo_%03u", uFebIdx);
943 title = Form(
"Proportion of uS with hit full copies in FEB #%03u; Time "
944 "[s]; Copies MS fract. []",
949 sHistName = Form(
"hStsFebSmxErrRatioCopySameAdcEvoAsic_%03u", uFebIdx);
950 title = Form(
"Proportion of uS with hit full copies per ASIC in FEB "
951 "#%03u; Time [s]; ASIC []; Copies MS fract. []",
960 fhMsErrorsEvo =
new TH2I(
"fhMsErrorsEvo",
"; MS index [s]; Error type []; Counts []", 600, 0.0, 600.0, 4, -0.5, 3.5);
970 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
984 for (UInt_t uFebIdx = 0; uFebIdx <
fuNbFebs; ++uFebIdx) {
1040 server->RegisterCommand(
"/Reset_All",
"bMcbm2018ResetSts=kTRUE");
1041 server->RegisterCommand(
"/Write_All",
"bMcbm2018WriteSts=kTRUE");
1042 server->RegisterCommand(
"/ScanNoisyCh",
"bMcbm2018ScanNoisySts=kTRUE");
1045 server->Restrict(
"/Reset_All",
"allow=admin");
1046 server->Restrict(
"/Write_All",
"allow=admin");
1047 server->Restrict(
"/ScanNoisyCh",
"allow=admin");
1057 for (UInt_t uFebIdx = 0; uFebIdx <
fuNbFebs; ++uFebIdx) {
1060 new TCanvas(Form(
"cStsSum_%03u", uFebIdx), Form(
"Summary plots for FEB %03u", uFebIdx), w,
h);
1111 server->Register(
"/canvases",
fvcStsSumm[uFebIdx]);
1115 new TCanvas(Form(
"cStsSmxErr_%03u", uFebIdx), Form(
"SMX logic error plots for FEB %03u", uFebIdx), w,
h);
1165 fcMsSizeAll =
dynamic_cast<TCanvas*
>(gROOT->FindObject(
"cMsSizeAll"));
1167 fcMsSizeAll =
new TCanvas(
"cMsSizeAll",
"Evolution of MS size in last 300 s", w,
h);
1169 LOG(info) <<
"Created MS size canvas in STS monitor";
1172 LOG(info) <<
"Recovered MS size canvas in STS monitor";
1194 LOG(debug) <<
"Timeslice contains " << ts.num_microslices(component) <<
"microslices.";
1205 for (UInt_t uMsIdx = 0; uMsIdx < uNbMsLoop; uMsIdx++) {
1206 Double_t dMsTime = (1e-9) *
static_cast<double>(ts.descriptor(
fvMsComponentsList[0], uMsIdx).idx);
1211 auto msDescriptor = ts.descriptor(uMsComp, uMsIdx);
1222 uint32_t uEqId =
static_cast<uint32_t
>(msDescriptor.eq_id & 0xFFFF);
1225 LOG(warning) <<
"Could not find the sDPB index for AFCK id 0x" << std::hex << uEqId << std::dec
1226 <<
" component " << uMsCompIdx <<
"\n"
1227 <<
"If valid this index has to be added in the TOF parameter file "
1228 "in the RocIdArray field"
1230 <<
"For now we remove it from the list of components analyzed";
1239 if (kFALSE ==
ProcessStsMs(ts, uMsComp, uMsIdx))
return kFALSE;
1264 if( static_cast<Int_t>( fvdMsTime[ uMsCompIdx ] ) < static_cast<Int_t>( dMsTime ) )
1267 UInt_t uFebIdxOffset = fUnpackParSts->GetNbFebsPerDpb() * fuCurrDpbIdx;
1268 for( UInt_t uFebIdx = 0; uFebIdx < fUnpackParSts->GetNbFebsPerDpb(); ++uFebIdx )
1270 UInt_t uFebIdxInSyst = uFebIdxOffset + uFebIdx;
1273 if( 0 == fviFebTimeSecLastRateUpdate[uFebIdxInSyst] )
1275 fviFebTimeSecLastRateUpdate[uFebIdxInSyst] = static_cast<Int_t>( dMsTime );
1276 fviFebCountsSinceLastRateUpdate[uFebIdxInSyst] = 0;
1277 for( UInt_t uChan = 0; uChan < fUnpackParSts->GetNbChanPerFeb(); ++uChan )
1278 fvdFebChanCountsSinceLastRateUpdate[uFebIdxInSyst][uChan] = 0.0;
1280 } // if( 0 == fviFebTimeSecLastRateUpdate[uFebIdxInSyst] )
1282 Int_t iTimeInt = static_cast<Int_t>( dMsTime ) - fviFebTimeSecLastRateUpdate[uFebIdxInSyst];
1283 if( fiTimeIntervalRateUpdate <= iTimeInt )
1286 if( 0 == fviFebCountsSinceLastRateUpdate[uFebIdxInSyst] )
1288 fviFebTimeSecLastRateUpdate[uFebIdxInSyst] = dMsTime;
1290 } // if( 0 == fviFebCountsSinceLastRateUpdate[uFebIdxInSyst] )
1292 for( UInt_t uChan = 0; uChan < fUnpackParSts->GetNbChanPerFeb(); ++uChan )
1294 fhStsFebChanHitRateProf[uFebIdxInSyst]->Fill( uChan,
1295 fvdFebChanCountsSinceLastRateUpdate[uFebIdxInSyst][uChan] / iTimeInt );
1296 fvdFebChanCountsSinceLastRateUpdate[uFebIdxInSyst][uChan] = 0.0;
1297 } // for( UInt_t uChan = 0; uChan < fUnpackParSts->GetNbChanPerFeb(); ++uChan )
1299 fviFebTimeSecLastRateUpdate[uFebIdxInSyst] = dMsTime;
1300 fviFebCountsSinceLastRateUpdate[uFebIdxInSyst] = 0;
1301 } // if( fiTimeIntervalRateUpdate <= iTimeInt )
1302 } // for( UInt_t uFebIdx = 0; uFebIdx < fUnpackParSts->GetNbFebsPerDpb(); ++uFebIdx )
1303 } // if( static_cast<Int_t>( fvdMsTime[ uMsCompIdx ] ) < static_cast<Int_t>( dMsTime ) )
1305 // Store MS time for coincidence plots
1306 fvdMsTime[ uMsCompIdx ] = dMsTime;
1309 UInt_t uTsMsbCycleHeader = std::floor( fulCurrentMsIdx /
1310 ( stsxyter::kulTsCycleNbBins * stsxyter::kdClockCycleNs ) )
1311 - fvuInitialTsMsbCycleHeader[ fuCurrDpbIdx ];
1312 if( kFALSE == fvuInitialHeaderDone[ fuCurrDpbIdx ] )
1314 fvuInitialTsMsbCycleHeader[ fuCurrDpbIdx ] = uTsMsbCycleHeader;
1315 fvuInitialHeaderDone[ fuCurrDpbIdx ] = kTRUE;
1316 } // if( kFALSE == fvuInitialHeaderDone[ fuCurrDpbIdx ] )
1317 else if( uTsMsbCycleHeader != fvuCurrentTsMsbCycle[ fuCurrDpbIdx ] &&
1318 4194303 != fvulCurrentTsMsb[fuCurrDpbIdx] )
1320 LOG(warning) << "TS MSB cycle from MS header does not match current cycle from data "
1321 << "for TS " << std::setw( 12 ) << fulCurrentTsIdx
1322 << " MS " << std::setw( 12 ) << fulCurrentMsIdx
1323 << " MsInTs " << std::setw( 3 ) << uMsIdx
1324 << " ====> " << fvuCurrentTsMsbCycle[ fuCurrDpbIdx ]
1325 << " VS " << uTsMsbCycleHeader;
1326 fvuCurrentTsMsbCycle[ fuCurrDpbIdx ] = uTsMsbCycleHeader;
1329 // If not integer number of message in input buffer, print warning/error
1330 if( 0 != ( uSize % kuBytesPerMessage ) )
1331 LOG(error) << "The input microslice buffer does NOT "
1332 << "contain only complete nDPB messages!";
1334 // Compute the number of complete messages in the input microslice buffer
1335 uint32_t uNbMessages = ( uSize - ( uSize % kuBytesPerMessage ) )
1336 / kuBytesPerMessage;
1338 // Prepare variables for the loop on contents
1339 const uint32_t* pInBuff = reinterpret_cast<const uint32_t*>( msContent );
1341 for( uint32_t uIdx = 0; uIdx < uNbMessages; ++uIdx )
1344 uint32_t ulData = static_cast<uint32_t>( pInBuff[uIdx] );
1346 stsxyter::Message mess( static_cast< uint32_t >( ulData & 0xFFFFFFFF ) );
1348 // Print message if requested
1349 if( fbPrintMessages )
1350 mess.PrintMess( std::cout, fPrintMessCtrl );
1352 if( 1000 == fulCurrentTsIdx )
1354 mess.PrintMess( std::cout, fPrintMessCtrl );
1355 } // if( 0 == fulCurrentTsIdx )
1357 stsxyter::MessType typeMess = mess.GetMessType();
1358 fmMsgCounter[ typeMess ] ++;
1359 fhStsMessType->Fill( static_cast< uint16_t > (typeMess) );
1360 fhStsMessTypePerDpb->Fill( fuCurrDpbIdx, static_cast< uint16_t > (typeMess) );
1364 case stsxyter::MessType::Hit :
1366 // Extract the eLink and Asic indices => Should GO IN the fill method now that obly hits are link/asic specific!
1367 UShort_t usElinkIdx = mess.GetLinkIndex();
1368 UInt_t uCrobIdx = usElinkIdx / fUnpackParSts->GetNbElinkPerCrob();
1369 Int_t uFebIdx = fUnpackParSts->ElinkIdxToFebIdx( usElinkIdx );
1372 LOG(warning) << "CbmMcbm2018MonitorSts::DoUnpack => "
1373 << "Wrong elink Idx!";
1375 } // if( -1 == uFebIdx )
1377 UInt_t uAsicIdx = ( fuCurrDpbIdx * fUnpackParSts->GetNbCrobsPerDpb() + uCrobIdx
1378 ) * fUnpackParSts->GetNbAsicsPerCrob()
1379 + fUnpackParSts->ElinkIdxToAsicIdx( 1 == fviFebType[ fuCurrDpbIdx ][ uCrobIdx ][ uFebIdx ],
1382 FillHitInfo( mess, usElinkIdx, uAsicIdx, uMsIdx );
1384 } // case stsxyter::MessType::Hit :
1385 case stsxyter::MessType::TsMsb :
1387 FillTsMsbInfo( mess, uIdx, uMsIdx );
1389 } // case stsxyter::MessType::TsMsb :
1390 case stsxyter::MessType::Epoch :
1392 // The first message in the TS is a special ones: EPOCH
1393 FillEpochInfo( mess );
1396 LOG(info) << "CbmMcbm2018MonitorSts::DoUnpack => "
1397 << "EPOCH message at unexpected position in MS: message "
1398 << uIdx << " VS message 0 expected!";
1400 } // case stsxyter::MessType::TsMsb :
1401 case stsxyter::MessType::Empty :
1403// FillTsMsbInfo( mess );
1405 } // case stsxyter::MessType::Empty :
1406 case stsxyter::MessType::Dummy :
1409 } // case stsxyter::MessType::Dummy / ReadDataAck / Ack :
1412 LOG(fatal) << "CbmMcbm2018MonitorSts::DoUnpack => "
1413 << "Unknown message type, should never happen, stopping here!";
1415 } // switch( mess.GetMessType() )
1416 } // for( uint32_t uIdx = 0; uIdx < uNbMessages; ++uIdx )
1427 std::vector<stsxyter::FinalHit>::iterator itA;
1436 UShort_t usAsicIdx = (*itA).GetAsic();
1466 bHitCopyInThisMs[uAsic] = kFALSE;
1467 bHitCopySameAdcInThisMs[uAsic] = kFALSE;
1468 bFlagOnInThisMs[uAsic] = kFALSE;
1481 UShort_t usChanIdx = (*itA).GetChan();
1482 ULong64_t ulHitTs = (*itA).GetTs();
1483 UShort_t usHitAdc = (*itA).GetAdc();
1490 Bool_t bIsNotCopy = kTRUE;
1491 if (vulLastHitTs[usChanIdx] == ulHitTs) {
1492 bIsNotCopy = kFALSE;
1493 bHitCopyInThisMs[uAsic] = kTRUE;
1494 if (vusLastHitAdc[usChanIdx] == usHitAdc) bHitCopySameAdcInThisMs[uAsic] = kTRUE;
1497 vulLastHitTs[usChanIdx] = ulHitTs;
1498 vusLastHitAdc[usChanIdx] = usHitAdc;
1514 std::vector<Bool_t> vbCopyOnAnyAsicMs(
fuNbFebs, kFALSE);
1515 std::vector<Bool_t> vbCopySameAdcOnAnyAsicMs(
fuNbFebs, kFALSE);
1516 std::vector<Bool_t> vbFlagOnAnyAsicMs(
fuNbFebs, kFALSE);
1525 bHitCopyInThisMs[uAsic] ? 1.0 : 0.0);
1528 bHitCopySameAdcInThisMs[uAsic] ? 1.0 : 0.0);
1531 bFlagOnInThisMs[uAsic] ? 1.0 : 0.0);
1533 vbCopyOnAnyAsicMs[uFebIdx] = vbCopyOnAnyAsicMs[uFebIdx] || bHitCopyInThisMs[uAsic];
1534 vbCopySameAdcOnAnyAsicMs[uFebIdx] = vbCopySameAdcOnAnyAsicMs[uFebIdx] || bHitCopySameAdcInThisMs[uAsic];
1535 vbFlagOnAnyAsicMs[uFebIdx] = vbFlagOnAnyAsicMs[uFebIdx] || bFlagOnInThisMs[uAsic];
1542 for (UInt_t uFebIdx = 0; uFebIdx <
fuNbFebs; ++uFebIdx) {
1545 vbCopySameAdcOnAnyAsicMs[uFebIdx] ? 1.0 : 0.0);
1551 for (UInt_t uFebIdx = 0; uFebIdx <
fuNbFebs; ++uFebIdx) {
1569 if( -1 < fdStsFebChanLastTimeForDist[ uFebIdx ][ uChanInFebA ] )
1571 fhStsFebChanDistT[ uFebIdx ]->Fill( dHitTsA - fdStsFebChanLastTimeForDist[ uFebIdx ][ uChanInFebA ],
1573 } // if( -1 < fdStsFebChanLastTimeForDist[ uFebIdx ][ uChanInFebA ] )
1574 fdStsFebChanLastTimeForDist[ uFebIdx ][ uChanInFebA ] = dHitTsA;
1576 for( UInt_t uFebIdxB = uFebIdx; uFebIdxB < fuNbFebs; ++uFebIdxB )
1579 Bool_t bSameModulePNsides = kFALSE;
1580 Double_t dBestDtMatch = 1e9; // ns
1581 std::vector< stsxyter::FinalHit >::iterator itBestMatch;
1582 UInt_t uFebB = uFebIdxB % fUnpackParSts->GetNbFebsPerCrob();
1583 UInt_t uCrobIdxB = ( uFebIdxB / fUnpackParSts->GetNbFebsPerCrob() ) % fUnpackParSts->GetNbCrobsPerDpb();
1584 UInt_t uDpbIdxB = ( uFebIdxB / fUnpackParSts->GetNbFebsPerCrob() ) / fUnpackParSts->GetNbCrobsPerDpb();
1585 if( fviFebModuleIdx[ uDpbIdxA ][ uCrobIdxA ][ uFebA ] == fviFebModuleIdx[ uDpbIdxB ][ uCrobIdxB ][ uFebB ] &&
1586 fviFebModuleSide[ uDpbIdxA ][ uCrobIdxA ][ uFebA ] != fviFebModuleSide[ uDpbIdxB ][ uCrobIdxB ][ uFebB ] )
1587 bSameModulePNsides = kTRUE;
1589 for( itB = fvmFebHitsInMs[ uFebIdxB ].begin(); itB != fvmFebHitsInMs[ uFebIdxB ].end(); ++itB )
1591 UShort_t usAsicIdxB = (*itB).GetAsic();
1592 UShort_t usChanIdxB = (*itB).GetChan();
1593 UInt_t uChanInFebB = usChanIdxB + fUnpackParSts->GetNbChanPerAsic() * (usAsicIdxB % fUnpackParSts->GetNbAsicsPerFeb());
1595 if( uFebIdx == uFebIdxB && uChanInFebA == uChanInFebB )
1598 ULong64_t ulHitTsB = (*itB).GetTs();
1599 Double_t dHitTsB = ulHitTsB * stsxyter::kdClockCycleNs;
1600 Double_t dDtClk = static_cast< Double_t >( ulHitTsB ) - static_cast< Double_t >( ulHitTsA );
1601 Double_t dDt = dDtClk * stsxyter::kdClockCycleNs;
1603 fhStsFebChanDtCoinc[ uFebIdx ][ uFebIdxB ]->Fill( dDt );
1606 if( -1.0 * fdFebChanCoincidenceLimit < dDt )
1609 if( fdFebChanCoincidenceLimit < dDt )
1612 fhStsFebChanCoinc[ uFebIdx ][ uFebIdxB ]->Fill( uChanInFebA, uChanInFebB );
1615 if( kTRUE == bSameModulePNsides )
1618 if( TMath::Abs( dDt ) < TMath::Abs( dBestDtMatch ) )
1622 } // if( dDt < dBestDtMatch )
1623 } // if same module and opposite sides
1624 } // if( -1.0 * fdFebChanCoincidenceLimit < dDt )
1625 } // for( itB = fvmFebHitsInMs[ uFebIdxB ].begin(); itB != fvmFebHitsInMs[ uFebIdxB ].end(); ++itB )
1628 if( kTRUE == bSameModulePNsides && dBestDtMatch < fdFebChanCoincidenceLimit )
1630 UInt_t uModIdx = fviFebModuleIdx[ uDpbIdxA ][ uCrobIdxA ][ uFebA ];
1632 UShort_t usAsicIdxB = (*itB).GetAsic();
1633 UShort_t usAsicInFebB = usAsicIdxB % fUnpackParSts->GetNbAsicsPerFeb();
1634 UShort_t usChanIdxB = (*itB).GetChan();
1635 UInt_t uChanInFebB = usChanIdxB + fUnpackParSts->GetNbChanPerAsic() * usAsicInFebB;
1637 UShort_t usAdcA = (*itA).GetAdc();
1638 UShort_t usAdcB = (*itBestMatch).GetAdc();
1639 Double_t dPosX = 0.0;
1640 Double_t dPosY = 0.0;
1642 fhStsModulePNCoincDt[ uModIdx ]->Fill( dBestDtMatch );
1643 if( 0 == fviFebModuleSide[ uDpbIdxA ][ uCrobIdxA ][ uFebA ] )
1646 fUnpackParSts->ComputeModuleCoordinates( uModIdx, uChanInFebB, uChanInFebA, dPosX, dPosY );
1649 fhStsModulePNCoincChan[ uModIdx ]->Fill( uChanInFebA, uChanInFebB );
1650 fhStsModulePNCoincAdc[ uModIdx ]->Fill( usAdcA, usAdcB );
1651 fhStsModuleCoincAdcChanP[ uModIdx ]->Fill( uChanInFebA, usAdcA );
1652 fhStsModuleCoincAdcChanN[ uModIdx ]->Fill( uChanInFebB, usAdcB );
1653 fhStsModulePNCoincDtAsicP[ uModIdx ]->Fill( dBestDtMatch, usAsicInFebA );
1654 fhStsModulePNCoincDtAsicN[ uModIdx ]->Fill( dBestDtMatch, usAsicInFebB );
1655 fhStsModuleCoincMap[ uModIdx ]->Fill( dPosX, dPosY );
1656 } // if( 0 == fviFebModuleSide[ uDpbIdxA ][ uCrobIdxA ][ uFebA ] )
1660 fUnpackParSts->ComputeModuleCoordinates( uModIdx, uChanInFebA, uChanInFebB, dPosX, dPosY );
1663 fhStsModulePNCoincChan[ uModIdx ]->Fill( uChanInFebB, uChanInFebA );
1664 fhStsModulePNCoincAdc[ uModIdx ]->Fill( usAdcB, usAdcA );
1665 fhStsModuleCoincAdcChanP[ uModIdx ]->Fill( uChanInFebB, usAdcB );
1666 fhStsModuleCoincAdcChanN[ uModIdx ]->Fill( uChanInFebA, usAdcA );
1667 fhStsModulePNCoincDtAsicP[ uModIdx ]->Fill( dBestDtMatch, usAsicInFebB );
1668 fhStsModulePNCoincDtAsicN[ uModIdx ]->Fill( dBestDtMatch, usAsicInFebA );
1669 fhStsModuleCoincMap[ uModIdx ]->Fill( dPosX, dPosY );
1670 } // else of if( 0 == fviFebModuleSide[ uDpbIdxA ][ uCrobIdxA ][ uFebA ] )
1673 fhStsModuleCoincMap[ uModIdx ]->Fill( dPosX, dPosY );
1674 } // if same module and opposite sides
1675 } // for( UInt_t uFebIdxB = uFebIdx; uFebIdxB < fuNbFebs; ++uFebIdxB )
1676 } // for( itA = fvmFebHitsInMs[ uFebIdx ].begin(); itA != fvmFebHitsInMs[ uFebIdx ].end(); ++itA )
1677 } // if( kTRUE == fbEnableCoincidenceMaps )
1689 if (0 == ts.index() % 1000) {
1690 for (UInt_t uDpb = 0; uDpb <
fuNrOfDpbs; ++uDpb) {
1691 Double_t dTsMsbTime =
1697 LOG(info) <<
"End of TS " << std::setw(7) << ts.index() <<
" eDPB " << std::setw(2) << uDpb
1698 <<
" current TS MSB counter is " << std::setw(12) <<
fvulCurrentTsMsb[uDpb]
1700 <<
" current TS MSB time is " << std::setw(12) << dTsMsbTime <<
" s";
1704 if (0 == ts.index() % 10000)
SaveAllHistos(
"data/PulserPeriodicHistosSave.root");