Logo ROOT   6.12/07
Reference Guide
List of all members | Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
ROOT::Detail::TDF::TLoopManager Class Reference

Definition at line 84 of file TDFNodes.hxx.

Classes

class  TCallback
 
class  TOneTimeCallback
 

Public Member Functions

 TLoopManager (TTree *tree, const ColumnNames_t &defaultBranches)
 
 TLoopManager (ULong64_t nEmptyEntries)
 
 TLoopManager (std::unique_ptr< TDataSource > ds, const ColumnNames_t &defaultBranches)
 
 TLoopManager (const TLoopManager &)=delete
 
void AddColumnAlias (const std::string &alias, const std::string &colName)
 
void AddDataSourceColumn (std::string_view name)
 
void Book (const ActionBasePtr_t &actionPtr)
 
void Book (const FilterBasePtr_t &filterPtr)
 
void Book (const TCustomColumnBasePtr_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
 
TCustomColumnBaseGetBookedBranch (const std::string &name) const
 
const std::map< std::string, TCustomColumnBasePtr_t > & GetBookedColumns () const
 
const ColumnNames_t & GetCustomColumnNames () const
 
TDataSourceGetDataSource () const
 
const ColumnNames_t & GetDefaultColumnNames () const
 Return the list of default columns – empty if none was provided when constructing the TDataFrame. More...
 
const ColumnNames_t & GetDefinedDataSourceColumns () const
 
::TDirectoryGetDirectory () const
 
TLoopManagerGetImplPtr ()
 
ULong64_t GetNEmptyEntries () const
 
unsigned int GetNSlots () const
 
std::shared_ptr< TLoopManagerGetSharedPtr ()
 
TTreeGetTree () const
 
void IncrChildrenCount ()
 
void Jit (const std::string &s)
 
bool MustRunNamedFilters () const
 
TLoopManageroperator= (const TLoopManager &)=delete
 
void PartialReport () const
 End of recursive chain of calls, does nothing. More...
 
void RegisterCallback (ULong64_t everyNEvents, std::function< void(unsigned int)> &&f)
 
void Report () const
 Call PrintReport 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 ()
 

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 TDataSource = ROOT::Experimental::TDF::TDataSource
 

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...
 
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 InitTDFValues 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, TCustomColumnBasePtr_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< TDataSourcefDataSource
 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 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/TDFNodes.hxx>

Inheritance diagram for ROOT::Detail::TDF::TLoopManager:
[legend]

Member Typedef Documentation

◆ Callback_t

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

Definition at line 88 of file TDFNodes.hxx.

◆ TDataSource

Definition at line 85 of file TDFNodes.hxx.

Member Enumeration Documentation

◆ ELoopType

Enumerator
kROOTFiles 
kROOTFilesMT 
kNoFiles 
kNoFilesMT 
kDataSource 
kDataSourceMT 

Definition at line 86 of file TDFNodes.hxx.

Constructor & Destructor Documentation

◆ TLoopManager() [1/4]

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

Definition at line 129 of file TDFNodes.cxx.

◆ TLoopManager() [2/4]

TLoopManager::TLoopManager ( ULong64_t  nEmptyEntries)

Definition at line 136 of file TDFNodes.cxx.

◆ TLoopManager() [3/4]

TLoopManager::TLoopManager ( std::unique_ptr< TDataSource ds,
const ColumnNames_t &  defaultBranches 
)

Definition at line 142 of file TDFNodes.cxx.

◆ TLoopManager() [4/4]

ROOT::Detail::TDF::TLoopManager::TLoopManager ( const TLoopManager )
delete

Member Function Documentation

◆ AddColumnAlias()

void ROOT::Detail::TDF::TLoopManager::AddColumnAlias ( const std::string &  alias,
const std::string &  colName 
)
inline

Definition at line 199 of file TDFNodes.hxx.

◆ AddDataSourceColumn()

void ROOT::Detail::TDF::TLoopManager::AddDataSourceColumn ( std::string_view  name)
inline

Definition at line 198 of file TDFNodes.hxx.

◆ Book() [1/5]

void TLoopManager::Book ( const ActionBasePtr_t actionPtr)

Definition at line 434 of file TDFNodes.cxx.

◆ Book() [2/5]

void TLoopManager::Book ( const FilterBasePtr_t filterPtr)

Definition at line 439 of file TDFNodes.cxx.

◆ Book() [3/5]

void TLoopManager::Book ( const TCustomColumnBasePtr_t branchPtr)

Definition at line 448 of file TDFNodes.cxx.

◆ Book() [4/5]

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

Definition at line 455 of file TDFNodes.cxx.

◆ Book() [5/5]

void TLoopManager::Book ( const RangeBasePtr_t rangePtr)

Definition at line 460 of file TDFNodes.cxx.

◆ CheckFilters()

bool TLoopManager::CheckFilters ( int  ,
unsigned  int 
)

Definition at line 466 of file TDFNodes.cxx.

◆ CleanUpNodes()

void TLoopManager::CleanUpNodes ( )
private

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

Definition at line 328 of file TDFNodes.cxx.

◆ CleanUpTask()

void TLoopManager::CleanUpTask ( unsigned int  slot)
private

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

Definition at line 354 of file TDFNodes.cxx.

◆ EvalChildrenCounts()

void TLoopManager::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 TLoopManager. 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 380 of file TDFNodes.cxx.

◆ GetAliasMap()

const std::map<std::string, std::string>& ROOT::Detail::TDF::TLoopManager::GetAliasMap ( ) const
inline

Definition at line 200 of file TDFNodes.hxx.

◆ GetBookedBranch()

TCustomColumnBase * TLoopManager::GetBookedBranch ( const std::string &  name) const

Definition at line 423 of file TDFNodes.cxx.

◆ GetBookedColumns()

const std::map<std::string, TCustomColumnBasePtr_t>& ROOT::Detail::TDF::TLoopManager::GetBookedColumns ( ) const
inline

Definition at line 178 of file TDFNodes.hxx.

◆ GetCustomColumnNames()

const ColumnNames_t& ROOT::Detail::TDF::TLoopManager::GetCustomColumnNames ( ) const
inline

Definition at line 175 of file TDFNodes.hxx.

◆ GetDataSource()

TDataSource* ROOT::Detail::TDF::TLoopManager::GetDataSource ( ) const
inline

Definition at line 181 of file TDFNodes.hxx.

◆ GetDefaultColumnNames()

const ColumnNames_t & TLoopManager::GetDefaultColumnNames ( ) const

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

Definition at line 413 of file TDFNodes.cxx.

◆ GetDefinedDataSourceColumns()

const ColumnNames_t& ROOT::Detail::TDF::TLoopManager::GetDefinedDataSourceColumns ( ) const
inline

Definition at line 197 of file TDFNodes.hxx.

◆ GetDirectory()

TDirectory * TLoopManager::GetDirectory ( ) const

Definition at line 429 of file TDFNodes.cxx.

◆ GetImplPtr()

TLoopManager * TLoopManager::GetImplPtr ( )

Definition at line 407 of file TDFNodes.cxx.

◆ GetNEmptyEntries()

ULong64_t ROOT::Detail::TDF::TLoopManager::GetNEmptyEntries ( ) const
inline

Definition at line 180 of file TDFNodes.hxx.

◆ GetNSlots()

unsigned int ROOT::Detail::TDF::TLoopManager::GetNSlots ( ) const
inline

Definition at line 188 of file TDFNodes.hxx.

◆ GetSharedPtr()

std::shared_ptr<TLoopManager> ROOT::Detail::TDF::TLoopManager::GetSharedPtr ( )
inline

Definition at line 173 of file TDFNodes.hxx.

◆ GetTree()

TTree * TLoopManager::GetTree ( ) const

Definition at line 418 of file TDFNodes.cxx.

◆ IncrChildrenCount()

void ROOT::Detail::TDF::TLoopManager::IncrChildrenCount ( )
inline

Definition at line 194 of file TDFNodes.hxx.

◆ InitNodes()

void TLoopManager::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 316 of file TDFNodes.cxx.

◆ InitNodeSlots()

void TLoopManager::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 InitTDFValues 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 303 of file TDFNodes.cxx.

◆ Jit()

void ROOT::Detail::TDF::TLoopManager::Jit ( const std::string &  s)
inline

Definition at line 196 of file TDFNodes.hxx.

◆ JitActions()

void TLoopManager::JitActions ( )
private

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

Definition at line 362 of file TDFNodes.cxx.

◆ MustRunNamedFilters()

bool ROOT::Detail::TDF::TLoopManager::MustRunNamedFilters ( ) const
inline

Definition at line 189 of file TDFNodes.hxx.

◆ operator=()

TLoopManager& ROOT::Detail::TDF::TLoopManager::operator= ( const TLoopManager )
delete

◆ PartialReport()

void ROOT::Detail::TDF::TLoopManager::PartialReport ( ) const
inline

End of recursive chain of calls, does nothing.

Definition at line 192 of file TDFNodes.hxx.

◆ RegisterCallback()

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

Definition at line 477 of file TDFNodes.cxx.

◆ Report()

void TLoopManager::Report ( ) const

Call PrintReport on all booked filters.

Definition at line 472 of file TDFNodes.cxx.

◆ Run()

void TLoopManager::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 388 of file TDFNodes.cxx.

◆ RunAndCheckFilters()

void TLoopManager::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 291 of file TDFNodes.cxx.

◆ RunDataSource()

void TLoopManager::RunDataSource ( )
private

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

Definition at line 235 of file TDFNodes.cxx.

◆ RunDataSourceMT()

void TLoopManager::RunDataSourceMT ( )
private

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

Definition at line 257 of file TDFNodes.cxx.

◆ RunEmptySource()

void TLoopManager::RunEmptySource ( )
private

Run event loop with no source files, in sequence.

Definition at line 189 of file TDFNodes.cxx.

◆ RunEmptySourceMT()

void TLoopManager::RunEmptySourceMT ( )
private

Run event loop with no source files, in parallel.

Definition at line 151 of file TDFNodes.cxx.

◆ RunTreeProcessorMT()

void TLoopManager::RunTreeProcessorMT ( )
private

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

Definition at line 198 of file TDFNodes.cxx.

◆ RunTreeReader()

void TLoopManager::RunTreeReader ( )
private

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

Definition at line 220 of file TDFNodes.cxx.

◆ SetTree()

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

Definition at line 193 of file TDFNodes.hxx.

◆ StopProcessing()

void ROOT::Detail::TDF::TLoopManager::StopProcessing ( )
inline

Definition at line 195 of file TDFNodes.hxx.

Member Data Documentation

◆ fAliasColumnNameMap

std::map<std::string, std::string> ROOT::Detail::TDF::TLoopManager::fAliasColumnNameMap
private

ColumnNameAlias-columnName pairs.

Definition at line 146 of file TDFNodes.hxx.

◆ fBookedActions

ActionBaseVec_t ROOT::Detail::TDF::TLoopManager::fBookedActions
private

Definition at line 125 of file TDFNodes.hxx.

◆ fBookedCustomColumns

std::map<std::string, TCustomColumnBasePtr_t> ROOT::Detail::TDF::TLoopManager::fBookedCustomColumns
private

Definition at line 128 of file TDFNodes.hxx.

◆ fBookedFilters

FilterBaseVec_t ROOT::Detail::TDF::TLoopManager::fBookedFilters
private

Definition at line 126 of file TDFNodes.hxx.

◆ fBookedNamedFilters

FilterBaseVec_t ROOT::Detail::TDF::TLoopManager::fBookedNamedFilters
private

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

Definition at line 127 of file TDFNodes.hxx.

◆ fBookedRanges

RangeBaseVec_t ROOT::Detail::TDF::TLoopManager::fBookedRanges
private

Definition at line 130 of file TDFNodes.hxx.

◆ fCallbacks

std::vector<TCallback> ROOT::Detail::TDF::TLoopManager::fCallbacks
private

Registered callbacks.

Definition at line 147 of file TDFNodes.hxx.

◆ fCallbacksOnce

std::vector<TOneTimeCallback> ROOT::Detail::TDF::TLoopManager::fCallbacksOnce
private

Registered callbacks to invoke just once before running the loop.

Definition at line 148 of file TDFNodes.hxx.

◆ fCustomColumnNames

ColumnNames_t ROOT::Detail::TDF::TLoopManager::fCustomColumnNames
private

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

Definition at line 129 of file TDFNodes.hxx.

◆ fDataSource

const std::unique_ptr<TDataSource> ROOT::Detail::TDF::TLoopManager::fDataSource
private

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

Definition at line 144 of file TDFNodes.hxx.

◆ fDefaultColumns

const ColumnNames_t ROOT::Detail::TDF::TLoopManager::fDefaultColumns
private

Definition at line 136 of file TDFNodes.hxx.

◆ fDefinedDataSourceColumns

ColumnNames_t ROOT::Detail::TDF::TLoopManager::fDefinedDataSourceColumns
private

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

Definition at line 145 of file TDFNodes.hxx.

◆ fDirPtr

::TDirectory* const ROOT::Detail::TDF::TLoopManager::fDirPtr {nullptr}
private

Definition at line 132 of file TDFNodes.hxx.

◆ fLoopType

const ELoopType ROOT::Detail::TDF::TLoopManager::fLoopType
private

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

Definition at line 142 of file TDFNodes.hxx.

◆ fMustRunNamedFilters

bool ROOT::Detail::TDF::TLoopManager::fMustRunNamedFilters {true}
private

Definition at line 139 of file TDFNodes.hxx.

◆ fNChildren

unsigned int ROOT::Detail::TDF::TLoopManager::fNChildren {0}
private

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

Definition at line 140 of file TDFNodes.hxx.

◆ fNEmptyEntries

const ULong64_t ROOT::Detail::TDF::TLoopManager::fNEmptyEntries {0}
private

Definition at line 137 of file TDFNodes.hxx.

◆ fNSlots

const unsigned int ROOT::Detail::TDF::TLoopManager::fNSlots {1}
private

Definition at line 138 of file TDFNodes.hxx.

◆ fNStopsReceived

unsigned int ROOT::Detail::TDF::TLoopManager::fNStopsReceived {0}
private

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

Definition at line 141 of file TDFNodes.hxx.

◆ fResProxyReadiness

std::vector<std::shared_ptr<bool> > ROOT::Detail::TDF::TLoopManager::fResProxyReadiness
private

Definition at line 131 of file TDFNodes.hxx.

◆ fToJit

std::string ROOT::Detail::TDF::TLoopManager::fToJit
private

string containing all BuildAndBook actions that should be jitted before running

Definition at line 143 of file TDFNodes.hxx.

◆ fTree

std::shared_ptr<TTree> ROOT::Detail::TDF::TLoopManager::fTree {nullptr}
private

Definition at line 133 of file TDFNodes.hxx.

Libraries for ROOT::Detail::TDF::TLoopManager:
[legend]

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