Commit 76cacd64 authored by Pierre-Alain Loizeau's avatar Pierre-Alain Loizeau
Browse files

In STS unpack monitor, add plots and debug plots for raw stats and duplicate hits

- FIX: collision of fMonitor declared on both CbmStsUnpackAlgoBase and CbmStsUnpackAlgo (was preventing monitor usage)
- Make Debug mode of STS unpack monitor easier to control in the run_unpack_tsa.C macro
- Main plot: Ratio of DIGI/RAW per FEB
- Main plots: Share taken by each ch in each FEB for RAW, DIGIS and DUPLI
- Main plot: Ratio of DIGI/RAW for each ch in each FEB
- Main plot: Ratio of DUPLI/RAW for each ch in each FEB
- Debug plot: ADC of DUPLI for each ch in each FEB
- Debug plots: Evolution of Share taken by each ch in each FEB for RAW, DIGIS and DUPLI
- Debug plot: Evolution of Ratio of DIGI/RAW for each ch in each FEB
- Debug plot: Evolution of Ratio of DUPLI/RAW for each ch in each FEB
- FIX: Warnings in some printout
parent ac8dcbb9
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
std::shared_ptr<CbmTrdUnpackMonitor> GetTrdMonitor(std::string treefilename); std::shared_ptr<CbmTrdUnpackMonitor> GetTrdMonitor(std::string treefilename);
std::shared_ptr<CbmTrdSpadic> GetTrdSpadic(bool useAvgBaseline = false); std::shared_ptr<CbmTrdSpadic> GetTrdSpadic(bool useAvgBaseline = false);
std::shared_ptr<CbmStsUnpackMonitor> GetStsMonitor(std::string treefilename); std::shared_ptr<CbmStsUnpackMonitor> GetStsMonitor(std::string treefilename, bool bDebugMode = false);
void run_unpack_tsa(std::vector<std::string> infile = {"test.tsa"}, UInt_t runid = 0, void run_unpack_tsa(std::vector<std::string> infile = {"test.tsa"}, UInt_t runid = 0,
const char* setupName = "mcbm_beam_2021_03", std::int32_t nevents = -1, std::string outpath = "") const char* setupName = "mcbm_beam_2021_03", std::int32_t nevents = -1, std::string outpath = "")
...@@ -128,7 +128,7 @@ void run_unpack_tsa(std::vector<std::string> infile = {"test.tsa"}, UInt_t runid ...@@ -128,7 +128,7 @@ void run_unpack_tsa(std::vector<std::string> infile = {"test.tsa"}, UInt_t runid
/// Enable duplicates rejection, Ignores the ADC for duplicates check /// Enable duplicates rejection, Ignores the ADC for duplicates check
//stsconfig->SetDuplicatesRejection ( true, true ); //stsconfig->SetDuplicatesRejection ( true, true );
/// Enable Monitor plots /// Enable Monitor plots
//stsconfig->SetMonitor(GetStsMonitor(outfilename)); //stsconfig->SetMonitor(GetStsMonitor(outfilename, true));
stsconfig->SetSystemTimeOffset(-2221); // [ns] value to be updated stsconfig->SetSystemTimeOffset(-2221); // [ns] value to be updated
} }
// ------------- // -------------
...@@ -330,7 +330,7 @@ std::shared_ptr<CbmTrdSpadic> GetTrdSpadic(bool useAvgBaseline) ...@@ -330,7 +330,7 @@ std::shared_ptr<CbmTrdSpadic> GetTrdSpadic(bool useAvgBaseline)
* @brief Get the Sts Monitor. Extra function to keep default macro part more silent. * @brief Get the Sts Monitor. Extra function to keep default macro part more silent.
* @return std::shared_ptr<CbmStsUnpackMonitor> * @return std::shared_ptr<CbmStsUnpackMonitor>
*/ */
std::shared_ptr<CbmStsUnpackMonitor> GetStsMonitor(std::string treefilename) std::shared_ptr<CbmStsUnpackMonitor> GetStsMonitor(std::string treefilename, bool bDebugMode = false)
{ {
// ----- Output filename and path ------------------------------------- // ----- Output filename and path -------------------------------------
std::string outpath = ""; std::string outpath = "";
...@@ -341,8 +341,8 @@ std::shared_ptr<CbmStsUnpackMonitor> GetStsMonitor(std::string treefilename) ...@@ -341,8 +341,8 @@ std::shared_ptr<CbmStsUnpackMonitor> GetStsMonitor(std::string treefilename)
filename = treefilename.substr(filenamepos++); filename = treefilename.substr(filenamepos++);
} }
if (outpath.empty()) outpath = gSystem->GetWorkingDirectory(); if (outpath.empty()) outpath = gSystem->GetWorkingDirectory();
std::string mydir = "/qa"; //std::string mydir = "/qa";
outpath += mydir; //outpath += mydir;
auto currentdir = gSystem->GetWorkingDirectory(); auto currentdir = gSystem->GetWorkingDirectory();
...@@ -359,7 +359,7 @@ std::shared_ptr<CbmStsUnpackMonitor> GetStsMonitor(std::string treefilename) ...@@ -359,7 +359,7 @@ std::shared_ptr<CbmStsUnpackMonitor> GetStsMonitor(std::string treefilename)
auto monitor = std::make_shared<CbmStsUnpackMonitor>(); auto monitor = std::make_shared<CbmStsUnpackMonitor>();
monitor->SetHistoFileName(outfilename); monitor->SetHistoFileName(outfilename);
//monitor->SetDebugMode(true); monitor->SetDebugMode(bDebugMode);
return monitor; return monitor;
} }
......
...@@ -451,6 +451,8 @@ void CbmStsUnpackAlgo::processHitInfo(const stsxyter::Message& mess) ...@@ -451,6 +451,8 @@ void CbmStsUnpackAlgo::processHitInfo(const stsxyter::Message& mess)
// Compute the Full time stamp // Compute the Full time stamp
const uint64_t ulHitTime = getFullTimeStamp(usRawTs); const uint64_t ulHitTime = getFullTimeStamp(usRawTs);
if (fMonitor) fMonitor->CountRawHit(uFebIdx, uChanInFeb);
/// Store hit for output only if it is mapped to a module!!! /// Store hit for output only if it is mapped to a module!!!
if (0 != fviFebAddress[uFebIdx] && fdAdcCut < usRawAdc) { if (0 != fviFebAddress[uFebIdx] && fdAdcCut < usRawAdc) {
/// Store only if masking is disabled or if channeld is not masked /// Store only if masking is disabled or if channeld is not masked
...@@ -466,8 +468,10 @@ void CbmStsUnpackAlgo::processHitInfo(const stsxyter::Message& mess) ...@@ -466,8 +468,10 @@ void CbmStsUnpackAlgo::processHitInfo(const stsxyter::Message& mess)
&& fulTsMsbIndexInTs[fuCurrDpbIdx] == fvvulLastTsMsbChan[uAsicIdx][usChan]) { && fulTsMsbIndexInTs[fuCurrDpbIdx] == fvvulLastTsMsbChan[uAsicIdx][usChan]) {
/// FIXME: add plots to check what is done in this rejection /// FIXME: add plots to check what is done in this rejection
LOG(debug) << "CbmStsUnpackAlgo::processHitInfo => " LOG(debug) << "CbmStsUnpackAlgo::processHitInfo => "
<< Form("Rejecting duplicate on Asic %3d channel %3d, TS %3d, ADC %2d", uAsicIdx, usChan, usRawTs, << Form("Rejecting duplicate on Asic %3u channel %3u, TS %3u, ADC %2u", uAsicIdx, usChan, usRawTs,
usRawAdc); usRawAdc);
if (fMonitor) fMonitor->FillDuplicateHitsAdc(uFebIdx, uChanInFeb, usRawAdc);
return; return;
} // if same TS, (ADC,) TS MSB, TS MSB cycle, reject } // if same TS, (ADC,) TS MSB, TS MSB cycle, reject
fvvusLastTsChan[uAsicIdx][usChan] = usRawTs; fvvusLastTsChan[uAsicIdx][usChan] = usRawTs;
...@@ -502,6 +506,8 @@ void CbmStsUnpackAlgo::processHitInfo(const stsxyter::Message& mess) ...@@ -502,6 +506,8 @@ void CbmStsUnpackAlgo::processHitInfo(const stsxyter::Message& mess)
fviFebSide[uFebIdx]); fviFebSide[uFebIdx]);
} }
if (fMonitor) fMonitor->CountDigi(uFebIdx, uChanInFeb);
/// Catch the pulser digis and either save them to their own output or drop them /// Catch the pulser digis and either save them to their own output or drop them
if (fvbFebPulser[uFebIdx]) { if (fvbFebPulser[uFebIdx]) {
if (fOptOutAVec) { if (fOptOutAVec) {
...@@ -685,6 +691,14 @@ bool CbmStsUnpackAlgo::unpack(const fles::Timeslice* ts, std::uint16_t icomp, UI ...@@ -685,6 +691,14 @@ bool CbmStsUnpackAlgo::unpack(const fles::Timeslice* ts, std::uint16_t icomp, UI
{ {
auto msDescriptor = ts->descriptor(icomp, imslice); auto msDescriptor = ts->descriptor(icomp, imslice);
/// If monitoring enable, fill here the "Per Timeslice" histograms with info from the previous TS
/// as only way to detect TS transitions due to the multiple calls in case of multiple components.
/// Time set to tlast MS in previous TS. Last TS will be missed.
if (fMonitor && 0 == imslice && 0 < fMsStartTime && msDescriptor.idx == ts->start_time()
&& fMsStartTime < msDescriptor.idx) {
fMonitor->FillPerTimesliceCountersHistos(static_cast<double_t>(fMsStartTime) / 1e9);
}
//Current equipment ID, tells from which DPB the current MS is originating //Current equipment ID, tells from which DPB the current MS is originating
const uint32_t uCurrentEquipmentId = msDescriptor.eq_id; const uint32_t uCurrentEquipmentId = msDescriptor.eq_id;
const uint8_t* msContent = reinterpret_cast<const uint8_t*>(ts->content(icomp, imslice)); const uint8_t* msContent = reinterpret_cast<const uint8_t*>(ts->content(icomp, imslice));
......
...@@ -166,9 +166,6 @@ protected: ...@@ -166,9 +166,6 @@ protected:
bool unpack(const fles::Timeslice* ts, std::uint16_t icomp, UInt_t imslice); bool unpack(const fles::Timeslice* ts, std::uint16_t icomp, UInt_t imslice);
// Monitoring // Monitoring
/** @brief Potential (online) monitor for the unpacking process */
std::shared_ptr<CbmStsUnpackMonitor> fMonitor = nullptr;
/** @brief Current µSlice time */ /** @brief Current µSlice time */
uint64_t fMsStartTime = 0; uint64_t fMsStartTime = 0;
......
...@@ -576,7 +576,7 @@ void CbmStsUnpackAlgoLegacy::ProcessHitInfo(const stsxyter::Message& mess) ...@@ -576,7 +576,7 @@ void CbmStsUnpackAlgoLegacy::ProcessHitInfo(const stsxyter::Message& mess)
&& fvuCurrentTsMsbCycle[fuCurrDpbIdx] == fvvusLastTsMsbCycleChan[uAsicIdx][usChan]) { && fvuCurrentTsMsbCycle[fuCurrDpbIdx] == fvvusLastTsMsbCycleChan[uAsicIdx][usChan]) {
/// FIXME: add plots to check what is done in this rejection /// FIXME: add plots to check what is done in this rejection
LOG(debug) << "CbmStsUnpackAlgoLegacy::ProcessHitInfo => " LOG(debug) << "CbmStsUnpackAlgoLegacy::ProcessHitInfo => "
<< Form("Rejecting duplicate on Asic %3d channel %3d, TS %3d, MSB %d, Cycle %d, ADC %2d", uAsicIdx, << Form("Rejecting duplicate on Asic %3u channel %3u, TS %3u, MSB %lu, Cycle %u, ADC %2u", uAsicIdx,
usChan, usRawTs, fvulCurrentTsMsb[fuCurrDpbIdx], fvuCurrentTsMsbCycle[fuCurrDpbIdx], usRawAdc); usChan, usRawTs, fvulCurrentTsMsb[fuCurrDpbIdx], fvuCurrentTsMsbCycle[fuCurrDpbIdx], usRawAdc);
return; return;
} // if SMX 2.0 DPB and same TS, ADC, TS MSB, TS MSB cycle! } // if SMX 2.0 DPB and same TS, ADC, TS MSB, TS MSB cycle!
...@@ -676,7 +676,7 @@ void CbmStsUnpackAlgoLegacy::ProcessEpochInfo(const stsxyter::Message& /*mess*/) ...@@ -676,7 +676,7 @@ void CbmStsUnpackAlgoLegacy::ProcessEpochInfo(const stsxyter::Message& /*mess*/)
void CbmStsUnpackAlgoLegacy::ProcessStatusInfo(const stsxyter::Message& mess, uint32_t uIdx) void CbmStsUnpackAlgoLegacy::ProcessStatusInfo(const stsxyter::Message& mess, uint32_t uIdx)
{ {
if (fMonitor && fMonitor->GetDebugMode()) { if (fMonitor && fMonitor->GetDebugMode()) {
std::cout << Form("DPB %2u TS %12u MS %12u mess %5u ", fuCurrDpbIdx, fTsIndex, fulCurrentMsIdx, uIdx); std::cout << Form("DPB %2u TS %12lu MS %12lu mess %5u ", fuCurrDpbIdx, fTsIndex, fulCurrentMsIdx, uIdx);
mess.PrintMess(std::cout, stsxyter::MessagePrintMask::msg_print_Human); mess.PrintMess(std::cout, stsxyter::MessagePrintMask::msg_print_Human);
} }
......
/* Copyright (C) 2021 Goethe-University, Frankfurt
SPDX-License-Identifier: GPL-3.0-only
Authors: Pierre-Alain Loizeau, Pascal Raisig [committer], Dominik Smith */
#include "CbmStsUnpackMonitor.h" #include "CbmStsUnpackMonitor.h"
#include "CbmQaCanvas.h" #include "CbmQaCanvas.h"
...@@ -54,6 +58,16 @@ Bool_t CbmStsUnpackMonitor::CreateHistograms(CbmMcbm2018StsPar* pUnpackPar) ...@@ -54,6 +58,16 @@ Bool_t CbmStsUnpackMonitor::CreateHistograms(CbmMcbm2018StsPar* pUnpackPar)
const UInt_t uNbAsicsPerFeb = pUnpackPar->GetNbAsicsPerFeb(); const UInt_t uNbAsicsPerFeb = pUnpackPar->GetNbAsicsPerFeb();
const UInt_t uNbChanPerFeb = pUnpackPar->GetNbChanPerFeb(); const UInt_t uNbChanPerFeb = pUnpackPar->GetNbChanPerFeb();
/// Initialize the per timeslice counters
fvuNbRawTsFeb.resize(uNbFebs);
fvvuNbRawTsChan.resize(uNbFebs);
fvuNbDigisTsFeb.resize(uNbFebs);
fvvuNbDigisTsChan.resize(uNbFebs);
for (uint32_t uFebIdx = 0; uFebIdx < uNbFebs; ++uFebIdx) {
fvvuNbRawTsChan[uFebIdx].resize(uNbChanPerFeb, 0);
fvvuNbDigisTsChan[uFebIdx].resize(uNbChanPerFeb, 0);
}
/// Create general unpacking histograms /// Create general unpacking histograms
fhDigisTimeInRun = new TH1I("hStsDigisTimeInRun", "Digis Nb vs Time in Run; Time in run [s]; Digis Nb []", 10, 0, 1); fhDigisTimeInRun = new TH1I("hStsDigisTimeInRun", "Digis Nb vs Time in Run; Time in run [s]; Digis Nb []", 10, 0, 1);
fhDigisTimeInRun->SetCanExtend(TH1::kAllAxes); fhDigisTimeInRun->SetCanExtend(TH1::kAllAxes);
...@@ -99,6 +113,12 @@ Bool_t CbmStsUnpackMonitor::CreateHistograms(CbmMcbm2018StsPar* pUnpackPar) ...@@ -99,6 +113,12 @@ Bool_t CbmStsUnpackMonitor::CreateHistograms(CbmMcbm2018StsPar* pUnpackPar)
fhStsStatusMessType = new TH2I(sHistName, title, uNbAsics, 0, uNbAsics, 16, 0., 16.); fhStsStatusMessType = new TH2I(sHistName, title, uNbAsics, 0, uNbAsics, 16, 0., 16.);
AddHistoToVector(fhStsStatusMessType, ""); AddHistoToVector(fhStsStatusMessType, "");
/// Timeslice counter ratio Plots
sHistName = "hRawHitRatioPerFeb";
title = "Proportion of digis over raw hits in each FEB; FEB []; digis/raw [Prct]";
fhRawHitRatioPerFeb = new TProfile(sHistName, title, uNbFebs, -0.5, uNbFebs - 0.5);
AddHistoToVector(fhRawHitRatioPerFeb, "");
///++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++/// ///++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++///
UInt_t uAlignedLimit = fuLongHistoNbSeconds - (fuLongHistoNbSeconds % fuLongHistoBinSizeSec); UInt_t uAlignedLimit = fuLongHistoNbSeconds - (fuLongHistoNbSeconds % fuLongHistoBinSizeSec);
fuLongHistoBinNb = uAlignedLimit / fuLongHistoBinSizeSec; fuLongHistoBinNb = uAlignedLimit / fuLongHistoBinSizeSec;
...@@ -107,6 +127,24 @@ Bool_t CbmStsUnpackMonitor::CreateHistograms(CbmMcbm2018StsPar* pUnpackPar) ...@@ -107,6 +127,24 @@ Bool_t CbmStsUnpackMonitor::CreateHistograms(CbmMcbm2018StsPar* pUnpackPar)
/// FEB-8 plots /// FEB-8 plots
/// All histos per FEB: with channels or ASIC as axis!! /// All histos per FEB: with channels or ASIC as axis!!
for (UInt_t uFebIdx = 0; uFebIdx < uNbFebs; ++uFebIdx) { for (UInt_t uFebIdx = 0; uFebIdx < uNbFebs; ++uFebIdx) {
/// Timeslice counter ratio Plots
sHistName = Form("hRawChRatio_%03d", uFebIdx);
title = Form("Proportion of raw hits in each channel of FEB %2d; Channel []; Share of FEB raw msg [Prct]", uFebIdx);
fvhRawChRatio.push_back(new TProfile(sHistName, title, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5));
sHistName = Form("hHitChRatio_%03d", uFebIdx);
title = Form("Proportion of digis in each channel of FEB %2d; Channel []; Share of FEB digis [Prct]", uFebIdx);
fvhHitChRatio.push_back(new TProfile(sHistName, title, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5));
sHistName = Form("hDupliChRatio_%03d", uFebIdx);
title =
Form("Proportion of duplicates in each channel of FEB %2d; Channel []; Share of FEB duplicates [Prct]", uFebIdx);
fvhDupliChRatio.push_back(new TProfile(sHistName, title, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5));
sHistName = Form("hRawHitRatioPerCh_%03d", uFebIdx);
title = Form("Proportion of digis over raw hits in each channel of FEB %2d; Channel []; digis/raw [Prct]", uFebIdx);
fvhRawHitRatioPerCh.push_back(new TProfile(sHistName, title, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5));
sHistName = Form("hRawDupliRatioPerCh_%03d", uFebIdx);
title =
Form("Proportion of duplicates over raw hits in each channel of FEB %2d; Channel []; dupli/raw [Prct]", uFebIdx);
fvhRawDupliRatioPerCh.push_back(new TProfile(sHistName, title, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5));
/// Channel counts /// Channel counts
sHistName = Form("hStsFebChanCntRaw_%03u", uFebIdx); sHistName = Form("hStsFebChanCntRaw_%03u", uFebIdx);
...@@ -211,6 +249,11 @@ Bool_t CbmStsUnpackMonitor::CreateHistograms(CbmMcbm2018StsPar* pUnpackPar) ...@@ -211,6 +249,11 @@ Bool_t CbmStsUnpackMonitor::CreateHistograms(CbmMcbm2018StsPar* pUnpackPar)
title = Form("Hits per second in FEB #%03u; Time [min]; Hits []", uFebIdx); title = Form("Hits per second in FEB #%03u; Time [min]; Hits []", uFebIdx);
fvhStsFebHitRateEvoLong.push_back(new TH1D(sHistName, title, fuLongHistoBinNb, -0.5, uAlignedLimit - 0.5)); fvhStsFebHitRateEvoLong.push_back(new TH1D(sHistName, title, fuLongHistoBinNb, -0.5, uAlignedLimit - 0.5));
AddHistoToVector(fvhRawChRatio[uFebIdx], "perFeb");
AddHistoToVector(fvhHitChRatio[uFebIdx], "perFeb");
AddHistoToVector(fvhDupliChRatio[uFebIdx], "perFeb");
AddHistoToVector(fvhRawHitRatioPerCh[uFebIdx], "perFeb");
AddHistoToVector(fvhRawDupliRatioPerCh[uFebIdx], "perFeb");
AddHistoToVector(fvhStsFebChanCntRaw[uFebIdx], "perFeb"); AddHistoToVector(fvhStsFebChanCntRaw[uFebIdx], "perFeb");
AddHistoToVector(fvhStsFebChanAdcRaw[uFebIdx], "perFeb"); AddHistoToVector(fvhStsFebChanAdcRaw[uFebIdx], "perFeb");
AddHistoToVector(fvhStsFebChanAdcRawProf[uFebIdx], "perFeb"); AddHistoToVector(fvhStsFebChanAdcRawProf[uFebIdx], "perFeb");
...@@ -340,7 +383,15 @@ Bool_t CbmStsUnpackMonitor::ResetHistograms() ...@@ -340,7 +383,15 @@ Bool_t CbmStsUnpackMonitor::ResetHistograms()
fhStsAllAsicsHitRateEvo->Reset(); fhStsAllAsicsHitRateEvo->Reset();
fhStsFebAsicHitCounts->Reset(); fhStsFebAsicHitCounts->Reset();
fhStsStatusMessType->Reset(); fhStsStatusMessType->Reset();
fhRawHitRatioPerFeb->Reset();
for (UInt_t uFebIdx = 0; uFebIdx < fvhRawChRatio.size(); ++uFebIdx) {
fvhRawChRatio[uFebIdx]->Reset();
fvhHitChRatio[uFebIdx]->Reset();
fvhDupliChRatio[uFebIdx]->Reset();
fvhRawHitRatioPerCh[uFebIdx]->Reset();
fvhRawDupliRatioPerCh[uFebIdx]->Reset();
}
for (UInt_t uFebIdx = 0; uFebIdx < fvhStsFebChanCntRaw.size(); ++uFebIdx) { for (UInt_t uFebIdx = 0; uFebIdx < fvhStsFebChanCntRaw.size(); ++uFebIdx) {
fvhStsFebChanCntRaw[uFebIdx]->Reset(); fvhStsFebChanCntRaw[uFebIdx]->Reset();
} }
...@@ -397,6 +448,8 @@ Bool_t CbmStsUnpackMonitor::CreateDebugHistograms(CbmMcbm2018StsPar* pUnpackPar) ...@@ -397,6 +448,8 @@ Bool_t CbmStsUnpackMonitor::CreateDebugHistograms(CbmMcbm2018StsPar* pUnpackPar)
const UInt_t uNbAsics = pUnpackPar->GetNrOfAsics(); const UInt_t uNbAsics = pUnpackPar->GetNrOfAsics();
const UInt_t uNrOfDpbs = pUnpackPar->GetNrOfDpbs(); const UInt_t uNrOfDpbs = pUnpackPar->GetNrOfDpbs();
const UInt_t uNbChanPerAsic = pUnpackPar->GetNbChanPerAsic(); const UInt_t uNbChanPerAsic = pUnpackPar->GetNbChanPerAsic();
const UInt_t uNbFebs = pUnpackPar->GetNrOfFebs();
const UInt_t uNbChanPerFeb = pUnpackPar->GetNbChanPerFeb();
TString sHistName {""}; TString sHistName {""};
TString title {""}; TString title {""};
...@@ -457,6 +510,52 @@ Bool_t CbmStsUnpackMonitor::CreateDebugHistograms(CbmMcbm2018StsPar* pUnpackPar) ...@@ -457,6 +510,52 @@ Bool_t CbmStsUnpackMonitor::CreateDebugHistograms(CbmMcbm2018StsPar* pUnpackPar)
fhStsDpbRawTsMsbDpb->SetCanExtend(TH2::kAllAxes); fhStsDpbRawTsMsbDpb->SetCanExtend(TH2::kAllAxes);
AddHistoToVector(fhStsDpbRawTsMsbDpb, ""); AddHistoToVector(fhStsDpbRawTsMsbDpb, "");
/// Timeslice counter ratio Plots
sHistName = "hRawHitRatioEvoPerFeb";
title = "Proportion of digis over raw hits in each FEB; Time [s]; FEB []; digis/raw [Prct]";
fhRawHitRatioEvoPerFeb = new TProfile2D(sHistName, title, 600, -0.5, 599.5, uNbFebs, -0.5, uNbFebs - 0.5);
AddHistoToVector(fhRawHitRatioEvoPerFeb, "");
for (uint32_t uFebIdx = 0; uFebIdx < uNbFebs; ++uFebIdx) {
sHistName = Form("hChDupliAdc_%03d", uFebIdx);
title = Form("ADC in duplicate raw in each channel of FEB %2d; Channel []; ADC []", uFebIdx);
fvhChDupliAdc.push_back(new TH2I(sHistName, title, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5, 32, -0.5, 31.5));
sHistName = Form("hRawChRatioEvo_%03d", uFebIdx);
title = Form("Proportion of raw hits in each channel of FEB %2d; Time [s]; Channel []; Share of FEB raw msg [Prct]",
uFebIdx);
fvhRawChRatioEvo.push_back(
new TProfile2D(sHistName, title, 600, -0.5, 599.5, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5));
sHistName = Form("hHitChRatioEvo_%03d", uFebIdx);
title =
Form("Proportion of digis in each channel of FEB %2d; Time [s]; Channel []; Share of FEB digis [Prct]", uFebIdx);
fvhHitChRatioEvo.push_back(
new TProfile2D(sHistName, title, 600, -0.5, 599.5, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5));
sHistName = Form("hDupliChRatioEvo_%03d", uFebIdx);
title =
Form("Proportion of duplicates in each channel of FEB %2d; Time [s]; Channel []; Share of FEB duplicates [Prct]",
uFebIdx);
fvhDupliChRatioEvo.push_back(
new TProfile2D(sHistName, title, 600, -0.5, 599.5, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5));
sHistName = Form("hRawHitRatioEvoPerCh_%03d", uFebIdx);
title = Form("Proportion of digis over raw hits in each channel of FEB %2d; Time [s]; Channel []; digis/raw [Prct]",
uFebIdx);
fvhRawHitRatioEvoPerCh.push_back(
new TProfile2D(sHistName, title, 600, -0.5, 599.5, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5));
sHistName = Form("hRawDupliRatioEvoPerCh_%03d", uFebIdx);
title =
Form("Proportion of duplicates over raw hits in each channel of FEB %2d; Time [s]; Channel []; dupli/raw [Prct]",
uFebIdx);
fvhRawDupliRatioEvoPerCh.push_back(
new TProfile2D(sHistName, title, 600, -0.5, 599.5, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5));
AddHistoToVector(fvhChDupliAdc[uFebIdx], "perFeb");
AddHistoToVector(fvhRawChRatioEvo[uFebIdx], "perFeb");
AddHistoToVector(fvhHitChRatioEvo[uFebIdx], "perFeb");
AddHistoToVector(fvhDupliChRatioEvo[uFebIdx], "perFeb");
AddHistoToVector(fvhRawHitRatioEvoPerCh[uFebIdx], "perFeb");
AddHistoToVector(fvhRawDupliRatioEvoPerCh[uFebIdx], "perFeb");
}
/// Asic plots /// Asic plots
/// All histos per Asic: with channels or ASIC as axis!! /// All histos per Asic: with channels or ASIC as axis!!
for (UInt_t uAsicIdx = 0; uAsicIdx < uNbAsics; ++uAsicIdx) { for (UInt_t uAsicIdx = 0; uAsicIdx < uNbAsics; ++uAsicIdx) {
...@@ -512,6 +611,16 @@ Bool_t CbmStsUnpackMonitor::ResetDebugHistograms() ...@@ -512,6 +611,16 @@ Bool_t CbmStsUnpackMonitor::ResetDebugHistograms()
fhStsDpbRawTsMsb->Reset(); fhStsDpbRawTsMsb->Reset();
fhStsDpbRawTsMsbSx->Reset(); fhStsDpbRawTsMsbSx->Reset();
fhStsDpbRawTsMsbDpb->Reset(); fhStsDpbRawTsMsbDpb->Reset();
fhRawHitRatioEvoPerFeb->Reset();
for (UInt_t uFebIdx = 0; uFebIdx < fvhRawChRatioEvo.size(); ++uFebIdx) {
fvhChDupliAdc[uFebIdx]->Reset();
fvhRawChRatioEvo[uFebIdx]->Reset();
fvhHitChRatioEvo[uFebIdx]->Reset();
fvhDupliChRatioEvo[uFebIdx]->Reset();
fvhRawHitRatioEvoPerCh[uFebIdx]->Reset();
fvhRawDupliRatioEvoPerCh[uFebIdx]->Reset();
}
for (UInt_t uAsicIdx = 0; uAsicIdx < fvhStsChanCntRaw.size(); ++uAsicIdx) { for (UInt_t uAsicIdx = 0; uAsicIdx < fvhStsChanCntRaw.size(); ++uAsicIdx) {
fvhStsChanCntRaw[uAsicIdx]->Reset(); fvhStsChanCntRaw[uAsicIdx]->Reset();
...@@ -597,6 +706,80 @@ void CbmStsUnpackMonitor::FillHitEvoMonitoringHistos(const UInt_t& uFebIdx, cons ...@@ -597,6 +706,80 @@ void CbmStsUnpackMonitor::FillHitEvoMonitoringHistos(const UInt_t& uFebIdx, cons
*/ */
} }
// -------------------------------------------------------------------------
void CbmStsUnpackMonitor::FillPerTimesliceCountersHistos(double_t dTsStartTimeS)
{
if (0 == dFirstTsStartTime) dFirstTsStartTime = dTsStartTimeS;
double_t dTimeInRun = dTsStartTimeS - dFirstTsStartTime;
double_t dRatio = 0;
uint32_t uNbFebs = fvuNbRawTsFeb.size();
uint32_t uNbChansPerFeb = (uNbFebs ? fvvuNbRawTsChan[0].size() : 0);
for (uint32_t uFebIdx = 0; uFebIdx < uNbFebs; ++uFebIdx) {
uint32_t uNbDupliFeb = fvuNbRawTsFeb[uFebIdx] - fvuNbDigisTsFeb[uFebIdx];
if (fvuNbRawTsFeb[uFebIdx]) {
dRatio = fvuNbDigisTsFeb[uFebIdx] * 100.0 / fvuNbRawTsFeb[uFebIdx];
fhRawHitRatioPerFeb->Fill(uFebIdx, dRatio);
if (fDebugMode) { //
fhRawHitRatioEvoPerFeb->Fill(dTimeInRun, uFebIdx, dRatio);
}
}
for (uint32_t uChan = 0; uChan < uNbChansPerFeb; ++uChan) {
uint32_t uNbDupliChan = fvvuNbRawTsChan[uFebIdx][uChan] - fvvuNbDigisTsChan[uFebIdx][uChan];
if (fvuNbRawTsFeb[uFebIdx]) {
dRatio = fvvuNbRawTsChan[uFebIdx][uChan] * 100.0 / fvuNbRawTsFeb[uFebIdx];
fvhRawChRatio[uFebIdx]->Fill(uChan, dRatio);
if (fDebugMode) { //
fvhRawChRatioEvo[uFebIdx]->Fill(dTimeInRun, uChan, dRatio);
}
}
if (fvuNbDigisTsFeb[uFebIdx]) {
dRatio = fvvuNbDigisTsChan[uFebIdx][uChan] * 100.0 / fvuNbDigisTsFeb[uFebIdx];
fvhHitChRatio[uFebIdx]->Fill(uChan, dRatio);
if (fDebugMode) { //
fvhHitChRatioEvo[uFebIdx]->Fill(dTimeInRun, uChan, dRatio);
}
}
if (uNbDupliFeb) {
dRatio = uNbDupliChan * 100.0 / uNbDupliFeb;
fvhDupliChRatio[uFebIdx]->Fill(uChan, dRatio);
if (fDebugMode) { //
fvhDupliChRatioEvo[uFebIdx]->Fill(dTimeInRun, uChan, dRatio);
}
}
if (fvvuNbRawTsChan[uFebIdx][uChan]) {
dRatio = fvvuNbDigisTsChan[uFebIdx][uChan] * 100.0 / fvvuNbRawTsChan[uFebIdx][uChan];
fvhRawHitRatioPerCh[uFebIdx]->Fill(uChan, dRatio);
if (fDebugMode) { //
fvhRawHitRatioEvoPerCh[uFebIdx]->Fill(dTimeInRun, uChan, dRatio);
}
dRatio = uNbDupliChan * 100.0 / fvvuNbRawTsChan[uFebIdx][uChan];
fvhRawDupliRatioPerCh[uFebIdx]->Fill(uChan, dRatio);
if (fDebugMode) { //
fvhRawDupliRatioEvoPerCh[uFebIdx]->Fill(dTimeInRun, uChan, dRatio);
}
}
fvvuNbRawTsChan[uFebIdx][uChan] = 0;
fvvuNbDigisTsChan[uFebIdx][uChan] = 0;
}
fvuNbRawTsFeb[uFebIdx] = 0;
fvuNbDigisTsFeb[uFebIdx] = 0;
}
}
// -------------------------------------------------------------------------
void CbmStsUnpackMonitor::FillDuplicateHitsAdc(const uint32_t& uFebIdx, const uint32_t& uChanInFeb,
const uint16_t& usAdc)
{
if (fDebugMode) { //
fvhChDupliAdc[uFebIdx]->Fill(uChanInFeb, usAdc);
}
}
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
void CbmStsUnpackMonitor::ResetDebugInfo() void CbmStsUnpackMonitor::ResetDebugInfo()
{ {
......
// ----------------------------------------------------------------------------- /* Copyright (C) 2021 Goethe-University, Frankfurt
// ----- ----- SPDX-License-Identifier: GPL-3.0-only
// ----- CbmStsUnpackMonitor ----- Authors: Pierre-Alain Loizeau, Pascal Raisig [committer], Dominik Smith */
// ----- Created 26.01.2019 by P.-A. Loizeau -----
// ----- -----
// -----------------------------------------------------------------------------
#ifndef CbmStsUnpackMonitor_H #ifndef CbmStsUnpackMonitor_H
#define CbmStsUnpackMonitor_H #define CbmStsUnpackMonitor_H
...@@ -14,6 +11,7 @@ ...@@ -14,6 +11,7 @@
#include "TH1.h" #include "TH1.h"
#include "TH2.h" #include "TH2.h"
#include "TProfile.h" #include "TProfile.h"
#include "TProfile2D.h"
#include <cstdint> #include <cstdint>
...@@ -211,6 +209,20 @@ public: ...@@ -211,6 +209,20 @@ public:
const UInt_t& uChanInFeb, const Double_t& dTimeSinceStartSec, const UInt_t& uChanInFeb, const Double_t& dTimeSinceStartSec,
const bool& isHitMissedEvts); const bool& isHitMissedEvts);
void CountRawHit(uint32_t uFebIdx, uint32_t uChanInFeb)
{
fvuNbRawTsFeb[uFebIdx]++;
fvvuNbRawTsChan[uFebIdx][uChanInFeb]++;
}
void CountDigi(uint32_t uFebIdx, uint32_t uChanInFeb)
{
fvuNbDigisTsFeb[uFebIdx]++;
fvvuNbDigisTsChan[uFebIdx][uChanInFeb]++;
}
void FillPerTimesliceCountersHistos(double_t dTsStartTime);
void FillDuplicateHitsAdc(const uint32_t& uFebIdx, const uint32_t& uChanInFeb, const uint16_t& usAdc);
/** @brief Activate the debug mode */ /** @brief Activate the debug mode */
bool GetDebugMode() { return fDebugMode; } bool GetDebugMode() { return fDebugMode; }
...@@ -223,27 +235,41 @@ private: ...@@ -223,27 +235,41 @@ private:
TString fHistoFileName = "HistosUnpackerSts.root"; TString fHistoFileName = "HistosUnpackerSts.root";
/// Rate evolution histos /// Rate evolution histos
double_t dFirstTsStartTime = 0;
//Bool_t fbLongHistoEnable; //Bool_t fbLongHistoEnable;
UInt_t fuLongHistoNbSeconds = 3600; UInt_t fuLongHistoNbSeconds = 3600;
UInt_t fuLongHistoBinSizeSec = 10; UInt_t fuLongHistoBinSizeSec = 10;
UInt_t fuLongHistoBinNb; UInt_t fuLongHistoBinNb = 1;
/// Per timeslice counters to evaluate the eventual raw messages rejection per FEB
std::vector<uint32_t> fvuNbRawTsFeb = {};
std::vector<uint32_t> fvuNbDigisTsFeb = {};
/// Per timeslice counters to evaluate the eventual raw messages rejection per [FEB, chan] pairs
std::vector<std::vector<uint32_t>> fvvuNbRawTsChan = {};
std::vector<std::vector<uint32_t>> fvvuNbDigisTsChan = {};
/// Canvases /// Canvases
std::vector<CbmQaCanvas*> fvcStsSumm; std::vector<CbmQaCanvas*> fvcStsSumm;
std::vector<CbmQaCanvas*> fvcStsSmxErr; std::vector<CbmQaCanvas*> fvcStsSmxErr;
///General histograms ///General histograms
TH1* fhDigisTimeInRun = nullptr; TH1* fhDigisTimeInRun = nullptr;
TH1* fhVectorSize = nullptr; TH1* fhVectorSize = nullptr;
TH1* fhVectorCapacity = nullptr; TH1* fhVectorCapacity = nullptr;
TH1* fhMsCntEvo = nullptr; TH1* fhMsCntEvo = nullptr;
TH2* fhMsErrorsEvo = nullptr; TH2* fhMsErrorsEvo = nullptr;
TH2* fhStsAllFebsHitRateEvo = nullptr; TH2* fhStsAllFebsHitRateEvo = nullptr;
TH2* fhStsAllAsicsHitRateEvo = nullptr; TH2* fhStsAllAsicsHitRateEvo = nullptr;
TH2* fhStsFebAsicHitCounts = nullptr; TH2* fhStsFebAsicHitCounts = nullptr;
TH2* fhStsStatusMessType = nullptr; TH2* fhStsStatusMessType = nullptr;
TProfile* fhRawHitRatioPerFeb = nullptr;
///General "per Feb" histogram vectors ///General "per Feb" histogram vectors
std::vector<TProfile*> fvhRawChRatio = {};
std::vector<TProfile*> fvhHitChRatio = {};
std::vector<TProfile*> fvhDupliChRatio = {};
std::vector<TProfile*> fvhRawHitRatioPerCh = {};
std::vector<TProfile*> fvhRawDupliRatioPerCh = {};
std::vector<TH1*> fvhStsFebChanCntRaw; std::vector<TH1*> fvhStsFebChanCntRaw;