Skip to content

Commit 19fd697

Browse files
matthias-kleinerwiechula
authored andcommitted
TPC: add check for empty data when receiving IDCs
1 parent 9fa6915 commit 19fd697

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

Detectors/TPC/workflow/include/TPCWorkflow/TPCFourierTransformAggregatorSpec.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,12 @@ class TPCFourierTransformAggregatorSpec : public o2::framework::Task
7474
return;
7575
}
7676

77-
mCCDBBuffer[lane] = pc.inputs().get<std::vector<long>>("tsccdb");
77+
const auto tsTmp = pc.inputs().get<std::vector<long>>("tsccdb");
78+
if (tsTmp.front() == 0) {
79+
LOGP(warning, "Received dummy data with empty timestamp");
80+
return;
81+
}
82+
mCCDBBuffer[lane] = tsTmp;
7883
if (mProcessedTimeStamp > mCCDBBuffer[lane].front()) {
7984
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());
8085
} else {
@@ -289,6 +294,7 @@ class TPCFourierTransformAggregatorSpec : public o2::framework::Task
289294
if (eos) {
290295
// in case of eos write out everything
291296
lastValidIdx = times.empty() ? -1 : times.size() - 1;
297+
LOGP(info, "End of stream detected: Creating IDC scalers with {} IDC objects", lastValidIdx);
292298
}
293299

294300
// create IDC scaler in case index is valid
@@ -342,7 +348,13 @@ class TPCFourierTransformAggregatorSpec : public o2::framework::Task
342348
const float deltaTime = times[i + 1].first - time.second;
343349
// if delta time is too large add dummy values
344350
if (deltaTime > (timesDuration / checkGapp)) {
345-
const int nDummyValues = deltaTime / idcIntegrationTime + 0.5;
351+
int nDummyValues = deltaTime / idcIntegrationTime + 0.5;
352+
// restrict dummy values
353+
const int nMaxDummyValues = checkGapp * timesDuration / idcIntegrationTime;
354+
if (nDummyValues > nMaxDummyValues) {
355+
nDummyValues = nMaxDummyValues;
356+
}
357+
346358
// add dummy to A
347359
if (idc.idc1[0].size() > 0) {
348360
float meanA = std::reduce(idc.idc1[0].begin(), idc.idc1[0].end()) / static_cast<float>(idc.idc1[0].size());

0 commit comments

Comments
 (0)