The head node of a RDF computation graph.
This class is responsible of running the event loop.
Definition at line 58 of file RLoopManager.hxx.
Classes | |
class | TCallback |
class | TOneTimeCallback |
Public Member Functions | |
RLoopManager (const RLoopManager &)=delete | |
RLoopManager (std::unique_ptr< RDataSource > ds, const ColumnNames_t &defaultBranches) | |
RLoopManager (TTree *tree, const ColumnNames_t &defaultBranches) | |
RLoopManager (ULong64_t nEmptyEntries) | |
void | AddColumnAlias (const std::string &alias, const std::string &colName) |
void | AddDataBlockCallback (std::function< void(unsigned int)> &&callback) |
void | AddDSValuePtrs (const std::string &col, const std::vector< void * > ptrs) |
void | AddFilterName (std::vector< std::string > &) |
End of recursive chain of calls, does nothing. | |
void | Book (RDFInternal::RActionBase *actionPtr) |
void | Book (RFilterBase *filterPtr) |
void | Book (RRangeBase *rangePtr) |
bool | CheckFilters (unsigned int, Long64_t) final |
void | Deregister (RDFInternal::RActionBase *actionPtr) |
void | Deregister (RFilterBase *filterPtr) |
void | Deregister (RRangeBase *rangePtr) |
const std::map< std::string, std::string > & | GetAliasMap () const |
std::vector< RDFInternal::RActionBase * > | GetAllActions () const |
Return all actions, either booked or already run. | |
std::vector< RDFInternal::RActionBase * > | GetBookedActions () |
const ColumnNames_t & | GetBranchNames () |
Return all valid TTree::Branch names (caching results for subsequent calls). | |
RDataSource * | GetDataSource () const |
const ColumnNames_t & | GetDefaultColumnNames () const |
Return the list of default columns – empty if none was provided when constructing the RDataFrame. | |
::TDirectory * | GetDirectory () const |
const std::map< std::string, std::vector< void * > > & | GetDSValuePtrs () const |
std::vector< std::string > | GetFiltersNames () |
For each booked filter, returns either the name or "Unnamed Filter". | |
std::shared_ptr< ROOT::Internal::RDF::GraphDrawing::GraphNode > | GetGraph () |
std::vector< RNodeBase * > | GetGraphEdges () const |
Return all graph edges known to RLoopManager This includes Filters and Ranges but not Defines. | |
RLoopManager * | GetLoopManagerUnchecked () final |
ULong64_t | GetNEmptyEntries () const |
unsigned int | GetNRuns () const |
unsigned int | GetNSlots () const |
TTree * | GetTree () const |
bool | HasDSValuePtrs (const std::string &col) const |
void | IncrChildrenCount () final |
void | Jit () |
Add RDF nodes that require just-in-time compilation to the computation graph. | |
void | JitDeclarations () |
RLoopManager & | operator= (const RLoopManager &)=delete |
void | PartialReport (ROOT::RDF::RCutFlowReport &) const final |
End of recursive chain of calls, does nothing. | |
void | RegisterCallback (ULong64_t everyNEvents, std::function< void(unsigned int)> &&f) |
void | Report (ROOT::RDF::RCutFlowReport &rep) const final |
Call FillReport on all booked filters. | |
void | Run () |
Start the event loop with a different mechanism depending on IMT/no IMT, data source/no data source. | |
void | SetTree (const std::shared_ptr< TTree > &tree) |
void | StopProcessing () final |
void | ToJitExec (const std::string &) const |
Public Member Functions inherited from ROOT::Detail::RDF::RNodeBase | |
RNodeBase (RLoopManager *lm=nullptr) | |
virtual | ~RNodeBase () |
virtual void | ResetChildrenCount () |
Private Types | |
using | Callback_t = std::function< void(unsigned int)> |
enum class | ELoopType { kROOTFiles , kROOTFilesMT , kNoFiles , kNoFilesMT , kDataSource , kDataSourceMT } |
Private Member Functions | |
void | CheckIndexedFriends () |
void | CleanUpNodes () |
Perform clean-up operations. To be called at the end of each event loop. | |
void | CleanUpTask (TTreeReader *r, unsigned int slot) |
Perform clean-up operations. To be called at the end of each task execution. | |
void | EvalChildrenCounts () |
Trigger counting of number of children nodes for each node of the functional graph. | |
void | InitNodes () |
Initialize all nodes of the functional graph before running the event loop. | |
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 InitSlot method, to get them ready for running a task. | |
void | RunAndCheckFilters (unsigned int slot, Long64_t entry) |
Execute actions and make sure named filters are called for each event. | |
void | RunDataSource () |
Run event loop over data accessed through a DataSource, in sequence. | |
void | RunDataSourceMT () |
Run event loop over data accessed through a DataSource, in parallel. | |
void | RunEmptySource () |
Run event loop with no source files, in sequence. | |
void | RunEmptySourceMT () |
Run event loop with no source files, in parallel. | |
void | RunTreeProcessorMT () |
Run event loop over one or multiple ROOT files, in parallel. | |
void | RunTreeReader () |
Run event loop over one or multiple ROOT files, in sequence. | |
void | SetupDataBlockCallbacks (TTreeReader *r, unsigned int slot) |
Private Attributes | |
std::map< std::string, std::string > | fAliasColumnNameMap |
ColumnNameAlias-columnName pairs. | |
std::vector< RDFInternal::RActionBase * > | fBookedActions |
Non-owning pointers to actions to be run. | |
std::vector< RFilterBase * > | fBookedFilters |
std::vector< RFilterBase * > | fBookedNamedFilters |
Contains a subset of fBookedFilters, i.e. only the named filters. | |
std::vector< RRangeBase * > | fBookedRanges |
std::vector< TCallback > | fCallbacks |
Registered callbacks. | |
std::vector< TOneTimeCallback > | fCallbacksOnce |
Registered callbacks to invoke just once before running the loop. | |
std::vector< Callback_t > | fDataBlockCallbacks |
Registered callbacks to call at the beginning of each "data block". | |
RDFInternal::RDataBlockNotifier | fDataBlockNotifier |
const std::unique_ptr< RDataSource > | fDataSource |
Owning pointer to a data-source object. Null if no data-source. | |
const ColumnNames_t | fDefaultColumns |
std::map< std::string, std::vector< void * > > | fDSValuePtrMap |
Registry of per-slot value pointers for booked data-source columns. | |
const ELoopType | fLoopType |
The kind of event loop that is going to be run (e.g. on ROOT files, on no files) | |
bool | fMustRunNamedFilters {true} |
const ULong64_t | fNEmptyEntries {0} |
unsigned int | fNRuns {0} |
Number of event loops run. | |
const unsigned int | fNSlots {1} |
std::vector< RDFInternal::RActionBase * > | fRunActions |
Non-owning pointers to actions already run. | |
std::shared_ptr< TTree > | fTree {nullptr} |
Shared pointer to the input TTree. | |
ColumnNames_t | fValidBranchNames |
Cache of the tree/chain branch names. Never access directy, always use GetBranchNames(). | |
Friends | |
struct | RCallCleanUpTask |
Additional Inherited Members | |
Protected Attributes inherited from ROOT::Detail::RDF::RNodeBase | |
RLoopManager * | fLoopManager |
unsigned int | fNChildren {0} |
Number of nodes of the functional graph hanging from this object. | |
unsigned int | fNStopsReceived {0} |
Number of times that a children node signaled to stop processing entries. | |
#include <ROOT/RDF/RLoopManager.hxx>
|
private |
Definition at line 60 of file RLoopManager.hxx.
|
strongprivate |
Enumerator | |
---|---|
kROOTFiles | |
kROOTFilesMT | |
kNoFiles | |
kNoFilesMT | |
kDataSource | |
kDataSourceMT |
Definition at line 59 of file RLoopManager.hxx.
RLoopManager::RLoopManager | ( | TTree * | tree, |
const ColumnNames_t & | defaultBranches | ||
) |
Definition at line 323 of file RLoopManager.cxx.
RLoopManager::RLoopManager | ( | ULong64_t | nEmptyEntries | ) |
Definition at line 331 of file RLoopManager.cxx.
RLoopManager::RLoopManager | ( | std::unique_ptr< RDataSource > | ds, |
const ColumnNames_t & | defaultBranches | ||
) |
Definition at line 337 of file RLoopManager.cxx.
|
delete |
|
inline |
Definition at line 175 of file RLoopManager.hxx.
Definition at line 851 of file RLoopManager.cxx.
Definition at line 846 of file RLoopManager.cxx.
|
inlinevirtual |
End of recursive chain of calls, does nothing.
Implements ROOT::Detail::RDF::RNodeBase.
Definition at line 184 of file RLoopManager.hxx.
void RLoopManager::Book | ( | RDFInternal::RActionBase * | actionPtr | ) |
Definition at line 724 of file RLoopManager.cxx.
void RLoopManager::Book | ( | RFilterBase * | filterPtr | ) |
Definition at line 735 of file RLoopManager.cxx.
void RLoopManager::Book | ( | RRangeBase * | rangePtr | ) |
Definition at line 750 of file RLoopManager.cxx.
Implements ROOT::Detail::RDF::RNodeBase.
Definition at line 761 of file RLoopManager.cxx.
|
private |
|
private |
Perform clean-up operations. To be called at the end of each event loop.
Definition at line 608 of file RLoopManager.cxx.
|
private |
Perform clean-up operations. To be called at the end of each task execution.
Definition at line 633 of file RLoopManager.cxx.
void RLoopManager::Deregister | ( | RDFInternal::RActionBase * | actionPtr | ) |
Definition at line 729 of file RLoopManager.cxx.
void RLoopManager::Deregister | ( | RFilterBase * | filterPtr | ) |
Definition at line 744 of file RLoopManager.cxx.
void RLoopManager::Deregister | ( | RRangeBase * | rangePtr | ) |
Definition at line 755 of file RLoopManager.cxx.
|
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 670 of file RLoopManager.cxx.
|
inline |
Definition at line 176 of file RLoopManager.hxx.
std::vector< RDFInternal::RActionBase * > RLoopManager::GetAllActions | ( | ) | const |
Return all actions, either booked or already run.
Definition at line 805 of file RLoopManager.cxx.
|
inline |
Definition at line 195 of file RLoopManager.hxx.
const ColumnNames_t & RLoopManager::GetBranchNames | ( | ) |
Return all valid TTree::Branch names (caching results for subsequent calls).
Never use fBranchNames directy, always request it through this method.
Definition at line 833 of file RLoopManager.cxx.
|
inline |
Definition at line 159 of file RLoopManager.hxx.
const ColumnNames_t & RLoopManager::GetDefaultColumnNames | ( | ) | const |
Return the list of default columns – empty if none was provided when constructing the RDataFrame.
Definition at line 714 of file RLoopManager.cxx.
::TDirectory * ROOT::Detail::RDF::RLoopManager::GetDirectory | ( | ) | const |
|
inline |
Definition at line 180 of file RLoopManager.hxx.
std::vector< std::string > RLoopManager::GetFiltersNames | ( | ) |
For each booked filter, returns either the name or "Unnamed Filter".
Definition at line 787 of file RLoopManager.cxx.
|
virtual |
Implements ROOT::Detail::RDF::RNodeBase.
Definition at line 813 of file RLoopManager.cxx.
std::vector< RNodeBase * > RLoopManager::GetGraphEdges | ( | ) | const |
Return all graph edges known to RLoopManager This includes Filters and Ranges but not Defines.
Definition at line 797 of file RLoopManager.cxx.
|
inlinefinalvirtual |
Reimplemented from ROOT::Detail::RDF::RNodeBase.
Definition at line 153 of file RLoopManager.hxx.
|
inline |
Definition at line 158 of file RLoopManager.hxx.
|
inline |
Definition at line 178 of file RLoopManager.hxx.
|
inline |
Definition at line 167 of file RLoopManager.hxx.
TTree * RLoopManager::GetTree | ( | ) | const |
Definition at line 719 of file RLoopManager.cxx.
bool RLoopManager::HasDSValuePtrs | ( | const std::string & | col | ) | const |
Definition at line 841 of file RLoopManager.cxx.
|
inlinefinalvirtual |
Implements ROOT::Detail::RDF::RNodeBase.
Definition at line 172 of file RLoopManager.hxx.
|
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 596 of file RLoopManager.cxx.
|
private |
Build TTreeReaderValues for all nodes This method loops over all filters, actions and other booked objects and calls their InitSlot
method, to get them ready for running a task.
Definition at line 567 of file RLoopManager.cxx.
void RLoopManager::Jit | ( | ) |
Add RDF nodes that require just-in-time compilation to the computation graph.
This method also clears the contents of GetCodeToJit().
Definition at line 645 of file RLoopManager.cxx.
void ROOT::Detail::RDF::RLoopManager::JitDeclarations | ( | ) |
|
delete |
|
inlinefinalvirtual |
End of recursive chain of calls, does nothing.
Implements ROOT::Detail::RDF::RNodeBase.
Definition at line 170 of file RLoopManager.hxx.
void RLoopManager::RegisterCallback | ( | ULong64_t | everyNEvents, |
std::function< void(unsigned int)> && | f | ||
) |
Definition at line 779 of file RLoopManager.cxx.
|
finalvirtual |
Call FillReport
on all booked filters.
Implements ROOT::Detail::RDF::RNodeBase.
Definition at line 767 of file RLoopManager.cxx.
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 680 of file RLoopManager.cxx.
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 546 of file RLoopManager.cxx.
|
private |
Run event loop over data accessed through a DataSource, in sequence.
Definition at line 473 of file RLoopManager.cxx.
|
private |
Run event loop over data accessed through a DataSource, in parallel.
Definition at line 504 of file RLoopManager.cxx.
|
private |
Run event loop with no source files, in sequence.
Definition at line 398 of file RLoopManager.cxx.
|
private |
Run event loop with no source files, in parallel.
Definition at line 353 of file RLoopManager.cxx.
|
private |
Run event loop over one or multiple ROOT files, in parallel.
Definition at line 414 of file RLoopManager.cxx.
|
private |
Run event loop over one or multiple ROOT files, in sequence.
Definition at line 446 of file RLoopManager.cxx.
Definition at line 171 of file RLoopManager.hxx.
|
private |
Definition at line 578 of file RLoopManager.cxx.
|
inlinefinalvirtual |
Implements ROOT::Detail::RDF::RNodeBase.
Definition at line 173 of file RLoopManager.hxx.
void RLoopManager::ToJitExec | ( | const std::string & | code | ) | const |
Definition at line 773 of file RLoopManager.cxx.
|
friend |
Definition at line 99 of file RLoopManager.hxx.
|
private |
ColumnNameAlias-columnName pairs.
Definition at line 116 of file RLoopManager.hxx.
|
private |
Non-owning pointers to actions to be run.
Definition at line 101 of file RLoopManager.hxx.
|
private |
Definition at line 103 of file RLoopManager.hxx.
|
private |
Contains a subset of fBookedFilters, i.e. only the named filters.
Definition at line 104 of file RLoopManager.hxx.
|
private |
Definition at line 105 of file RLoopManager.hxx.
|
private |
Registered callbacks.
Definition at line 117 of file RLoopManager.hxx.
|
private |
Registered callbacks to invoke just once before running the loop.
Definition at line 118 of file RLoopManager.hxx.
|
private |
Registered callbacks to call at the beginning of each "data block".
Definition at line 119 of file RLoopManager.hxx.
|
private |
Definition at line 120 of file RLoopManager.hxx.
|
private |
Owning pointer to a data-source object. Null if no data-source.
Definition at line 115 of file RLoopManager.hxx.
|
private |
Definition at line 110 of file RLoopManager.hxx.
|
private |
Registry of per-slot value pointers for booked data-source columns.
Definition at line 124 of file RLoopManager.hxx.
|
private |
The kind of event loop that is going to be run (e.g. on ROOT files, on no files)
Definition at line 114 of file RLoopManager.hxx.
|
private |
Definition at line 113 of file RLoopManager.hxx.
|
private |
Definition at line 111 of file RLoopManager.hxx.
|
private |
Number of event loops run.
Definition at line 121 of file RLoopManager.hxx.
|
private |
Definition at line 112 of file RLoopManager.hxx.
|
private |
Non-owning pointers to actions already run.
Definition at line 102 of file RLoopManager.hxx.
|
private |
Shared pointer to the input TTree.
It does not delete the pointee if the TTree/TChain was passed directly as an argument to RDataFrame's ctor (in which case we let users retain ownership).
Definition at line 109 of file RLoopManager.hxx.
|
private |
Cache of the tree/chain branch names. Never access directy, always use GetBranchNames().
Definition at line 127 of file RLoopManager.hxx.