Skip to content

Commit

Permalink
TPC: add check for empty data when receiving IDCs
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias-kleiner committed Nov 14, 2024
1 parent 1fbc2d0 commit 0a801eb
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@ class TPCFourierTransformAggregatorSpec : public o2::framework::Task
return;
}

mCCDBBuffer[lane] = pc.inputs().get<std::vector<long>>("tsccdb");
const auto tsTmp = pc.inputs().get<std::vector<long>>("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 {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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<float>(idc.idc1[0].size());
Expand Down

0 comments on commit 0a801eb

Please sign in to comment.