From fefab4d5943d9c84a1519c0e15d427aed9724aa0 Mon Sep 17 00:00:00 2001 From: shahoian Date: Mon, 23 Nov 2026 00:10:04 +0100 Subject: [PATCH] Allow pipelinining in readers In order to be able to run multiple lanes of the reader, it should not assume the event to read as a previous entry + 1, but use the TimingInfo.slice as a tree entry to read. Condition to issue EoS becomes currentEntry + NLanes >= NEntries. --- Detectors/CPV/workflow/src/ClusterReaderSpec.cxx | 8 +++++--- Detectors/CPV/workflow/src/DigitReaderSpec.cxx | 8 +++++--- Detectors/CTP/workflowIO/src/DigitReaderSpec.cxx | 8 +++++--- .../FIT/FDD/workflow/src/DigitReaderSpec.cxx | 8 +++++--- .../FIT/FDD/workflow/src/RecPointReaderSpec.cxx | 8 +++++--- .../FIT/FT0/workflow/src/DigitReaderSpec.cxx | 8 +++++--- .../FIT/FT0/workflow/src/RecPointReaderSpec.cxx | 8 +++++--- .../FIT/FV0/workflow/src/DigitReaderSpec.cxx | 8 +++++--- .../FIT/FV0/workflow/src/RecPointReaderSpec.cxx | 8 +++++--- .../FITWorkflow/FITIntegrateClusterReaderSpec.h | 15 ++++++++++++--- Detectors/Filtering/src/FilteredTFReaderSpec.cxx | 8 +++++--- .../readers/src/GlobalFwdTrackReaderSpec.cxx | 8 +++++--- .../readers/src/IRFrameReaderSpec.cxx | 8 +++++--- .../readers/src/MatchedMCHMIDReaderSpec.cxx | 8 +++++--- .../readers/src/MatchedMFTMCHReaderSpec.cxx | 8 +++++--- .../readers/src/PrimaryVertexReaderSpec.cxx | 8 +++++--- .../readers/src/SecondaryVertexReaderSpec.cxx | 8 +++++--- .../readers/src/StrangenessTrackingReaderSpec.cxx | 8 +++++--- .../src/TrackCosmicsExtendedReaderSpec.cxx | 8 +++++--- .../readers/src/TrackCosmicsReaderSpec.cxx | 8 +++++--- .../readers/src/TrackTPCITSReaderSpec.cxx | 8 +++++--- .../src/TPCUnbinnedResidualReaderSpec.cxx | 13 ++++++++++--- .../HMPID/workflow/src/ClustersReaderSpec.cxx | 8 +++++--- Detectors/HMPID/workflow/src/DigitsReaderSpec.cxx | 8 +++++--- .../HMPID/workflow/src/HMPMatchedReaderSpec.cxx | 13 ++++++++++--- .../ITSMFT/ITS/workflow/src/TrackReaderSpec.cxx | 8 +++++--- .../ITSMFT/ITS/workflow/src/VertexReaderSpec.cxx | 8 +++++--- .../ITSMFT/MFT/workflow/src/TrackReaderSpec.cxx | 8 +++++--- .../common/workflow/src/ClusterReaderSpec.cxx | 8 +++++--- .../common/workflow/src/DigitReaderSpec.cxx | 8 +++++--- Detectors/PHOS/workflow/src/CellReaderSpec.cxx | 8 +++++--- Detectors/PHOS/workflow/src/DigitReaderSpec.cxx | 8 +++++--- .../TOF/workflowIO/src/CalibClusReaderSpec.cxx | 8 +++++--- .../TOF/workflowIO/src/ClusterReaderSpec.cxx | 8 +++++--- Detectors/TOF/workflowIO/src/DigitReaderSpec.cxx | 15 +++++++++++---- .../src/TOFIntegrateClusterReaderSpec.cxx | 15 ++++++++++++--- .../TOF/workflowIO/src/TOFMatchedReaderSpec.cxx | 13 ++++++++++--- .../TPC/workflow/readers/src/TrackReaderSpec.cxx | 8 +++++--- .../workflow/readers/src/TriggerReaderSpec.cxx | 12 ++++++++++-- .../TRD/workflow/io/src/TRDCalibReaderSpec.cxx | 13 ++++++++++--- .../TRD/workflow/io/src/TRDDigitReaderSpec.cxx | 13 ++++++++++--- Detectors/TRD/workflow/io/src/TRDPHReaderSpec.cxx | 13 ++++++++++--- .../TRD/workflow/io/src/TRDTrackReaderSpec.cxx | 8 +++++--- .../TRD/workflow/io/src/TRDTrackletReaderSpec.cxx | 13 ++++++++++--- .../IOTOF/workflow/src/ClusterReaderSpec.cxx | 8 +++++--- .../ALICE3/IOTOF/workflow/src/DigitReaderSpec.cxx | 13 ++++++++++--- .../common/workflow/src/ClusterReaderSpec.cxx | 8 +++++--- .../common/workflow/src/DigitReaderSpec.cxx | 8 +++++--- .../ITS3/workflow/src/DigitReaderSpec.cxx | 8 +++++--- Detectors/ZDC/workflow/src/DigitReaderSpec.cxx | 8 +++++--- Detectors/ZDC/workflow/src/RecEventReaderSpec.cxx | 8 +++++--- Detectors/ZDC/workflow/src/RecoReaderSpec.cxx | 8 +++++--- 52 files changed, 325 insertions(+), 156 deletions(-) diff --git a/Detectors/CPV/workflow/src/ClusterReaderSpec.cxx b/Detectors/CPV/workflow/src/ClusterReaderSpec.cxx index 62dc5efe4e0c0..19e857e2af97c 100644 --- a/Detectors/CPV/workflow/src/ClusterReaderSpec.cxx +++ b/Detectors/CPV/workflow/src/ClusterReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file ClusterReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include #include #include "Framework/ControlService.h" @@ -40,7 +42,7 @@ void ClusterReader::init(InitContext& ic) void ClusterReader::run(ProcessingContext& pc) { - auto ent = mTree->GetReadEntry() + 1; + long ent = pc.services().get().timeslice; // A timeframe holds no collision at all whenever the interaction rate is low enough, and // the tree then has no entry to read. Publish empty containers instead of reading past the // end and pushing branch addresses that GetEntry has not filled, so that the consumers @@ -48,7 +50,7 @@ void ClusterReader::run(ProcessingContext& pc) // every production build since ENABLE_CASSERT defaults to OFF.) const bool noEntry = ent >= mTree->GetEntries(); if (noEntry) { - LOG(info) << "no entry to read, publishing empty output"; + LOGP(warning, "No entry {} to read, tree contains {} entries, publishing empty output", ent, mTree->GetEntries()); } else { mTree->GetEntry(ent); } @@ -59,7 +61,7 @@ void ClusterReader::run(ProcessingContext& pc) pc.outputs().snapshot(Output{mOrigin, "CLUSTERTRUEMC", 0}, mMCTruth); } - if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (noEntry || mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/CPV/workflow/src/DigitReaderSpec.cxx b/Detectors/CPV/workflow/src/DigitReaderSpec.cxx index 1a4999847f68c..bb7074c421936 100644 --- a/Detectors/CPV/workflow/src/DigitReaderSpec.cxx +++ b/Detectors/CPV/workflow/src/DigitReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file DigitReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include #include #include "Framework/ControlService.h" @@ -40,7 +42,7 @@ void DigitReader::init(InitContext& ic) void DigitReader::run(ProcessingContext& pc) { - auto ent = mTree->GetReadEntry() + 1; + long ent = pc.services().get().timeslice; // A timeframe holds no collision at all whenever the interaction rate is low enough, and // the tree then has no entry to read. Publish empty containers instead of reading past the // end and pushing branch addresses that GetEntry has not filled, so that the consumers @@ -48,7 +50,7 @@ void DigitReader::run(ProcessingContext& pc) // every production build since ENABLE_CASSERT defaults to OFF.) const bool noEntry = ent >= mTree->GetEntries(); if (noEntry) { - LOG(info) << "no entry to read, publishing empty output"; + LOGP(warning, "No entry {} to read, tree contains {} entries, publishing empty output", ent, mTree->GetEntries()); } else { mTree->GetEntry(ent); } @@ -59,7 +61,7 @@ void DigitReader::run(ProcessingContext& pc) pc.outputs().snapshot(Output{mOrigin, "DIGITSMCTR", 0}, mMCTruth); } - if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (noEntry || mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/CTP/workflowIO/src/DigitReaderSpec.cxx b/Detectors/CTP/workflowIO/src/DigitReaderSpec.cxx index dfc9851f06b8e..2f5b68f6457ed 100644 --- a/Detectors/CTP/workflowIO/src/DigitReaderSpec.cxx +++ b/Detectors/CTP/workflowIO/src/DigitReaderSpec.cxx @@ -9,6 +9,8 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include "CTPWorkflowIO/DigitReaderSpec.h" #include "TFile.h" @@ -85,7 +87,7 @@ void DigitReader::run(ProcessingContext& pc) } auto ent = mTree->GetReadEntry(); if (!mUseIRFrames) { - ent++; + ent = pc.services().get().timeslice; // A timeframe holds no collision at all whenever the interaction rate is low enough, and // the tree then has no entry to read. Publish empty containers instead of reading past the // end and pushing branch addresses that GetEntry has not filled, so that the consumers @@ -93,14 +95,14 @@ void DigitReader::run(ProcessingContext& pc) // every production build since ENABLE_CASSERT defaults to OFF.) const bool noEntry = ent >= mTree->GetEntries(); if (noEntry) { - LOG(info) << "no entry to read, publishing empty output"; + LOGP(warning, "No entry {} to read, tree contains {} entries, publishing empty output", ent, mTree->GetEntries()); } else { mTree->GetEntry(ent); } LOG(info) << "DigitReader pushes " << mDigits.size() << " digits at entry " << ent; pc.outputs().snapshot(Output{"CTP", "DIGITS", 0}, mDigits); pc.outputs().snapshot(Output{"CTP", "LUMI", 0}, mLumi); - if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (noEntry || mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/FIT/FDD/workflow/src/DigitReaderSpec.cxx b/Detectors/FIT/FDD/workflow/src/DigitReaderSpec.cxx index a75f24787b2f5..a40f23d4f7c0f 100644 --- a/Detectors/FIT/FDD/workflow/src/DigitReaderSpec.cxx +++ b/Detectors/FIT/FDD/workflow/src/DigitReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file DigitReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include #include "TTree.h" @@ -76,7 +78,7 @@ void DigitReader::run(ProcessingContext& pc) mUseMC = false; } } - auto ent = mTree->GetReadEntry() + 1; + long ent = pc.services().get().timeslice; // A timeframe holds no collision at all whenever the interaction rate is low enough, and // the tree then has no entry to read. Publish empty containers instead of reading past the // end and pushing branch addresses that GetEntry has not filled, so that the consumers @@ -84,7 +86,7 @@ void DigitReader::run(ProcessingContext& pc) // every production build since ENABLE_CASSERT defaults to OFF.) const bool noEntry = ent >= mTree->GetEntries(); if (noEntry) { - LOG(info) << "no entry to read, publishing empty output"; + LOGP(warning, "No entry {} to read, tree contains {} entries, publishing empty output", ent, mTree->GetEntries()); } else { mTree->GetEntry(ent); } @@ -110,7 +112,7 @@ void DigitReader::run(ProcessingContext& pc) } pc.outputs().snapshot(Output{mOrigin, "DIGITLBL", 0}, mcTruth); } - if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (noEntry || mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/FIT/FDD/workflow/src/RecPointReaderSpec.cxx b/Detectors/FIT/FDD/workflow/src/RecPointReaderSpec.cxx index 6fee8e5d4ecc4..7c5b0f6616224 100644 --- a/Detectors/FIT/FDD/workflow/src/RecPointReaderSpec.cxx +++ b/Detectors/FIT/FDD/workflow/src/RecPointReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file RecPointReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include "Framework/ConfigParamRegistry.h" #include "Framework/ControlService.h" #include "Framework/Logger.h" @@ -44,7 +46,7 @@ void RecPointReader::init(InitContext& ic) void RecPointReader::run(ProcessingContext& pc) { - auto ent = mTree->GetReadEntry() + 1; + long ent = pc.services().get().timeslice; // A timeframe holds no collision at all whenever the interaction rate is low enough, and // the tree then has no entry to read. Publish empty containers instead of reading past the // end and pushing branch addresses that GetEntry has not filled, so that the consumers @@ -52,7 +54,7 @@ void RecPointReader::run(ProcessingContext& pc) // every production build since ENABLE_CASSERT defaults to OFF.) const bool noEntry = ent >= mTree->GetEntries(); if (noEntry) { - LOG(info) << "no entry to read, publishing empty output"; + LOGP(warning, "No entry {} to read, tree contains {} entries, publishing empty output", ent, mTree->GetEntries()); } else { mTree->GetEntry(ent); } @@ -65,7 +67,7 @@ void RecPointReader::run(ProcessingContext& pc) pc.outputs().snapshot(Output{mOrigin, "RECPOINTS", 0}, recPoints); pc.outputs().snapshot(Output{mOrigin, "RECCHDATA", 0}, channelData); - if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (noEntry || mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/FIT/FT0/workflow/src/DigitReaderSpec.cxx b/Detectors/FIT/FT0/workflow/src/DigitReaderSpec.cxx index 8cfdb91fa4797..671ad7bf7a6ee 100644 --- a/Detectors/FIT/FT0/workflow/src/DigitReaderSpec.cxx +++ b/Detectors/FIT/FT0/workflow/src/DigitReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file DigitReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include #include #include "Framework/ConfigParamRegistry.h" @@ -60,7 +62,7 @@ void DigitReader::run(ProcessingContext& pc) if (mUseMC) { mTree->SetBranchAddress("FT0DIGITSMCTR", &plabels); } - auto ent = mTree->GetReadEntry() + 1; + long ent = pc.services().get().timeslice; // A timeframe holds no collision at all whenever the interaction rate is low enough, and // the tree then has no entry to read. Publish empty containers instead of reading past the // end and pushing branch addresses that GetEntry has not filled, so that the consumers @@ -68,7 +70,7 @@ void DigitReader::run(ProcessingContext& pc) // every production build since ENABLE_CASSERT defaults to OFF.) const bool noEntry = ent >= mTree->GetEntries(); if (noEntry) { - LOG(info) << "no entry to read, publishing empty output"; + LOGP(warning, "No entry {} to read, tree contains {} entries, publishing empty output", ent, mTree->GetEntries()); } else { mTree->GetEntry(ent); } @@ -81,7 +83,7 @@ void DigitReader::run(ProcessingContext& pc) if (mUseTrgInput) { pc.outputs().snapshot(Output{"FT0", "TRIGGERINPUT", 0}, trgInput); } - if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (noEntry || mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/FIT/FT0/workflow/src/RecPointReaderSpec.cxx b/Detectors/FIT/FT0/workflow/src/RecPointReaderSpec.cxx index be184d38155f1..337afc8c2cdb6 100644 --- a/Detectors/FIT/FT0/workflow/src/RecPointReaderSpec.cxx +++ b/Detectors/FIT/FT0/workflow/src/RecPointReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file RecPointReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include #include "Framework/ConfigParamRegistry.h" @@ -44,7 +46,7 @@ void RecPointReader::init(InitContext& ic) void RecPointReader::run(ProcessingContext& pc) { - auto ent = mTree->GetReadEntry() + 1; + long ent = pc.services().get().timeslice; // A timeframe holds no collision at all whenever the interaction rate is low enough, and // the tree then has no entry to read. Publish empty containers instead of reading past the // end and pushing branch addresses that GetEntry has not filled, so that the consumers @@ -52,7 +54,7 @@ void RecPointReader::run(ProcessingContext& pc) // every production build since ENABLE_CASSERT defaults to OFF.) const bool noEntry = ent >= mTree->GetEntries(); if (noEntry) { - LOG(info) << "no entry to read, publishing empty output"; + LOGP(warning, "No entry {} to read, tree contains {} entries, publishing empty output", ent, mTree->GetEntries()); } else { mTree->GetEntry(ent); } @@ -65,7 +67,7 @@ void RecPointReader::run(ProcessingContext& pc) pc.outputs().snapshot(Output{mOrigin, "RECPOINTS", 0}, recPoints); pc.outputs().snapshot(Output{mOrigin, "RECCHDATA", 0}, channelData); - if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (noEntry || mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/FIT/FV0/workflow/src/DigitReaderSpec.cxx b/Detectors/FIT/FV0/workflow/src/DigitReaderSpec.cxx index 79df17caf9da0..518b7cfcd52a9 100644 --- a/Detectors/FIT/FV0/workflow/src/DigitReaderSpec.cxx +++ b/Detectors/FIT/FV0/workflow/src/DigitReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file DigitReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include #include #include "Framework/ConfigParamRegistry.h" @@ -61,7 +63,7 @@ void DigitReader::run(ProcessingContext& pc) if (mUseMC) { mTree->SetBranchAddress("FV0DigitLabels", &plabels); } - auto ent = mTree->GetReadEntry() + 1; + long ent = pc.services().get().timeslice; // A timeframe holds no collision at all whenever the interaction rate is low enough, and // the tree then has no entry to read. Publish empty containers instead of reading past the // end and pushing branch addresses that GetEntry has not filled, so that the consumers @@ -69,7 +71,7 @@ void DigitReader::run(ProcessingContext& pc) // every production build since ENABLE_CASSERT defaults to OFF.) const bool noEntry = ent >= mTree->GetEntries(); if (noEntry) { - LOG(info) << "no entry to read, publishing empty output"; + LOGP(warning, "No entry {} to read, tree contains {} entries, publishing empty output", ent, mTree->GetEntries()); } else { mTree->GetEntry(ent); } @@ -82,7 +84,7 @@ void DigitReader::run(ProcessingContext& pc) if (mUseTrgInput) { pc.outputs().snapshot(Output{"FV0", "TRIGGERINPUT", 0}, trgInput); } - if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (noEntry || mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/FIT/FV0/workflow/src/RecPointReaderSpec.cxx b/Detectors/FIT/FV0/workflow/src/RecPointReaderSpec.cxx index 053c28b7a987e..c634814f9ee16 100644 --- a/Detectors/FIT/FV0/workflow/src/RecPointReaderSpec.cxx +++ b/Detectors/FIT/FV0/workflow/src/RecPointReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file RecPointReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include #include "Framework/ConfigParamRegistry.h" @@ -44,7 +46,7 @@ void RecPointReader::init(InitContext& ic) void RecPointReader::run(ProcessingContext& pc) { - auto ent = mTree->GetReadEntry() + 1; + long ent = pc.services().get().timeslice; // A timeframe holds no collision at all whenever the interaction rate is low enough, and // the tree then has no entry to read. Publish empty containers instead of reading past the // end and pushing branch addresses that GetEntry has not filled, so that the consumers @@ -52,7 +54,7 @@ void RecPointReader::run(ProcessingContext& pc) // every production build since ENABLE_CASSERT defaults to OFF.) const bool noEntry = ent >= mTree->GetEntries(); if (noEntry) { - LOG(info) << "no entry to read, publishing empty output"; + LOGP(warning, "No entry {} to read, tree contains {} entries, publishing empty output", ent, mTree->GetEntries()); } else { mTree->GetEntry(ent); } @@ -65,7 +67,7 @@ void RecPointReader::run(ProcessingContext& pc) pc.outputs().snapshot(Output{mOrigin, "RECPOINTS", 0}, recPoints); pc.outputs().snapshot(Output{mOrigin, "RECCHDATA", 0}, channelData); - if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (noEntry || mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/FIT/workflow/include/FITWorkflow/FITIntegrateClusterReaderSpec.h b/Detectors/FIT/workflow/include/FITWorkflow/FITIntegrateClusterReaderSpec.h index 2ebb385a0e222..a87b1edbe7408 100644 --- a/Detectors/FIT/workflow/include/FITWorkflow/FITIntegrateClusterReaderSpec.h +++ b/Detectors/FIT/workflow/include/FITWorkflow/FITIntegrateClusterReaderSpec.h @@ -12,6 +12,7 @@ #ifndef O2_FIT_FITINTEGRATECLUSTERREADER_SPEC #define O2_FIT_FITINTEGRATECLUSTERREADER_SPEC +#include "Framework/DeviceSpec.h" #include #include @@ -97,7 +98,7 @@ template void IntegratedClusterReader::run(ProcessingContext& pc) { // check time order inside the TChain - if (mChainEntry == 0) { + if (mIndices.empty()) { mIndices.clear(); mIndices.reserve(mChain->GetEntries()); // disable all branches except the firstTForbit branch to significantly speed up the loop over the TTree @@ -111,8 +112,16 @@ void IntegratedClusterReader::run(ProcessingContext& pc) std::sort(mIndices.begin(), mIndices.end()); } + mChainEntry = pc.services().get().timeslice; + if (mChainEntry >= mIndices.size()) { + LOG(warning) << "No entry " << mChainEntry << " to read in chain with " << mIndices.size() << " entries"; + pc.services().get().endOfStream(); + pc.services().get().readyToQuit(QuitRequest::Me); + return; + } + LOGP(debug, "Processing entry {}", mIndices[mChainEntry].second); - mChain->GetEntry(mIndices[mChainEntry++].second); + mChain->GetEntry(mIndices[mChainEntry].second); // inject correct timing informations auto& timingInfo = pc.services().get(); @@ -125,7 +134,7 @@ void IntegratedClusterReader::run(ProcessingContext& pc) pc.outputs().snapshot(Output{FitType::getDataOrigin(), FitType::getDataDescriptionFITC()}, mFITC); usleep(100); - if (mChainEntry >= mChain->GetEntries()) { + if (mChainEntry + pc.services().get().maxInputTimeslices >= mChain->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/Filtering/src/FilteredTFReaderSpec.cxx b/Detectors/Filtering/src/FilteredTFReaderSpec.cxx index 96be122485541..93d920a04e0aa 100644 --- a/Detectors/Filtering/src/FilteredTFReaderSpec.cxx +++ b/Detectors/Filtering/src/FilteredTFReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file FilteredTFReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include #include "Framework/ControlService.h" #include "Framework/ConfigParamRegistry.h" @@ -39,7 +41,7 @@ void FilteredTFReader::run(ProcessingContext& pc) { // FIXME: fill all output headers by TF specific info (extend findMessageHeaderStack) - auto ent = mTree->GetReadEntry() + 1; + long ent = pc.services().get().timeslice; // A timeframe holds no collision at all whenever the interaction rate is low enough, and // the tree then has no entry to read. Publish empty containers instead of reading past the // end and pushing branch addresses that GetEntry has not filled, so that the consumers @@ -47,7 +49,7 @@ void FilteredTFReader::run(ProcessingContext& pc) // every production build since ENABLE_CASSERT defaults to OFF.) const bool noEntry = ent >= mTree->GetEntries(); if (noEntry) { - LOG(info) << "no entry to read, publishing empty output"; + LOGP(warning, "No entry {} to read, tree contains {} entries, publishing empty output", ent, mTree->GetEntries()); } else { mTree->GetEntry(ent); } @@ -64,7 +66,7 @@ void FilteredTFReader::run(ProcessingContext& pc) pc.outputs().snapshot(Output{"ITS", "COMPCLUSTERS", 0}, mFiltTF.ITSClusters); pc.outputs().snapshot(Output{"ITS", "PATTERNS", 0}, mFiltTF.ITSClusterPatterns); - if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (noEntry || mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/GlobalTrackingWorkflow/readers/src/GlobalFwdTrackReaderSpec.cxx b/Detectors/GlobalTrackingWorkflow/readers/src/GlobalFwdTrackReaderSpec.cxx index e92a85268c000..0aad947324358 100644 --- a/Detectors/GlobalTrackingWorkflow/readers/src/GlobalFwdTrackReaderSpec.cxx +++ b/Detectors/GlobalTrackingWorkflow/readers/src/GlobalFwdTrackReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file GlobalFwdTrackReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include #include "TFile.h" #include "TTree.h" @@ -60,7 +62,7 @@ void GlobalFwdTrackReader::init(InitContext& ic) void GlobalFwdTrackReader::run(ProcessingContext& pc) { - auto ent = mTree->GetReadEntry() + 1; + long ent = pc.services().get().timeslice; // A timeframe holds no collision at all whenever the interaction rate is low enough, and // the tree then has no entry to read. Publish empty containers instead of reading past the // end and pushing branch addresses that GetEntry has not filled, so that the consumers @@ -68,7 +70,7 @@ void GlobalFwdTrackReader::run(ProcessingContext& pc) // every production build since ENABLE_CASSERT defaults to OFF.) const bool noEntry = ent >= mTree->GetEntries(); if (noEntry) { - LOG(info) << "no entry to read, publishing empty output"; + LOGP(warning, "No entry {} to read, tree contains {} entries, publishing empty output", ent, mTree->GetEntries()); } else { mTree->GetEntry(ent); } @@ -79,7 +81,7 @@ void GlobalFwdTrackReader::run(ProcessingContext& pc) pc.outputs().snapshot(Output{"GLO", "GLFWD_MC", 0}, mLabels); } - if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (noEntry || mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/GlobalTrackingWorkflow/readers/src/IRFrameReaderSpec.cxx b/Detectors/GlobalTrackingWorkflow/readers/src/IRFrameReaderSpec.cxx index 0017fd8fea3d6..f1dec0970bdc3 100644 --- a/Detectors/GlobalTrackingWorkflow/readers/src/IRFrameReaderSpec.cxx +++ b/Detectors/GlobalTrackingWorkflow/readers/src/IRFrameReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file IRFrameReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include #include #include "Framework/ControlService.h" @@ -59,7 +61,7 @@ void IRFrameReaderSpec::init(InitContext& ic) void IRFrameReaderSpec::run(ProcessingContext& pc) { - auto ent = mTree->GetReadEntry() + 1; + long ent = pc.services().get().timeslice; // A timeframe holds no collision at all whenever the interaction rate is low enough, and // the tree then has no entry to read. Publish empty containers instead of reading past the // end and pushing branch addresses that GetEntry has not filled, so that the consumers @@ -67,14 +69,14 @@ void IRFrameReaderSpec::run(ProcessingContext& pc) // every production build since ENABLE_CASSERT defaults to OFF.) const bool noEntry = ent >= mTree->GetEntries(); if (noEntry) { - LOG(info) << "no entry to read, publishing empty output"; + LOGP(warning, "No entry {} to read, tree contains {} entries, publishing empty output", ent, mTree->GetEntries()); } else { mTree->GetEntry(ent); } LOG(debug) << "Pushing " << mIRF.size() << " IR-frames in at entry " << ent; pc.outputs().snapshot(Output{mDataOrigin, "IRFRAMES", mSubSpec}, mIRF); - if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (noEntry || mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/GlobalTrackingWorkflow/readers/src/MatchedMCHMIDReaderSpec.cxx b/Detectors/GlobalTrackingWorkflow/readers/src/MatchedMCHMIDReaderSpec.cxx index c1cc5f7e649cf..d52516bbba82a 100644 --- a/Detectors/GlobalTrackingWorkflow/readers/src/MatchedMCHMIDReaderSpec.cxx +++ b/Detectors/GlobalTrackingWorkflow/readers/src/MatchedMCHMIDReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file MatchedMCHMIDReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include #include "TFile.h" #include "TTree.h" @@ -60,7 +62,7 @@ void MatchMCHMIDReader::init(InitContext& ic) void MatchMCHMIDReader::run(ProcessingContext& pc) { - auto ent = mTree->GetReadEntry() + 1; + long ent = pc.services().get().timeslice; // A timeframe holds no collision at all whenever the interaction rate is low enough, and // the tree then has no entry to read. Publish empty containers instead of reading past the // end and pushing branch addresses that GetEntry has not filled, so that the consumers @@ -68,7 +70,7 @@ void MatchMCHMIDReader::run(ProcessingContext& pc) // every production build since ENABLE_CASSERT defaults to OFF.) const bool noEntry = ent >= mTree->GetEntries(); if (noEntry) { - LOG(info) << "no entry to read, publishing empty output"; + LOGP(warning, "No entry {} to read, tree contains {} entries, publishing empty output", ent, mTree->GetEntries()); } else { mTree->GetEntry(ent); } @@ -79,7 +81,7 @@ void MatchMCHMIDReader::run(ProcessingContext& pc) pc.outputs().snapshot(OutputRef{"muontracklabels"}, mLabels); } - if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (noEntry || mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/GlobalTrackingWorkflow/readers/src/MatchedMFTMCHReaderSpec.cxx b/Detectors/GlobalTrackingWorkflow/readers/src/MatchedMFTMCHReaderSpec.cxx index 36c577b392c35..dd99f90542ead 100644 --- a/Detectors/GlobalTrackingWorkflow/readers/src/MatchedMFTMCHReaderSpec.cxx +++ b/Detectors/GlobalTrackingWorkflow/readers/src/MatchedMFTMCHReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file MatchedMFTMCHReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include #include "TFile.h" #include "TTree.h" @@ -60,7 +62,7 @@ void MatchMFTMCHReader::init(InitContext& ic) void MatchMFTMCHReader::run(ProcessingContext& pc) { - auto ent = mTree->GetReadEntry() + 1; + long ent = pc.services().get().timeslice; // A timeframe holds no collision at all whenever the interaction rate is low enough, and // the tree then has no entry to read. Publish empty containers instead of reading past the // end and pushing branch addresses that GetEntry has not filled, so that the consumers @@ -68,7 +70,7 @@ void MatchMFTMCHReader::run(ProcessingContext& pc) // every production build since ENABLE_CASSERT defaults to OFF.) const bool noEntry = ent >= mTree->GetEntries(); if (noEntry) { - LOG(info) << "no entry to read, publishing empty output"; + LOGP(warning, "No entry {} to read, tree contains {} entries, publishing empty output", ent, mTree->GetEntries()); } else { mTree->GetEntry(ent); } @@ -76,7 +78,7 @@ void MatchMFTMCHReader::run(ProcessingContext& pc) pc.outputs().snapshot(Output{"GLO", "MTC_MFTMCH", 0}, mTracks); - if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (noEntry || mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/GlobalTrackingWorkflow/readers/src/PrimaryVertexReaderSpec.cxx b/Detectors/GlobalTrackingWorkflow/readers/src/PrimaryVertexReaderSpec.cxx index 8f9c52e26a980..b28113bb248a2 100644 --- a/Detectors/GlobalTrackingWorkflow/readers/src/PrimaryVertexReaderSpec.cxx +++ b/Detectors/GlobalTrackingWorkflow/readers/src/PrimaryVertexReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file VertexReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include #include "Framework/ControlService.h" @@ -79,7 +81,7 @@ void PrimaryVertexReader::init(InitContext& ic) void PrimaryVertexReader::run(ProcessingContext& pc) { - auto ent = mTree->GetReadEntry() + 1; + long ent = pc.services().get().timeslice; // A timeframe holds no collision at all whenever the interaction rate is low enough, and // the tree then has no entry to read. Publish empty containers instead of reading past the // end and pushing branch addresses that GetEntry has not filled, so that the consumers @@ -87,7 +89,7 @@ void PrimaryVertexReader::run(ProcessingContext& pc) // every production build since ENABLE_CASSERT defaults to OFF.) const bool noEntry = ent >= mTree->GetEntries(); if (noEntry) { - LOG(info) << "no entry to read, publishing empty output"; + LOGP(warning, "No entry {} to read, tree contains {} entries, publishing empty output", ent, mTree->GetEntries()); } else { mTree->GetEntry(ent); } @@ -149,7 +151,7 @@ void PrimaryVertexReader::run(ProcessingContext& pc) } } - if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (noEntry || mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/GlobalTrackingWorkflow/readers/src/SecondaryVertexReaderSpec.cxx b/Detectors/GlobalTrackingWorkflow/readers/src/SecondaryVertexReaderSpec.cxx index 891b2bac3e155..68d3f31313c56 100644 --- a/Detectors/GlobalTrackingWorkflow/readers/src/SecondaryVertexReaderSpec.cxx +++ b/Detectors/GlobalTrackingWorkflow/readers/src/SecondaryVertexReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file SecondaryVertexReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include #include "Framework/ControlService.h" @@ -88,7 +90,7 @@ void SecondaryVertexReader::init(InitContext& ic) void SecondaryVertexReader::run(ProcessingContext& pc) { - auto ent = mTree->GetReadEntry() + 1; + long ent = pc.services().get().timeslice; // A timeframe holds no collision at all whenever the interaction rate is low enough, and // the tree then has no entry to read. Publish empty containers instead of reading past the // end and pushing branch addresses that GetEntry has not filled, so that the consumers @@ -96,7 +98,7 @@ void SecondaryVertexReader::run(ProcessingContext& pc) // every production build since ENABLE_CASSERT defaults to OFF.) const bool noEntry = ent >= mTree->GetEntries(); if (noEntry) { - LOG(info) << "no entry to read, publishing empty output"; + LOGP(warning, "No entry {} to read, tree contains {} entries, publishing empty output", ent, mTree->GetEntries()); } else { mTree->GetEntry(ent); } @@ -113,7 +115,7 @@ void SecondaryVertexReader::run(ProcessingContext& pc) pc.outputs().snapshot(Output{"GLO", "DECAYS3BODY", 0}, m3Bodys); pc.outputs().snapshot(Output{"GLO", "PVTX_3BODYREFS", 0}, mPV23BodyRef); - if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (noEntry || mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/GlobalTrackingWorkflow/readers/src/StrangenessTrackingReaderSpec.cxx b/Detectors/GlobalTrackingWorkflow/readers/src/StrangenessTrackingReaderSpec.cxx index 060a8957985b3..dceae48df17e9 100644 --- a/Detectors/GlobalTrackingWorkflow/readers/src/StrangenessTrackingReaderSpec.cxx +++ b/Detectors/GlobalTrackingWorkflow/readers/src/StrangenessTrackingReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file StrangenessTrackingReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include "GlobalTrackingWorkflowReaders/StrangenessTrackingReaderSpec.h" #include @@ -72,7 +74,7 @@ void StrangenessTrackingReader::init(InitContext& ic) void StrangenessTrackingReader::run(ProcessingContext& pc) { - auto ent = mTree->GetReadEntry() + 1; + long ent = pc.services().get().timeslice; // A timeframe holds no collision at all whenever the interaction rate is low enough, and // the tree then has no entry to read. Publish empty containers instead of reading past the // end and pushing branch addresses that GetEntry has not filled, so that the consumers @@ -80,7 +82,7 @@ void StrangenessTrackingReader::run(ProcessingContext& pc) // every production build since ENABLE_CASSERT defaults to OFF.) const bool noEntry = ent >= mTree->GetEntries(); if (noEntry) { - LOG(info) << "no entry to read, publishing empty output"; + LOGP(warning, "No entry {} to read, tree contains {} entries, publishing empty output", ent, mTree->GetEntries()); } else { mTree->GetEntry(ent); } @@ -94,7 +96,7 @@ void StrangenessTrackingReader::run(ProcessingContext& pc) // pc.outputs().snapshot(Output{"GLO", "PVTX_V0REFS", 0}, mPV2V0Ref); - if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (noEntry || mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/GlobalTrackingWorkflow/readers/src/TrackCosmicsExtendedReaderSpec.cxx b/Detectors/GlobalTrackingWorkflow/readers/src/TrackCosmicsExtendedReaderSpec.cxx index 01f9903cb656a..a9b87cf130641 100644 --- a/Detectors/GlobalTrackingWorkflow/readers/src/TrackCosmicsExtendedReaderSpec.cxx +++ b/Detectors/GlobalTrackingWorkflow/readers/src/TrackCosmicsExtendedReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file TrackCosmicsExtendedReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include #include "Framework/ConfigParamRegistry.h" @@ -35,11 +37,11 @@ void TrackCosmicsExtendedReader::init(InitContext& ic) void TrackCosmicsExtendedReader::run(ProcessingContext& pc) { - auto ent = mTree->GetReadEntry() + 1; + long ent = pc.services().get().timeslice; // Same as in TrackCosmicsReader: publish empty containers if the tree has no entry left const bool noEntry = ent >= mTree->GetEntries(); if (noEntry) { - LOG(info) << "no entry to read, publishing empty output"; + LOGP(warning, "No entry {} to read, tree contains {} entries, publishing empty output", ent, mTree->GetEntries()); mCosmics.clear(); mTFInfo = {}; } else { @@ -49,7 +51,7 @@ void TrackCosmicsExtendedReader::run(ProcessingContext& pc) pc.outputs().snapshot(Output{"GLO", "COSMFULL", 0}, mCosmics); pc.outputs().snapshot(Output{"GLO", "COSMFULLTF", 0}, mTFInfo); - if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (noEntry || mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/GlobalTrackingWorkflow/readers/src/TrackCosmicsReaderSpec.cxx b/Detectors/GlobalTrackingWorkflow/readers/src/TrackCosmicsReaderSpec.cxx index a673676bc9dc8..eb1fad6cb11ec 100644 --- a/Detectors/GlobalTrackingWorkflow/readers/src/TrackCosmicsReaderSpec.cxx +++ b/Detectors/GlobalTrackingWorkflow/readers/src/TrackCosmicsReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file TrackCosmicsReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include #include "Framework/ConfigParamRegistry.h" @@ -36,7 +38,7 @@ void TrackCosmicsReader::init(InitContext& ic) void TrackCosmicsReader::run(ProcessingContext& pc) { - auto ent = mTree->GetReadEntry() + 1; + long ent = pc.services().get().timeslice; // A timeframe holds no collision at all whenever the interaction rate is low enough, and // the tree then has no entry to read. Publish empty containers instead of reading past the // end and pushing branch addresses that GetEntry has not filled, so that the consumers @@ -44,7 +46,7 @@ void TrackCosmicsReader::run(ProcessingContext& pc) // every production build since ENABLE_CASSERT defaults to OFF.) const bool noEntry = ent >= mTree->GetEntries(); if (noEntry) { - LOG(info) << "no entry to read, publishing empty output"; + LOGP(warning, "No entry {} to read, tree contains {} entries, publishing empty output", ent, mTree->GetEntries()); } else { mTree->GetEntry(ent); } @@ -55,7 +57,7 @@ void TrackCosmicsReader::run(ProcessingContext& pc) pc.outputs().snapshot(Output{"GLO", "COSMICTRC_MC", 0}, mLabels); } - if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (noEntry || mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/GlobalTrackingWorkflow/readers/src/TrackTPCITSReaderSpec.cxx b/Detectors/GlobalTrackingWorkflow/readers/src/TrackTPCITSReaderSpec.cxx index 3064d8cd3006d..985d59825e928 100644 --- a/Detectors/GlobalTrackingWorkflow/readers/src/TrackTPCITSReaderSpec.cxx +++ b/Detectors/GlobalTrackingWorkflow/readers/src/TrackTPCITSReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file TrackTPCITSReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include #include "TFile.h" #include "TTree.h" @@ -63,7 +65,7 @@ void TrackTPCITSReader::init(InitContext& ic) void TrackTPCITSReader::run(ProcessingContext& pc) { - auto ent = mTree->GetReadEntry() + 1; + long ent = pc.services().get().timeslice; // A timeframe holds no collision at all whenever the interaction rate is low enough, and // the tree then has no entry to read. Publish empty containers instead of reading past the // end and pushing branch addresses that GetEntry has not filled, so that the consumers @@ -71,7 +73,7 @@ void TrackTPCITSReader::run(ProcessingContext& pc) // every production build since ENABLE_CASSERT defaults to OFF.) const bool noEntry = ent >= mTree->GetEntries(); if (noEntry) { - LOG(info) << "no entry to read, publishing empty output"; + LOGP(warning, "No entry {} to read, tree contains {} entries, publishing empty output", ent, mTree->GetEntries()); } else { mTree->GetEntry(ent); } @@ -85,7 +87,7 @@ void TrackTPCITSReader::run(ProcessingContext& pc) pc.outputs().snapshot(Output{"GLO", "TPCITSAB_MC", 0}, mLabelsAB); } - if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (noEntry || mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/GlobalTrackingWorkflow/tpcinterpolationworkflow/src/TPCUnbinnedResidualReaderSpec.cxx b/Detectors/GlobalTrackingWorkflow/tpcinterpolationworkflow/src/TPCUnbinnedResidualReaderSpec.cxx index a3c99fd2c9438..2eb17d3724ee6 100644 --- a/Detectors/GlobalTrackingWorkflow/tpcinterpolationworkflow/src/TPCUnbinnedResidualReaderSpec.cxx +++ b/Detectors/GlobalTrackingWorkflow/tpcinterpolationworkflow/src/TPCUnbinnedResidualReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file TPCUnbinnedResidualReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include "TPCInterpolationWorkflow/TPCUnbinnedResidualReaderSpec.h" #include "Framework/ControlService.h" @@ -63,8 +65,13 @@ void TPCUnbinnedResidualReader::connectTree() void TPCUnbinnedResidualReader::run(ProcessingContext& pc) { - auto currEntry = mTreeIn->GetReadEntry() + 1; - assert(currEntry < mTreeIn->GetEntries()); // this should not happen + long currEntry = pc.services().get().timeslice; + if (currEntry >= mTreeIn->GetEntries()) { + LOG(warning) << "No entry " << currEntry << " to read in tree with " << mTreeIn->GetEntries() << " entries"; + pc.services().get().endOfStream(); + pc.services().get().readyToQuit(QuitRequest::Me); + return; + } mTreeIn->GetEntry(currEntry); LOG(info) << "Pushing " << mUnbinnedResid.size() << " unbinned residuals at entry " << currEntry; pc.outputs().snapshot(Output{"GLO", "UNBINNEDRES", 0}, mUnbinnedResid); @@ -78,7 +85,7 @@ void TPCUnbinnedResidualReader::run(ProcessingContext& pc) pc.outputs().snapshot(Output{"GLO", "TRKDATAMC", 0}, mTrackDataMC); } - if (mTreeIn->GetReadEntry() + 1 >= mTreeIn->GetEntries()) { + if (mTreeIn->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTreeIn->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/HMPID/workflow/src/ClustersReaderSpec.cxx b/Detectors/HMPID/workflow/src/ClustersReaderSpec.cxx index 5802355b326a8..f859843d23feb 100644 --- a/Detectors/HMPID/workflow/src/ClustersReaderSpec.cxx +++ b/Detectors/HMPID/workflow/src/ClustersReaderSpec.cxx @@ -16,6 +16,8 @@ /// \brief Implementation of a data processor to read Cluster tree and provide the array for further usage /// +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include "HMPIDWorkflow/ClustersReaderSpec.h" #include @@ -67,7 +69,7 @@ void ClusterReaderTask::init(framework::InitContext& ic) void ClusterReaderTask::run(ProcessingContext& pc) { - auto ent = mTree->GetReadEntry() + 1; + long ent = pc.services().get().timeslice; // A timeframe holds no collision at all whenever the interaction rate is low enough, and // the tree then has no entry to read. Publish empty containers instead of reading past the // end and pushing branch addresses that GetEntry has not filled, so that the consumers @@ -75,7 +77,7 @@ void ClusterReaderTask::run(ProcessingContext& pc) // every production build since ENABLE_CASSERT defaults to OFF.) const bool noEntry = ent >= mTree->GetEntries(); if (noEntry) { - LOG(info) << "no entry to read, publishing empty output"; + LOGP(warning, "No entry {} to read, tree contains {} entries, publishing empty output", ent, mTree->GetEntries()); } else { mTree->GetEntry(ent); } @@ -85,7 +87,7 @@ void ClusterReaderTask::run(ProcessingContext& pc) mClustersReceived += mClustersFromFile.size(); LOG(info) << "[HMPID ClusterReader - run() ] clusters = " << mClustersFromFile.size(); - if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (noEntry || mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); mExTimer.stop(); diff --git a/Detectors/HMPID/workflow/src/DigitsReaderSpec.cxx b/Detectors/HMPID/workflow/src/DigitsReaderSpec.cxx index 8953fd37fa47d..d04dc2bbfb58e 100644 --- a/Detectors/HMPID/workflow/src/DigitsReaderSpec.cxx +++ b/Detectors/HMPID/workflow/src/DigitsReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file DigitReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include #include #include "Framework/ConfigParamRegistry.h" @@ -111,7 +113,7 @@ void DigitReader::run(ProcessingContext& pc) } // mTree->Print("toponly"); - auto ent = mTree->GetReadEntry() + 1; + long ent = pc.services().get().timeslice; // A timeframe holds no collision at all whenever the interaction rate is low enough, and // the tree then has no entry to read. Publish empty containers instead of reading past the // end and pushing branch addresses that GetEntry has not filled, so that the consumers @@ -119,7 +121,7 @@ void DigitReader::run(ProcessingContext& pc) // every production build since ENABLE_CASSERT defaults to OFF.) const bool noEntry = ent >= mTree->GetEntries(); if (noEntry) { - LOG(info) << "no entry to read, publishing empty output"; + LOGP(warning, "No entry {} to read, tree contains {} entries, publishing empty output", ent, mTree->GetEntries()); } else { mTree->GetEntry(ent); } @@ -129,7 +131,7 @@ void DigitReader::run(ProcessingContext& pc) mDigitsReceived += mDigitsFromFile.size(); LOG(info) << "[HMPID DigitsReader - run() ] digits = " << mDigitsFromFile.size(); - if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (noEntry || mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); mExTimer.stop(); diff --git a/Detectors/HMPID/workflow/src/HMPMatchedReaderSpec.cxx b/Detectors/HMPID/workflow/src/HMPMatchedReaderSpec.cxx index 3ddb71e282a96..7a5612f1dd003 100644 --- a/Detectors/HMPID/workflow/src/HMPMatchedReaderSpec.cxx +++ b/Detectors/HMPID/workflow/src/HMPMatchedReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file HMPMatchedReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include #include "TTree.h" @@ -57,8 +59,13 @@ void HMPMatchedReader::connectTree(const std::string& filename) void HMPMatchedReader::run(ProcessingContext& pc) { - auto currEntry = mTree->GetReadEntry() + 1; - assert(currEntry < mTree->GetEntries()); // this should not happen + long currEntry = pc.services().get().timeslice; + if (currEntry >= mTree->GetEntries()) { + LOG(warning) << "No entry " << currEntry << " to read in tree with " << mTree->GetEntries() << " entries"; + pc.services().get().endOfStream(); + pc.services().get().readyToQuit(QuitRequest::Me); + return; + } mTree->GetEntry(currEntry); LOG(debug) << "Pushing " << mMatches.size() << " HMP matchings at entry " << currEntry; @@ -67,7 +74,7 @@ void HMPMatchedReader::run(ProcessingContext& pc) pc.outputs().snapshot(Output{o2::header::gDataOriginHMP, "MCLABELS", 0}, mLabelHMP); } - if (mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/ITSMFT/ITS/workflow/src/TrackReaderSpec.cxx b/Detectors/ITSMFT/ITS/workflow/src/TrackReaderSpec.cxx index 1a8056b91c7d2..d2935a5a1e36e 100644 --- a/Detectors/ITSMFT/ITS/workflow/src/TrackReaderSpec.cxx +++ b/Detectors/ITSMFT/ITS/workflow/src/TrackReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file TrackReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include #include #include "Framework/ControlService.h" @@ -33,7 +35,7 @@ void TrackReader::init(InitContext& ic) void TrackReader::run(ProcessingContext& pc) { - auto ent = mTree->GetReadEntry() + 1; + long ent = pc.services().get().timeslice; // A timeframe holds no collision at all whenever the interaction rate is low enough, and // the tree then has no entry to read. Publish empty containers instead of reading past the // end and pushing branch addresses that GetEntry has not filled, so that the consumers @@ -41,7 +43,7 @@ void TrackReader::run(ProcessingContext& pc) // every production build since ENABLE_CASSERT defaults to OFF.) const bool noEntry = ent >= mTree->GetEntries(); if (noEntry) { - LOG(info) << "no entry to read, publishing empty output"; + LOGP(warning, "No entry {} to read, tree contains {} entries, publishing empty output", ent, mTree->GetEntries()); } else { mTree->GetEntry(ent); } @@ -56,7 +58,7 @@ void TrackReader::run(ProcessingContext& pc) pc.outputs().snapshot(Output{mOrigin, "VERTICESMCTR", 0}, mMCVertTruth); } - if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (noEntry || mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/ITSMFT/ITS/workflow/src/VertexReaderSpec.cxx b/Detectors/ITSMFT/ITS/workflow/src/VertexReaderSpec.cxx index eca02da2b8b79..01692ccdcd171 100644 --- a/Detectors/ITSMFT/ITS/workflow/src/VertexReaderSpec.cxx +++ b/Detectors/ITSMFT/ITS/workflow/src/VertexReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file VertexReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include #include "Framework/ControlService.h" @@ -36,7 +38,7 @@ void VertexReader::init(InitContext& ic) void VertexReader::run(ProcessingContext& pc) { - auto ent = mTree->GetReadEntry() + 1; + long ent = pc.services().get().timeslice; // A timeframe holds no collision at all whenever the interaction rate is low enough, and // the tree then has no entry to read. Publish empty containers instead of reading past the // end and pushing branch addresses that GetEntry has not filled, so that the consumers @@ -44,7 +46,7 @@ void VertexReader::run(ProcessingContext& pc) // every production build since ENABLE_CASSERT defaults to OFF.) const bool noEntry = ent >= mTree->GetEntries(); if (noEntry) { - LOG(info) << "no entry to read, publishing empty output"; + LOGP(warning, "No entry {} to read, tree contains {} entries, publishing empty output", ent, mTree->GetEntries()); } else { mTree->GetEntry(ent); } @@ -53,7 +55,7 @@ void VertexReader::run(ProcessingContext& pc) pc.outputs().snapshot(Output{"ITS", "VERTICES", 0}, mVertices); pc.outputs().snapshot(Output{"ITS", "VERTICESROF", 0}, mVerticesROFRec); - if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (noEntry || mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/ITSMFT/MFT/workflow/src/TrackReaderSpec.cxx b/Detectors/ITSMFT/MFT/workflow/src/TrackReaderSpec.cxx index 356e629f9839e..8029340957755 100644 --- a/Detectors/ITSMFT/MFT/workflow/src/TrackReaderSpec.cxx +++ b/Detectors/ITSMFT/MFT/workflow/src/TrackReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file TrackReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include #include #include "Framework/ControlService.h" @@ -41,7 +43,7 @@ void TrackReader::init(InitContext& ic) void TrackReader::run(ProcessingContext& pc) { - auto ent = mTree->GetReadEntry() + 1; + long ent = pc.services().get().timeslice; // A timeframe holds no collision at all whenever the interaction rate is low enough, and // the tree then has no entry to read. Publish empty containers instead of reading past the // end and pushing branch addresses that GetEntry has not filled, so that the consumers @@ -49,7 +51,7 @@ void TrackReader::run(ProcessingContext& pc) // every production build since ENABLE_CASSERT defaults to OFF.) const bool noEntry = ent >= mTree->GetEntries(); if (noEntry) { - LOG(info) << "no entry to read, publishing empty output"; + LOGP(warning, "No entry {} to read, tree contains {} entries, publishing empty output", ent, mTree->GetEntries()); } else { mTree->GetEntry(ent); } @@ -61,7 +63,7 @@ void TrackReader::run(ProcessingContext& pc) pc.outputs().snapshot(Output{mOrigin, "TRACKSMCTR", 0}, mMCTruth); } - if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (noEntry || mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/ITSMFT/common/workflow/src/ClusterReaderSpec.cxx b/Detectors/ITSMFT/common/workflow/src/ClusterReaderSpec.cxx index b22469535bd03..bfcc4cbad1ab6 100644 --- a/Detectors/ITSMFT/common/workflow/src/ClusterReaderSpec.cxx +++ b/Detectors/ITSMFT/common/workflow/src/ClusterReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file ClusterReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include #include @@ -56,7 +58,7 @@ void ClusterReader::init(InitContext& ic) template void ClusterReader::run(ProcessingContext& pc) { - auto ent = mTree->GetReadEntry() + 1; + long ent = pc.services().get().timeslice; // A timeframe holds no collision at all whenever the interaction rate is low enough, and // the tree then has no entry to read. Publish empty containers instead of reading past the // end and pushing branch addresses that GetEntry has not filled, so that the consumers @@ -64,7 +66,7 @@ void ClusterReader::run(ProcessingContext& pc) // every production build since ENABLE_CASSERT defaults to OFF.) const bool noEntry = ent >= mTree->GetEntries(); if (noEntry) { - LOG(info) << "no entry to read, publishing empty output"; + LOGP(warning, "No entry {} to read, tree contains {} entries, publishing empty output", ent, mTree->GetEntries()); } else { mTree->GetEntry(ent); } @@ -93,7 +95,7 @@ void ClusterReader::run(ProcessingContext& pc) std::vector dummyTrig; pc.outputs().snapshot(Output{Origin, "PHYSTRIG", 0}, dummyTrig); } - if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (noEntry || mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/ITSMFT/common/workflow/src/DigitReaderSpec.cxx b/Detectors/ITSMFT/common/workflow/src/DigitReaderSpec.cxx index 9b1fb55da6729..9061687484f2f 100644 --- a/Detectors/ITSMFT/common/workflow/src/DigitReaderSpec.cxx +++ b/Detectors/ITSMFT/common/workflow/src/DigitReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file DigitReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include #include #include @@ -101,13 +103,13 @@ void DigitReader::run(ProcessingContext& pc) auto ent = mTree->GetReadEntry(); if (!mUseIRFrames) { - ent++; + ent = pc.services().get().timeslice; if (ent >= mTree->GetEntries()) { // A timeframe holds no collision at all whenever the interaction rate is low enough, and the // digit tree then has no entry to read. Send empty output rather than dereferencing the // branch addresses, which GetEntry has not filled. (This used to be an assert, which is // compiled out of every production build since ENABLE_CASSERT defaults to OFF.) - LOG(info) << mDetName << "DigitReader has no entry to read, sending empty output"; + LOGP(warning, "{}DigitReader: no entry {} to read, tree contains {} entries, sending empty output", mDetName, ent, mTree->GetEntries()); for (uint32_t iLayer = 0; iLayer < mLayers; ++iLayer) { pc.outputs().snapshot(Output{Origin, "DIGITSROF", iLayer}, std::vector{}); pc.outputs().snapshot(Output{Origin, "DIGITS", iLayer}, std::vector{}); @@ -150,7 +152,7 @@ void DigitReader::run(ProcessingContext& pc) std::vector dummyTrig; pc.outputs().snapshot(Output{Origin, "PHYSTRIG", 0}, dummyTrig); } - if (mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/PHOS/workflow/src/CellReaderSpec.cxx b/Detectors/PHOS/workflow/src/CellReaderSpec.cxx index 733e55a505974..60992a9ffe8c5 100644 --- a/Detectors/PHOS/workflow/src/CellReaderSpec.cxx +++ b/Detectors/PHOS/workflow/src/CellReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file CellReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include #include #include "Framework/ControlService.h" @@ -40,7 +42,7 @@ void CellReader::init(InitContext& ic) void CellReader::run(ProcessingContext& pc) { - auto ent = mTree->GetReadEntry() + 1; + long ent = pc.services().get().timeslice; // A timeframe holds no collision at all whenever the interaction rate is low enough, and // the tree then has no entry to read. Publish empty containers instead of reading past the // end and pushing branch addresses that GetEntry has not filled, so that the consumers @@ -48,7 +50,7 @@ void CellReader::run(ProcessingContext& pc) // every production build since ENABLE_CASSERT defaults to OFF.) const bool noEntry = ent >= mTree->GetEntries(); if (noEntry) { - LOG(info) << "no entry to read, publishing empty output"; + LOGP(warning, "No entry {} to read, tree contains {} entries, publishing empty output", ent, mTree->GetEntries()); } else { mTree->GetEntry(ent); } @@ -59,7 +61,7 @@ void CellReader::run(ProcessingContext& pc) pc.outputs().snapshot(Output{mOrigin, "CELLSMCTR", 0}, mMCTruth); } - if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (noEntry || mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/PHOS/workflow/src/DigitReaderSpec.cxx b/Detectors/PHOS/workflow/src/DigitReaderSpec.cxx index d4aa1d54748fe..0fcc1131f8ae8 100644 --- a/Detectors/PHOS/workflow/src/DigitReaderSpec.cxx +++ b/Detectors/PHOS/workflow/src/DigitReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file DigitReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include #include #include "Framework/ControlService.h" @@ -40,7 +42,7 @@ void DigitReader::init(InitContext& ic) void DigitReader::run(ProcessingContext& pc) { - auto ent = mTree->GetReadEntry() + 1; + long ent = pc.services().get().timeslice; // A timeframe holds no collision at all whenever the interaction rate is low enough, and // the tree then has no entry to read. Publish empty containers instead of reading past the // end and pushing branch addresses that GetEntry has not filled, so that the consumers @@ -48,7 +50,7 @@ void DigitReader::run(ProcessingContext& pc) // every production build since ENABLE_CASSERT defaults to OFF.) const bool noEntry = ent >= mTree->GetEntries(); if (noEntry) { - LOG(info) << "no entry to read, publishing empty output"; + LOGP(warning, "No entry {} to read, tree contains {} entries, publishing empty output", ent, mTree->GetEntries()); } else { mTree->GetEntry(ent); } @@ -59,7 +61,7 @@ void DigitReader::run(ProcessingContext& pc) pc.outputs().snapshot(Output{mOrigin, "DIGITSMCTR", 0}, mMCTruth); } - if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (noEntry || mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/TOF/workflowIO/src/CalibClusReaderSpec.cxx b/Detectors/TOF/workflowIO/src/CalibClusReaderSpec.cxx index 56b246c87b513..b36ac60c98a61 100644 --- a/Detectors/TOF/workflowIO/src/CalibClusReaderSpec.cxx +++ b/Detectors/TOF/workflowIO/src/CalibClusReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file CalibClusReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include #include "Framework/ControlService.h" @@ -35,7 +37,7 @@ void CalibClusReader::init(InitContext& ic) void CalibClusReader::run(ProcessingContext& pc) { - auto ent = mTree->GetReadEntry() + 1; + long ent = pc.services().get().timeslice; // A timeframe holds no collision at all whenever the interaction rate is low enough, and // the tree then has no entry to read. Publish empty containers instead of reading past the // end and pushing branch addresses that GetEntry has not filled, so that the consumers @@ -43,7 +45,7 @@ void CalibClusReader::run(ProcessingContext& pc) // every production build since ENABLE_CASSERT defaults to OFF.) const bool noEntry = ent >= mTree->GetEntries(); if (noEntry) { - LOG(info) << "no entry to read, publishing empty output"; + LOGP(warning, "No entry {} to read, tree contains {} entries, publishing empty output", ent, mTree->GetEntries()); } else { mTree->GetEntry(ent); } @@ -57,7 +59,7 @@ void CalibClusReader::run(ProcessingContext& pc) pc.outputs().snapshot(Output{o2::header::gDataOriginTOF, "INFOTRACKSIZE", 0}, mCosmicTrackSize); } - if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (noEntry || mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/TOF/workflowIO/src/ClusterReaderSpec.cxx b/Detectors/TOF/workflowIO/src/ClusterReaderSpec.cxx index ea76c8c7dbb56..07d3b4ab18efc 100644 --- a/Detectors/TOF/workflowIO/src/ClusterReaderSpec.cxx +++ b/Detectors/TOF/workflowIO/src/ClusterReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file ClusterReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include #include "Framework/ControlService.h" @@ -39,7 +41,7 @@ void ClusterReader::init(InitContext& ic) void ClusterReader::run(ProcessingContext& pc) { - auto ent = mTree->GetReadEntry() + 1; + long ent = pc.services().get().timeslice; // A timeframe holds no collision at all whenever the interaction rate is low enough, and // the tree then has no entry to read. Publish empty containers instead of reading past the // end and pushing branch addresses that GetEntry has not filled, so that the consumers @@ -47,7 +49,7 @@ void ClusterReader::run(ProcessingContext& pc) // every production build since ENABLE_CASSERT defaults to OFF.) const bool noEntry = ent >= mTree->GetEntries(); if (noEntry) { - LOG(info) << "no entry to read, publishing empty output"; + LOGP(warning, "No entry {} to read, tree contains {} entries, publishing empty output", ent, mTree->GetEntries()); } else { mTree->GetEntry(ent); } @@ -59,7 +61,7 @@ void ClusterReader::run(ProcessingContext& pc) pc.outputs().snapshot(Output{o2::header::gDataOriginTOF, "CLUSTERSMCTR", 0}, mLabels); } - if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (noEntry || mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/TOF/workflowIO/src/DigitReaderSpec.cxx b/Detectors/TOF/workflowIO/src/DigitReaderSpec.cxx index 6986d88f06912..30ba6362baaca 100644 --- a/Detectors/TOF/workflowIO/src/DigitReaderSpec.cxx +++ b/Detectors/TOF/workflowIO/src/DigitReaderSpec.cxx @@ -11,6 +11,7 @@ /// @file DigitReaderSpec.cxx +#include "Framework/DeviceSpec.h" #include #include "TTree.h" @@ -70,6 +71,14 @@ void DigitReader::run(ProcessingContext& pc) treeDig->SetBranchAddress("TOFDigitMCTruth", &mPlabels); } + mCurrentEntry = pc.services().get().timeslice; + if (mCurrentEntry >= treeDig->GetEntries()) { + LOG(warning) << "No entry " << mCurrentEntry << " to read in tree with " << treeDig->GetEntries() << " entries"; + mState = 2; + pc.services().get().endOfStream(); + pc.services().get().readyToQuit(QuitRequest::Me); + return; + } treeDig->GetEntry(mCurrentEntry); // fill diagnostic frequencies @@ -105,12 +114,10 @@ void DigitReader::run(ProcessingContext& pc) return; } - mCurrentEntry++; - - if (mCurrentEntry >= treeDig->GetEntries()) { + if (mCurrentEntry + pc.services().get().maxInputTimeslices >= treeDig->GetEntries()) { mState = 2; - //pc.services().get().readyToQuit(QuitRequest::Me); pc.services().get().endOfStream(); + pc.services().get().readyToQuit(QuitRequest::Me); } } diff --git a/Detectors/TOF/workflowIO/src/TOFIntegrateClusterReaderSpec.cxx b/Detectors/TOF/workflowIO/src/TOFIntegrateClusterReaderSpec.cxx index 917c5c495c791..87cc1d8306d7b 100644 --- a/Detectors/TOF/workflowIO/src/TOFIntegrateClusterReaderSpec.cxx +++ b/Detectors/TOF/workflowIO/src/TOFIntegrateClusterReaderSpec.cxx @@ -11,6 +11,7 @@ /// @file TOFIntegrateClusterReaderSpec.cxx +#include "Framework/DeviceSpec.h" #include #include @@ -93,7 +94,7 @@ void IntegratedClusterReader::init(InitContext& ic) void IntegratedClusterReader::run(ProcessingContext& pc) { // check time order inside the TChain - if (mChainEntry == 0) { + if (mIndices.empty()) { mIndices.clear(); mIndices.reserve(mChain->GetEntries()); // disable all branches except the firstTForbit branch to significantly speed up the loop over the TTree @@ -107,8 +108,16 @@ void IntegratedClusterReader::run(ProcessingContext& pc) std::sort(mIndices.begin(), mIndices.end()); } + mChainEntry = pc.services().get().timeslice; + if (mChainEntry >= mIndices.size()) { + LOG(warning) << "No entry " << mChainEntry << " to read in chain with " << mIndices.size() << " entries"; + pc.services().get().endOfStream(); + pc.services().get().readyToQuit(QuitRequest::Me); + return; + } + LOGP(debug, "Processing entry {}", mIndices[mChainEntry].second); - mChain->GetEntry(mIndices[mChainEntry++].second); + mChain->GetEntry(mIndices[mChainEntry].second); // inject correct timing informations auto& timingInfo = pc.services().get(); @@ -121,7 +130,7 @@ void IntegratedClusterReader::run(ProcessingContext& pc) pc.outputs().snapshot(Output{header::gDataOriginTOF, "ITOFCQ"}, mTOFCqTot); usleep(100); - if (mChainEntry >= mChain->GetEntries()) { + if (mChainEntry + pc.services().get().maxInputTimeslices >= mChain->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/TOF/workflowIO/src/TOFMatchedReaderSpec.cxx b/Detectors/TOF/workflowIO/src/TOFMatchedReaderSpec.cxx index 48ccb83ca3cc3..1de9335323ad5 100644 --- a/Detectors/TOF/workflowIO/src/TOFMatchedReaderSpec.cxx +++ b/Detectors/TOF/workflowIO/src/TOFMatchedReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file TOFMatchedReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include #include "TTree.h" @@ -68,8 +70,13 @@ void TOFMatchedReader::connectTree(const std::string& filename) void TOFMatchedReader::run(ProcessingContext& pc) { - auto currEntry = mTree->GetReadEntry() + 1; - assert(currEntry < mTree->GetEntries()); // this should not happen + long currEntry = pc.services().get().timeslice; + if (currEntry >= mTree->GetEntries()) { + LOG(warning) << "No entry " << currEntry << " to read in tree with " << mTree->GetEntries() << " entries"; + pc.services().get().endOfStream(); + pc.services().get().readyToQuit(QuitRequest::Me); + return; + } mTree->GetEntry(currEntry); LOG(debug) << "Pushing " << mMatches.size() << " TOF matchings at entry " << currEntry; @@ -82,7 +89,7 @@ void TOFMatchedReader::run(ProcessingContext& pc) pc.outputs().snapshot(Output{o2::header::gDataOriginTOF, ddMCMatchTOF[mMode], tpcMatchSS}, mLabelTOF); } - if (mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/TPC/workflow/readers/src/TrackReaderSpec.cxx b/Detectors/TPC/workflow/readers/src/TrackReaderSpec.cxx index 8d0f7681c2f33..060be76ae6951 100644 --- a/Detectors/TPC/workflow/readers/src/TrackReaderSpec.cxx +++ b/Detectors/TPC/workflow/readers/src/TrackReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file TrackReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include #include "Framework/ControlService.h" #include "Framework/ConfigParamRegistry.h" @@ -40,7 +42,7 @@ void TrackReader::init(InitContext& ic) void TrackReader::run(ProcessingContext& pc) { - auto ent = mTree->GetReadEntry() + 1; + long ent = pc.services().get().timeslice; // A timeframe holds no collision at all whenever the interaction rate is low enough, and // the tree then has no entry to read. Publish empty containers instead of reading past the // end and pushing branch addresses that GetEntry has not filled, so that the consumers @@ -48,7 +50,7 @@ void TrackReader::run(ProcessingContext& pc) // every production build since ENABLE_CASSERT defaults to OFF.) const bool noEntry = ent >= mTree->GetEntries(); if (noEntry) { - LOG(info) << "no entry to read, publishing empty output"; + LOGP(warning, "No entry {} to read, tree contains {} entries, publishing empty output", ent, mTree->GetEntries()); } else { accumulate(ent, 1); // to really accumulate all, use accumulate(ent,mTree->GetEntries()); } @@ -83,7 +85,7 @@ void TrackReader::run(ProcessingContext& pc) if (mUseMC) { pc.outputs().snapshot(Output{"TPC", "TRACKSMCLBL", 0}, mMCTruthOut); } - if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (noEntry || mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/TPC/workflow/readers/src/TriggerReaderSpec.cxx b/Detectors/TPC/workflow/readers/src/TriggerReaderSpec.cxx index 5dd3c16b3b1a8..d9c70f80561d1 100644 --- a/Detectors/TPC/workflow/readers/src/TriggerReaderSpec.cxx +++ b/Detectors/TPC/workflow/readers/src/TriggerReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file TriggerReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include #include "Framework/ControlService.h" #include "Framework/ConfigParamRegistry.h" @@ -33,11 +35,17 @@ void TriggerReader::init(InitContext& ic) void TriggerReader::run(ProcessingContext& pc) { - auto ent = mTree->GetReadEntry() + 1; + long ent = pc.services().get().timeslice; + if (ent >= mTree->GetEntries()) { + LOG(warning) << "No entry " << ent << " to read in tree with " << mTree->GetEntries() << " entries"; + pc.services().get().endOfStream(); + pc.services().get().readyToQuit(QuitRequest::Me); + return; + } mTree->GetEntry(ent); pc.outputs().snapshot(Output{"TPC", "TRIGGERWORDS", 0}, *mTrig); - if (mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/TRD/workflow/io/src/TRDCalibReaderSpec.cxx b/Detectors/TRD/workflow/io/src/TRDCalibReaderSpec.cxx index 26445f3ef6329..8951d5a7f7bf0 100644 --- a/Detectors/TRD/workflow/io/src/TRDCalibReaderSpec.cxx +++ b/Detectors/TRD/workflow/io/src/TRDCalibReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file TRDCalibReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include "TRDWorkflowIO/TRDCalibReaderSpec.h" #include "Framework/ControlService.h" @@ -59,15 +61,20 @@ void TRDCalibReader::connectTree() void TRDCalibReader::run(ProcessingContext& pc) { - auto currEntry = mTree->GetReadEntry() + 1; - assert(currEntry < mTree->GetEntries()); // this should not happen + long currEntry = pc.services().get().timeslice; + if (currEntry >= mTree->GetEntries()) { + LOG(warning) << "No entry " << currEntry << " to read in tree with " << mTree->GetEntries() << " entries"; + pc.services().get().endOfStream(); + pc.services().get().readyToQuit(QuitRequest::Me); + return; + } mTree->GetEntry(currEntry); LOG(info) << "Pushing angular residual histograms filled with " << mAngResids.getNEntries() << " entries at tree entry " << currEntry; pc.outputs().snapshot(Output{o2::header::gDataOriginTRD, "ANGRESHISTS", 0}, mAngResids); pc.outputs().snapshot(Output{o2::header::gDataOriginTRD, "PULSEHEIGHT", 0}, mPHData); pc.outputs().snapshot(Output{o2::header::gDataOriginTRD, "GAINCALIBHISTS", 0}, mGainData); - if (mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/TRD/workflow/io/src/TRDDigitReaderSpec.cxx b/Detectors/TRD/workflow/io/src/TRDDigitReaderSpec.cxx index 92d001bc5120a..5999246ed6fdd 100644 --- a/Detectors/TRD/workflow/io/src/TRDDigitReaderSpec.cxx +++ b/Detectors/TRD/workflow/io/src/TRDDigitReaderSpec.cxx @@ -9,6 +9,8 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include "TRDWorkflowIO/TRDDigitReaderSpec.h" @@ -54,8 +56,13 @@ void TRDDigitReaderSpec::connectTree() void TRDDigitReaderSpec::run(ProcessingContext& pc) { - auto currEntry = mTreeDigits->GetReadEntry() + 1; - assert(currEntry < mTreeDigits->GetEntries()); // this should not happen + long currEntry = pc.services().get().timeslice; + if (currEntry >= mTreeDigits->GetEntries()) { + LOG(warning) << "No entry " << currEntry << " to read in tree with " << mTreeDigits->GetEntries() << " entries"; + pc.services().get().endOfStream(); + pc.services().get().readyToQuit(QuitRequest::Me); + return; + } mTreeDigits->GetEntry(currEntry); LOGP(info, "Pushing {} digits for tree entry {}", mDigits.size(), currEntry); pc.outputs().snapshot(Output{o2::header::gDataOriginTRD, "DIGITS", mSubSpec}, mDigits); @@ -67,7 +74,7 @@ void TRDDigitReaderSpec::run(ProcessingContext& pc) auto& sharedlabels = pc.outputs().make>(Output{o2::header::gDataOriginTRD, "LABELS", 0}); mLabels->copyandflatten(sharedlabels); } - if (mTreeDigits->GetReadEntry() + 1 >= mTreeDigits->GetEntries()) { + if (mTreeDigits->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTreeDigits->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/TRD/workflow/io/src/TRDPHReaderSpec.cxx b/Detectors/TRD/workflow/io/src/TRDPHReaderSpec.cxx index 7f873beb2ece1..1720a9d19ec61 100644 --- a/Detectors/TRD/workflow/io/src/TRDPHReaderSpec.cxx +++ b/Detectors/TRD/workflow/io/src/TRDPHReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file TRDPHReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include "TRDWorkflowIO/TRDPHReaderSpec.h" #include "Framework/ControlService.h" @@ -49,14 +51,19 @@ void TRDPHReader::connectTree() void TRDPHReader::run(ProcessingContext& pc) { - auto currEntry = mTree->GetReadEntry() + 1; - assert(currEntry < mTree->GetEntries()); + long currEntry = pc.services().get().timeslice; + if (currEntry >= mTree->GetEntries()) { + LOG(warning) << "No entry " << currEntry << " to read in tree with " << mTree->GetEntries() << " entries"; + pc.services().get().endOfStream(); + pc.services().get().readyToQuit(QuitRequest::Me); + return; + } mTree->GetEntry(currEntry); LOG(info) << "Pushing vector of PH values filled with " << mPHValues.size() << " entries at tree entry " << currEntry; pc.outputs().snapshot(Output{o2::header::gDataOriginTRD, "PULSEHEIGHT", 0}, mPHValues); - if (mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/TRD/workflow/io/src/TRDTrackReaderSpec.cxx b/Detectors/TRD/workflow/io/src/TRDTrackReaderSpec.cxx index 965dd252b26bd..98b05d78c0276 100644 --- a/Detectors/TRD/workflow/io/src/TRDTrackReaderSpec.cxx +++ b/Detectors/TRD/workflow/io/src/TRDTrackReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file TRDTrackReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include "TRDWorkflowIO/TRDTrackReaderSpec.h" #include "Framework/ConfigParamRegistry.h" #include "Framework/ControlService.h" @@ -37,7 +39,7 @@ void TRDTrackReader::init(InitContext& ic) void TRDTrackReader::run(ProcessingContext& pc) { - auto ent = mTree->GetReadEntry() + 1; + long ent = pc.services().get().timeslice; // A timeframe holds no collision at all whenever the interaction rate is low enough, and // the tree then has no entry to read. Publish empty containers instead of reading past the // end and pushing branch addresses that GetEntry has not filled, so that the consumers @@ -45,7 +47,7 @@ void TRDTrackReader::run(ProcessingContext& pc) // every production build since ENABLE_CASSERT defaults to OFF.) const bool noEntry = ent >= mTree->GetEntries(); if (noEntry) { - LOG(info) << "no entry to read, publishing empty output"; + LOGP(warning, "No entry {} to read, tree contains {} entries, publishing empty output", ent, mTree->GetEntries()); } else { mTree->GetEntry(ent); } @@ -74,7 +76,7 @@ void TRDTrackReader::run(ProcessingContext& pc) } } - if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (noEntry || mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/TRD/workflow/io/src/TRDTrackletReaderSpec.cxx b/Detectors/TRD/workflow/io/src/TRDTrackletReaderSpec.cxx index 864cc3d665af5..f7d55c78bc3e7 100644 --- a/Detectors/TRD/workflow/io/src/TRDTrackletReaderSpec.cxx +++ b/Detectors/TRD/workflow/io/src/TRDTrackletReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file TRDTrackletReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include "TRDWorkflowIO/TRDTrackletReaderSpec.h" #include "Framework/ControlService.h" @@ -67,8 +69,13 @@ void TRDTrackletReader::connectTree() void TRDTrackletReader::run(ProcessingContext& pc) { - auto currEntry = mTreeTrklt->GetReadEntry() + 1; - assert(currEntry < mTreeTrklt->GetEntries()); // this should not happen + long currEntry = pc.services().get().timeslice; + if (currEntry >= mTreeTrklt->GetEntries()) { + LOG(warning) << "No entry " << currEntry << " to read in tree with " << mTreeTrklt->GetEntries() << " entries"; + pc.services().get().endOfStream(); + pc.services().get().readyToQuit(QuitRequest::Me); + return; + } mTreeTrklt->GetEntry(currEntry); LOG(info) << "Pushing " << mTriggerRecords.size() << " TRD trigger records at entry " << currEntry; LOG(info) << "Pushing " << mTracklets.size() << " uncalibrated TRD tracklets for these trigger records"; @@ -88,7 +95,7 @@ void TRDTrackletReader::run(ProcessingContext& pc) pc.outputs().snapshot(Output{"TRD", "TRKLABELS", 0}, mLabels); } - if (mTreeTrklt->GetReadEntry() + 1 >= mTreeTrklt->GetEntries()) { + if (mTreeTrklt->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTreeTrklt->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/Upgrades/ALICE3/IOTOF/workflow/src/ClusterReaderSpec.cxx b/Detectors/Upgrades/ALICE3/IOTOF/workflow/src/ClusterReaderSpec.cxx index 49e0d7ea3ccf0..52e444dd39dea 100644 --- a/Detectors/Upgrades/ALICE3/IOTOF/workflow/src/ClusterReaderSpec.cxx +++ b/Detectors/Upgrades/ALICE3/IOTOF/workflow/src/ClusterReaderSpec.cxx @@ -12,6 +12,8 @@ /// \file ClusterReaderSpec.cxx /// \brief The TF3 cluster reader (ClusterReaderSpec.h). +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include "IOTOFWorkflow/ClusterReaderSpec.h" #include "Framework/ConfigParamRegistry.h" @@ -34,12 +36,12 @@ void ClusterReader::init(InitContext& ic) void ClusterReader::run(ProcessingContext& pc) { - const auto entry = mTree->GetReadEntry() + 1; + long entry = pc.services().get().timeslice; // A timeframe without a collision has no entry: publish empty streams, so // that the consumers still see the timeframe (as TRK's reader does). const bool noEntry = entry >= mTree->GetEntries(); if (noEntry) { - LOG(info) << "TF3ClusterReader: no entry to read, publishing empty output"; + LOGP(warning, "TF3ClusterReader: no entry {} to read, tree contains {} entries, publishing empty output", entry, mTree->GetEntries()); } else { mTree->GetEntry(entry); } @@ -55,7 +57,7 @@ void ClusterReader::run(ProcessingContext& pc) if (mUseMC) { pc.outputs().snapshot(Output{o2::header::gDataOriginTF3, "CLUSTERSMCTR", 0}, noEntry ? noLabels : *mLabels); } - if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (noEntry || mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/Upgrades/ALICE3/IOTOF/workflow/src/DigitReaderSpec.cxx b/Detectors/Upgrades/ALICE3/IOTOF/workflow/src/DigitReaderSpec.cxx index 9ff4213a951b8..938747d53acc6 100644 --- a/Detectors/Upgrades/ALICE3/IOTOF/workflow/src/DigitReaderSpec.cxx +++ b/Detectors/Upgrades/ALICE3/IOTOF/workflow/src/DigitReaderSpec.cxx @@ -9,6 +9,8 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include #include "TTree.h" @@ -52,8 +54,13 @@ void TF3DigitReader::init(o2::framework::InitContext& ic) void TF3DigitReader::run(o2::framework::ProcessingContext& pc) { - auto ent = mTree->GetReadEntry() + 1; - assert(ent < mTree->GetEntries()); // this should not happen + long ent = pc.services().get().timeslice; + if (ent >= mTree->GetEntries()) { + LOG(warning) << "No entry " << ent << " to read in tree with " << mTree->GetEntries() << " entries"; + pc.services().get().endOfStream(); + pc.services().get().readyToQuit(QuitRequest::Me); + return; + } o2::dataformats::IOMCTruthContainerView* plabels = nullptr; if (mUseMC) { @@ -78,7 +85,7 @@ void TF3DigitReader::run(o2::framework::ProcessingContext& pc) pc.outputs().snapshot(Output{mOrigin, "DIGITSMC2ROF", 0}, mDigMC2ROFs); } - if (mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/Upgrades/ALICE3/TRKFT3/common/workflow/src/ClusterReaderSpec.cxx b/Detectors/Upgrades/ALICE3/TRKFT3/common/workflow/src/ClusterReaderSpec.cxx index 185a44787e176..896b442018750 100644 --- a/Detectors/Upgrades/ALICE3/TRKFT3/common/workflow/src/ClusterReaderSpec.cxx +++ b/Detectors/Upgrades/ALICE3/TRKFT3/common/workflow/src/ClusterReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file ClusterReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include "TRKWorkflow/ClusterReaderSpec.h" #include "DetectorsCommonDataFormats/DetID.h" #include "Framework/ConfigParamRegistry.h" @@ -67,12 +69,12 @@ template void ClusterReader::run(ProcessingContext& pc) { constexpr auto origin = DetID == o2::detectors::DetID::TRK ? o2::header::gDataOriginTRK : o2::header::gDataOriginFT3; - const auto entry = mTree->GetReadEntry() + 1; + long entry = pc.services().get().timeslice; // A timeframe without a collision has no entry: publish empty streams, so // that the consumers still see the timeframe (as the digit reader does). const bool noEntry = entry >= mTree->GetEntries(); if (noEntry) { - LOG(info) << detName() << "ClusterReader: no entry to read, publishing empty output"; + LOGP(warning, "{}ClusterReader: no entry {} to read, tree contains {} entries, publishing empty output", detName(), entry, mTree->GetEntries()); } else { mTree->GetEntry(entry); } @@ -93,7 +95,7 @@ void ClusterReader::run(ProcessingContext& pc) pc.outputs().snapshot(Output{origin, "CLUSTERSMCTR", subspec}, noEntry ? noLabels : *mLabels[layer]); } } - if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (noEntry || mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/Upgrades/ALICE3/TRKFT3/common/workflow/src/DigitReaderSpec.cxx b/Detectors/Upgrades/ALICE3/TRKFT3/common/workflow/src/DigitReaderSpec.cxx index 507a584372745..27756eff6c57c 100644 --- a/Detectors/Upgrades/ALICE3/TRKFT3/common/workflow/src/DigitReaderSpec.cxx +++ b/Detectors/Upgrades/ALICE3/TRKFT3/common/workflow/src/DigitReaderSpec.cxx @@ -9,6 +9,8 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include #include "TTree.h" @@ -65,7 +67,7 @@ void DigitReader::init(InitContext& ic) void DigitReader::run(ProcessingContext& pc) { - auto ent = mTree->GetReadEntry() + 1; + long ent = pc.services().get().timeslice; // A timeframe holds no collision at all whenever the interaction rate is low enough, and // the tree then has no entry to read. Publish empty containers instead of reading past the // end and pushing branch addresses that GetEntry has not filled, so that the consumers @@ -73,7 +75,7 @@ void DigitReader::run(ProcessingContext& pc) // every production build since ENABLE_CASSERT defaults to OFF.) const bool noEntry = ent >= mTree->GetEntries(); if (noEntry) { - LOG(info) << "no entry to read, publishing empty output"; + LOGP(warning, "No entry {} to read, tree contains {} entries, publishing empty output", ent, mTree->GetEntries()); } else { mTree->GetEntry(ent); } @@ -106,7 +108,7 @@ void DigitReader::run(ProcessingContext& pc) pc.outputs().snapshot(Output{mOrigin, "GBTCALIB", 0}, mCalib); } - if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (noEntry || mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/Upgrades/ITS3/workflow/src/DigitReaderSpec.cxx b/Detectors/Upgrades/ITS3/workflow/src/DigitReaderSpec.cxx index 04300e43ac343..9960822853276 100644 --- a/Detectors/Upgrades/ITS3/workflow/src/DigitReaderSpec.cxx +++ b/Detectors/Upgrades/ITS3/workflow/src/DigitReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file DigitReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include #include "Framework/ControlService.h" @@ -47,7 +49,7 @@ void ITS3DigitReader::init(InitContext& ic) void ITS3DigitReader::run(ProcessingContext& pc) { - auto ent = mTree->GetReadEntry() + 1; + long ent = pc.services().get().timeslice; // A timeframe holds no collision at all whenever the interaction rate is low enough, and // the tree then has no entry to read. Publish empty containers instead of reading past the // end and pushing branch addresses that GetEntry has not filled, so that the consumers @@ -55,7 +57,7 @@ void ITS3DigitReader::run(ProcessingContext& pc) // every production build since ENABLE_CASSERT defaults to OFF.) const bool noEntry = ent >= mTree->GetEntries(); if (noEntry) { - LOG(info) << "no entry to read, publishing empty output"; + LOGP(warning, "No entry {} to read, tree contains {} entries, publishing empty output", ent, mTree->GetEntries()); } else { mTree->GetEntry(ent); } @@ -86,7 +88,7 @@ void ITS3DigitReader::run(ProcessingContext& pc) } } - if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (noEntry || mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/ZDC/workflow/src/DigitReaderSpec.cxx b/Detectors/ZDC/workflow/src/DigitReaderSpec.cxx index 0384115816da5..aaafb3102556e 100644 --- a/Detectors/ZDC/workflow/src/DigitReaderSpec.cxx +++ b/Detectors/ZDC/workflow/src/DigitReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file DigitReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include #include "TTree.h" @@ -65,7 +67,7 @@ void DigitReader::run(ProcessingContext& pc) mTree->SetBranchAddress("ZDCDigitLabels", &plabels); } - auto ent = mTree->GetReadEntry() < 0 ? mTree->GetReadEntry() + mFirstEntry + 1 : mTree->GetReadEntry() + 1; + long ent = pc.services().get().timeslice + mFirstEntry; // A timeframe holds no collision at all whenever the interaction rate is low enough, and // the tree then has no entry to read. Publish empty containers instead of reading past the // end and pushing branch addresses that GetEntry has not filled, so that the consumers @@ -73,7 +75,7 @@ void DigitReader::run(ProcessingContext& pc) // every production build since ENABLE_CASSERT defaults to OFF.) const bool noEntry = ent >= mTree->GetEntries(); if (noEntry) { - LOG(info) << "no entry to read, publishing empty output"; + LOGP(warning, "No entry {} to read, tree contains {} entries, publishing empty output", ent, mTree->GetEntries()); } else { mTree->GetEntry(ent); } @@ -84,7 +86,7 @@ void DigitReader::run(ProcessingContext& pc) if (mUseMC) { pc.outputs().snapshot(Output{"ZDC", "DIGITSLBL", 0}, labels); } - uint64_t nextEntry = mTree->GetReadEntry() + 1; + uint64_t nextEntry = mTree->GetReadEntry() + pc.services().get().maxInputTimeslices; if (noEntry || nextEntry >= mTree->GetEntries() || (mLastEntry >= 0 && nextEntry > mLastEntry)) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); diff --git a/Detectors/ZDC/workflow/src/RecEventReaderSpec.cxx b/Detectors/ZDC/workflow/src/RecEventReaderSpec.cxx index f5678b4065a5e..a94181738c9af 100644 --- a/Detectors/ZDC/workflow/src/RecEventReaderSpec.cxx +++ b/Detectors/ZDC/workflow/src/RecEventReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file RecEventReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include #include "Framework/ConfigParamRegistry.h" @@ -44,7 +46,7 @@ void RecEventReader::init(InitContext& ic) void RecEventReader::run(ProcessingContext& pc) { - auto ent = mTree->GetReadEntry() + 1; + long ent = pc.services().get().timeslice; // A timeframe holds no collision at all whenever the interaction rate is low enough, and // the tree then has no entry to read. Publish empty containers instead of reading past the // end and pushing branch addresses that GetEntry has not filled, so that the consumers @@ -52,7 +54,7 @@ void RecEventReader::run(ProcessingContext& pc) // every production build since ENABLE_CASSERT defaults to OFF.) const bool noEntry = ent >= mTree->GetEntries(); if (noEntry) { - LOG(info) << "no entry to read, publishing empty output"; + LOGP(warning, "No entry {} to read, tree contains {} entries, publishing empty output", ent, mTree->GetEntries()); } else { mTree->GetEntry(ent); } @@ -71,7 +73,7 @@ void RecEventReader::run(ProcessingContext& pc) pc.outputs().snapshot(Output{"ZDC", "TDCDATA", 0}, tdcData); pc.outputs().snapshot(Output{"ZDC", "INFO", 0}, info); - if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (noEntry || mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); } diff --git a/Detectors/ZDC/workflow/src/RecoReaderSpec.cxx b/Detectors/ZDC/workflow/src/RecoReaderSpec.cxx index 87c6b6c36cc8b..e8dc1fbb14de2 100644 --- a/Detectors/ZDC/workflow/src/RecoReaderSpec.cxx +++ b/Detectors/ZDC/workflow/src/RecoReaderSpec.cxx @@ -11,6 +11,8 @@ /// @file RecoReaderSpec.cxx +#include "Framework/DeviceSpec.h" +#include "Framework/TimingInfo.h" #include #include @@ -63,7 +65,7 @@ void RecoReader::run(ProcessingContext& pc) mTree->SetBranchAddress("ZDCRecInfo", &InfoPtr); mTree->SetBranchAddress("ZDCWaveform", &WaveformDataPtr); - auto ent = mTree->GetReadEntry() + 1; + long ent = pc.services().get().timeslice; // A timeframe holds no collision at all whenever the interaction rate is low enough, and // the tree then has no entry to read. Publish empty containers instead of reading past the // end and pushing branch addresses that GetEntry has not filled, so that the consumers @@ -71,7 +73,7 @@ void RecoReader::run(ProcessingContext& pc) // every production build since ENABLE_CASSERT defaults to OFF.) const bool noEntry = ent >= mTree->GetEntries(); if (noEntry) { - LOG(info) << "no entry to read, publishing empty output"; + LOGP(warning, "No entry {} to read, tree contains {} entries, publishing empty output", ent, mTree->GetEntries()); } else { mTree->GetEntry(ent); } @@ -82,7 +84,7 @@ void RecoReader::run(ProcessingContext& pc) pc.outputs().snapshot(Output{"ZDC", "INFO", 0}, Info); pc.outputs().snapshot(Output{"ZDC", "WAVE", 0}, WaveformData); - if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { + if (noEntry || mTree->GetReadEntry() + pc.services().get().maxInputTimeslices >= mTree->GetEntries()) { pc.services().get().endOfStream(); pc.services().get().readyToQuit(QuitRequest::Me); }