From d74040feb3c2bd2da81f19662b3d19ad8e88dbe9 Mon Sep 17 00:00:00 2001 From: Danilo Piparo <danilo.piparo@cern.ch> Date: Wed, 8 May 2019 21:51:29 +0200 Subject: [PATCH] [TTreeProcessorMT] Add workround for ROOT-10113 the issue is that, under certain circumstances to be clarified, the TEntryList::GetEntry method returns -1 even when it should when called for the first time. --- tree/treeplayer/src/TTreeProcessorMT.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tree/treeplayer/src/TTreeProcessorMT.cxx b/tree/treeplayer/src/TTreeProcessorMT.cxx index 4aa6239b49d..65bbb626fe2 100644 --- a/tree/treeplayer/src/TTreeProcessorMT.cxx +++ b/tree/treeplayer/src/TTreeProcessorMT.cxx @@ -83,12 +83,15 @@ TTreeView::MakeReaderWithEntryList(TEntryList &globalList, Long64_t start, Long6 // TEntryList and SetEntriesRange do not work together (the former has precedence). // We need to construct a TEntryList that contains only those entry numbers in our desired range. auto localList = std::make_unique<TEntryList>(); + // We call GetEntry twice: workaround for ROOT-10113 (the return value for 1 call only could be -1) + globalList.GetEntry(0); Long64_t entry = globalList.GetEntry(0); do { - if (entry >= end) + if (entry >= end) { break; - else if (entry >= start) + } else if (entry >= start) { localList->Enter(entry); + } } while ((entry = globalList.Next()) >= 0); auto reader = std::make_unique<TTreeReader>(fChain.get(), localList.get()); -- GitLab