65 std::vector<ROOT::Internal::TreeViewCluster> clusters;
66 const auto &fileNames =
treeView->GetFileNames();
67 const auto nFileNames = fileNames.size();
68 const auto &treeName =
treeView->GetTreeName();
70 for (
auto i = 0u; i < nFileNames; ++i) {
71 std::unique_ptr<TFile> f(
TFile::Open(fileNames[i].c_str()));
73 f->GetObject(treeName.c_str(), t);
74 auto clusterIter = t->GetClusterIterator(0);
76 const Long64_t entries = t->GetEntries();
78 while ((start = clusterIter()) < entries) {
79 end = clusterIter.GetNextEntry();
114 treeView->PushLoadedEntry(c.startEntry);
116 auto readerAndEntryList =
treeView->GetTreeReader(c.startEntry, c.endEntry);
117 auto &
reader = std::get<0>(readerAndEntryList);
126 pool.
Foreach(mapFunction, clusters);
void Foreach(F func, unsigned nTimes)
Execute func (with no arguments) nTimes in parallel.
TTreeReader is a simple, robust and fast interface to read values from a TTree, TChain or TNtuple...
A cluster of entries as seen by TTreeView.
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=1, Int_t netopt=0)
Create / open a file.
void function(const Char_t *name_, T fun, const Char_t *docstring=0)
This class provides a simple interface to execute the same task multiple times in parallel...
void Process(std::function< void(TTreeReader &)> func)
Process the entries of a TTree in parallel.
std::vector< ROOT::Internal::TreeViewCluster > MakeClusters()
Divide input data in clusters, i.e. the workloads to distribute to tasks.
ROOT::TThreadedObject< ROOT::Internal::TTreeView > treeView
! Thread-local TreeViews
TTreeProcessorMT(std::string_view filename, std::string_view treename="")
Constructor based on a file name.
A List of entry numbers in a TTree or TChain.