Logo ROOT   6.08/07
Reference Guide
List of all members | Public Member Functions | Private Attributes | List of all members
ROOT::TTreeProcessor Class Reference

Definition at line 138 of file TTreeProcessor.hxx.

Public Member Functions

 TTreeProcessor (std::string_view filename, std::string_view treename="")
 Regular constructor. More...
 
void Process (std::function< void(TTreeReader &)> func)
 Process the entries of a TTree in parallel. More...
 

Private Attributes

ROOT::TThreadedObject< ROOT::Internal::TTreeViewtreeView
 ! Threaded object with <file,tree> per thread More...
 

#include <ROOT/TTreeProcessor.hxx>

Constructor & Destructor Documentation

◆ TTreeProcessor()

ROOT::TTreeProcessor::TTreeProcessor ( std::string_view  filename,
std::string_view  treename = "" 
)
inline

Regular constructor.

Parameters
[in]filenameName of the file containing the tree to process.
[in]treenameName of the tree to process. If not provided, the implementation will automatically search for a tree in the file.

Definition at line 149 of file TTreeProcessor.hxx.

Member Function Documentation

◆ Process()

void TTreeProcessor::Process ( std::function< void(TTreeReader &)>  func)

Process the entries of a TTree in parallel.

The user-provided function receives a TTreeReader which can be used to iterate on a subrange of entries

TTreeProcessor::Process([](TTreeReader& readerSubRange) {
// Select branches to read
while (readerSubRange.next()) {
// Use content of current entry
}
});

The user needs to be aware that each of the subranges can potentially be processed in parallel. This means that the code of the user function should be thread safe.

Parameters
[in]funcUser-defined function that processes a subrange of entries

Definition at line 51 of file TTreeProcessor.cxx.

Member Data Documentation

◆ treeView

ROOT::TThreadedObject<ROOT::Internal::TTreeView> ROOT::TTreeProcessor::treeView
private

! Threaded object with <file,tree> per thread

Definition at line 140 of file TTreeProcessor.hxx.


The documentation for this class was generated from the following files: