Skip to content

Commit

Permalink
[ntuple] Update chain processing tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
enirolf committed Jan 22, 2025
1 parent e082d1c commit bf4b538
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tutorials/io/ntuple/ntpl012_processor_chain.C
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,14 @@ void Read(const std::vector<RNTupleOpenSpec> &ntuples)
// Access to the entry values in this case can be achieved through RNTupleProcessor::GetEntry() or through its
// iterator.
auto processor = RNTupleProcessor::CreateChain(ntuples, std::move(model));
int prevProcessorNumber{-1};

for (const auto &entry : *processor) {
// The RNTupleProcessor provides some additional bookkeeping information. The local entry number is reset each
// a new ntuple in the chain is opened for processing.
if (processor->GetLocalEntryNumber() == 0) {
std::cout << "Processing " << ntuples.at(processor->GetCurrentNTupleNumber()).fNTupleName << " ("
if (static_cast<int>(processor->GetCurrentProcessorNumber()) > prevProcessorNumber) {
prevProcessorNumber = processor->GetCurrentProcessorNumber();
std::cout << "Processing " << ntuples.at(prevProcessorNumber).fNTupleName << " ("
<< processor->GetNEntriesProcessed() << " total entries processed so far)" << std::endl;
}

Expand Down

0 comments on commit bf4b538

Please sign in to comment.