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

Definition at line 51 of file RInterfaceBase.hxx.

Public Member Functions

 RInterfaceBase (RDFDetail::RLoopManager &lm, const RDFInternal::RColumnRegister &colRegister)
 
 RInterfaceBase (std::shared_ptr< RDFDetail::RLoopManager > lm)
 
RDFDescription Describe ()
 Return information about the dataframe.
 
ColumnNames_t GetColumnNames ()
 Returns the names of the available columns.
 
std::string GetColumnType (std::string_view column)
 Return the type of a given column as a string.
 
ColumnNames_t GetDefinedColumnNames ()
 Returns the names of the defined columns.
 
unsigned int GetNRuns () const
 Gets the number of event loops run.
 
unsigned int GetNSlots () const
 Gets the number of data processing slots.
 
RVariationsDescription GetVariations () const
 Return a descriptor for the systematic variations registered in this branch of the computation graph.
 
bool HasColumn (std::string_view columnName)
 Checks if a column is present in the dataset.
 

Protected Member Functions

void AddDefaultColumns ()
 
template<typename... ColumnTypes>
void CheckAndFillDSColumns (ColumnNames_t validCols, TTraits::TypeList< ColumnTypes... > typeList)
 
void CheckIMTDisabled (std::string_view callerName)
 
template<typename ActionTag , typename... ColTypes, typename ActionResultType , typename RDFNode , typename HelperArgType = ActionResultType, std::enable_if_t< RDFInternal::RNeedJitting< ColTypes... >::value, int > = 0>
RResultPtr< ActionResultType > CreateAction (const ColumnNames_t &columns, const std::shared_ptr< ActionResultType > &r, const std::shared_ptr< HelperArgType > &helperArg, const std::shared_ptr< RDFNode > &proxiedPtr, const int nColumns=-1)
 Create RAction object, return RResultPtr for the action Overload for the case in which one or more column types were not specified (RTTI + jitting).
 
template<typename ActionTag , typename... ColTypes, typename ActionResultType , typename RDFNode , typename HelperArgType = ActionResultType, std::enable_if_t<!RDFInternal::RNeedJitting< ColTypes... >::value, int > = 0>
RResultPtr< ActionResultType > CreateAction (const ColumnNames_t &columns, const std::shared_ptr< ActionResultType > &r, const std::shared_ptr< HelperArgType > &helperArg, const std::shared_ptr< RDFNode > &proxiedPtr, const int=-1)
 Create RAction object, return RResultPtr for the action Overload for the case in which all column types were specified (no jitting).
 
std::string DescribeDataset () const
 
ColumnNames_t GetColumnTypeNamesList (const ColumnNames_t &columnList)
 
RDFDetail::RLoopManagerGetLoopManager () const
 
ColumnNames_t GetValidatedColumnNames (const unsigned int nColumns, const ColumnNames_t &columns)
 
template<typename RetType >
void SanityChecksForVary (const std::vector< std::string > &colNames, const std::vector< std::string > &variationTags, std::string_view variationName)
 

Protected Attributes

RDFInternal::RColumnRegister fColRegister
 Contains the columns defined up to this node.
 
RDataSourcefDataSource = nullptr
 Non-owning pointer to a data-source object. Null if no data-source. RLoopManager has ownership of the object.
 
RDFDetail::RLoopManagerfLoopManager
 < The RLoopManager at the root of this computation graph. Never null.
 

#include <ROOT/RDF/RInterfaceBase.hxx>

Inheritance diagram for ROOT::RDF::RInterfaceBase:
[legend]

Constructor & Destructor Documentation

◆ RInterfaceBase() [1/2]

ROOT::RDF::RInterfaceBase::RInterfaceBase ( std::shared_ptr< RDFDetail::RLoopManager lm)

Definition at line 106 of file RInterfaceBase.cxx.

◆ RInterfaceBase() [2/2]

ROOT::RDF::RInterfaceBase::RInterfaceBase ( RDFDetail::RLoopManager lm,
const RDFInternal::RColumnRegister colRegister 
)

Definition at line 112 of file RInterfaceBase.cxx.

Member Function Documentation

◆ AddDefaultColumns()

void ROOT::RDF::RInterfaceBase::AddDefaultColumns ( )
protected

Definition at line 406 of file RInterfaceBase.cxx.

◆ CheckAndFillDSColumns()

template<typename... ColumnTypes>
void ROOT::RDF::RInterfaceBase::CheckAndFillDSColumns ( ColumnNames_t  validCols,
TTraits::TypeList< ColumnTypes... >  typeList 
)
inlineprotected

Definition at line 135 of file RInterfaceBase.hxx.

◆ CheckIMTDisabled()

void ROOT::RDF::RInterfaceBase::CheckIMTDisabled ( std::string_view  callerName)
protected

Definition at line 397 of file RInterfaceBase.cxx.

◆ CreateAction() [1/2]

template<typename ActionTag , typename... ColTypes, typename ActionResultType , typename RDFNode , typename HelperArgType = ActionResultType, std::enable_if_t< RDFInternal::RNeedJitting< ColTypes... >::value, int > = 0>
RResultPtr< ActionResultType > ROOT::RDF::RInterfaceBase::CreateAction ( const ColumnNames_t columns,
const std::shared_ptr< ActionResultType > &  r,
const std::shared_ptr< HelperArgType > &  helperArg,
const std::shared_ptr< RDFNode > &  proxiedPtr,
const int  nColumns = -1 
)
inlineprotected

Create RAction object, return RResultPtr for the action Overload for the case in which one or more column types were not specified (RTTI + jitting).

This overload has a nColumns optional argument. If present, the number of required columns for this action is taken equal to nColumns, otherwise it is assumed to be sizeof...(ColTypes).

Definition at line 172 of file RInterfaceBase.hxx.

◆ CreateAction() [2/2]

template<typename ActionTag , typename... ColTypes, typename ActionResultType , typename RDFNode , typename HelperArgType = ActionResultType, std::enable_if_t<!RDFInternal::RNeedJitting< ColTypes... >::value, int > = 0>
RResultPtr< ActionResultType > ROOT::RDF::RInterfaceBase::CreateAction ( const ColumnNames_t columns,
const std::shared_ptr< ActionResultType > &  r,
const std::shared_ptr< HelperArgType > &  helperArg,
const std::shared_ptr< RDFNode > &  proxiedPtr,
const int  = -1 
)
inlineprotected

Create RAction object, return RResultPtr for the action Overload for the case in which all column types were specified (no jitting).

For most actions, r and helperArg will refer to the same object, because the only argument to forward to the action helper is the result value itself. We need the distinction for actions such as Snapshot or Cache, for which the constructor arguments of the action helper are different from the returned value.

Definition at line 149 of file RInterfaceBase.hxx.

◆ Describe()

ROOT::RDF::RDFDescription ROOT::RDF::RInterfaceBase::Describe ( )

Return information about the dataframe.

Returns
information about the dataframe as RDFDescription object

This convenience function describes the dataframe and combines the following information:

This is not an action nor a transformation, just a query to the RDataFrame object. The result is dependent on the node from which this method is called, e.g. the list of defined columns returned by GetDefinedColumnNames().

Please note that this is a convenience feature and the layout of the output can be subject to change and should be parsed via RDFDescription methods.

Example usage:

RDataFrame df(10);
auto df2 = df.Define("x", "1.f").Define("s", "\"myStr\"");
// Describe the dataframe
df2.Describe().Print()
df2.Describe().Print(/*shortFormat=*&zwj;/true)
std::cout << df2.Describe().AsString() << std::endl;
std::cout << df2.Describe().AsString(/*shortFormat=*&zwj;/true) << std::endl;
ROOT's RDataFrame offers a modern, high-level interface for analysis of data stored in TTree ,...

Definition at line 215 of file RInterfaceBase.cxx.

◆ DescribeDataset()

std::string ROOT::RDF::RInterfaceBase::DescribeDataset ( ) const
protected

Definition at line 27 of file RInterfaceBase.cxx.

◆ GetColumnNames()

ROOT::RDF::ColumnNames_t ROOT::RDF::RInterfaceBase::GetColumnNames ( )

Returns the names of the available columns.

Returns
the container of column names.

This is not an action nor a transformation, just a query to the RDataFrame object.

Example usage:

auto colNames = d.GetColumnNames();
// Print columns' names
for (auto &&colName : colNames) std::cout << colName << std::endl;
#define d(i)
Definition RSha256.hxx:102

Definition at line 130 of file RInterfaceBase.cxx.

◆ GetColumnType()

std::string ROOT::RDF::RInterfaceBase::GetColumnType ( std::string_view  column)

Return the type of a given column as a string.

Returns
the type of the required column.

This is not an action nor a transformation, just a query to the RDataFrame object.

Example usage:

auto colType = d.GetColumnType("columnName");
// Print column type
std::cout << "Column " << colType << " has type " << colType << std::endl;

Definition at line 175 of file RInterfaceBase.cxx.

◆ GetColumnTypeNamesList()

ROOT::RDF::ColumnNames_t ROOT::RDF::RInterfaceBase::GetColumnTypeNamesList ( const ColumnNames_t columnList)
protected

Definition at line 387 of file RInterfaceBase.cxx.

◆ GetDefinedColumnNames()

ROOT::RDF::ColumnNames_t ROOT::RDF::RInterfaceBase::GetDefinedColumnNames ( )

Returns the names of the defined columns.

Returns
the container of the defined column names.

This is not an action nor a transformation, just a simple utility to get the columns names that have been defined up to the node. If no column has been defined, e.g. on a root node, it returns an empty collection.

Example usage:

auto defColNames = d.GetDefinedColumnNames();
// Print defined columns' names
for (auto &&defColName : defColNames) std::cout << defColName << std::endl;

Definition at line 289 of file RInterfaceBase.cxx.

◆ GetLoopManager()

RDFDetail::RLoopManager * ROOT::RDF::RInterfaceBase::GetLoopManager ( ) const
inlineprotected

Definition at line 127 of file RInterfaceBase.hxx.

◆ GetNRuns()

unsigned int ROOT::RDF::RInterfaceBase::GetNRuns ( ) const

Gets the number of event loops run.

Returns
The number of event loops run by this RDataFrame instance

This method returns the number of events loops run so far by this RDataFrame instance.

Example usage:

std::cout << df.GetNRuns() << std::endl; // prints "0"
df.Sum("rdfentry_").GetValue(); // trigger the event loop
std::cout << df.GetNRuns() << std::endl; // prints "1"
df.Sum("rdfentry_").GetValue(); // trigger another event loop
std::cout << df.GetNRuns() << std::endl; // prints "2"

Definition at line 382 of file RInterfaceBase.cxx.

◆ GetNSlots()

unsigned int ROOT::RDF::RInterfaceBase::GetNSlots ( ) const

Gets the number of data processing slots.

Returns
The number of data processing slots used by this RDataFrame instance

This method returns the number of data processing slots used by this RDataFrame instance. This number is influenced by the global switch ROOT::EnableImplicitMT().

Example usage:

std::cout << df.GetNSlots() << std::endl; // prints "6"
unsigned int GetNSlots() const
Gets the number of data processing slots.
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
void EnableImplicitMT(UInt_t numthreads=0)
Enable ROOT's implicit multi-threading for all objects and methods that provide an internal paralleli...
Definition TROOT.cxx:527

Definition at line 363 of file RInterfaceBase.cxx.

◆ GetValidatedColumnNames()

ColumnNames_t ROOT::RDF::RInterfaceBase::GetValidatedColumnNames ( const unsigned int  nColumns,
const ColumnNames_t columns 
)
inlineprotected

Definition at line 129 of file RInterfaceBase.hxx.

◆ GetVariations()

ROOT::RDF::RVariationsDescription ROOT::RDF::RInterfaceBase::GetVariations ( ) const

Return a descriptor for the systematic variations registered in this branch of the computation graph.

This is not an action nor a transformation, just a simple utility to inspect the systematic variations that have been registered with Vary() up to this node. When called on the root node, it returns an empty descriptor.

Example usage:

auto variations = d.GetVariations();
variations.Print();

Definition at line 314 of file RInterfaceBase.cxx.

◆ HasColumn()

bool ROOT::RDF::RInterfaceBase::HasColumn ( std::string_view  columnName)

Checks if a column is present in the dataset.

Returns
true if the column is available, false otherwise

This method checks if a column is part of the input ROOT dataset, has been defined or can be provided by the data source.

Example usage:

auto rdf = base.Define("definedColumn", [](){return 0;});
rdf.HasColumn("definedColumn"); // true: we defined it
rdf.HasColumn("rdfentry_"); // true: it's always there
rdf.HasColumn("foo"); // false: it is not there

Definition at line 333 of file RInterfaceBase.cxx.

◆ SanityChecksForVary()

template<typename RetType >
void ROOT::RDF::RInterfaceBase::SanityChecksForVary ( const std::vector< std::string > &  colNames,
const std::vector< std::string > &  variationTags,
std::string_view  variationName 
)
inlineprotected

Definition at line 70 of file RInterfaceBase.hxx.

Member Data Documentation

◆ fColRegister

RDFInternal::RColumnRegister ROOT::RDF::RInterfaceBase::fColRegister
protected

Contains the columns defined up to this node.

Definition at line 59 of file RInterfaceBase.hxx.

◆ fDataSource

RDataSource* ROOT::RDF::RInterfaceBase::fDataSource = nullptr
protected

Non-owning pointer to a data-source object. Null if no data-source. RLoopManager has ownership of the object.

Definition at line 56 of file RInterfaceBase.hxx.

◆ fLoopManager

RDFDetail::RLoopManager* ROOT::RDF::RInterfaceBase::fLoopManager
protected

< The RLoopManager at the root of this computation graph. Never null.

Definition at line 54 of file RInterfaceBase.hxx.

Libraries for ROOT::RDF::RInterfaceBase:

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