Logo ROOT   6.14/05
Reference Guide
List of all members | Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
ROOT::Detail::RDF::RLoopManager Class Reference

Definition at line 89 of file RDFNodes.hxx.

Classes

class  TCallback
 
class  TOneTimeCallback
 

Public Member Functions

 RLoopManager (TTree *tree, const ColumnNames_t &defaultBranches)
 
 RLoopManager (ULong64_t nEmptyEntries)
 
 RLoopManager (std::unique_ptr< RDataSource > ds, const ColumnNames_t &defaultBranches)
 
 RLoopManager (const RLoopManager &)=delete
 
void AddColumnAlias (const std::string &alias, const std::string &colName)
 
void AddCustomColumnName (std::string_view name)
 
void AddDataSourceColumn (std::string_view name)
 
void Book (const ActionBasePtr_t &actionPtr)
 
void Book (const FilterBasePtr_t &filterPtr)
 
void Book (const RCustomColumnBasePtr_t &branchPtr)
 
void Book (const std::shared_ptr< bool > &branchPtr)
 
void Book (const RangeBasePtr_t &rangePtr)
 
bool CheckFilters (int, unsigned int)
 
const std::map< std::string, std::string > & GetAliasMap () const
 
const std::map< std::string, RCustomColumnBasePtr_t > & GetBookedColumns () const
 
const ColumnNames_t & GetCustomColumnNames () const
 
RDataSourceGetDataSource () const
 
const ColumnNames_t & GetDefaultColumnNames () const
 Return the list of default columns – empty if none was provided when constructing the RDataFrame. More...
 
const ColumnNames_t & GetDefinedDataSourceColumns () const
 
::TDirectoryGetDirectory () const
 
unsigned int GetID () const
 
RLoopManagerGetLoopManagerUnchecked ()
 
ULong64_t GetNEmptyEntries () const
 
unsigned int GetNSlots () const
 
TTreeGetTree () const
 
void IncrChildrenCount ()
 
bool MustRunNamedFilters () const
 
RLoopManageroperator= (const RLoopManager &)=delete
 
void PartialReport (ROOT::RDF::RCutFlowReport &) const
 End of recursive chain of calls, does nothing. More...
 
void RegisterCallback (ULong64_t everyNEvents, std::function< void(unsigned int)> &&f)
 
void Report (ROOT::RDF::RCutFlowReport &rep) const
 Call FillReport on all booked filters. More...
 
void Run ()
 Start the event loop with a different mechanism depending on IMT/no IMT, data source/no data source. More...
 
void SetTree (const std::shared_ptr< TTree > &tree)
 
void StopProcessing ()
 
void ToJit (const std::string &s)
 

Private Types

using Callback_t = std::function< void(unsigned int)>
 
enum  ELoopType {
  ELoopType::kROOTFiles, ELoopType::kROOTFilesMT, ELoopType::kNoFiles, ELoopType::kNoFilesMT,
  ELoopType::kDataSource, ELoopType::kDataSourceMT
}
 
using RDataSource = ROOT::RDF::RDataSource
 

Private Member Functions

void CleanUpNodes ()
 Perform clean-up operations. To be called at the end of each event loop. More...
 
void CleanUpTask (unsigned int slot)
 Perform clean-up operations. To be called at the end of each task execution. More...
 
void EvalChildrenCounts ()
 Trigger counting of number of children nodes for each node of the functional graph. More...
 
unsigned int GetNextID () const
 
void InitNodes ()
 Initialize all nodes of the functional graph before running the event loop. More...
 
void InitNodeSlots (TTreeReader *r, unsigned int slot)
 Build TTreeReaderValues for all nodes This method loops over all filters, actions and other booked objects and calls their InitRDFValues methods. More...
 
void JitActions ()
 Jit all actions that required runtime column type inference, and clean the fToJit member variable. More...
 
void RunAndCheckFilters (unsigned int slot, Long64_t entry)
 Execute actions and make sure named filters are called for each event. More...
 
void RunDataSource ()
 Run event loop over data accessed through a DataSource, in sequence. More...
 
void RunDataSourceMT ()
 Run event loop over data accessed through a DataSource, in parallel. More...
 
void RunEmptySource ()
 Run event loop with no source files, in sequence. More...
 
void RunEmptySourceMT ()
 Run event loop with no source files, in parallel. More...
 
void RunTreeProcessorMT ()
 Run event loop over one or multiple ROOT files, in parallel. More...
 
void RunTreeReader ()
 Run event loop over one or multiple ROOT files, in sequence. More...
 

Private Attributes

std::map< std::string, std::string > fAliasColumnNameMap
 ColumnNameAlias-columnName pairs. More...
 
ActionBaseVec_t fBookedActions
 
std::map< std::string, RCustomColumnBasePtr_tfBookedCustomColumns
 
FilterBaseVec_t fBookedFilters
 
FilterBaseVec_t fBookedNamedFilters
 Contains a subset of fBookedFilters, i.e. only the named filters. More...
 
RangeBaseVec_t fBookedRanges
 
std::vector< TCallbackfCallbacks
 Registered callbacks. More...
 
std::vector< TOneTimeCallbackfCallbacksOnce
 Registered callbacks to invoke just once before running the loop. More...
 
ColumnNames_t fCustomColumnNames
 Contains names of all custom columns defined in the functional graph. More...
 
const std::unique_ptr< RDataSourcefDataSource
 Owning pointer to a data-source object. Null if no data-source. More...
 
const ColumnNames_t fDefaultColumns
 
ColumnNames_t fDefinedDataSourceColumns
 List of data-source columns that have been Defined so far. More...
 
::TDirectory *const fDirPtr {nullptr}
 
const unsigned int fID = GetNextID()
 A unique ID that identifies the computation graph that starts with this RLoopManager. More...
 
const ELoopType fLoopType
 The kind of event loop that is going to be run (e.g. on ROOT files, on no files) More...
 
bool fMustRunNamedFilters {true}
 
unsigned int fNChildren {0}
 Number of nodes of the functional graph hanging from this object. More...
 
const ULong64_t fNEmptyEntries {0}
 
const unsigned int fNSlots {1}
 
unsigned int fNStopsReceived {0}
 Number of times that a children node signaled to stop processing entries. More...
 
std::vector< std::shared_ptr< bool > > fResProxyReadiness
 
std::string fToJit
 string containing all BuildAndBook actions that should be jitted before running More...
 
std::shared_ptr< TTreefTree {nullptr}
 

#include <ROOT/RDFNodes.hxx>

Member Typedef Documentation

◆ Callback_t

using ROOT::Detail::RDF::RLoopManager::Callback_t = std::function<void(unsigned int)>
private

Definition at line 93 of file RDFNodes.hxx.

◆ RDataSource

Definition at line 90 of file RDFNodes.hxx.

Member Enumeration Documentation

◆ ELoopType

Enumerator
kROOTFiles 
kROOTFilesMT 
kNoFiles 
kNoFilesMT 
kDataSource 
kDataSourceMT 

Definition at line 91 of file RDFNodes.hxx.

Constructor & Destructor Documentation

◆ RLoopManager() [1/4]

RLoopManager::RLoopManager ( TTree tree,
const ColumnNames_t &  defaultBranches 
)

Definition at line 221 of file RDFNodes.cxx.

◆ RLoopManager() [2/4]

RLoopManager::RLoopManager ( ULong64_t  nEmptyEntries)

Definition at line 228 of file RDFNodes.cxx.

◆ RLoopManager() [3/4]

RLoopManager::RLoopManager ( std::unique_ptr< RDataSource ds,
const ColumnNames_t &  defaultBranches 
)

Definition at line 234 of file RDFNodes.cxx.

◆ RLoopManager() [4/4]

ROOT::Detail::RDF::RLoopManager::RLoopManager ( const RLoopManager )
delete

Member Function Documentation

◆ AddColumnAlias()

void ROOT::Detail::RDF::RLoopManager::AddColumnAlias ( const std::string &  alias,
const std::string &  colName 
)
inline

Definition at line 208 of file RDFNodes.hxx.

◆ AddCustomColumnName()

void ROOT::Detail::RDF::RLoopManager::AddCustomColumnName ( std::string_view  name)
inline

Definition at line 209 of file RDFNodes.hxx.

◆ AddDataSourceColumn()

void ROOT::Detail::RDF::RLoopManager::AddDataSourceColumn ( std::string_view  name)
inline

Definition at line 207 of file RDFNodes.hxx.

◆ Book() [1/5]

void RLoopManager::Book ( const ActionBasePtr_t actionPtr)

Definition at line 544 of file RDFNodes.cxx.

◆ Book() [2/5]

void RLoopManager::Book ( const FilterBasePtr_t filterPtr)

Definition at line 549 of file RDFNodes.cxx.

◆ Book() [3/5]

void RLoopManager::Book ( const RCustomColumnBasePtr_t branchPtr)

Definition at line 558 of file RDFNodes.cxx.

◆ Book() [4/5]

void RLoopManager::Book ( const std::shared_ptr< bool > &  branchPtr)

Definition at line 564 of file RDFNodes.cxx.

◆ Book() [5/5]

void RLoopManager::Book ( const RangeBasePtr_t rangePtr)

Definition at line 569 of file RDFNodes.cxx.

◆ CheckFilters()

bool RLoopManager::CheckFilters ( int  ,
unsigned  int 
)

Definition at line 575 of file RDFNodes.cxx.

◆ CleanUpNodes()

void RLoopManager::CleanUpNodes ( )
private

Perform clean-up operations. To be called at the end of each event loop.

Definition at line 432 of file RDFNodes.cxx.

◆ CleanUpTask()

void RLoopManager::CleanUpTask ( unsigned int  slot)
private

Perform clean-up operations. To be called at the end of each task execution.

Definition at line 458 of file RDFNodes.cxx.

◆ EvalChildrenCounts()

void RLoopManager::EvalChildrenCounts ( )
private

Trigger counting of number of children nodes for each node of the functional graph.

This is done once before starting the event loop. Each action sends an increase children count signal upstream, which is propagated until RLoopManager. Each time a node receives the signal, in increments its children counter. Each node only propagates the signal once, even if it receives it multiple times. Named filters also send an increase children count signal, just like actions, as they always execute during the event loop so the graph branch they belong to must count as active even if it does not end in an action.

Definition at line 487 of file RDFNodes.cxx.

◆ GetAliasMap()

const std::map<std::string, std::string>& ROOT::Detail::RDF::RLoopManager::GetAliasMap ( ) const
inline

Definition at line 210 of file RDFNodes.hxx.

◆ GetBookedColumns()

const std::map<std::string, RCustomColumnBasePtr_t>& ROOT::Detail::RDF::RLoopManager::GetBookedColumns ( ) const
inline

Definition at line 187 of file RDFNodes.hxx.

◆ GetCustomColumnNames()

const ColumnNames_t& ROOT::Detail::RDF::RLoopManager::GetCustomColumnNames ( ) const
inline

Definition at line 185 of file RDFNodes.hxx.

◆ GetDataSource()

RDataSource* ROOT::Detail::RDF::RLoopManager::GetDataSource ( ) const
inline

Definition at line 190 of file RDFNodes.hxx.

◆ GetDefaultColumnNames()

const ColumnNames_t & RLoopManager::GetDefaultColumnNames ( ) const

Return the list of default columns – empty if none was provided when constructing the RDataFrame.

Definition at line 529 of file RDFNodes.cxx.

◆ GetDefinedDataSourceColumns()

const ColumnNames_t& ROOT::Detail::RDF::RLoopManager::GetDefinedDataSourceColumns ( ) const
inline

Definition at line 206 of file RDFNodes.hxx.

◆ GetDirectory()

TDirectory * RLoopManager::GetDirectory ( ) const

Definition at line 539 of file RDFNodes.cxx.

◆ GetID()

unsigned int ROOT::Detail::RDF::RLoopManager::GetID ( ) const
inline

Definition at line 212 of file RDFNodes.hxx.

◆ GetLoopManagerUnchecked()

RLoopManager * RLoopManager::GetLoopManagerUnchecked ( )

Definition at line 523 of file RDFNodes.cxx.

◆ GetNEmptyEntries()

ULong64_t ROOT::Detail::RDF::RLoopManager::GetNEmptyEntries ( ) const
inline

Definition at line 189 of file RDFNodes.hxx.

◆ GetNextID()

unsigned int RLoopManager::GetNextID ( ) const
private

Definition at line 495 of file RDFNodes.cxx.

◆ GetNSlots()

unsigned int ROOT::Detail::RDF::RLoopManager::GetNSlots ( ) const
inline

Definition at line 197 of file RDFNodes.hxx.

◆ GetTree()

TTree * RLoopManager::GetTree ( ) const

Definition at line 534 of file RDFNodes.cxx.

◆ IncrChildrenCount()

void ROOT::Detail::RDF::RLoopManager::IncrChildrenCount ( )
inline

Definition at line 203 of file RDFNodes.hxx.

◆ InitNodes()

void RLoopManager::InitNodes ( )
private

Initialize all nodes of the functional graph before running the event loop.

This method is called once per event-loop and performs generic initialization operations that do not depend on the specific processing slot (i.e. operations that are common for all threads).

Definition at line 418 of file RDFNodes.cxx.

◆ InitNodeSlots()

void RLoopManager::InitNodeSlots ( TTreeReader r,
unsigned int  slot 
)
private

Build TTreeReaderValues for all nodes This method loops over all filters, actions and other booked objects and calls their InitRDFValues methods.

It is called once per node per slot, before running the event loop. It also informs each node of the TTreeReader that a particular slot will be using.

Definition at line 401 of file RDFNodes.cxx.

◆ JitActions()

void RLoopManager::JitActions ( )
private

Jit all actions that required runtime column type inference, and clean the fToJit member variable.

Definition at line 469 of file RDFNodes.cxx.

◆ MustRunNamedFilters()

bool ROOT::Detail::RDF::RLoopManager::MustRunNamedFilters ( ) const
inline

Definition at line 198 of file RDFNodes.hxx.

◆ operator=()

RLoopManager& ROOT::Detail::RDF::RLoopManager::operator= ( const RLoopManager )
delete

◆ PartialReport()

void ROOT::Detail::RDF::RLoopManager::PartialReport ( ROOT::RDF::RCutFlowReport ) const
inline

End of recursive chain of calls, does nothing.

Definition at line 201 of file RDFNodes.hxx.

◆ RegisterCallback()

void RLoopManager::RegisterCallback ( ULong64_t  everyNEvents,
std::function< void(unsigned int)> &&  f 
)

Definition at line 587 of file RDFNodes.cxx.

◆ Report()

void RLoopManager::Report ( ROOT::RDF::RCutFlowReport rep) const

Call FillReport on all booked filters.

Definition at line 581 of file RDFNodes.cxx.

◆ Run()

void RLoopManager::Run ( )

Start the event loop with a different mechanism depending on IMT/no IMT, data source/no data source.

Also perform a few setup and clean-up operations (jit actions if necessary, clear booked actions after the loop...).

Definition at line 504 of file RDFNodes.cxx.

◆ RunAndCheckFilters()

void RLoopManager::RunAndCheckFilters ( unsigned int  slot,
Long64_t  entry 
)
private

Execute actions and make sure named filters are called for each event.

Named filters must be called even if the analysis logic would not require it, lest they report confusing results.

Definition at line 386 of file RDFNodes.cxx.

◆ RunDataSource()

void RLoopManager::RunDataSource ( )
private

Run event loop over data accessed through a DataSource, in sequence.

Definition at line 328 of file RDFNodes.cxx.

◆ RunDataSourceMT()

void RLoopManager::RunDataSourceMT ( )
private

Run event loop over data accessed through a DataSource, in parallel.

Definition at line 351 of file RDFNodes.cxx.

◆ RunEmptySource()

void RLoopManager::RunEmptySource ( )
private

Run event loop with no source files, in sequence.

Definition at line 281 of file RDFNodes.cxx.

◆ RunEmptySourceMT()

void RLoopManager::RunEmptySourceMT ( )
private

Run event loop with no source files, in parallel.

Definition at line 243 of file RDFNodes.cxx.

◆ RunTreeProcessorMT()

void RLoopManager::RunTreeProcessorMT ( )
private

Run event loop over one or multiple ROOT files, in parallel.

Definition at line 290 of file RDFNodes.cxx.

◆ RunTreeReader()

void RLoopManager::RunTreeReader ( )
private

Run event loop over one or multiple ROOT files, in sequence.

Definition at line 312 of file RDFNodes.cxx.

◆ SetTree()

void ROOT::Detail::RDF::RLoopManager::SetTree ( const std::shared_ptr< TTree > &  tree)
inline

Definition at line 202 of file RDFNodes.hxx.

◆ StopProcessing()

void ROOT::Detail::RDF::RLoopManager::StopProcessing ( )
inline

Definition at line 204 of file RDFNodes.hxx.

◆ ToJit()

void ROOT::Detail::RDF::RLoopManager::ToJit ( const std::string &  s)
inline

Definition at line 205 of file RDFNodes.hxx.

Member Data Documentation

◆ fAliasColumnNameMap

std::map<std::string, std::string> ROOT::Detail::RDF::RLoopManager::fAliasColumnNameMap
private

ColumnNameAlias-columnName pairs.

Definition at line 153 of file RDFNodes.hxx.

◆ fBookedActions

ActionBaseVec_t ROOT::Detail::RDF::RLoopManager::fBookedActions
private

Definition at line 132 of file RDFNodes.hxx.

◆ fBookedCustomColumns

std::map<std::string, RCustomColumnBasePtr_t> ROOT::Detail::RDF::RLoopManager::fBookedCustomColumns
private

Definition at line 135 of file RDFNodes.hxx.

◆ fBookedFilters

FilterBaseVec_t ROOT::Detail::RDF::RLoopManager::fBookedFilters
private

Definition at line 133 of file RDFNodes.hxx.

◆ fBookedNamedFilters

FilterBaseVec_t ROOT::Detail::RDF::RLoopManager::fBookedNamedFilters
private

Contains a subset of fBookedFilters, i.e. only the named filters.

Definition at line 134 of file RDFNodes.hxx.

◆ fBookedRanges

RangeBaseVec_t ROOT::Detail::RDF::RLoopManager::fBookedRanges
private

Definition at line 137 of file RDFNodes.hxx.

◆ fCallbacks

std::vector<TCallback> ROOT::Detail::RDF::RLoopManager::fCallbacks
private

Registered callbacks.

Definition at line 154 of file RDFNodes.hxx.

◆ fCallbacksOnce

std::vector<TOneTimeCallback> ROOT::Detail::RDF::RLoopManager::fCallbacksOnce
private

Registered callbacks to invoke just once before running the loop.

Definition at line 155 of file RDFNodes.hxx.

◆ fCustomColumnNames

ColumnNames_t ROOT::Detail::RDF::RLoopManager::fCustomColumnNames
private

Contains names of all custom columns defined in the functional graph.

Definition at line 136 of file RDFNodes.hxx.

◆ fDataSource

const std::unique_ptr<RDataSource> ROOT::Detail::RDF::RLoopManager::fDataSource
private

Owning pointer to a data-source object. Null if no data-source.

Definition at line 151 of file RDFNodes.hxx.

◆ fDefaultColumns

const ColumnNames_t ROOT::Detail::RDF::RLoopManager::fDefaultColumns
private

Definition at line 143 of file RDFNodes.hxx.

◆ fDefinedDataSourceColumns

ColumnNames_t ROOT::Detail::RDF::RLoopManager::fDefinedDataSourceColumns
private

List of data-source columns that have been Defined so far.

Definition at line 152 of file RDFNodes.hxx.

◆ fDirPtr

::TDirectory* const ROOT::Detail::RDF::RLoopManager::fDirPtr {nullptr}
private

Definition at line 139 of file RDFNodes.hxx.

◆ fID

const unsigned int ROOT::Detail::RDF::RLoopManager::fID = GetNextID()
private

A unique ID that identifies the computation graph that starts with this RLoopManager.

Used, for example, to jit objects in a namespace reserved for this computation graph

Definition at line 158 of file RDFNodes.hxx.

◆ fLoopType

const ELoopType ROOT::Detail::RDF::RLoopManager::fLoopType
private

The kind of event loop that is going to be run (e.g. on ROOT files, on no files)

Definition at line 149 of file RDFNodes.hxx.

◆ fMustRunNamedFilters

bool ROOT::Detail::RDF::RLoopManager::fMustRunNamedFilters {true}
private

Definition at line 146 of file RDFNodes.hxx.

◆ fNChildren

unsigned int ROOT::Detail::RDF::RLoopManager::fNChildren {0}
private

Number of nodes of the functional graph hanging from this object.

Definition at line 147 of file RDFNodes.hxx.

◆ fNEmptyEntries

const ULong64_t ROOT::Detail::RDF::RLoopManager::fNEmptyEntries {0}
private

Definition at line 144 of file RDFNodes.hxx.

◆ fNSlots

const unsigned int ROOT::Detail::RDF::RLoopManager::fNSlots {1}
private

Definition at line 145 of file RDFNodes.hxx.

◆ fNStopsReceived

unsigned int ROOT::Detail::RDF::RLoopManager::fNStopsReceived {0}
private

Number of times that a children node signaled to stop processing entries.

Definition at line 148 of file RDFNodes.hxx.

◆ fResProxyReadiness

std::vector<std::shared_ptr<bool> > ROOT::Detail::RDF::RLoopManager::fResProxyReadiness
private

Definition at line 138 of file RDFNodes.hxx.

◆ fToJit

std::string ROOT::Detail::RDF::RLoopManager::fToJit
private

string containing all BuildAndBook actions that should be jitted before running

Definition at line 150 of file RDFNodes.hxx.

◆ fTree

std::shared_ptr<TTree> ROOT::Detail::RDF::RLoopManager::fTree {nullptr}
private

Definition at line 140 of file RDFNodes.hxx.

Libraries for ROOT::Detail::RDF::RLoopManager:
[legend]

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