Skip to content
Snippets Groups Projects
Commit f7982b9c authored by Danilo Piparo's avatar Danilo Piparo
Browse files

[TTreeProcessorMT] Properly reconstruct TEntryList in the TChain case

for example when the TEntryList contains sub lists, matching with the
name of the file and tree whenever needed.
parent c01912c1
No related branches found
No related tags found
No related merge requests found
......@@ -82,17 +82,41 @@ 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.
std::vector<TEntryList*> globalEntryLists;
auto innerLists = globalList.GetLists();
if (!innerLists) {
globalEntryLists.emplace_back(&globalList);
} else {
for (auto lp : *innerLists) {
globalEntryLists.emplace_back(static_cast<TEntryList*>(lp));
}
}
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) {
break;
} else if (entry >= start) {
localList->Enter(entry);
for (auto gl : globalEntryLists) {
// We call GetEntry twice: workaround for ROOT-10113 (the return value for 1 call only could be -1)
gl->GetEntry(0);
Long64_t entry = gl->GetEntry(0);
// this may be owned by the local list
auto tmp_list = new TEntryList(gl->GetName(), gl->GetTitle(), gl->GetFileName(), gl->GetTreeName());
do {
if (entry >= end) {
break;
} else if (entry >= start) {
tmp_list->Enter(entry);
}
} while ((entry = gl->Next()) >= 0);
if (tmp_list->GetN() > 0) {
localList->Add(tmp_list);
} else {
delete tmp_list;
}
} while ((entry = globalList.Next()) >= 0);
}
auto reader = std::make_unique<TTreeReader>(fChain.get(), localList.get());
return std::make_pair(std::move(reader), std::move(localList));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment