From 0a801eb19b326d3664080d1bade8875a1ee2410b Mon Sep 17 00:00:00 2001 From: Matthias Kleiner Date: Thu, 14 Nov 2024 11:36:20 +0100 Subject: [PATCH] TPC: add check for empty data when receiving IDCs --- .../TPCFourierTransformAggregatorSpec.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Detectors/TPC/workflow/include/TPCWorkflow/TPCFourierTransformAggregatorSpec.h b/Detectors/TPC/workflow/include/TPCWorkflow/TPCFourierTransformAggregatorSpec.h index adc43ee6d0258..956e9c899cebc 100644 --- a/Detectors/TPC/workflow/include/TPCWorkflow/TPCFourierTransformAggregatorSpec.h +++ b/Detectors/TPC/workflow/include/TPCWorkflow/TPCFourierTransformAggregatorSpec.h @@ -74,7 +74,12 @@ class TPCFourierTransformAggregatorSpec : public o2::framework::Task return; } - mCCDBBuffer[lane] = pc.inputs().get>("tsccdb"); + const auto tsTmp = pc.inputs().get>("tsccdb"); + if (tsTmp.front() == 0) { + LOGP(warning, "Received dummy data with empty timestamp"); + return; + } + mCCDBBuffer[lane] = tsTmp; if (mProcessedTimeStamp > mCCDBBuffer[lane].front()) { LOGP(warning, "Already received data from a later time stamp {} then the currently received time stamp {}! (This might not be an issue)", mProcessedTimeStamp, mCCDBBuffer[lane].front()); } else { @@ -289,6 +294,7 @@ class TPCFourierTransformAggregatorSpec : public o2::framework::Task if (eos) { // in case of eos write out everything lastValidIdx = times.empty() ? -1 : times.size() - 1; + LOGP(info, "End of stream detected: Creating IDC scalers with {} IDC objects", lastValidIdx); } // create IDC scaler in case index is valid @@ -342,7 +348,13 @@ class TPCFourierTransformAggregatorSpec : public o2::framework::Task const float deltaTime = times[i + 1].first - time.second; // if delta time is too large add dummy values if (deltaTime > (timesDuration / checkGapp)) { - const int nDummyValues = deltaTime / idcIntegrationTime + 0.5; + int nDummyValues = deltaTime / idcIntegrationTime + 0.5; + // restrict dummy values + const int nMaxDummyValues = checkGapp * timesDuration / idcIntegrationTime; + if (nDummyValues > nMaxDummyValues) { + nDummyValues = nMaxDummyValues; + } + // add dummy to A if (idc.idc1[0].size() > 0) { float meanA = std::reduce(idc.idc1[0].begin(), idc.idc1[0].end()) / static_cast(idc.idc1[0].size());