514 TString sHistName {
""};
517 sHistName =
"hPulserMessageType";
518 title =
"Nb of message for each type; Type";
535 sHistName =
"hPulserSysMessType";
536 title =
"Nb of system message for each type; System Type";
544 sHistName =
"hPulserMessageTypePerDpb";
545 title =
"Nb of message of each type for each DPB; DPB; Type";
561 sHistName =
"hPulserSysMessTypePerDpb";
562 title =
"Nb of system message of each type for each DPB; DPB; System Type";
570 sHistName =
"hStsStatusMessType";
571 title =
"Nb of status message of each type for each DPB; ASIC; Status Type";
580 sHistName =
"hStsMsStatusFieldType";
581 title =
"For each flag in the MS header, ON/OFF counts; Flag bit []; ON/OFF; MS []";
590 sHistName =
"hStsMessTypePerElink";
591 title =
"Nb of message of each type for each DPB; DPB; Type";
601 sHistName =
"hStsHitsElinkPerDpb";
602 title =
"Nb of hit messages per eLink for each DPB; DPB; eLink; Hits nb []";
606 sHistName =
"hStsAllFebsHitRateEvo";
607 title =
"Hits per second & FEB; Time [s]; FEB []; Hits []";
611 sHistName =
"hStsAllAsicsHitRateEvo";
612 title =
"Hits per second & ASIC; Time [s]; ASIC []; Hits []";
616 sHistName =
"hStsFebAsicHitCounts";
617 title =
"Hits per FEB & ASIC; FEB []; ASIC in FEB[]; Hits []";
671 for (UInt_t uFebIdx = 0; uFebIdx <
fuNbFebs; ++uFebIdx) {
673 sHistName = Form(
"hStsFebChanCntRaw_%03u", uFebIdx);
674 title = Form(
"Hits Count per channel, FEB #%03u; Channel; Hits []", uFebIdx);
678 sHistName = Form(
"hStsFebChanCntRawGood_%03u", uFebIdx);
679 title = Form(
"Hits Count per channel in good MS (SX2 bug flag off), FEB "
680 "#%03u; Channel; Hits []",
686 sHistName = Form(
"hStsFebChanAdcRaw_%03u", uFebIdx);
687 title = Form(
"Raw Adc distribution per channel, FEB #%03u; Channel []; Adc "
695 sHistName = Form(
"hStsFebChanAdcRawProfc_%03u", uFebIdx);
696 title = Form(
"Raw Adc prodile per channel, FEB #%03u; Channel []; Adc []", uFebIdx);
701 sHistName = Form( "hStsFebChanAdcCal_%03u", uFebIdx );
702 title = Form( "Cal. Adc distribution per channel, FEB #%03u; Channel []; Adc [e-]; Hits []", uFebIdx );
703 fhStsFebChanAdcCal.push_back( new TH2I(sHistName, title,
704 fUnpackParSts->GetNbChanPerFeb(), -0.5, fUnpackParSts->GetNbChanPerFeb() - 0.5,
708 sHistName = Form( "hStsFebChanAdcCalProfc_%03u", uFebIdx );
709 title = Form( "Cal. Adc prodile per channel, FEB #%03u; Channel []; Adc [e-]", uFebIdx );
710 fhStsFebChanAdcCalProf.push_back( new TProfile(sHistName, title,
711 fUnpackParSts->GetNbChanPerFeb(), -0.5, fUnpackParSts->GetNbChanPerFeb() - 0.5 ) );
714 sHistName = Form(
"hStsFebChanRawTs_%03u", uFebIdx);
715 title = Form(
"Raw Timestamp distribution per channel, FEB #%03u; Channel "
716 "[]; Ts []; Hits []",
723 sHistName = Form(
"hStsFebChanMissEvt_%03u", uFebIdx);
724 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 []",
739 sHistName = Form(
"hStsFebAsicMissEvtEvo_%03u", uFebIdx);
740 title = Form(
"Missed Evt flags per second & StsXyter in FEB #%03u; Time "
741 "[s]; Asic []; Missed Evt flags []",
747 sHistName = Form(
"hStsFebMissEvtEvo_%03u", uFebIdx);
748 title = Form(
"Missed Evt flags per second & channel in FEB #%03u; Time "
749 "[s]; Missed Evt flags []",
754 sHistName = Form(
"hStsFebChanRateEvo_%03u", uFebIdx);
755 title = Form(
"Hits per second & channel in FEB #%03u; Time [s]; Channel []; Hits []", uFebIdx);
760 sHistName = Form(
"hStsFebChanRateProf_%03u", uFebIdx);
761 title = Form(
"Hits per second for each channel in FEB #%03u; Channel []; Hits/s []", uFebIdx);
766 sHistName = Form(
"hStsFebAsicRateEvo_%03u", uFebIdx);
767 title = Form(
"Hits per second & StsXyter in FEB #%03u; Time [s]; Asic []; Hits []", uFebIdx);
772 sHistName = Form(
"hStsFebRateEvo_%03u", uFebIdx);
773 title = Form(
"Hits per second in FEB #%03u; Time [s]; Hits []", uFebIdx);
777 sHistName = Form(
"hStsFebChanRateEvoLong_%03u", uFebIdx);
778 title = Form(
"Hits per second & channel in FEB #%03u; Time [min]; Channel []; Hits []", uFebIdx);
784 sHistName = Form(
"hStsFebAsicRateEvoLong_%03u", uFebIdx);
785 title = Form(
"Hits per second & StsXyter in FEB #%03u; Time [min]; Asic []; Hits []", uFebIdx);
791 sHistName = Form(
"hStsFebRateEvoLong_%03u", uFebIdx);
792 title = Form(
"Hits per second in FEB #%03u; Time [min]; Hits []", uFebIdx);
796 sHistName = Form(
"hStsFebChanDistT_%03u", uFebIdx);
797 title = Form(
"Time distance between hits on same channel in FEB #%03u; "
798 "Time difference [ns]; Channel []; ",
804 sHistName = Form(
"hStsFebChanCloseHitsCounts_%03u", uFebIdx);
805 title = Form(
"Hits with too small dt on same channel in FEB #%03u; Channel "
810 sHistName = Form(
"hStsFebChanCloseHitsRatio_%03u", uFebIdx);
811 title = Form(
"Ratio of Hits with too small dt on same channel in FEB "
819 fhStsFebChanDtCoinc[ uFebIdx ].resize( fuNbFebs, nullptr );
820 fhStsFebChanCoinc[ uFebIdx ].resize( fuNbFebs, nullptr );
821 for( UInt_t uFebIdxB = uFebIdx; uFebIdxB < fuNbFebs; ++uFebIdxB )
823 sHistName = Form( "hStsFebChanDtCoinc_%03u_%03u", uFebIdx, uFebIdxB );
824 title = Form( "Channel coincidences Time diff between FEB #%03u and FEB #%03u; Time difference [ns]",
826 fhStsFebChanDtCoinc[ uFebIdx ][ uFebIdxB ] = new TH1I( sHistName, title, 400, -1250., 1250.);
828 sHistName = Form( "hStsFebChanCoinc_%03u_%03u", uFebIdx, uFebIdxB );
829 title = Form( "Channel coincidences between FEB #%03u and FEB #%03u; Channel FEB #%03u []; Channel FEB #%03u []; Coinc. []",
830 uFebIdx, uFebIdxB, uFebIdx, uFebIdxB );
831 fhStsFebChanCoinc[ uFebIdx ][ uFebIdxB ] = new TH2I( sHistName, title,
832 fUnpackParSts->GetNbChanPerFeb(), -0.5, fUnpackParSts->GetNbChanPerFeb() - 0.5,
833 fUnpackParSts->GetNbChanPerFeb(), -0.5, fUnpackParSts->GetNbChanPerFeb() - 0.5 );
834 } // for( UInt_t uFebIdxB = uFebIdx; uFebIdxB < fuNbFebs; ++uFebIdxB )
841 Double_t dSensorMinX = - fUnpackParSts->GetSensorSzX() / 2.0;
842 Double_t dSensorMaxX = fUnpackParSts->GetSensorSzX() / 2.0;
843 Double_t dSensorMinY = - fUnpackParSts->GetSensorSzY() / 2.0;
844 Double_t dSensorMaxY = fUnpackParSts->GetSensorSzY() / 2.0;
845 for( UInt_t uModIdx = 0; uModIdx < fuNbModules; ++ uModIdx )
848 sHistName = Form( "hStsModulePNCoincDt_%03u", uModIdx );
849 title = Form( "Channel coincidences Time diff between P and N sides on module #%03u; Time difference [ns]",
851 fhStsModulePNCoincDt.push_back( new TH1I( sHistName, title, 400, -1250., 1250.) );
853 sHistName = Form( "hStsModulePNCoincDtAsicP_%03u", uModIdx );
854 title = Form( "Channel coincidences Time diff between P and N sides on module #%03u; Time difference [ns]; Asic on P FEB []",
856 fhStsModulePNCoincDtAsicP.push_back( new TH2I( sHistName, title,
858 fUnpackParSts->GetNbAsicsPerFeb(), -0.5, fUnpackParSts->GetNbAsicsPerFeb() - 0.5) );
860 sHistName = Form( "hStsModulePNCoincDtAsicN_%03u", uModIdx );
861 title = Form( "Channel coincidences Time diff between P and N sides on module #%03u; Time difference [ns]; Asic on P FEB []",
863 fhStsModulePNCoincDtAsicN.push_back( new TH2I( sHistName, title,
865 fUnpackParSts->GetNbAsicsPerFeb(), -0.5, fUnpackParSts->GetNbAsicsPerFeb() - 0.5) );
869 sHistName = Form( "hStsModulePNCoincChan_%03u", uModIdx );
870 title = Form( "P-N channel coincidences in module #%03u; Channel P []; Channel N []; Cnt []", uModIdx );
871 fhStsModulePNCoincChan.push_back( new TH2D( sHistName, title,
872 fUnpackParSts->GetNbChanPerFeb(), -0.5, fUnpackParSts->GetNbChanPerFeb() - 0.5,
873 fUnpackParSts->GetNbChanPerFeb(), -0.5, fUnpackParSts->GetNbChanPerFeb() - 0.5 ) );
876 sHistName = Form( "hStsModulePNCoincAdc_%03u", uModIdx );
877 title = Form( "Adc values of P-N coincidences in module #%03u; ADC Channel P [bin]; ADC Channel N [bin]; Cnt []", uModIdx );
878 fhStsModulePNCoincAdc.push_back( new TH2D( sHistName, title,
879 stsxyter::kuHitNbAdcBins, -0.5, stsxyter::kuHitNbAdcBins - 0.5,
880 stsxyter::kuHitNbAdcBins, -0.5, stsxyter::kuHitNbAdcBins - 0.5 ) );
882 sHistName = Form( "hStsModuleCoincAdcChanP_%03u", uModIdx );
883 title = Form( "Adc values of P chan in P-N coincidences in module #%03u; Channel P [bin]; ADC val. [bin]; Cnt []", uModIdx );
884 fhStsModuleCoincAdcChanP.push_back( new TH2D( sHistName, title,
885 fUnpackParSts->GetNbChanPerFeb(), -0.5, fUnpackParSts->GetNbChanPerFeb() - 0.5,
886 stsxyter::kuHitNbAdcBins, -0.5, stsxyter::kuHitNbAdcBins - 0.5 ) );
888 sHistName = Form( "hStsModuleCoincAdcChanN_%03u", uModIdx );
889 title = Form( "Adc values of N chan in P-N coincidences in module #%03u; Channel N [bin]; ADC val. [bin]; Cnt []", uModIdx );
890 fhStsModuleCoincAdcChanN.push_back( new TH2D( sHistName, title,
891 fUnpackParSts->GetNbChanPerFeb(), -0.5, fUnpackParSts->GetNbChanPerFeb() - 0.5,
892 stsxyter::kuHitNbAdcBins, -0.5, stsxyter::kuHitNbAdcBins - 0.5 ) );
895 sHistName = Form( "hStsModuleCoincMap_%03u", uModIdx );
896 title = Form( "X-Y map of P-N coincidences in module #%03u; Pos. X [mm]; Pos. Y [mm]; Cnt []", uModIdx );
897 fhStsModuleCoincMap.push_back( new TH2D( sHistName, title,
898 2*fUnpackParSts->GetSensorSzX(), 2*dSensorMinX, 2*dSensorMaxX,
899 2*fUnpackParSts->GetSensorSzY(), 2*dSensorMinY, 2*dSensorMaxY ) );
900 } // for( UInt_t uModIdx = 0; uModIdx < fuNbModules; ++ uModIdx )
907 for (UInt_t uFebIdx = 0; uFebIdx <
fuNbFebs; ++uFebIdx) {
909 sHistName = Form(
"hStsFebSmxErrRatioEvo_%03u", uFebIdx);
910 title = Form(
"Proportion of uS with SMX logic error in FEB #%03u; Time "
911 "[s]; Error MS fract. []",
916 sHistName = Form(
"hStsFebSmxErrRatioEvoAsic_%03u", uFebIdx);
917 title = Form(
"Proportion of uS with SMX logic error per ASIC in FEB "
918 "#%03u; Time [s]; ASIC []; Error MS fract. []",
925 sHistName = Form(
"hStsFebSmxErrRatioCopyEvo_%03u", uFebIdx);
926 title = Form(
"Proportion of uS with hit copies in FEB #%03u; Time [s]; "
927 "Copies MS fract. []",
932 sHistName = Form(
"hStsFebSmxErrRatioCopyEvoAsic_%03u", uFebIdx);
933 title = Form(
"Proportion of uS with hit copies per ASIC in FEB #%03u; "
934 "Time [s]; ASIC []; Copies MS fract. []",
941 sHistName = Form(
"hStsFebSmxErrRatioCopySameAdcEvo_%03u", uFebIdx);
942 title = Form(
"Proportion of uS with hit full copies in FEB #%03u; Time "
943 "[s]; Copies MS fract. []",
948 sHistName = Form(
"hStsFebSmxErrRatioCopySameAdcEvoAsic_%03u", uFebIdx);
949 title = Form(
"Proportion of uS with hit full copies per ASIC in FEB "
950 "#%03u; Time [s]; ASIC []; Copies MS fract. []",
959 fhMsErrorsEvo =
new TH2I(
"fhMsErrorsEvo",
"; MS index [s]; Error type []; Counts []", 600, 0.0, 600.0, 4, -0.5, 3.5);
969 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
983 for (UInt_t uFebIdx = 0; uFebIdx <
fuNbFebs; ++uFebIdx) {
1039 server->RegisterCommand(
"/Reset_All",
"bMcbm2018ResetSts=kTRUE");
1040 server->RegisterCommand(
"/Write_All",
"bMcbm2018WriteSts=kTRUE");
1041 server->RegisterCommand(
"/ScanNoisyCh",
"bMcbm2018ScanNoisySts=kTRUE");
1044 server->Restrict(
"/Reset_All",
"allow=admin");
1045 server->Restrict(
"/Write_All",
"allow=admin");
1046 server->Restrict(
"/ScanNoisyCh",
"allow=admin");
1056 for (UInt_t uFebIdx = 0; uFebIdx <
fuNbFebs; ++uFebIdx) {
1059 new TCanvas(Form(
"cStsSum_%03u", uFebIdx), Form(
"Summary plots for FEB %03u", uFebIdx), w,
h);
1110 server->Register(
"/canvases",
fvcStsSumm[uFebIdx]);
1114 new TCanvas(Form(
"cStsSmxErr_%03u", uFebIdx), Form(
"SMX logic error plots for FEB %03u", uFebIdx), w,
h);
1164 fcMsSizeAll =
dynamic_cast<TCanvas*
>(gROOT->FindObject(
"cMsSizeAll"));
1166 fcMsSizeAll =
new TCanvas(
"cMsSizeAll",
"Evolution of MS size in last 300 s", w,
h);
1168 LOG(info) <<
"Created MS size canvas in STS monitor";
1171 LOG(info) <<
"Recovered MS size canvas in STS monitor";
1193 LOG(debug) <<
"Timeslice contains " << ts.num_microslices(component) <<
"microslices.";
1204 for (UInt_t uMsIdx = 0; uMsIdx < uNbMsLoop; uMsIdx++) {
1205 Double_t dMsTime = (1e-9) *
static_cast<double>(ts.descriptor(
fvMsComponentsList[0], uMsIdx).idx);
1210 auto msDescriptor = ts.descriptor(uMsComp, uMsIdx);
1221 uint32_t uEqId =
static_cast<uint32_t
>(msDescriptor.eq_id & 0xFFFF);
1224 LOG(warning) <<
"Could not find the sDPB index for AFCK id 0x" << std::hex << uEqId << std::dec
1225 <<
" component " << uMsCompIdx <<
"\n"
1226 <<
"If valid this index has to be added in the TOF parameter file "
1227 "in the RocIdArray field"
1229 <<
"For now we remove it from the list of components analyzed";
1238 if (kFALSE ==
ProcessStsMs(ts, uMsComp, uMsIdx))
return kFALSE;
1263 if( static_cast<Int_t>( fvdMsTime[ uMsCompIdx ] ) < static_cast<Int_t>( dMsTime ) )
1266 UInt_t uFebIdxOffset = fUnpackParSts->GetNbFebsPerDpb() * fuCurrDpbIdx;
1267 for( UInt_t uFebIdx = 0; uFebIdx < fUnpackParSts->GetNbFebsPerDpb(); ++uFebIdx )
1269 UInt_t uFebIdxInSyst = uFebIdxOffset + uFebIdx;
1272 if( 0 == fviFebTimeSecLastRateUpdate[uFebIdxInSyst] )
1274 fviFebTimeSecLastRateUpdate[uFebIdxInSyst] = static_cast<Int_t>( dMsTime );
1275 fviFebCountsSinceLastRateUpdate[uFebIdxInSyst] = 0;
1276 for( UInt_t uChan = 0; uChan < fUnpackParSts->GetNbChanPerFeb(); ++uChan )
1277 fvdFebChanCountsSinceLastRateUpdate[uFebIdxInSyst][uChan] = 0.0;
1279 } // if( 0 == fviFebTimeSecLastRateUpdate[uFebIdxInSyst] )
1281 Int_t iTimeInt = static_cast<Int_t>( dMsTime ) - fviFebTimeSecLastRateUpdate[uFebIdxInSyst];
1282 if( fiTimeIntervalRateUpdate <= iTimeInt )
1285 if( 0 == fviFebCountsSinceLastRateUpdate[uFebIdxInSyst] )
1287 fviFebTimeSecLastRateUpdate[uFebIdxInSyst] = dMsTime;
1289 } // if( 0 == fviFebCountsSinceLastRateUpdate[uFebIdxInSyst] )
1291 for( UInt_t uChan = 0; uChan < fUnpackParSts->GetNbChanPerFeb(); ++uChan )
1293 fhStsFebChanHitRateProf[uFebIdxInSyst]->Fill( uChan,
1294 fvdFebChanCountsSinceLastRateUpdate[uFebIdxInSyst][uChan] / iTimeInt );
1295 fvdFebChanCountsSinceLastRateUpdate[uFebIdxInSyst][uChan] = 0.0;
1296 } // for( UInt_t uChan = 0; uChan < fUnpackParSts->GetNbChanPerFeb(); ++uChan )
1298 fviFebTimeSecLastRateUpdate[uFebIdxInSyst] = dMsTime;
1299 fviFebCountsSinceLastRateUpdate[uFebIdxInSyst] = 0;
1300 } // if( fiTimeIntervalRateUpdate <= iTimeInt )
1301 } // for( UInt_t uFebIdx = 0; uFebIdx < fUnpackParSts->GetNbFebsPerDpb(); ++uFebIdx )
1302 } // if( static_cast<Int_t>( fvdMsTime[ uMsCompIdx ] ) < static_cast<Int_t>( dMsTime ) )
1304 // Store MS time for coincidence plots
1305 fvdMsTime[ uMsCompIdx ] = dMsTime;
1308 UInt_t uTsMsbCycleHeader = std::floor( fulCurrentMsIdx /
1309 ( stsxyter::kulTsCycleNbBins * stsxyter::kdClockCycleNs ) )
1310 - fvuInitialTsMsbCycleHeader[ fuCurrDpbIdx ];
1311 if( kFALSE == fvuInitialHeaderDone[ fuCurrDpbIdx ] )
1313 fvuInitialTsMsbCycleHeader[ fuCurrDpbIdx ] = uTsMsbCycleHeader;
1314 fvuInitialHeaderDone[ fuCurrDpbIdx ] = kTRUE;
1315 } // if( kFALSE == fvuInitialHeaderDone[ fuCurrDpbIdx ] )
1316 else if( uTsMsbCycleHeader != fvuCurrentTsMsbCycle[ fuCurrDpbIdx ] &&
1317 4194303 != fvulCurrentTsMsb[fuCurrDpbIdx] )
1319 LOG(warning) << "TS MSB cycle from MS header does not match current cycle from data "
1320 << "for TS " << std::setw( 12 ) << fulCurrentTsIdx
1321 << " MS " << std::setw( 12 ) << fulCurrentMsIdx
1322 << " MsInTs " << std::setw( 3 ) << uMsIdx
1323 << " ====> " << fvuCurrentTsMsbCycle[ fuCurrDpbIdx ]
1324 << " VS " << uTsMsbCycleHeader;
1325 fvuCurrentTsMsbCycle[ fuCurrDpbIdx ] = uTsMsbCycleHeader;
1328 // If not integer number of message in input buffer, print warning/error
1329 if( 0 != ( uSize % kuBytesPerMessage ) )
1330 LOG(error) << "The input microslice buffer does NOT "
1331 << "contain only complete nDPB messages!";
1333 // Compute the number of complete messages in the input microslice buffer
1334 uint32_t uNbMessages = ( uSize - ( uSize % kuBytesPerMessage ) )
1335 / kuBytesPerMessage;
1337 // Prepare variables for the loop on contents
1338 const uint32_t* pInBuff = reinterpret_cast<const uint32_t*>( msContent );
1340 for( uint32_t uIdx = 0; uIdx < uNbMessages; ++uIdx )
1343 uint32_t ulData = static_cast<uint32_t>( pInBuff[uIdx] );
1345 stsxyter::Message mess( static_cast< uint32_t >( ulData & 0xFFFFFFFF ) );
1347 // Print message if requested
1348 if( fbPrintMessages )
1349 mess.PrintMess( std::cout, fPrintMessCtrl );
1351 if( 1000 == fulCurrentTsIdx )
1353 mess.PrintMess( std::cout, fPrintMessCtrl );
1354 } // if( 0 == fulCurrentTsIdx )
1356 stsxyter::MessType typeMess = mess.GetMessType();
1357 fmMsgCounter[ typeMess ] ++;
1358 fhStsMessType->Fill( static_cast< uint16_t > (typeMess) );
1359 fhStsMessTypePerDpb->Fill( fuCurrDpbIdx, static_cast< uint16_t > (typeMess) );
1363 case stsxyter::MessType::Hit :
1365 // Extract the eLink and Asic indices => Should GO IN the fill method now that obly hits are link/asic specific!
1366 UShort_t usElinkIdx = mess.GetLinkIndex();
1367 UInt_t uCrobIdx = usElinkIdx / fUnpackParSts->GetNbElinkPerCrob();
1368 Int_t uFebIdx = fUnpackParSts->ElinkIdxToFebIdx( usElinkIdx );
1371 LOG(warning) << "CbmMcbm2018MonitorSts::DoUnpack => "
1372 << "Wrong elink Idx!";
1374 } // if( -1 == uFebIdx )
1376 UInt_t uAsicIdx = ( fuCurrDpbIdx * fUnpackParSts->GetNbCrobsPerDpb() + uCrobIdx
1377 ) * fUnpackParSts->GetNbAsicsPerCrob()
1378 + fUnpackParSts->ElinkIdxToAsicIdx( 1 == fviFebType[ fuCurrDpbIdx ][ uCrobIdx ][ uFebIdx ],
1381 FillHitInfo( mess, usElinkIdx, uAsicIdx, uMsIdx );
1383 } // case stsxyter::MessType::Hit :
1384 case stsxyter::MessType::TsMsb :
1386 FillTsMsbInfo( mess, uIdx, uMsIdx );
1388 } // case stsxyter::MessType::TsMsb :
1389 case stsxyter::MessType::Epoch :
1391 // The first message in the TS is a special ones: EPOCH
1392 FillEpochInfo( mess );
1395 LOG(info) << "CbmMcbm2018MonitorSts::DoUnpack => "
1396 << "EPOCH message at unexpected position in MS: message "
1397 << uIdx << " VS message 0 expected!";
1399 } // case stsxyter::MessType::TsMsb :
1400 case stsxyter::MessType::Empty :
1402// FillTsMsbInfo( mess );
1404 } // case stsxyter::MessType::Empty :
1405 case stsxyter::MessType::Dummy :
1408 } // case stsxyter::MessType::Dummy / ReadDataAck / Ack :
1411 LOG(fatal) << "CbmMcbm2018MonitorSts::DoUnpack => "
1412 << "Unknown message type, should never happen, stopping here!";
1414 } // switch( mess.GetMessType() )
1415 } // for( uint32_t uIdx = 0; uIdx < uNbMessages; ++uIdx )
1426 std::vector<stsxyter::FinalHit>::iterator itA;
1435 UShort_t usAsicIdx = (*itA).GetAsic();
1439 UShort_t usFebIdx = usAsicIdx /
fUnpackParSts->GetNbAsicsPerFeb();
1465 bHitCopyInThisMs[uAsic] = kFALSE;
1466 bHitCopySameAdcInThisMs[uAsic] = kFALSE;
1467 bFlagOnInThisMs[uAsic] = kFALSE;
1473 UInt_t uAsicInFeb = uAsic %
fUnpackParSts->GetNbAsicsPerFeb();
1475 std::vector<ULong64_t> vulLastHitTs(
fUnpackParSts->GetNbChanPerAsic(), 0);
1476 std::vector<UShort_t> vusLastHitAdc(
fUnpackParSts->GetNbChanPerAsic(), 0);
1480 UShort_t usChanIdx = (*itA).GetChan();
1481 ULong64_t ulHitTs = (*itA).GetTs();
1482 UShort_t usHitAdc = (*itA).GetAdc();
1484 UInt_t uChanInFeb = usChanIdx +
fUnpackParSts->GetNbChanPerAsic() * uAsicInFeb;
1489 Bool_t bIsNotCopy = kTRUE;
1490 if (vulLastHitTs[usChanIdx] == ulHitTs) {
1491 bIsNotCopy = kFALSE;
1492 bHitCopyInThisMs[uAsic] = kTRUE;
1493 if (vusLastHitAdc[usChanIdx] == usHitAdc) bHitCopySameAdcInThisMs[uAsic] = kTRUE;
1496 vulLastHitTs[usChanIdx] = ulHitTs;
1497 vusLastHitAdc[usChanIdx] = usHitAdc;
1513 std::vector<Bool_t> vbCopyOnAnyAsicMs(
fuNbFebs, kFALSE);
1514 std::vector<Bool_t> vbCopySameAdcOnAnyAsicMs(
fuNbFebs, kFALSE);
1515 std::vector<Bool_t> vbFlagOnAnyAsicMs(
fuNbFebs, kFALSE);
1521 UInt_t uAsicInFeb = uAsic %
fUnpackParSts->GetNbAsicsPerFeb();
1524 bHitCopyInThisMs[uAsic] ? 1.0 : 0.0);
1527 bHitCopySameAdcInThisMs[uAsic] ? 1.0 : 0.0);
1530 bFlagOnInThisMs[uAsic] ? 1.0 : 0.0);
1532 vbCopyOnAnyAsicMs[uFebIdx] = vbCopyOnAnyAsicMs[uFebIdx] || bHitCopyInThisMs[uAsic];
1533 vbCopySameAdcOnAnyAsicMs[uFebIdx] = vbCopySameAdcOnAnyAsicMs[uFebIdx] || bHitCopySameAdcInThisMs[uAsic];
1534 vbFlagOnAnyAsicMs[uFebIdx] = vbFlagOnAnyAsicMs[uFebIdx] || bFlagOnInThisMs[uAsic];
1541 for (UInt_t uFebIdx = 0; uFebIdx <
fuNbFebs; ++uFebIdx) {
1544 vbCopySameAdcOnAnyAsicMs[uFebIdx] ? 1.0 : 0.0);
1550 for (UInt_t uFebIdx = 0; uFebIdx <
fuNbFebs; ++uFebIdx) {
1568 if( -1 < fdStsFebChanLastTimeForDist[ uFebIdx ][ uChanInFebA ] )
1570 fhStsFebChanDistT[ uFebIdx ]->Fill( dHitTsA - fdStsFebChanLastTimeForDist[ uFebIdx ][ uChanInFebA ],
1572 } // if( -1 < fdStsFebChanLastTimeForDist[ uFebIdx ][ uChanInFebA ] )
1573 fdStsFebChanLastTimeForDist[ uFebIdx ][ uChanInFebA ] = dHitTsA;
1575 for( UInt_t uFebIdxB = uFebIdx; uFebIdxB < fuNbFebs; ++uFebIdxB )
1578 Bool_t bSameModulePNsides = kFALSE;
1579 Double_t dBestDtMatch = 1e9; // ns
1580 std::vector< stsxyter::FinalHit >::iterator itBestMatch;
1581 UInt_t uFebB = uFebIdxB % fUnpackParSts->GetNbFebsPerCrob();
1582 UInt_t uCrobIdxB = ( uFebIdxB / fUnpackParSts->GetNbFebsPerCrob() ) % fUnpackParSts->GetNbCrobsPerDpb();
1583 UInt_t uDpbIdxB = ( uFebIdxB / fUnpackParSts->GetNbFebsPerCrob() ) / fUnpackParSts->GetNbCrobsPerDpb();
1584 if( fviFebModuleIdx[ uDpbIdxA ][ uCrobIdxA ][ uFebA ] == fviFebModuleIdx[ uDpbIdxB ][ uCrobIdxB ][ uFebB ] &&
1585 fviFebModuleSide[ uDpbIdxA ][ uCrobIdxA ][ uFebA ] != fviFebModuleSide[ uDpbIdxB ][ uCrobIdxB ][ uFebB ] )
1586 bSameModulePNsides = kTRUE;
1588 for( itB = fvmFebHitsInMs[ uFebIdxB ].begin(); itB != fvmFebHitsInMs[ uFebIdxB ].end(); ++itB )
1590 UShort_t usAsicIdxB = (*itB).GetAsic();
1591 UShort_t usChanIdxB = (*itB).GetChan();
1592 UInt_t uChanInFebB = usChanIdxB + fUnpackParSts->GetNbChanPerAsic() * (usAsicIdxB % fUnpackParSts->GetNbAsicsPerFeb());
1594 if( uFebIdx == uFebIdxB && uChanInFebA == uChanInFebB )
1597 ULong64_t ulHitTsB = (*itB).GetTs();
1598 Double_t dHitTsB = ulHitTsB * stsxyter::kdClockCycleNs;
1599 Double_t dDtClk = static_cast< Double_t >( ulHitTsB ) - static_cast< Double_t >( ulHitTsA );
1600 Double_t dDt = dDtClk * stsxyter::kdClockCycleNs;
1602 fhStsFebChanDtCoinc[ uFebIdx ][ uFebIdxB ]->Fill( dDt );
1605 if( -1.0 * fdFebChanCoincidenceLimit < dDt )
1608 if( fdFebChanCoincidenceLimit < dDt )
1611 fhStsFebChanCoinc[ uFebIdx ][ uFebIdxB ]->Fill( uChanInFebA, uChanInFebB );
1614 if( kTRUE == bSameModulePNsides )
1617 if( TMath::Abs( dDt ) < TMath::Abs( dBestDtMatch ) )
1621 } // if( dDt < dBestDtMatch )
1622 } // if same module and opposite sides
1623 } // if( -1.0 * fdFebChanCoincidenceLimit < dDt )
1624 } // for( itB = fvmFebHitsInMs[ uFebIdxB ].begin(); itB != fvmFebHitsInMs[ uFebIdxB ].end(); ++itB )
1627 if( kTRUE == bSameModulePNsides && dBestDtMatch < fdFebChanCoincidenceLimit )
1629 UInt_t uModIdx = fviFebModuleIdx[ uDpbIdxA ][ uCrobIdxA ][ uFebA ];
1631 UShort_t usAsicIdxB = (*itB).GetAsic();
1632 UShort_t usAsicInFebB = usAsicIdxB % fUnpackParSts->GetNbAsicsPerFeb();
1633 UShort_t usChanIdxB = (*itB).GetChan();
1634 UInt_t uChanInFebB = usChanIdxB + fUnpackParSts->GetNbChanPerAsic() * usAsicInFebB;
1636 UShort_t usAdcA = (*itA).GetAdc();
1637 UShort_t usAdcB = (*itBestMatch).GetAdc();
1638 Double_t dPosX = 0.0;
1639 Double_t dPosY = 0.0;
1641 fhStsModulePNCoincDt[ uModIdx ]->Fill( dBestDtMatch );
1642 if( 0 == fviFebModuleSide[ uDpbIdxA ][ uCrobIdxA ][ uFebA ] )
1645 fUnpackParSts->ComputeModuleCoordinates( uModIdx, uChanInFebB, uChanInFebA, dPosX, dPosY );
1648 fhStsModulePNCoincChan[ uModIdx ]->Fill( uChanInFebA, uChanInFebB );
1649 fhStsModulePNCoincAdc[ uModIdx ]->Fill( usAdcA, usAdcB );
1650 fhStsModuleCoincAdcChanP[ uModIdx ]->Fill( uChanInFebA, usAdcA );
1651 fhStsModuleCoincAdcChanN[ uModIdx ]->Fill( uChanInFebB, usAdcB );
1652 fhStsModulePNCoincDtAsicP[ uModIdx ]->Fill( dBestDtMatch, usAsicInFebA );
1653 fhStsModulePNCoincDtAsicN[ uModIdx ]->Fill( dBestDtMatch, usAsicInFebB );
1654 fhStsModuleCoincMap[ uModIdx ]->Fill( dPosX, dPosY );
1655 } // if( 0 == fviFebModuleSide[ uDpbIdxA ][ uCrobIdxA ][ uFebA ] )
1659 fUnpackParSts->ComputeModuleCoordinates( uModIdx, uChanInFebA, uChanInFebB, dPosX, dPosY );
1662 fhStsModulePNCoincChan[ uModIdx ]->Fill( uChanInFebB, uChanInFebA );
1663 fhStsModulePNCoincAdc[ uModIdx ]->Fill( usAdcB, usAdcA );
1664 fhStsModuleCoincAdcChanP[ uModIdx ]->Fill( uChanInFebB, usAdcB );
1665 fhStsModuleCoincAdcChanN[ uModIdx ]->Fill( uChanInFebA, usAdcA );
1666 fhStsModulePNCoincDtAsicP[ uModIdx ]->Fill( dBestDtMatch, usAsicInFebB );
1667 fhStsModulePNCoincDtAsicN[ uModIdx ]->Fill( dBestDtMatch, usAsicInFebA );
1668 fhStsModuleCoincMap[ uModIdx ]->Fill( dPosX, dPosY );
1669 } // else of if( 0 == fviFebModuleSide[ uDpbIdxA ][ uCrobIdxA ][ uFebA ] )
1672 fhStsModuleCoincMap[ uModIdx ]->Fill( dPosX, dPosY );
1673 } // if same module and opposite sides
1674 } // for( UInt_t uFebIdxB = uFebIdx; uFebIdxB < fuNbFebs; ++uFebIdxB )
1675 } // for( itA = fvmFebHitsInMs[ uFebIdx ].begin(); itA != fvmFebHitsInMs[ uFebIdx ].end(); ++itA )
1676 } // if( kTRUE == fbEnableCoincidenceMaps )
1688 if (0 == ts.index() % 1000) {
1689 for (UInt_t uDpb = 0; uDpb <
fuNrOfDpbs; ++uDpb) {
1690 Double_t dTsMsbTime =
1696 LOG(info) <<
"End of TS " << std::setw(7) << ts.index() <<
" eDPB " << std::setw(2) << uDpb
1697 <<
" current TS MSB counter is " << std::setw(12) <<
fvulCurrentTsMsb[uDpb]
1699 <<
" current TS MSB time is " << std::setw(12) << dTsMsbTime <<
" s";
1703 if (0 == ts.index() % 10000)
SaveAllHistos(
"data/PulserPeriodicHistosSave.root");
1710 auto msDescriptor = ts.descriptor(uMsComp, uMsIdx);
1712 const uint8_t* msContent =
reinterpret_cast<const uint8_t*
>(ts.content(uMsComp, uMsIdx));
1732 LOG(warning) <<
"Could not find the sDPB index for AFCK id 0x" << std::hex <<
fuCurrentEquipmentId << std::dec
1733 <<
" component " << uMsComp <<
"\n"
1734 <<
"If valid this index has to be added in the TOF parameter file in "
1735 "the RocIdArray field"
1737 <<
"For now we remove it from the list of components analyzed";
1745 uint32_t uSize = msDescriptor.size;
1749 <<
" has size: " << uSize;
1756 fhMsSz[uMsComp]->Fill(uSize);
1764 for (UInt_t uFebIdx = 0; uFebIdx <
fUnpackParSts->GetNbFebsPerDpb(); ++uFebIdx) {
1765 UInt_t uFebIdxInSyst = uFebIdxOffset + uFebIdx;
1771 for (UInt_t uChan = 0; uChan <
fUnpackParSts->GetNbChanPerFeb(); ++uChan)
1784 for (UInt_t uChan = 0; uChan <
fUnpackParSts->GetNbChanPerFeb(); ++uChan) {
1800// if( 0 == fuCurrDpbIdx && fulCurrentTsIdx < 100 )
1801 if( fulCurrentTsIdx < 100 )
1802 LOG(info) << "TS " << std::setw( 12 ) << fulCurrentTsIdx
1803 << " MS " << std::setw( 12 ) << fulCurrentMsIdx
1804 << " MsInTs " << std::setw( 3 ) << uMsIdx
1805 << " DPB " << fuCurrDpbIdx;
1809 uint16_t uMsHeaderFlags = msDescriptor.flags;
1810 for (UInt_t uBit = 0; uBit < 16; ++uBit)
1827 else if (0 == uMsIdx) {
1830 <<
" MS Idx " << std::setw(4) << uMsIdx <<
" Msg Idx " << std::setw(5) << 0 <<
" DPB " << std::setw(2)
1837 LOG(warning) <<
"TS MSB cycle from MS header does not match current cycle from data "
1840 << uTsMsbCycleHeader;
1847 <<
" MS Idx " << std::setw(4) << uMsIdx <<
" Msg Idx " << std::setw(5) << 0 <<
" DPB " << std::setw(2)
1852 LOG(warning) <<
"TS MSB cycle from MS header does not match current cycle from data "
1855 <<
" (cnt) VS " << uTsMsbCycleHeader <<
" (header)";
1862 LOG(error) <<
"The input microslice buffer does NOT "
1863 <<
"contain only complete nDPB messages!";
1869 const uint32_t* pInBuff =
reinterpret_cast<const uint32_t*
>(msContent);
1871 for (uint32_t uIdx = 0; uIdx < uNbMessages; ++uIdx) {
1873 uint32_t ulData =
static_cast<uint32_t
>(pInBuff[uIdx]);
1899 static_cast<uint16_t
>(typeMess));
1903 if( ( 0 == fuCurrDpbIdx || 13 < usElinkIdx ) && fulCurrentTsIdx < 100 )
1904 mess.PrintMess( std::cout, stsxyter::MessagePrintMask::msg_print_Hex | stsxyter::MessagePrintMask::msg_print_Human );
1907 UInt_t uCrobIdx = usElinkIdx /
fUnpackParSts->GetNbElinkPerCrob();
1910 if (-1 == uFebIdx) {
1911 LOG(warning) <<
"CbmMcbm2018MonitorSts::DoUnpack => "
1912 <<
"Wrong elink Idx! Elink raw " << Form(
"%d remap %d", usElinkIdx, uFebIdx);
1936 LOG(info) <<
"CbmMcbm2018MonitorSts::DoUnpack => "
1937 <<
"EPOCH message at unexpected position in MS: message " << uIdx <<
" VS message 0 expected!";
1943 static_cast<uint16_t
>(typeMess));
1946 if( ( 0 == fuCurrDpbIdx || 13 < usElinkIdx ) && fulCurrentTsIdx < 100 )
1947 mess.PrintMess( std::cout, stsxyter::MessagePrintMask::msg_print_Hex | stsxyter::MessagePrintMask::msg_print_Human );
1950 UInt_t uCrobIdx = usElinkIdx /
fUnpackParSts->GetNbElinkPerCrob();
1990 LOG(fatal) <<
"CbmMcbm2018MonitorSts::DoUnpack => "
1991 <<
"Unknown message type, should never happen, stopping "
1992 "here! Type found was: "
1993 <<
static_cast<int>(typeMess);