Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::Detail::RDF::RLoopManager Class Reference

The head node of a RDF computation graph.

This class is responsible of running the event loop.

Definition at line 119 of file RLoopManager.hxx.

Public Member Functions

 RLoopManager (const ColumnNames_t &defaultColumns={})
 
 RLoopManager (const RLoopManager &)=delete
 
 RLoopManager (RLoopManager &&)=delete
 
 RLoopManager (ROOT::RDF::Experimental::RDatasetSpec &&spec)
 
 RLoopManager (std::unique_ptr< RDataSource > ds, const ColumnNames_t &defaultBranches)
 
 RLoopManager (TTree *tree, const ColumnNames_t &defaultBranches)
 
 RLoopManager (ULong64_t nEmptyEntries)
 
 ~RLoopManager () override
 
RColumnReaderBaseAddDataSourceColumnReader (unsigned int slot, std::string_view col, const std::type_info &ti, TTreeReader *treeReader)
 
void AddDataSourceColumnReaders (std::string_view col, std::vector< std::unique_ptr< RColumnReaderBase > > &&readers, const std::type_info &ti)
 
void AddFilterName (std::vector< std::string > &) final
 End of recursive chain of calls, does nothing.
 
void AddSampleCallback (void *nodePtr, ROOT::RDF::SampleCallback_t &&callback)
 
RColumnReaderBaseAddTreeColumnReader (unsigned int slot, std::string_view col, std::unique_ptr< RColumnReaderBase > &&reader, const std::type_info &ti)
 Register a new RTreeColumnReader with this RLoopManager.
 
void ChangeBeginAndEndEntries (Long64_t begin, Long64_t end)
 
void ChangeSpec (ROOT::RDF::Experimental::RDatasetSpec &&spec)
 Changes the internal TTree held by the RLoopManager.
 
bool CheckFilters (unsigned int, Long64_t) final
 
void DataSourceThreadTask (const std::pair< ULong64_t, ULong64_t > &entryRange, ROOT::Internal::RSlotStack &slotStack, std::atomic< ULong64_t > &entryCount)
 The task run by every thread on the input entry range, for the generic RDataSource.
 
void Deregister (RDefineBase *definePtr)
 
void Deregister (RDFInternal::RActionBase *actionPtr)
 
void Deregister (RDFInternal::RVariationBase *varPtr)
 
void Deregister (RFilterBase *filterPtr)
 
void Deregister (RRangeBase *rangePtr)
 
void EraseSuppressErrorsForMissingBranch (const std::string &branchName)
 
std::vector< RDFInternal::RActionBase * > GetAllActions () const
 Return all actions, either booked or already run.
 
const ColumnNames_tGetBranchNames ()
 Return all valid TTree::Branch names (caching results for subsequent calls).
 
ROOT::Internal::RDF::RStringCacheGetColumnNamesCache ()
 
RColumnReaderBaseGetDatasetColumnReader (unsigned int slot, std::string_view col, const std::type_info &ti) const
 
RDataSourceGetDataSource () const
 
const ColumnNames_tGetDefaultColumnNames () const
 Return the list of default columns – empty if none was provided when constructing the RDataFrame.
 
std::vector< std::string > GetFiltersNames ()
 For each booked filter, returns either the name or "Unnamed Filter".
 
std::shared_ptr< ROOT::Internal::RDF::GraphDrawing::GraphNodeGetGraph (std::unordered_map< void *, std::shared_ptr< ROOT::Internal::RDF::GraphDrawing::GraphNode > > &visitedMap) final
 
std::vector< RNodeBase * > GetGraphEdges () const
 Return all graph edges known to RLoopManager This includes Filters and Ranges but not Defines.
 
RLoopManagerGetLoopManagerUnchecked () final
 
ULong64_t GetNEmptyEntries () const
 
unsigned int GetNRuns () const
 
unsigned int GetNSlots () const
 
const std::set< std::string > & GetSuppressErrorsForMissingBranches () const
 
TTreeGetTree () const
 
std::set< std::pair< std::string_view, std::unique_ptr< ROOT::Internal::RDF::RDefinesWithReaders > > > & GetUniqueDefinesWithReaders ()
 
std::set< std::pair< std::string_view, std::unique_ptr< ROOT::Internal::RDF::RVariationsWithReaders > > > & GetUniqueVariationsWithReaders ()
 
bool HasDataSourceColumnReaders (std::string_view col, const std::type_info &ti) const
 Return true if AddDataSourceColumnReaders was called for column name col.
 
void IncrChildrenCount () final
 
void InsertSuppressErrorsForMissingBranch (const std::string &branchName)
 
void Jit ()
 Add RDF nodes that require just-in-time compilation to the computation graph.
 
RLoopManageroperator= (const RLoopManager &)=delete
 
RLoopManageroperator= (RLoopManager &&)=delete
 
void PartialReport (ROOT::RDF::RCutFlowReport &) const final
 End of recursive chain of calls, does nothing.
 
void Register (RDefineBase *definePtr)
 
void Register (RDFInternal::RActionBase *actionPtr)
 
void Register (RDFInternal::RVariationBase *varPtr)
 
void Register (RFilterBase *filterPtr)
 
void Register (RRangeBase *rangePtr)
 
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 (bool jit=true)
 Start the event loop with a different mechanism depending on IMT/no IMT, data source/no data source.
 
void SetDataSource (std::unique_ptr< ROOT::RDF::RDataSource > dataSource)
 
void SetEmptyEntryRange (std::pair< ULong64_t, ULong64_t > &&newRange)
 
void SetSlotStack (const std::shared_ptr< ROOT::Internal::RSlotStack > &slotStack)
 Register a slot stack to be used by this RLoopManager.
 
void SetTree (std::shared_ptr< TTree > tree)
 
void SetTTreeLifeline (std::any lifeline)
 
void StopProcessing () final
 
void ToJitExec (const std::string &) const
 
void TTreeThreadTask (TTreeReader &treeReader, ROOT::Internal::RSlotStack &slotStack, std::atomic< ULong64_t > &entryCount)
 The task run by every thread on an entry range (known by the input TTreeReader), for the TTree data source.
 
- Public Member Functions inherited from ROOT::Detail::RDF::RNodeBase
 RNodeBase (const RNodeBase &)=delete
 
 RNodeBase (const std::vector< std::string > &variations={}, RLoopManager *lm=nullptr)
 
 RNodeBase (RNodeBase &&)=delete
 
virtual ~RNodeBase ()=default
 
const std::vector< std::string > & GetVariations () const
 
virtual std::shared_ptr< RNodeBaseGetVariedFilter (const std::string &)
 Return a clone of this node that acts as a Filter working with values in the variationName "universe".
 
RNodeBaseoperator= (const RNodeBase &)=delete
 
RNodeBaseoperator= (RNodeBase &&)=delete
 
virtual void ResetChildrenCount ()
 

Private Types

using ColumnNames_t = std::vector<std::string>
 
enum class  ELoopType {
  kInvalid , kROOTFiles , kROOTFilesMT , kNoFiles ,
  kNoFilesMT , kDataSource , kDataSourceMT
}
 

Private Member Functions

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 SetupSampleCallbacks (TTreeReader *r, unsigned int slot)
 
std::shared_ptr< ROOT::Internal::RSlotStackSlotStack () const
 Create a slot stack with the desired number of slots or reuse a shared instance.
 
void UpdateSampleInfo (unsigned int slot, const std::pair< ULong64_t, ULong64_t > &range)
 
void UpdateSampleInfo (unsigned int slot, TTreeReader &r)
 

Private Attributes

Long64_t fBeginEntry {0}
 
std::vector< RDFInternal::RActionBase * > fBookedActions
 Non-owning pointers to actions to be run.
 
std::vector< RDefineBase * > fBookedDefines
 
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< RDFInternal::RVariationBase * > fBookedVariations
 
ROOT::Internal::RDF::RStringCache fCachedColNames
 
std::vector< RDFInternal::RCallbackfCallbacksEveryNEvents
 Registered callbacks to be executed every N events.
 
std::vector< RDFInternal::ROneTimeCallbackfCallbacksOnce
 Registered callbacks to invoke just once before running the loop.
 
std::vector< std::unordered_map< std::string, std::unique_ptr< RColumnReaderBase > > > fDatasetColumnReaders
 Readers for TTree/RDataSource columns (one per slot), shared by all nodes in the computation graph.
 
std::unique_ptr< RDataSourcefDataSource {}
 Owning pointer to a data-source object.
 
ColumnNames_t fDefaultColumns
 
std::pair< ULong64_t, ULong64_tfEmptyEntryRange {}
 Range of entries created when no data source is specified.
 
Long64_t fEndEntry {std::numeric_limits<Long64_t>::max()}
 
std::vector< std::unique_ptr< TChain > > fFriends
 Friends of the fTree. Only used if we constructed fTree ourselves.
 
ELoopType fLoopType {ELoopType::kInvalid}
 The kind of event loop that is going to be run (e.g. on ROOT files, on no files)
 
bool fMustRunNamedFilters {true}
 
RDFInternal::RNewSampleNotifier fNewSampleNotifier
 
ROOT::Internal::TreeUtils::RNoCleanupNotifier fNoCleanupNotifier
 
unsigned int fNRuns {0}
 Number of event loops run.
 
unsigned int fNSlots {1}
 
std::vector< RDFInternal::RActionBase * > fRunActions
 Non-owning pointers to actions already run.
 
std::unordered_map< void *, ROOT::RDF::SampleCallback_tfSampleCallbacks
 Registered callbacks to call at the beginning of each "data block".
 
std::vector< ROOT::RDF::RSampleInfofSampleInfos
 
std::unordered_map< std::string, ROOT::RDF::Experimental::RSample * > fSampleMap
 Keys are fname + "/" + treename as RSampleInfo::fID; Values are pointers to the corresponding sample.
 
std::vector< ROOT::RDF::Experimental::RSamplefSamples
 Samples need to survive throughout the whole event loop, hence stored as an attribute.
 
std::weak_ptr< ROOT::Internal::RSlotStackfSlotStack
 Pointer to a shared slot stack in case this instance runs concurrently with others:
 
std::set< std::string > fSuppressErrorsForMissingBranches {}
 
std::shared_ptr< TTreefTree {nullptr}
 Shared pointer to the input TTree.
 
std::any fTTreeLifeline {}
 A wrapped reference to a TTree dataset that can be shared by many computation graphs.
 
std::set< std::pair< std::string_view, std::unique_ptr< ROOT::Internal::RDF::RDefinesWithReaders > > > fUniqueDefinesWithReaders
 
std::set< std::pair< std::string_view, std::unique_ptr< ROOT::Internal::RDF::RVariationsWithReaders > > > fUniqueVariationsWithReaders
 
ColumnNames_t fValidBranchNames
 Cache of the tree/chain branch names. Never access directy, always use GetBranchNames().
 

Friends

struct RCallCleanUpTask
 
struct ROOT::Internal::RDF::RDSRangeRAII
 

Additional Inherited Members

- Protected Attributes inherited from ROOT::Detail::RDF::RNodeBase
RLoopManagerfLoopManager
 
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.
 
std::vector< std::string > fVariations
 List of systematic variations that affect this node.
 

#include <ROOT/RDF/RLoopManager.hxx>

Inheritance diagram for ROOT::Detail::RDF::RLoopManager:
[legend]

Member Typedef Documentation

◆ ColumnNames_t

using ROOT::Detail::RDF::RLoopManager::ColumnNames_t = std::vector<std::string>
private

Definition at line 120 of file RLoopManager.hxx.

Member Enumeration Documentation

◆ ELoopType

Enumerator
kInvalid 
kROOTFiles 
kROOTFilesMT 
kNoFiles 
kNoFilesMT 
kDataSource 
kDataSourceMT 

Definition at line 121 of file RLoopManager.hxx.

Constructor & Destructor Documentation

◆ RLoopManager() [1/7]

ROOT::Detail::RDF::RLoopManager::RLoopManager ( const ColumnNames_t & defaultColumns = {})

◆ RLoopManager() [2/7]

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

Definition at line 378 of file RLoopManager.cxx.

◆ RLoopManager() [3/7]

RLoopManager::RLoopManager ( ULong64_t nEmptyEntries)

Definition at line 390 of file RLoopManager.cxx.

◆ RLoopManager() [4/7]

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

Definition at line 400 of file RLoopManager.cxx.

◆ RLoopManager() [5/7]

RLoopManager::RLoopManager ( ROOT::RDF::Experimental::RDatasetSpec && spec)

Definition at line 412 of file RLoopManager.cxx.

◆ RLoopManager() [6/7]

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

◆ RLoopManager() [7/7]

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

◆ ~RLoopManager()

ROOT::Detail::RDF::RLoopManager::~RLoopManager ( )
overridedefault

Member Function Documentation

◆ AddDataSourceColumnReader()

RColumnReaderBase * RLoopManager::AddDataSourceColumnReader ( unsigned int slot,
std::string_view col,
const std::type_info & ti,
TTreeReader * treeReader )

Definition at line 1278 of file RLoopManager.cxx.

◆ AddDataSourceColumnReaders()

void RLoopManager::AddDataSourceColumnReaders ( std::string_view col,
std::vector< std::unique_ptr< RColumnReaderBase > > && readers,
const std::type_info & ti )

Definition at line 1249 of file RLoopManager.cxx.

◆ AddFilterName()

void ROOT::Detail::RDF::RLoopManager::AddFilterName ( std::vector< std::string > & )
inlinefinalvirtual

End of recursive chain of calls, does nothing.

Implements ROOT::Detail::RDF::RNodeBase.

Definition at line 270 of file RLoopManager.hxx.

◆ AddSampleCallback()

void RLoopManager::AddSampleCallback ( void * nodePtr,
ROOT::RDF::SampleCallback_t && callback )

Definition at line 1302 of file RLoopManager.cxx.

◆ AddTreeColumnReader()

RColumnReaderBase * RLoopManager::AddTreeColumnReader ( unsigned int slot,
std::string_view col,
std::unique_ptr< RColumnReaderBase > && reader,
const std::type_info & ti )

Register a new RTreeColumnReader with this RLoopManager.

Returns
A shared pointer to the inserted column reader.

Definition at line 1265 of file RLoopManager.cxx.

◆ ChangeBeginAndEndEntries()

void RLoopManager::ChangeBeginAndEndEntries ( Long64_t begin,
Long64_t end )

Definition at line 1313 of file RLoopManager.cxx.

◆ ChangeSpec()

void RLoopManager::ChangeSpec ( ROOT::RDF::Experimental::RDatasetSpec && spec)

Changes the internal TTree held by the RLoopManager.

Warning
This method may lead to potentially dangerous interactions if used after the construction of the RDataFrame. Changing the specification makes sense if and only if the schema of the dataset is unchanged, i.e. the new specification refers to exactly the same number of columns, with the same names and types. The actual use case of this method is moving the processing of the same RDataFrame to a different range of entries of the same dataset (which may be stored in a different set of files).
Parameters
specThe specification of the dataset to be adopted.

Definition at line 467 of file RLoopManager.cxx.

◆ CheckFilters()

bool RLoopManager::CheckFilters ( unsigned int ,
Long64_t  )
finalvirtual

Implements ROOT::Detail::RDF::RNodeBase.

Definition at line 1139 of file RLoopManager.cxx.

◆ CleanUpNodes()

void RLoopManager::CleanUpNodes ( )
private

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

Definition at line 927 of file RLoopManager.cxx.

◆ CleanUpTask()

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

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

Definition at line 951 of file RLoopManager.cxx.

◆ DataSourceThreadTask()

void ROOT::Detail::RDF::RLoopManager::DataSourceThreadTask ( const std::pair< ULong64_t, ULong64_t > & entryRange,
ROOT::Internal::RSlotStack & slotStack,
std::atomic< ULong64_t > & entryCount )

The task run by every thread on the input entry range, for the generic RDataSource.

Definition at line 1469 of file RLoopManager.cxx.

◆ Deregister() [1/5]

void RLoopManager::Deregister ( RDefineBase * definePtr)

Definition at line 1122 of file RLoopManager.cxx.

◆ Deregister() [2/5]

void RLoopManager::Deregister ( RDFInternal::RActionBase * actionPtr)

Definition at line 1085 of file RLoopManager.cxx.

◆ Deregister() [3/5]

void RLoopManager::Deregister ( RDFInternal::RVariationBase * varPtr)

Definition at line 1133 of file RLoopManager.cxx.

◆ Deregister() [4/5]

void RLoopManager::Deregister ( RFilterBase * filterPtr)

Definition at line 1101 of file RLoopManager.cxx.

◆ Deregister() [5/5]

void RLoopManager::Deregister ( RRangeBase * rangePtr)

Definition at line 1112 of file RLoopManager.cxx.

◆ EraseSuppressErrorsForMissingBranch()

void ROOT::Detail::RDF::RLoopManager::EraseSuppressErrorsForMissingBranch ( const std::string & branchName)
inline

Definition at line 315 of file RLoopManager.hxx.

◆ 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 1002 of file RLoopManager.cxx.

◆ GetAllActions()

std::vector< RDFInternal::RActionBase * > RLoopManager::GetAllActions ( ) const

Return all actions, either booked or already run.

Definition at line 1192 of file RLoopManager.cxx.

◆ GetBranchNames()

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 1227 of file RLoopManager.cxx.

◆ GetColumnNamesCache()

ROOT::Internal::RDF::RStringCache & ROOT::Detail::RDF::RLoopManager::GetColumnNamesCache ( )
inline

Definition at line 292 of file RLoopManager.hxx.

◆ GetDatasetColumnReader()

RColumnReaderBase * RLoopManager::GetDatasetColumnReader ( unsigned int slot,
std::string_view col,
const std::type_info & ti ) const

Definition at line 1293 of file RLoopManager.cxx.

◆ GetDataSource()

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

Definition at line 238 of file RLoopManager.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 1063 of file RLoopManager.cxx.

◆ GetFiltersNames()

std::vector< std::string > RLoopManager::GetFiltersNames ( )

For each booked filter, returns either the name or "Unnamed Filter".

Definition at line 1174 of file RLoopManager.cxx.

◆ GetGraph()

std::shared_ptr< ROOT::Internal::RDF::GraphDrawing::GraphNode > RLoopManager::GetGraph ( std::unordered_map< void *, std::shared_ptr< ROOT::Internal::RDF::GraphDrawing::GraphNode > > & visitedMap)
finalvirtual

Implements ROOT::Detail::RDF::RNodeBase.

Definition at line 1200 of file RLoopManager.cxx.

◆ GetGraphEdges()

std::vector< RNodeBase * > RLoopManager::GetGraphEdges ( ) const

Return all graph edges known to RLoopManager This includes Filters and Ranges but not Defines.

Definition at line 1184 of file RLoopManager.cxx.

◆ GetLoopManagerUnchecked()

RLoopManager * ROOT::Detail::RDF::RLoopManager::GetLoopManagerUnchecked ( )
inlinefinalvirtual

Reimplemented from ROOT::Detail::RDF::RNodeBase.

Definition at line 233 of file RLoopManager.hxx.

◆ GetNEmptyEntries()

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

Definition at line 237 of file RLoopManager.hxx.

◆ GetNRuns()

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

Definition at line 259 of file RLoopManager.hxx.

◆ GetNSlots()

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

Definition at line 250 of file RLoopManager.hxx.

◆ GetSuppressErrorsForMissingBranches()

const std::set< std::string > & ROOT::Detail::RDF::RLoopManager::GetSuppressErrorsForMissingBranches ( ) const
inline

Definition at line 319 of file RLoopManager.hxx.

◆ GetTree()

TTree * RLoopManager::GetTree ( ) const

Definition at line 1068 of file RLoopManager.cxx.

◆ GetUniqueDefinesWithReaders()

std::set< std::pair< std::string_view, std::unique_ptr< ROOT::Internal::RDF::RDefinesWithReaders > > > & ROOT::Detail::RDF::RLoopManager::GetUniqueDefinesWithReaders ( )
inline

Definition at line 294 of file RLoopManager.hxx.

◆ GetUniqueVariationsWithReaders()

std::set< std::pair< std::string_view, std::unique_ptr< ROOT::Internal::RDF::RVariationsWithReaders > > > & ROOT::Detail::RDF::RLoopManager::GetUniqueVariationsWithReaders ( )
inline

Definition at line 299 of file RLoopManager.hxx.

◆ HasDataSourceColumnReaders()

bool RLoopManager::HasDataSourceColumnReaders ( std::string_view col,
const std::type_info & ti ) const

Return true if AddDataSourceColumnReaders was called for column name col.

Definition at line 1239 of file RLoopManager.cxx.

◆ IncrChildrenCount()

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

Implements ROOT::Detail::RDF::RNodeBase.

Definition at line 255 of file RLoopManager.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 915 of file RLoopManager.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 InitSlot method, to get them ready for running a task.

Definition at line 834 of file RLoopManager.cxx.

◆ InsertSuppressErrorsForMissingBranch()

void ROOT::Detail::RDF::RLoopManager::InsertSuppressErrorsForMissingBranch ( const std::string & branchName)
inline

Definition at line 311 of file RLoopManager.hxx.

◆ Jit()

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 972 of file RLoopManager.cxx.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ PartialReport()

void ROOT::Detail::RDF::RLoopManager::PartialReport ( ROOT::RDF::RCutFlowReport & ) const
inlinefinalvirtual

End of recursive chain of calls, does nothing.

Implements ROOT::Detail::RDF::RNodeBase.

Definition at line 253 of file RLoopManager.hxx.

◆ Register() [1/5]

void RLoopManager::Register ( RDefineBase * definePtr)

Definition at line 1117 of file RLoopManager.cxx.

◆ Register() [2/5]

void RLoopManager::Register ( RDFInternal::RActionBase * actionPtr)

Definition at line 1079 of file RLoopManager.cxx.

◆ Register() [3/5]

void RLoopManager::Register ( RDFInternal::RVariationBase * varPtr)

Definition at line 1128 of file RLoopManager.cxx.

◆ Register() [4/5]

void RLoopManager::Register ( RFilterBase * filterPtr)

Definition at line 1092 of file RLoopManager.cxx.

◆ Register() [5/5]

void RLoopManager::Register ( RRangeBase * rangePtr)

Definition at line 1107 of file RLoopManager.cxx.

◆ RegisterCallback()

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

Definition at line 1166 of file RLoopManager.cxx.

◆ Report()

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

Call FillReport on all booked filters.

Implements ROOT::Detail::RDF::RNodeBase.

Definition at line 1145 of file RLoopManager.cxx.

◆ Run()

void RLoopManager::Run ( bool jit = true)

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...). The jitting phase is skipped if the jit parameter is false (unsafe, use with care).

Definition at line 1013 of file RLoopManager.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 814 of file RLoopManager.cxx.

◆ RunDataSource()

void RLoopManager::RunDataSource ( )
private

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

Definition at line 728 of file RLoopManager.cxx.

◆ RunDataSourceMT()

void RLoopManager::RunDataSourceMT ( )
private

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

Definition at line 794 of file RLoopManager.cxx.

◆ RunEmptySource()

void RLoopManager::RunEmptySource ( )
private

Run event loop with no source files, in sequence.

Definition at line 555 of file RLoopManager.cxx.

◆ RunEmptySourceMT()

void RLoopManager::RunEmptySourceMT ( )
private

Run event loop with no source files, in parallel.

Definition at line 508 of file RLoopManager.cxx.

◆ RunTreeProcessorMT()

void RLoopManager::RunTreeProcessorMT ( )
private

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

Definition at line 599 of file RLoopManager.cxx.

◆ RunTreeReader()

void RLoopManager::RunTreeReader ( )
private

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

Definition at line 656 of file RLoopManager.cxx.

◆ SetDataSource()

void ROOT::Detail::RDF::RLoopManager::SetDataSource ( std::unique_ptr< ROOT::RDF::RDataSource > dataSource)

Definition at line 1460 of file RLoopManager.cxx.

◆ SetEmptyEntryRange()

void RLoopManager::SetEmptyEntryRange ( std::pair< ULong64_t, ULong64_t > && newRange)

Definition at line 1308 of file RLoopManager.cxx.

◆ SetSlotStack()

void ROOT::Detail::RDF::RLoopManager::SetSlotStack ( const std::shared_ptr< ROOT::Internal::RSlotStack > & slotStack)
inline

Register a slot stack to be used by this RLoopManager.

This allows for sharing RDataFrame helpers safely in the context of RunGraphs(). Note that the loop manager only stores a weak_ptr, in between runs.

Definition at line 307 of file RLoopManager.hxx.

◆ SetTree()

void RLoopManager::SetTree ( std::shared_ptr< TTree > tree)

Definition at line 1151 of file RLoopManager.cxx.

◆ SetTTreeLifeline()

void ROOT::Detail::RDF::RLoopManager::SetTTreeLifeline ( std::any lifeline)

Definition at line 1319 of file RLoopManager.cxx.

◆ SetupSampleCallbacks()

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

Definition at line 850 of file RLoopManager.cxx.

◆ SlotStack()

std::shared_ptr< ROOT::Internal::RSlotStack > RLoopManager::SlotStack ( ) const
private

Create a slot stack with the desired number of slots or reuse a shared instance.

When a LoopManager runs in isolation, it will create its own slot stack from the number of slots. When it runs as part of RunGraphs(), each loop manager will be assigned a shared slot stack, so dataframe helpers can be shared in a thread-safe manner.

Definition at line 898 of file RLoopManager.cxx.

◆ StopProcessing()

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

Implements ROOT::Detail::RDF::RNodeBase.

Definition at line 256 of file RLoopManager.hxx.

◆ ToJitExec()

void RLoopManager::ToJitExec ( const std::string & code) const

Definition at line 1160 of file RLoopManager.cxx.

◆ TTreeThreadTask()

void ROOT::Detail::RDF::RLoopManager::TTreeThreadTask ( TTreeReader & treeReader,
ROOT::Internal::RSlotStack & slotStack,
std::atomic< ULong64_t > & entryCount )

The task run by every thread on an entry range (known by the input TTreeReader), for the TTree data source.

Definition at line 1504 of file RLoopManager.cxx.

◆ UpdateSampleInfo() [1/2]

void RLoopManager::UpdateSampleInfo ( unsigned int slot,
const std::pair< ULong64_t, ULong64_t > & range )
private

Definition at line 864 of file RLoopManager.cxx.

◆ UpdateSampleInfo() [2/2]

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

Definition at line 869 of file RLoopManager.cxx.

Friends And Related Symbol Documentation

◆ RCallCleanUpTask

friend struct RCallCleanUpTask
friend

Definition at line 131 of file RLoopManager.hxx.

◆ ROOT::Internal::RDF::RDSRangeRAII

Definition at line 132 of file RLoopManager.hxx.

Member Data Documentation

◆ fBeginEntry

Long64_t ROOT::Detail::RDF::RLoopManager::fBeginEntry {0}
private

Definition at line 145 of file RLoopManager.hxx.

◆ fBookedActions

std::vector<RDFInternal::RActionBase *> ROOT::Detail::RDF::RLoopManager::fBookedActions
private

Non-owning pointers to actions to be run.

Definition at line 134 of file RLoopManager.hxx.

◆ fBookedDefines

std::vector<RDefineBase *> ROOT::Detail::RDF::RLoopManager::fBookedDefines
private

Definition at line 139 of file RLoopManager.hxx.

◆ fBookedFilters

std::vector<RFilterBase *> ROOT::Detail::RDF::RLoopManager::fBookedFilters
private

Definition at line 136 of file RLoopManager.hxx.

◆ fBookedNamedFilters

std::vector<RFilterBase *> ROOT::Detail::RDF::RLoopManager::fBookedNamedFilters
private

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

Definition at line 137 of file RLoopManager.hxx.

◆ fBookedRanges

std::vector<RRangeBase *> ROOT::Detail::RDF::RLoopManager::fBookedRanges
private

Definition at line 138 of file RLoopManager.hxx.

◆ fBookedVariations

std::vector<RDFInternal::RVariationBase *> ROOT::Detail::RDF::RLoopManager::fBookedVariations
private

Definition at line 140 of file RLoopManager.hxx.

◆ fCachedColNames

ROOT::Internal::RDF::RStringCache ROOT::Detail::RDF::RLoopManager::fCachedColNames
private

Definition at line 207 of file RLoopManager.hxx.

◆ fCallbacksEveryNEvents

std::vector<RDFInternal::RCallback> ROOT::Detail::RDF::RLoopManager::fCallbacksEveryNEvents
private

Registered callbacks to be executed every N events.

The registration happens via the RegisterCallback method.

Definition at line 165 of file RLoopManager.hxx.

◆ fCallbacksOnce

std::vector<RDFInternal::ROneTimeCallback> ROOT::Detail::RDF::RLoopManager::fCallbacksOnce
private

Registered callbacks to invoke just once before running the loop.

The registration happens via the RegisterCallback method.

Definition at line 168 of file RLoopManager.hxx.

◆ fDatasetColumnReaders

std::vector<std::unordered_map<std::string, std::unique_ptr<RColumnReaderBase> > > ROOT::Detail::RDF::RLoopManager::fDatasetColumnReaders
private

Readers for TTree/RDataSource columns (one per slot), shared by all nodes in the computation graph.

Definition at line 177 of file RLoopManager.hxx.

◆ fDataSource

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 162 of file RLoopManager.hxx.

◆ fDefaultColumns

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

Definition at line 155 of file RLoopManager.hxx.

◆ fEmptyEntryRange

std::pair<ULong64_t, ULong64_t> ROOT::Detail::RDF::RLoopManager::fEmptyEntryRange {}
private

Range of entries created when no data source is specified.

Definition at line 157 of file RLoopManager.hxx.

◆ fEndEntry

Long64_t ROOT::Detail::RDF::RLoopManager::fEndEntry {std::numeric_limits<Long64_t>::max()}
private

Definition at line 146 of file RLoopManager.hxx.

◆ fFriends

std::vector<std::unique_ptr<TChain> > ROOT::Detail::RDF::RLoopManager::fFriends
private

Friends of the fTree. Only used if we constructed fTree ourselves.

Definition at line 154 of file RLoopManager.hxx.

◆ fLoopType

ELoopType ROOT::Detail::RDF::RLoopManager::fLoopType {ELoopType::kInvalid}
private

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

Definition at line 161 of file RLoopManager.hxx.

◆ fMustRunNamedFilters

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

Definition at line 159 of file RLoopManager.hxx.

◆ fNewSampleNotifier

RDFInternal::RNewSampleNotifier ROOT::Detail::RDF::RLoopManager::fNewSampleNotifier
private

Definition at line 172 of file RLoopManager.hxx.

◆ fNoCleanupNotifier

ROOT::Internal::TreeUtils::RNoCleanupNotifier ROOT::Detail::RDF::RLoopManager::fNoCleanupNotifier
private

Definition at line 182 of file RLoopManager.hxx.

◆ fNRuns

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

Number of event loops run.

Definition at line 174 of file RLoopManager.hxx.

◆ fNSlots

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

Definition at line 158 of file RLoopManager.hxx.

◆ fRunActions

std::vector<RDFInternal::RActionBase *> ROOT::Detail::RDF::RLoopManager::fRunActions
private

Non-owning pointers to actions already run.

Definition at line 135 of file RLoopManager.hxx.

◆ fSampleCallbacks

std::unordered_map<void *, ROOT::RDF::SampleCallback_t> ROOT::Detail::RDF::RLoopManager::fSampleCallbacks
private

Registered callbacks to call at the beginning of each "data block".

The key is the pointer of the corresponding node in the computation graph (a RDefinePerSample or a RAction).

Definition at line 171 of file RLoopManager.hxx.

◆ fSampleInfos

std::vector<ROOT::RDF::RSampleInfo> ROOT::Detail::RDF::RLoopManager::fSampleInfos
private

Definition at line 173 of file RLoopManager.hxx.

◆ fSampleMap

std::unordered_map<std::string, ROOT::RDF::Experimental::RSample *> ROOT::Detail::RDF::RLoopManager::fSampleMap
private

Keys are fname + "/" + treename as RSampleInfo::fID; Values are pointers to the corresponding sample.

Definition at line 149 of file RLoopManager.hxx.

◆ fSamples

std::vector<ROOT::RDF::Experimental::RSample> ROOT::Detail::RDF::RLoopManager::fSamples
private

Samples need to survive throughout the whole event loop, hence stored as an attribute.

Definition at line 151 of file RLoopManager.hxx.

◆ fSlotStack

std::weak_ptr<ROOT::Internal::RSlotStack> ROOT::Detail::RDF::RLoopManager::fSlotStack
private

Pointer to a shared slot stack in case this instance runs concurrently with others:

Definition at line 184 of file RLoopManager.hxx.

◆ fSuppressErrorsForMissingBranches

std::set<std::string> ROOT::Detail::RDF::RLoopManager::fSuppressErrorsForMissingBranches {}
private

Definition at line 206 of file RLoopManager.hxx.

◆ fTree

std::shared_ptr<TTree> ROOT::Detail::RDF::RLoopManager::fTree {nullptr}
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 144 of file RLoopManager.hxx.

◆ fTTreeLifeline

std::any ROOT::Detail::RDF::RLoopManager::fTTreeLifeline {}
private

A wrapped reference to a TTree dataset that can be shared by many computation graphs.

Ensures lifetime management.

Definition at line 215 of file RLoopManager.hxx.

◆ fUniqueDefinesWithReaders

std::set<std::pair<std::string_view, std::unique_ptr<ROOT::Internal::RDF::RDefinesWithReaders> > > ROOT::Detail::RDF::RLoopManager::fUniqueDefinesWithReaders
private

Definition at line 209 of file RLoopManager.hxx.

◆ fUniqueVariationsWithReaders

std::set<std::pair<std::string_view, std::unique_ptr<ROOT::Internal::RDF::RVariationsWithReaders> > > ROOT::Detail::RDF::RLoopManager::fUniqueVariationsWithReaders
private

Definition at line 211 of file RLoopManager.hxx.

◆ fValidBranchNames

ColumnNames_t ROOT::Detail::RDF::RLoopManager::fValidBranchNames
private

Cache of the tree/chain branch names. Never access directy, always use GetBranchNames().

Definition at line 180 of file RLoopManager.hxx.

Libraries for ROOT::Detail::RDF::RLoopManager:

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