Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::Internal::RDF::RColumnRegister Class Reference

A binder for user-defined columns and aliases.

The storage is copy-on-write and shared between all instances of the class that have the same values.

Definition at line 43 of file RColumnRegister.hxx.

Public Member Functions

 RColumnRegister (const RColumnRegister &)=default
 
 RColumnRegister (RColumnRegister &&)=default
 
 RColumnRegister (std::shared_ptr< RDFDetail::RLoopManager > lm)
 
void AddAlias (std::string_view alias, std::string_view colName)
 Add a new alias to the ledger.
 
void AddColumn (const std::shared_ptr< RDFDetail::RDefineBase > &column)
 Add a new booked column.
 
void AddVariation (const std::shared_ptr< RVariationBase > &variation)
 Register a new systematic variation.
 
void Clear ()
 Empty the contents of this ledger.
 
RVariationBaseFindVariation (const std::string &colName, const std::string &variationName) const
 Return the RVariation object that handles the specified variation of the specified column.
 
const DefinesMap_tGetColumns () const
 Returns a map of pointers to the defined columns.
 
ColumnNames_t GetNames () const
 Returns the list of the names of the defined columns (Defines + Aliases).
 
std::vector< std::string > GetVariationDeps (const ColumnNames_t &columns) const
 Get the names of all variations that directly or indirectly affect the specified columns.
 
std::vector< std::string > GetVariationDeps (const std::string &column) const
 Get the names of all variations that directly or indirectly affect a given column.
 
const VariationsMap_tGetVariations () const
 Returns the multimap of systematic variations, see fVariations.
 
std::vector< std::string > GetVariationsFor (const std::string &column) const
 Get the names of the variations that directly provide alternative values for this column.
 
bool HasName (std::string_view name) const
 Check if the provided name is tracked in the names list.
 
bool IsAlias (const std::string &name) const
 Return true if the given column name is an existing alias.
 
RColumnRegisteroperator= (const RColumnRegister &)=default
 
std::string ResolveAlias (std::string_view alias) const
 Return the actual column name that the alias resolves to.
 

Private Types

using ColumnNames_t = std::vector< std::string >
 
using DefinesMap_t = std::unordered_map< std::string, std::shared_ptr< RDFDetail::RDefineBase > >
 
using VariationsMap_t = std::unordered_multimap< std::string, std::shared_ptr< RVariationBase > >
 See fVariations for more information on this type.
 

Private Member Functions

void AddName (std::string_view name)
 Add a new name to the list returned by GetNames without booking a new column.
 

Private Attributes

std::shared_ptr< const std::unordered_map< std::string, std::string > > fAliases
 Immutable map of Aliases, can be shared among several nodes.
 
std::shared_ptr< const ColumnNames_tfColumnNames
 Names of Defines and Aliases registered so far.
 
std::shared_ptr< const DefinesMap_tfDefines
 Immutable map of Defines, can be shared among several nodes.
 
std::shared_ptr< RDFDetail::RLoopManagerfLoopManager
 
std::shared_ptr< const VariationsMap_tfVariations
 Immutable multimap of Variations, can be shared among several nodes.
 

#include <ROOT/RDF/RColumnRegister.hxx>

Member Typedef Documentation

◆ ColumnNames_t

using ROOT::Internal::RDF::RColumnRegister::ColumnNames_t = std::vector<std::string>
private

Definition at line 44 of file RColumnRegister.hxx.

◆ DefinesMap_t

using ROOT::Internal::RDF::RColumnRegister::DefinesMap_t = std::unordered_map<std::string, std::shared_ptr<RDFDetail::RDefineBase> >
private

Definition at line 45 of file RColumnRegister.hxx.

◆ VariationsMap_t

using ROOT::Internal::RDF::RColumnRegister::VariationsMap_t = std::unordered_multimap<std::string, std::shared_ptr<RVariationBase> >
private

See fVariations for more information on this type.

Definition at line 47 of file RColumnRegister.hxx.

Constructor & Destructor Documentation

◆ RColumnRegister() [1/3]

ROOT::Internal::RDF::RColumnRegister::RColumnRegister ( const RColumnRegister )
default

◆ RColumnRegister() [2/3]

ROOT::Internal::RDF::RColumnRegister::RColumnRegister ( RColumnRegister &&  )
default

◆ RColumnRegister() [3/3]

ROOT::Internal::RDF::RColumnRegister::RColumnRegister ( std::shared_ptr< RDFDetail::RLoopManager lm)
inline

Definition at line 78 of file RColumnRegister.hxx.

Member Function Documentation

◆ AddAlias()

void ROOT::Internal::RDF::RColumnRegister::AddAlias ( std::string_view  alias,
std::string_view  colName 
)

Add a new alias to the ledger.

Definition at line 105 of file RDFColumnRegister.cxx.

◆ AddColumn()

void ROOT::Internal::RDF::RColumnRegister::AddColumn ( const std::shared_ptr< RDFDetail::RDefineBase > &  column)

Add a new booked column.

Internally it recreates the map with the new column, and swaps it with the old one.

Definition at line 27 of file RDFColumnRegister.cxx.

◆ AddName()

void ROOT::Internal::RDF::RColumnRegister::AddName ( std::string_view  name)
private

Add a new name to the list returned by GetNames without booking a new column.

This is needed because we abuse fColumnNames to also keep track of the aliases defined in each branch of the computation graph. Internally it recreates the vector with the new name, and swaps it with the old one.

Definition at line 94 of file RDFColumnRegister.cxx.

◆ AddVariation()

void ROOT::Internal::RDF::RColumnRegister::AddVariation ( const std::shared_ptr< RVariationBase > &  variation)

Register a new systematic variation.

Definition at line 36 of file RDFColumnRegister.cxx.

◆ Clear()

void ROOT::Internal::RDF::RColumnRegister::Clear ( )

Empty the contents of this ledger.

The only allowed operation on a RColumnRegister object after a call to Clear is its destruction.

Definition at line 135 of file RDFColumnRegister.cxx.

◆ FindVariation()

RVariationBase & ROOT::Internal::RDF::RColumnRegister::FindVariation ( const std::string &  colName,
const std::string &  variationName 
) const

Return the RVariation object that handles the specified variation of the specified column.

Definition at line 83 of file RDFColumnRegister.cxx.

◆ GetColumns()

const DefinesMap_t & ROOT::Internal::RDF::RColumnRegister::GetColumns ( ) const
inline

Returns a map of pointers to the defined columns.

Definition at line 91 of file RColumnRegister.hxx.

◆ GetNames()

ColumnNames_t ROOT::Internal::RDF::RColumnRegister::GetNames ( ) const
inline

Returns the list of the names of the defined columns (Defines + Aliases).

Definition at line 87 of file RColumnRegister.hxx.

◆ GetVariationDeps() [1/2]

std::vector< std::string > ROOT::Internal::RDF::RColumnRegister::GetVariationDeps ( const ColumnNames_t columns) const

Get the names of all variations that directly or indirectly affect the specified columns.

This list includes variations applied to the columns as well as variations applied to other columns on which the value of any of these columns depend (typically via Define expressions).

Definition at line 61 of file RDFColumnRegister.cxx.

◆ GetVariationDeps() [2/2]

std::vector< std::string > ROOT::Internal::RDF::RColumnRegister::GetVariationDeps ( const std::string &  column) const

Get the names of all variations that directly or indirectly affect a given column.

This list includes variations applied to the column as well as variations applied to other columns on which the value of this column depends (typically via a Define expression).

Definition at line 56 of file RDFColumnRegister.cxx.

◆ GetVariations()

const VariationsMap_t & ROOT::Internal::RDF::RColumnRegister::GetVariations ( ) const
inline

Returns the multimap of systematic variations, see fVariations.

Definition at line 95 of file RColumnRegister.hxx.

◆ GetVariationsFor()

std::vector< std::string > ROOT::Internal::RDF::RColumnRegister::GetVariationsFor ( const std::string &  column) const

Get the names of the variations that directly provide alternative values for this column.

Definition at line 45 of file RDFColumnRegister.cxx.

◆ HasName()

bool ROOT::Internal::RDF::RColumnRegister::HasName ( std::string_view  name) const

Check if the provided name is tracked in the names list.

Definition at line 21 of file RDFColumnRegister.cxx.

◆ IsAlias()

bool ROOT::Internal::RDF::RColumnRegister::IsAlias ( const std::string &  name) const

Return true if the given column name is an existing alias.

Definition at line 115 of file RDFColumnRegister.cxx.

◆ operator=()

RColumnRegister & ROOT::Internal::RDF::RColumnRegister::operator= ( const RColumnRegister )
default

◆ ResolveAlias()

std::string ROOT::Internal::RDF::RColumnRegister::ResolveAlias ( std::string_view  alias) const

Return the actual column name that the alias resolves to.

Drills through multiple levels of aliasing if needed. Returns the input in case it's not an alias. Expands #var to R_rdf_sizeof_var (the #var columns are implicitly-defined aliases).

Definition at line 120 of file RDFColumnRegister.cxx.

Member Data Documentation

◆ fAliases

std::shared_ptr<const std::unordered_map<std::string, std::string> > ROOT::Internal::RDF::RColumnRegister::fAliases
private

Immutable map of Aliases, can be shared among several nodes.

Definition at line 66 of file RColumnRegister.hxx.

◆ fColumnNames

std::shared_ptr<const ColumnNames_t> ROOT::Internal::RDF::RColumnRegister::fColumnNames
private

Names of Defines and Aliases registered so far.

Definition at line 71 of file RColumnRegister.hxx.

◆ fDefines

std::shared_ptr<const DefinesMap_t> ROOT::Internal::RDF::RColumnRegister::fDefines
private

Immutable map of Defines, can be shared among several nodes.

When a new define is added (through a call to RInterface::Define or similar) a new map with the extra element is created.

Definition at line 64 of file RColumnRegister.hxx.

◆ fLoopManager

std::shared_ptr<RDFDetail::RLoopManager> ROOT::Internal::RDF::RColumnRegister::fLoopManager
private

Definition at line 59 of file RColumnRegister.hxx.

◆ fVariations

std::shared_ptr<const VariationsMap_t> ROOT::Internal::RDF::RColumnRegister::fVariations
private

Immutable multimap of Variations, can be shared among several nodes.

The key is the name of an existing column, the values are all variations that affect that column. As a consequence, Variations that affect multiple columns are inserted multiple times, once per column.

Definition at line 70 of file RColumnRegister.hxx.

Libraries for ROOT::Internal::RDF::RColumnRegister:

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