diff --git a/macro/run/run_unpack_tsa.C b/macro/run/run_unpack_tsa.C index 7e9753cb124a23b268ad1a32510c883dcf8e0c14..b317ee552625cf9e97e6c114a1e0be30a5136721 100644 --- a/macro/run/run_unpack_tsa.C +++ b/macro/run/run_unpack_tsa.C @@ -30,7 +30,7 @@ std::shared_ptr<CbmTrdUnpackMonitor> GetTrdMonitor(std::string treefilename); 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, 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 /// Enable duplicates rejection, Ignores the ADC for duplicates check //stsconfig->SetDuplicatesRejection ( true, true ); /// Enable Monitor plots - //stsconfig->SetMonitor(GetStsMonitor(outfilename)); + //stsconfig->SetMonitor(GetStsMonitor(outfilename, true)); stsconfig->SetSystemTimeOffset(-2221); // [ns] value to be updated } // ------------- @@ -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. * @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 ------------------------------------- std::string outpath = ""; @@ -341,8 +341,8 @@ std::shared_ptr<CbmStsUnpackMonitor> GetStsMonitor(std::string treefilename) filename = treefilename.substr(filenamepos++); } if (outpath.empty()) outpath = gSystem->GetWorkingDirectory(); - std::string mydir = "/qa"; - outpath += mydir; + //std::string mydir = "/qa"; + //outpath += mydir; auto currentdir = gSystem->GetWorkingDirectory(); @@ -359,7 +359,7 @@ std::shared_ptr<CbmStsUnpackMonitor> GetStsMonitor(std::string treefilename) auto monitor = std::make_shared<CbmStsUnpackMonitor>(); monitor->SetHistoFileName(outfilename); - //monitor->SetDebugMode(true); + monitor->SetDebugMode(bDebugMode); return monitor; } diff --git a/reco/detectors/sts/unpack/CbmStsUnpackAlgo.cxx b/reco/detectors/sts/unpack/CbmStsUnpackAlgo.cxx index 9c5edfe70309cdeda4d4d07c0726058cb93e623c..1b030220c20dd61ee813969ced421645e5c51940 100644 --- a/reco/detectors/sts/unpack/CbmStsUnpackAlgo.cxx +++ b/reco/detectors/sts/unpack/CbmStsUnpackAlgo.cxx @@ -451,6 +451,8 @@ void CbmStsUnpackAlgo::processHitInfo(const stsxyter::Message& mess) // Compute the Full time stamp const uint64_t ulHitTime = getFullTimeStamp(usRawTs); + if (fMonitor) fMonitor->CountRawHit(uFebIdx, uChanInFeb); + /// Store hit for output only if it is mapped to a module!!! if (0 != fviFebAddress[uFebIdx] && fdAdcCut < usRawAdc) { /// Store only if masking is disabled or if channeld is not masked @@ -466,8 +468,10 @@ void CbmStsUnpackAlgo::processHitInfo(const stsxyter::Message& mess) && fulTsMsbIndexInTs[fuCurrDpbIdx] == fvvulLastTsMsbChan[uAsicIdx][usChan]) { /// FIXME: add plots to check what is done in this rejection 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); + + if (fMonitor) fMonitor->FillDuplicateHitsAdc(uFebIdx, uChanInFeb, usRawAdc); return; } // if same TS, (ADC,) TS MSB, TS MSB cycle, reject fvvusLastTsChan[uAsicIdx][usChan] = usRawTs; @@ -502,6 +506,8 @@ void CbmStsUnpackAlgo::processHitInfo(const stsxyter::Message& mess) fviFebSide[uFebIdx]); } + if (fMonitor) fMonitor->CountDigi(uFebIdx, uChanInFeb); + /// Catch the pulser digis and either save them to their own output or drop them if (fvbFebPulser[uFebIdx]) { if (fOptOutAVec) { @@ -685,6 +691,14 @@ bool CbmStsUnpackAlgo::unpack(const fles::Timeslice* ts, std::uint16_t icomp, UI { 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 const uint32_t uCurrentEquipmentId = msDescriptor.eq_id; const uint8_t* msContent = reinterpret_cast<const uint8_t*>(ts->content(icomp, imslice)); diff --git a/reco/detectors/sts/unpack/CbmStsUnpackAlgo.h b/reco/detectors/sts/unpack/CbmStsUnpackAlgo.h index 800eb454666088c3aae7cf311db0b78d60d002ff..bb882a56a3c732acadfbce47be0d7267d9df5208 100644 --- a/reco/detectors/sts/unpack/CbmStsUnpackAlgo.h +++ b/reco/detectors/sts/unpack/CbmStsUnpackAlgo.h @@ -166,9 +166,6 @@ protected: bool unpack(const fles::Timeslice* ts, std::uint16_t icomp, UInt_t imslice); // Monitoring - /** @brief Potential (online) monitor for the unpacking process */ - std::shared_ptr<CbmStsUnpackMonitor> fMonitor = nullptr; - /** @brief Current µSlice time */ uint64_t fMsStartTime = 0; diff --git a/reco/detectors/sts/unpack/CbmStsUnpackAlgoLegacy.cxx b/reco/detectors/sts/unpack/CbmStsUnpackAlgoLegacy.cxx index 19bc9e5dade721b48a3a50d24f22dbbedf563781..097ceecedd6be1f840d0426002365c648d97ad11 100644 --- a/reco/detectors/sts/unpack/CbmStsUnpackAlgoLegacy.cxx +++ b/reco/detectors/sts/unpack/CbmStsUnpackAlgoLegacy.cxx @@ -576,7 +576,7 @@ void CbmStsUnpackAlgoLegacy::ProcessHitInfo(const stsxyter::Message& mess) && fvuCurrentTsMsbCycle[fuCurrDpbIdx] == fvvusLastTsMsbCycleChan[uAsicIdx][usChan]) { /// FIXME: add plots to check what is done in this rejection 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); return; } // 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*/) void CbmStsUnpackAlgoLegacy::ProcessStatusInfo(const stsxyter::Message& mess, uint32_t uIdx) { 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); } diff --git a/reco/detectors/sts/unpack/CbmStsUnpackMonitor.cxx b/reco/detectors/sts/unpack/CbmStsUnpackMonitor.cxx index 24b0cb526074b200a50502c9268b07b9897868aa..7a4b2d994f661fa17b3631a82add832c1e7b9f18 100644 --- a/reco/detectors/sts/unpack/CbmStsUnpackMonitor.cxx +++ b/reco/detectors/sts/unpack/CbmStsUnpackMonitor.cxx @@ -1,3 +1,7 @@ +/* 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 "CbmQaCanvas.h" @@ -54,6 +58,16 @@ Bool_t CbmStsUnpackMonitor::CreateHistograms(CbmMcbm2018StsPar* pUnpackPar) const UInt_t uNbAsicsPerFeb = pUnpackPar->GetNbAsicsPerFeb(); 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 fhDigisTimeInRun = new TH1I("hStsDigisTimeInRun", "Digis Nb vs Time in Run; Time in run [s]; Digis Nb []", 10, 0, 1); fhDigisTimeInRun->SetCanExtend(TH1::kAllAxes); @@ -99,6 +113,12 @@ Bool_t CbmStsUnpackMonitor::CreateHistograms(CbmMcbm2018StsPar* pUnpackPar) fhStsStatusMessType = new TH2I(sHistName, title, uNbAsics, 0, uNbAsics, 16, 0., 16.); 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); fuLongHistoBinNb = uAlignedLimit / fuLongHistoBinSizeSec; @@ -107,6 +127,24 @@ Bool_t CbmStsUnpackMonitor::CreateHistograms(CbmMcbm2018StsPar* pUnpackPar) /// FEB-8 plots /// All histos per FEB: with channels or ASIC as axis!! 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 sHistName = Form("hStsFebChanCntRaw_%03u", uFebIdx); @@ -211,6 +249,11 @@ Bool_t CbmStsUnpackMonitor::CreateHistograms(CbmMcbm2018StsPar* pUnpackPar) 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)); + 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(fvhStsFebChanAdcRaw[uFebIdx], "perFeb"); AddHistoToVector(fvhStsFebChanAdcRawProf[uFebIdx], "perFeb"); @@ -340,7 +383,15 @@ Bool_t CbmStsUnpackMonitor::ResetHistograms() fhStsAllAsicsHitRateEvo->Reset(); fhStsFebAsicHitCounts->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) { fvhStsFebChanCntRaw[uFebIdx]->Reset(); } @@ -397,6 +448,8 @@ Bool_t CbmStsUnpackMonitor::CreateDebugHistograms(CbmMcbm2018StsPar* pUnpackPar) const UInt_t uNbAsics = pUnpackPar->GetNrOfAsics(); const UInt_t uNrOfDpbs = pUnpackPar->GetNrOfDpbs(); const UInt_t uNbChanPerAsic = pUnpackPar->GetNbChanPerAsic(); + const UInt_t uNbFebs = pUnpackPar->GetNrOfFebs(); + const UInt_t uNbChanPerFeb = pUnpackPar->GetNbChanPerFeb(); TString sHistName {""}; TString title {""}; @@ -457,6 +510,52 @@ Bool_t CbmStsUnpackMonitor::CreateDebugHistograms(CbmMcbm2018StsPar* pUnpackPar) fhStsDpbRawTsMsbDpb->SetCanExtend(TH2::kAllAxes); 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 /// All histos per Asic: with channels or ASIC as axis!! for (UInt_t uAsicIdx = 0; uAsicIdx < uNbAsics; ++uAsicIdx) { @@ -512,6 +611,16 @@ Bool_t CbmStsUnpackMonitor::ResetDebugHistograms() fhStsDpbRawTsMsb->Reset(); fhStsDpbRawTsMsbSx->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) { fvhStsChanCntRaw[uAsicIdx]->Reset(); @@ -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() { diff --git a/reco/detectors/sts/unpack/CbmStsUnpackMonitor.h b/reco/detectors/sts/unpack/CbmStsUnpackMonitor.h index 579b7393bea6e51850188ec094c2cfd619307134..58ae412e3f5dee0968af38b9b036478c2c2c27c0 100644 --- a/reco/detectors/sts/unpack/CbmStsUnpackMonitor.h +++ b/reco/detectors/sts/unpack/CbmStsUnpackMonitor.h @@ -1,9 +1,6 @@ -// ----------------------------------------------------------------------------- -// ----- ----- -// ----- CbmStsUnpackMonitor ----- -// ----- Created 26.01.2019 by P.-A. Loizeau ----- -// ----- ----- -// ----------------------------------------------------------------------------- +/* Copyright (C) 2021 Goethe-University, Frankfurt + SPDX-License-Identifier: GPL-3.0-only + Authors: Pierre-Alain Loizeau, Pascal Raisig [committer], Dominik Smith */ #ifndef CbmStsUnpackMonitor_H #define CbmStsUnpackMonitor_H @@ -14,6 +11,7 @@ #include "TH1.h" #include "TH2.h" #include "TProfile.h" +#include "TProfile2D.h" #include <cstdint> @@ -211,6 +209,20 @@ public: const UInt_t& uChanInFeb, const Double_t& dTimeSinceStartSec, 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 */ bool GetDebugMode() { return fDebugMode; } @@ -223,27 +235,41 @@ private: TString fHistoFileName = "HistosUnpackerSts.root"; /// Rate evolution histos + double_t dFirstTsStartTime = 0; //Bool_t fbLongHistoEnable; UInt_t fuLongHistoNbSeconds = 3600; 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 std::vector<CbmQaCanvas*> fvcStsSumm; std::vector<CbmQaCanvas*> fvcStsSmxErr; ///General histograms - TH1* fhDigisTimeInRun = nullptr; - TH1* fhVectorSize = nullptr; - TH1* fhVectorCapacity = nullptr; - TH1* fhMsCntEvo = nullptr; - TH2* fhMsErrorsEvo = nullptr; - TH2* fhStsAllFebsHitRateEvo = nullptr; - TH2* fhStsAllAsicsHitRateEvo = nullptr; - TH2* fhStsFebAsicHitCounts = nullptr; - TH2* fhStsStatusMessType = nullptr; + TH1* fhDigisTimeInRun = nullptr; + TH1* fhVectorSize = nullptr; + TH1* fhVectorCapacity = nullptr; + TH1* fhMsCntEvo = nullptr; + TH2* fhMsErrorsEvo = nullptr; + TH2* fhStsAllFebsHitRateEvo = nullptr; + TH2* fhStsAllAsicsHitRateEvo = nullptr; + TH2* fhStsFebAsicHitCounts = nullptr; + TH2* fhStsStatusMessType = nullptr; + TProfile* fhRawHitRatioPerFeb = nullptr; ///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<TH2*> fvhStsFebChanAdcRaw; std::vector<TProfile*> fvhStsFebChanAdcRawProf; @@ -264,7 +290,7 @@ private: /** @brief Flag if debug mode is active or not */ bool fDebugMode = false; - ///Debugging histograms + /// Debugging histograms TH1* fhStsMessType = nullptr; TH2* fhStsMessTypePerDpb = nullptr; TH2* fhStsMessTypePerElink = nullptr; @@ -273,6 +299,14 @@ private: TH2* fhStsDpbRawTsMsbSx = nullptr; TH2* fhStsDpbRawTsMsbDpb = nullptr; + TProfile2D* fhRawHitRatioEvoPerFeb = nullptr; + std::vector<TH2*> fvhChDupliAdc = {}; + std::vector<TProfile2D*> fvhRawChRatioEvo = {}; + std::vector<TProfile2D*> fvhHitChRatioEvo = {}; + std::vector<TProfile2D*> fvhDupliChRatioEvo = {}; + std::vector<TProfile2D*> fvhRawHitRatioEvoPerCh = {}; + std::vector<TProfile2D*> fvhRawDupliRatioEvoPerCh = {}; + static const UInt_t kiMaxNbFlibLinks = 32; TH1* fvhMsSize[kiMaxNbFlibLinks]; TProfile* fvhMsSizeTime[kiMaxNbFlibLinks];