Logo ROOT   6.12/07
Reference Guide
List of all members | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
ROOT::Experimental::TDF::TInterface< Proxied > Class Template Reference

template<typename Proxied>
class ROOT::Experimental::TDF::TInterface< Proxied >

The public interface to the TDataFrame federation of classes.

Template Parameters
TOne of the "node" base types (e.g. TLoopManager, TFilterBase). The user never specifies this type manually.

Definition at line 44 of file TDFInterface.hxx.

Public Member Functions

 TInterface (const TInterface &)=default
 Copy-ctor for TInterface. More...
 
 TInterface (TInterface &&)=default
 Move-ctor for TInterface. More...
 
TInterface< Proxied > Alias (std::string_view alias, std::string_view columnName)
 Allow to refer to a column with a different name. More...
 
template<typename... BranchTypes>
TInterface< TLoopManagerCache (const ColumnNames_t &columnList)
 Save selected columns in memory. More...
 
TInterface< TLoopManagerCache (const ColumnNames_t &columnList)
 Save selected columns in memory. More...
 
TInterface< TLoopManagerCache (std::string_view columnNameRegexp="")
 Save selected columns in memory. More...
 
TResultProxy< ULong64_tCount ()
 Return the number of entries processed (lazy action) More...
 
template<typename F , typename std::enable_if<!std::is_convertible< F, std::string >::value, int >::type = 0>
TInterface< Proxied > Define (std::string_view name, F expression, const ColumnNames_t &columns={})
 Creates a custom column. More...
 
TInterfaceJittedDefine Define (std::string_view name, std::string_view expression)
 Creates a custom column. More...
 
template<typename F >
TInterface< Proxied > DefineSlot (std::string_view name, F expression, const ColumnNames_t &columns={})
 Creates a custom column with a value dependent on the processing slot. More...
 
template<typename F >
TInterface< Proxied > DefineSlotEntry (std::string_view name, F expression, const ColumnNames_t &columns={})
 Creates a custom column with a value dependent on the processing slot and the current entry. More...
 
template<typename FirstColumn , typename... OtherColumns, typename T >
TResultProxy< T > Fill (T &&model, const ColumnNames_t &columnList)
 Return an object of type T on which T::Fill will be called once per event (lazy action) More...
 
template<typename T >
TResultProxy< T > Fill (T &&model, const ColumnNames_t &bl)
 Return an object of type T on which T::Fill will be called once per event (lazy action) More...
 
template<typename F , typename std::enable_if<!std::is_convertible< F, std::string >::value, int >::type = 0>
TInterface< TDFDetail::TFilter< F, Proxied > > Filter (F f, const ColumnNames_t &columns={}, std::string_view name="")
 Append a filter to the call graph. More...
 
template<typename F , typename std::enable_if<!std::is_convertible< F, std::string >::value, int >::type = 0>
TInterface< TDFDetail::TFilter< F, Proxied > > Filter (F f, std::string_view name)
 Append a filter to the call graph. More...
 
template<typename F >
TInterface< TDFDetail::TFilter< F, Proxied > > Filter (F f, const std::initializer_list< std::string > &columns)
 Append a filter to the call graph. More...
 
TInterface< TFilterBaseFilter (std::string_view expression, std::string_view name="")
 Append a filter to the call graph. More...
 
template<typename F >
void Foreach (F f, const ColumnNames_t &columns={})
 Execute a user-defined function on each entry (instant action) More...
 
template<typename F >
void ForeachSlot (F f, const ColumnNames_t &columns={})
 Execute a user-defined function requiring a processing slot index on each entry (instant action) More...
 
ColumnNames_t GetColumnNames ()
 Returns the names of the available columns. More...
 
template<typename V = TDFDetail::TInferType>
TResultProxy<::TH1DHisto1D (const TH1DModel &model={"", "", 128u, 0., 0.}, std::string_view vName="")
 Fill and return a one-dimensional histogram with the values of a column (lazy action) More...
 
template<typename V = TDFDetail::TInferType>
TResultProxy<::TH1DHisto1D (std::string_view vName)
 
template<typename V = TDFDetail::TInferType, typename W = TDFDetail::TInferType>
TResultProxy<::TH1DHisto1D (const TH1DModel &model, std::string_view vName, std::string_view wName)
 Fill and return a one-dimensional histogram with the weighted values of a column (lazy action) More...
 
template<typename V = TDFDetail::TInferType, typename W = TDFDetail::TInferType>
TResultProxy<::TH1DHisto1D (std::string_view vName, std::string_view wName)
 Fill and return a one-dimensional histogram with the weighted values of a column (lazy action) More...
 
template<typename V , typename W >
TResultProxy<::TH1DHisto1D (const TH1DModel &model={"", "", 128u, 0., 0.})
 Fill and return a one-dimensional histogram with the weighted values of a column (lazy action) More...
 
template<typename V1 = TDFDetail::TInferType, typename V2 = TDFDetail::TInferType>
TResultProxy<::TH2DHisto2D (const TH2DModel &model, std::string_view v1Name="", std::string_view v2Name="")
 Fill and return a two-dimensional histogram (lazy action) More...
 
template<typename V1 = TDFDetail::TInferType, typename V2 = TDFDetail::TInferType, typename W = TDFDetail::TInferType>
TResultProxy<::TH2DHisto2D (const TH2DModel &model, std::string_view v1Name, std::string_view v2Name, std::string_view wName)
 Fill and return a weighted two-dimensional histogram (lazy action) More...
 
template<typename V1 , typename V2 , typename W >
TResultProxy<::TH2DHisto2D (const TH2DModel &model)
 
template<typename V1 = TDFDetail::TInferType, typename V2 = TDFDetail::TInferType, typename V3 = TDFDetail::TInferType>
TResultProxy<::TH3DHisto3D (const TH3DModel &model, std::string_view v1Name="", std::string_view v2Name="", std::string_view v3Name="")
 Fill and return a three-dimensional histogram (lazy action) More...
 
template<typename V1 = TDFDetail::TInferType, typename V2 = TDFDetail::TInferType, typename V3 = TDFDetail::TInferType, typename W = TDFDetail::TInferType>
TResultProxy<::TH3DHisto3D (const TH3DModel &model, std::string_view v1Name, std::string_view v2Name, std::string_view v3Name, std::string_view wName)
 Fill and return a three-dimensional histogram (lazy action) More...
 
template<typename V1 , typename V2 , typename V3 , typename W >
TResultProxy<::TH3DHisto3D (const TH3DModel &model)
 
template<typename T = TDFDetail::TInferType>
TResultProxy< TDFDetail::MaxReturnType_t< T > > Max (std::string_view columnName="")
 Return the maximum of processed column values (lazy action) More...
 
template<typename T = TDFDetail::TInferType>
TResultProxy< double > Mean (std::string_view columnName="")
 Return the mean of processed column values (lazy action) More...
 
template<typename T = TDFDetail::TInferType>
TResultProxy< TDFDetail::MinReturnType_t< T > > Min (std::string_view columnName="")
 Return the minimum of processed column values (lazy action) More...
 
TInterfaceoperator= (const TInterface &)=default
 Copy-assignment operator for TInterface. More...
 
template<typename V1 = TDFDetail::TInferType, typename V2 = TDFDetail::TInferType>
TResultProxy<::TProfileProfile1D (const TProfile1DModel &model, std::string_view v1Name="", std::string_view v2Name="")
 Fill and return a one-dimensional profile (lazy action) More...
 
template<typename V1 = TDFDetail::TInferType, typename V2 = TDFDetail::TInferType, typename W = TDFDetail::TInferType>
TResultProxy<::TProfileProfile1D (const TProfile1DModel &model, std::string_view v1Name, std::string_view v2Name, std::string_view wName)
 Fill and return a one-dimensional profile (lazy action) More...
 
template<typename V1 , typename V2 , typename W >
TResultProxy<::TProfileProfile1D (const TProfile1DModel &model)
 
template<typename V1 = TDFDetail::TInferType, typename V2 = TDFDetail::TInferType, typename V3 = TDFDetail::TInferType>
TResultProxy<::TProfile2DProfile2D (const TProfile2DModel &model, std::string_view v1Name="", std::string_view v2Name="", std::string_view v3Name="")
 Fill and return a two-dimensional profile (lazy action) More...
 
template<typename V1 = TDFDetail::TInferType, typename V2 = TDFDetail::TInferType, typename V3 = TDFDetail::TInferType, typename W = TDFDetail::TInferType>
TResultProxy<::TProfile2DProfile2D (const TProfile2DModel &model, std::string_view v1Name, std::string_view v2Name, std::string_view v3Name, std::string_view wName)
 Fill and return a two-dimensional profile (lazy action) More...
 
template<typename V1 , typename V2 , typename V3 , typename W >
TResultProxy<::TProfile2DProfile2D (const TProfile2DModel &model)
 
TInterface< TDFDetail::TRange< Proxied > > Range (unsigned int start, unsigned int stop, unsigned int stride=1)
 Creates a node that filters entries based on range. More...
 
TInterface< TDFDetail::TRange< Proxied > > Range (unsigned int stop)
 Creates a node that filters entries based on range. More...
 
template<typename F , typename T = typename TTraits::CallableTraits<F>::ret_type>
TResultProxy< T > Reduce (F f, std::string_view columnName="")
 Execute a user-defined reduce operation on the values of a column. More...
 
template<typename F , typename T = typename TTraits::CallableTraits<F>::ret_type>
TResultProxy< T > Reduce (F f, std::string_view columnName, const T &redIdentity)
 Execute a user-defined reduce operation on the values of a column. More...
 
void Report ()
 Print filtering statistics on screen. More...
 
template<typename... BranchTypes>
TInterface< TLoopManagerSnapshot (std::string_view treename, std::string_view filename, const ColumnNames_t &columnList, const TSnapshotOptions &options=TSnapshotOptions())
 Save selected columns to disk, in a new TTree treename in file filename. More...
 
TInterface< TLoopManagerSnapshot (std::string_view treename, std::string_view filename, const ColumnNames_t &columnList, const TSnapshotOptions &options=TSnapshotOptions())
 Save selected columns to disk, in a new TTree treename in file filename. More...
 
TInterface< TLoopManagerSnapshot (std::string_view treename, std::string_view filename, std::string_view columnNameRegexp="", const TSnapshotOptions &options=TSnapshotOptions())
 Save selected columns to disk, in a new TTree treename in file filename. More...
 
template<typename T = TDFDetail::TInferType>
TResultProxy< TDFDetail::SumReturnType_t< T > > Sum (std::string_view columnName="", const TDFDetail::SumReturnType_t< T > &initValue=TDFDetail::SumReturnType_t< T >{})
 Return the sum of processed column values (lazy action) More...
 
template<typename T , typename COLL = std::vector<T>>
TResultProxy< typename TDFDetail::ColType_t< T, COLL > > Take (std::string_view column="")
 Return a collection of values of a column (lazy action, returns a std::vector by default) More...
 

Protected Member Functions

 TInterface (const std::shared_ptr< Proxied > &proxied, const std::weak_ptr< TLoopManager > &impl, const ColumnNames_t &validColumns, TDataSource *ds)
 
template<typename T = Proxied, typename std::enable_if< std::is_same< T, TLoopManager >::value, int >::type = 0>
 TInterface (const std::shared_ptr< Proxied > &proxied)
 Only enabled when building a TInterface<TLoopManager> More...
 
std::shared_ptr< TLoopManagerGetDataFrameChecked ()
 Get the TLoopManager if reachable. If not, throw. More...
 
const std::shared_ptr< Proxied > & GetProxiedPtr () const
 

Private Types

using ColumnNames_t = TDFDetail::ColumnNames_t
 
using TCustomColumnBase = TDFDetail::TCustomColumnBase
 
using TFilterBase = TDFDetail::TFilterBase
 
using TLoopManager = TDFDetail::TLoopManager
 
using TRangeBase = TDFDetail::TRangeBase
 

Private Member Functions

void AddDefaultColumns ()
 
template<typename... BranchTypes, int... S>
TInterface< TLoopManagerCacheImpl (const ColumnNames_t &columnList, TDFInternal::StaticSeq< S... > s)
 Implementation of cache. More...
 
Long_t CallJitTransformation (std::string_view transformation, std::string_view nodeName, std::string_view expression, std::string_view returnTypeName)
 
ColumnNames_t ConvertRegexToColumns (std::string_view columnNameRegexp, std::string_view callerName)
 
template<typename ActionType , typename... BranchTypes, typename ActionResultType , typename std::enable_if<!TDFInternal::TNeedJitting< BranchTypes... >::value, int >::type = 0>
TResultProxy< ActionResultType > CreateAction (const ColumnNames_t &columns, const std::shared_ptr< ActionResultType > &r)
 
template<typename ActionType , typename... BranchTypes, typename ActionResultType , typename std::enable_if< TDFInternal::TNeedJitting< BranchTypes... >::value, int >::type = 0>
TResultProxy< ActionResultType > CreateAction (const ColumnNames_t &columns, const std::shared_ptr< ActionResultType > &r, const int nColumns=-1)
 
template<typename F , typename ExtraArgs >
std::enable_if< std::is_default_constructible< typename TTraits::CallableTraits< F >::ret_type >::value, TInterface< Proxied > >::type DefineImpl (std::string_view name, F &&expression, const ColumnNames_t &columns)
 
template<typename F , typename ExtraArgs , typename std::enable_if<!std::is_convertible< F, std::string >::value &&!std::is_default_constructible< typename TTraits::CallableTraits< F >::ret_type >::value, int >::type = 0>
TInterface< Proxied > DefineImpl (std::string_view, F, const ColumnNames_t &={})
 
template<>
std::string GetNodeTypeName ()
 
template<>
std::string GetNodeTypeName ()
 
template<>
std::string GetNodeTypeName ()
 
template<typename... BranchTypes>
TInterface< TLoopManagerSnapshotImpl (std::string_view treename, std::string_view filename, const ColumnNames_t &columnList, const TSnapshotOptions &options)
 Implementation of snapshot. More...
 

Static Private Member Functions

static std::string GetNodeTypeName ()
 Return string containing fully qualified type name of the node pointed by fProxied. More...
 

Private Attributes

TDataSource *const fDataSource = nullptr
 Non-owning pointer to a data-source object. Null if no data-source. TLoopManager has ownership of the object. More...
 
const std::weak_ptr< TLoopManagerfImplWeakPtr
 Weak pointer to the TLoopManager at the root of the graph. More...
 
const std::shared_ptr< Proxied > fProxiedPtr
 Smart pointer to the graph node encapsulated by this TInterface. More...
 
ColumnNames_t fValidCustomColumns
 Names of columns Defined for this branch of the functional graph. More...
 

Friends

template<typename T >
class TInterface
 
std::string cling::printValue (::ROOT::Experimental::TDataFrame *tdf)
 

#include <ROOT/TDFInterface.hxx>

Member Typedef Documentation

◆ ColumnNames_t

template<typename Proxied>
using ROOT::Experimental::TDF::TInterface< Proxied >::ColumnNames_t = TDFDetail::ColumnNames_t
private

Definition at line 334 of file TDFInterface.hxx.

◆ TCustomColumnBase

template<typename Proxied>
using ROOT::Experimental::TDF::TInterface< Proxied >::TCustomColumnBase = TDFDetail::TCustomColumnBase
private

Definition at line 337 of file TDFInterface.hxx.

◆ TFilterBase

template<typename Proxied>
using ROOT::Experimental::TDF::TInterface< Proxied >::TFilterBase = TDFDetail::TFilterBase
private

Definition at line 335 of file TDFInterface.hxx.

◆ TLoopManager

template<typename Proxied>
using ROOT::Experimental::TDF::TInterface< Proxied >::TLoopManager = TDFDetail::TLoopManager
private

Definition at line 338 of file TDFInterface.hxx.

◆ TRangeBase

template<typename Proxied>
using ROOT::Experimental::TDF::TInterface< Proxied >::TRangeBase = TDFDetail::TRangeBase
private

Definition at line 336 of file TDFInterface.hxx.

Constructor & Destructor Documentation

◆ TInterface() [1/4]

template<typename Proxied>
ROOT::Experimental::TDF::TInterface< Proxied >::TInterface ( const TInterface< Proxied > &  )
default

Copy-ctor for TInterface.

◆ TInterface() [2/4]

template<typename Proxied>
ROOT::Experimental::TDF::TInterface< Proxied >::TInterface ( TInterface< Proxied > &&  )
default

Move-ctor for TInterface.

◆ TInterface() [3/4]

template<typename Proxied>
ROOT::Experimental::TDF::TInterface< Proxied >::TInterface ( const std::shared_ptr< Proxied > &  proxied,
const std::weak_ptr< TLoopManager > &  impl,
const ColumnNames_t validColumns,
TDataSource ds 
)
inlineprotected

Definition at line 1835 of file TDFInterface.hxx.

◆ TInterface() [4/4]

template<typename Proxied>
template<typename T = Proxied, typename std::enable_if< std::is_same< T, TLoopManager >::value, int >::type = 0>
ROOT::Experimental::TDF::TInterface< Proxied >::TInterface ( const std::shared_ptr< Proxied > &  proxied)
inlineprotected

Only enabled when building a TInterface<TLoopManager>

Definition at line 1843 of file TDFInterface.hxx.

Member Function Documentation

◆ AddDefaultColumns()

template<typename Proxied>
void ROOT::Experimental::TDF::TInterface< Proxied >::AddDefaultColumns ( )
inlineprivate

Definition at line 1513 of file TDFInterface.hxx.

◆ Alias()

template<typename Proxied>
TInterface<Proxied> ROOT::Experimental::TDF::TInterface< Proxied >::Alias ( std::string_view  alias,
std::string_view  columnName 
)
inline

Allow to refer to a column with a different name.

Parameters
[in]aliasname of the column alias
[in]columnNameof the column to be aliased Aliasing an alias is supported.

Definition at line 569 of file TDFInterface.hxx.

◆ Cache() [1/3]

template<typename Proxied>
template<typename... BranchTypes>
TInterface<TLoopManager> ROOT::Experimental::TDF::TInterface< Proxied >::Cache ( const ColumnNames_t columnList)
inline

Save selected columns in memory.

Parameters
[in]columnsto be cached in memory

The content of the selected columns is saved in memory exploiting the functionality offered by the Take action. No extra copy is carried out when serving cached data to the actions and transformations requesting it.

Definition at line 686 of file TDFInterface.hxx.

◆ Cache() [2/3]

template<typename Proxied>
TInterface<TLoopManager> ROOT::Experimental::TDF::TInterface< Proxied >::Cache ( const ColumnNames_t columnList)
inline

Save selected columns in memory.

Parameters
[in]columnsto be cached in memory

The content of the selected columns is saved in memory exploiting the functionality offered by the Take action. No extra copy is carried out when serving cached data to the actions and transformations requesting it.

Definition at line 699 of file TDFInterface.hxx.

◆ Cache() [3/3]

template<typename Proxied>
TInterface<TLoopManager> ROOT::Experimental::TDF::TInterface< Proxied >::Cache ( std::string_view  columnNameRegexp = "")
inline

Save selected columns in memory.

Parameters
[in]aregular expression to select the columns

The existing columns are matched against the regeular expression. If the string provided is empty, all columns are selected.

Definition at line 744 of file TDFInterface.hxx.

◆ CacheImpl()

template<typename Proxied>
template<typename... BranchTypes, int... S>
TInterface<TLoopManager> ROOT::Experimental::TDF::TInterface< Proxied >::CacheImpl ( const ColumnNames_t columnList,
TDFInternal::StaticSeq< S... >  s 
)
inlineprivate

Implementation of cache.

Definition at line 1775 of file TDFInterface.hxx.

◆ CallJitTransformation()

template<typename Proxied>
Long_t ROOT::Experimental::TDF::TInterface< Proxied >::CallJitTransformation ( std::string_view  transformation,
std::string_view  nodeName,
std::string_view  expression,
std::string_view  returnTypeName 
)
inlineprivate

Definition at line 1591 of file TDFInterface.hxx.

◆ ConvertRegexToColumns()

template<typename Proxied>
ColumnNames_t ROOT::Experimental::TDF::TInterface< Proxied >::ConvertRegexToColumns ( std::string_view  columnNameRegexp,
std::string_view  callerName 
)
inlineprivate

Definition at line 1533 of file TDFInterface.hxx.

◆ Count()

template<typename Proxied>
TResultProxy<ULong64_t> ROOT::Experimental::TDF::TInterface< Proxied >::Count ( )
inline

Return the number of entries processed (lazy action)

Useful e.g. for counting the number of entries passing a certain filter (see also Report). This action is lazy: upon invocation of this method the calculation is booked but not executed. See TResultProxy documentation.

Definition at line 900 of file TDFInterface.hxx.

◆ CreateAction() [1/2]

template<typename Proxied>
template<typename ActionType , typename... BranchTypes, typename ActionResultType , typename std::enable_if<!TDFInternal::TNeedJitting< BranchTypes... >::value, int >::type = 0>
TResultProxy<ActionResultType> ROOT::Experimental::TDF::TInterface< Proxied >::CreateAction ( const ColumnNames_t columns,
const std::shared_ptr< ActionResultType > &  r 
)
inlineprivate

Definition at line 1617 of file TDFInterface.hxx.

◆ CreateAction() [2/2]

template<typename Proxied>
template<typename ActionType , typename... BranchTypes, typename ActionResultType , typename std::enable_if< TDFInternal::TNeedJitting< BranchTypes... >::value, int >::type = 0>
TResultProxy<ActionResultType> ROOT::Experimental::TDF::TInterface< Proxied >::CreateAction ( const ColumnNames_t columns,
const std::shared_ptr< ActionResultType > &  r,
const int  nColumns = -1 
)
inlineprivate

Definition at line 1638 of file TDFInterface.hxx.

◆ Define() [1/2]

template<typename Proxied>
template<typename F , typename std::enable_if<!std::is_convertible< F, std::string >::value, int >::type = 0>
TInterface<Proxied> ROOT::Experimental::TDF::TInterface< Proxied >::Define ( std::string_view  name,
F  expression,
const ColumnNames_t columns = {} 
)
inline

Creates a custom column.

Parameters
[in]nameThe name of the custom column.
[in]expressionFunction, lambda expression, functor class or any other callable object producing the temporary value. Returns the value that will be assigned to the custom column.
[in]columnsNames of the columns/branches in input to the producer function.

Create a custom column that will be visible from all subsequent nodes of the functional chain. The expression is only evaluated for entries that pass all the preceding filters. A new variable is created called name, accessible as if it was contained in the dataset from subsequent transformations/actions.

Use cases include:

  • caching the results of complex calculations for easy and efficient multiple access
  • extraction of quantities of interest from complex objects
  • column aliasing, i.e. changing the name of a branch/column

An exception is thrown if the name of the new column is already in use.

Definition at line 480 of file TDFInterface.hxx.

◆ Define() [2/2]

template<typename Proxied>
TInterfaceJittedDefine ROOT::Experimental::TDF::TInterface< Proxied >::Define ( std::string_view  name,
std::string_view  expression 
)
inline

Creates a custom column.

Parameters
[in]nameThe name of the custom column.
[in]expressionAn expression in C++ which represents the temporary value

The expression is just-in-time compiled and used to produce the column entries. The It must be valid C++ syntax in which variable names are substituted with the names of branches/columns.

Refer to the first overload of this method for the full documentation.

Definition at line 553 of file TDFInterface.hxx.

◆ DefineImpl() [1/2]

template<typename Proxied>
template<typename F , typename ExtraArgs >
std::enable_if<std::is_default_constructible<typename TTraits::CallableTraits<F>::ret_type>::value, TInterface<Proxied> >::type ROOT::Experimental::TDF::TInterface< Proxied >::DefineImpl ( std::string_view  name,
F &&  expression,
const ColumnNames_t columns 
)
inlineprivate

Definition at line 1664 of file TDFInterface.hxx.

◆ DefineImpl() [2/2]

template<typename Proxied>
template<typename F , typename ExtraArgs , typename std::enable_if<!std::is_convertible< F, std::string >::value &&!std::is_default_constructible< typename TTraits::CallableTraits< F >::ret_type >::value, int >::type = 0>
TInterface<Proxied> ROOT::Experimental::TDF::TInterface< Proxied >::DefineImpl ( std::string_view  ,
F  ,
const ColumnNames_t = {} 
)
inlineprivate

Definition at line 1701 of file TDFInterface.hxx.

◆ DefineSlot()

template<typename Proxied>
template<typename F >
TInterface<Proxied> ROOT::Experimental::TDF::TInterface< Proxied >::DefineSlot ( std::string_view  name,
F  expression,
const ColumnNames_t columns = {} 
)
inline

Creates a custom column with a value dependent on the processing slot.

Parameters
[in]nameThe name of the custom column.
[in]expressionFunction, lambda expression, functor class or any other callable object producing the temporary value. Returns the value that will be assigned to the custom column.
[in]columnsNames of the columns/branches in input to the producer function (excluding the slot number).

This alternative implementation of Define is meant as a helper in writing thread-safe custom columns. The expression must be a callable of signature R(unsigned int, T1, T2, ...) where T1, T2... are the types of the columns that the expression takes as input. The first parameter is reserved for an unsigned integer representing a "slot number". TDataFrame guarantees that different threads will invoke the expression with different slot numbers - slot numbers will range from zero to ROOT::GetImplicitMTPoolSize()-1.

The following two calls are equivalent, although DefineSlot is slightly more performant:

int function(unsigned int, double, double);
Define("x", function, {"tdfslot_", "column1", "column2"})
DefineSlot("x", function, {"column1", "column2"})

See Define for more information.

Definition at line 508 of file TDFInterface.hxx.

◆ DefineSlotEntry()

template<typename Proxied>
template<typename F >
TInterface<Proxied> ROOT::Experimental::TDF::TInterface< Proxied >::DefineSlotEntry ( std::string_view  name,
F  expression,
const ColumnNames_t columns = {} 
)
inline

Creates a custom column with a value dependent on the processing slot and the current entry.

Parameters
[in]nameThe name of the custom column.
[in]expressionFunction, lambda expression, functor class or any other callable object producing the temporary value. Returns the value that will be assigned to the custom column.
[in]columnsNames of the columns/branches in input to the producer function (excluding slot and entry).

This alternative implementation of Define is meant as a helper in writing entry-specific, thread-safe custom columns. The expression must be a callable of signature R(unsigned int, ULong64_t, T1, T2, ...) where T1, T2... are the types of the columns that the expression takes as input. The first parameter is reserved for an unsigned integer representing a "slot number". TDataFrame guarantees that different threads will invoke the expression with different slot numbers - slot numbers will range from zero to ROOT::GetImplicitMTPoolSize()-1. The second parameter is reserved for a ULong64_t representing the current entry being processed by the current thread.

The following two Defines are equivalent, although DefineSlotEntry is slightly more performant:

int function(unsigned int, ULong64_t, double, double);
Define("x", function, {"tdfslot_", "tdfentry_", "column1", "column2"})
DefineSlotEntry("x", function, {"column1", "column2"})

See Define for more information.

Definition at line 537 of file TDFInterface.hxx.

◆ Fill() [1/2]

template<typename Proxied>
template<typename FirstColumn , typename... OtherColumns, typename T >
TResultProxy<T> ROOT::Experimental::TDF::TInterface< Proxied >::Fill ( T &&  model,
const ColumnNames_t columnList 
)
inline

Return an object of type T on which T::Fill will be called once per event (lazy action)

T must be a type that provides a copy- or move-constructor and a T::Fill method that takes as many arguments as the column names pass as columnList. The arguments of T::Fill must have type equal to the one of the specified columns (these types are passed as template parameters to this method).

Template Parameters
FirstColumnThe first type of the column the values of which are used to fill the object.
OtherColumnsA list of the other types of the columns the values of which are used to fill the object.
TThe type of the object to fill. Automatically deduced.
Parameters
[in]modelThe model to be considered to build the new return value.
[in]columnListA list containing the names of the columns that will be passed when calling Fill

The user gives up ownership of the model object. The list of column names to be used for filling must always be specified. This action is lazy: upon invocation of this method the calculation is booked but not executed. See TResultProxy documentation.

Definition at line 1343 of file TDFInterface.hxx.

◆ Fill() [2/2]

template<typename Proxied>
template<typename T >
TResultProxy<T> ROOT::Experimental::TDF::TInterface< Proxied >::Fill ( T &&  model,
const ColumnNames_t bl 
)
inline

Return an object of type T on which T::Fill will be called once per event (lazy action)

This overload infers the types of the columns specified in columnList at runtime and just-in-time compiles the method with these types. See previous overload for more information.

Template Parameters
TThe type of the object to fill. Automatically deduced.
Parameters
[in]modelThe model to be considered to build the new return value.
[in]columnListThe name of the columns read to fill the object.

This overload of Fill infers the type of the specified columns at runtime and just-in-time compiles the previous overload. Check the previous overload for more details on Fill.

Definition at line 1364 of file TDFInterface.hxx.

◆ Filter() [1/4]

template<typename Proxied>
template<typename F , typename std::enable_if<!std::is_convertible< F, std::string >::value, int >::type = 0>
TInterface<TDFDetail::TFilter<F, Proxied> > ROOT::Experimental::TDF::TInterface< Proxied >::Filter ( F  f,
const ColumnNames_t columns = {},
std::string_view  name = "" 
)
inline

Append a filter to the call graph.

Parameters
[in]fFunction, lambda expression, functor class or any other callable object. It must return a bool signalling whether the event has passed the selection (true) or not (false).
[in]columnsNames of the columns/branches in input to the filter function.
[in]nameOptional name of this filter. See Report.

Append a filter node at the point of the call graph corresponding to the object this method is called on. The callable f should not have side-effects (e.g. modification of an external or static variable) to ensure correct results when implicit multi-threading is active.

TDataFrame only evaluates filters when necessary: if multiple filters are chained one after another, they are executed in order and the first one returning false causes the event to be discarded. Even if multiple actions or transformations depend on the same filter, it is executed once per entry. If its result is requested more than once, the cached result is served.

Definition at line 398 of file TDFInterface.hxx.

◆ Filter() [2/4]

template<typename Proxied>
template<typename F , typename std::enable_if<!std::is_convertible< F, std::string >::value, int >::type = 0>
TInterface<TDFDetail::TFilter<F, Proxied> > ROOT::Experimental::TDF::TInterface< Proxied >::Filter ( F  f,
std::string_view  name 
)
inline

Append a filter to the call graph.

Parameters
[in]fFunction, lambda expression, functor class or any other callable object. It must return a bool signalling whether the event has passed the selection (true) or not (false).
[in]nameOptional name of this filter. See Report.

Refer to the first overload of this method for the full documentation.

Definition at line 423 of file TDFInterface.hxx.

◆ Filter() [3/4]

template<typename Proxied>
template<typename F >
TInterface<TDFDetail::TFilter<F, Proxied> > ROOT::Experimental::TDF::TInterface< Proxied >::Filter ( F  f,
const std::initializer_list< std::string > &  columns 
)
inline

Append a filter to the call graph.

Parameters
[in]fFunction, lambda expression, functor class or any other callable object. It must return a bool signalling whether the event has passed the selection (true) or not (false).
[in]columnsNames of the columns/branches in input to the filter function.

Refer to the first overload of this method for the full documentation.

Definition at line 438 of file TDFInterface.hxx.

◆ Filter() [4/4]

template<typename Proxied>
TInterface<TFilterBase> ROOT::Experimental::TDF::TInterface< Proxied >::Filter ( std::string_view  expression,
std::string_view  name = "" 
)
inline

Append a filter to the call graph.

Parameters
[in]expressionThe filter expression in C++
[in]nameOptional name of this filter. See Report.

The expression is just-in-time compiled and used to filter entries. It must be valid C++ syntax in which variable names are substituted with the names of branches/columns.

Refer to the first overload of this method for the full documentation.

Definition at line 453 of file TDFInterface.hxx.

◆ Foreach()

template<typename Proxied>
template<typename F >
void ROOT::Experimental::TDF::TInterface< Proxied >::Foreach ( F  f,
const ColumnNames_t columns = {} 
)
inline

Execute a user-defined function on each entry (instant action)

Parameters
[in]fFunction, lambda expression, functor class or any other callable object performing user defined calculations.
[in]columnsNames of the columns/branches in input to the user function.

The callable f is invoked once per entry. This is an instant action: upon invocation, an event loop as well as execution of all scheduled actions is triggered. Users are responsible for the thread-safety of this callable when executing with implicit multi-threading enabled (i.e. ROOT::EnableImplicitMT).

Definition at line 792 of file TDFInterface.hxx.

◆ ForeachSlot()

template<typename Proxied>
template<typename F >
void ROOT::Experimental::TDF::TInterface< Proxied >::ForeachSlot ( F  f,
const ColumnNames_t columns = {} 
)
inline

Execute a user-defined function requiring a processing slot index on each entry (instant action)

Parameters
[in]fFunction, lambda expression, functor class or any other callable object performing user defined calculations.
[in]columnsNames of the columns/branches in input to the user function.

Same as Foreach, but the user-defined function takes an extra unsigned int as its first parameter, the processing slot index. This slot index will be assigned a different value, 0 to poolSize - 1, for each thread of execution. This is meant as a helper in writing thread-safe Foreach actions when using TDataFrame after ROOT::EnableImplicitMT(). The user-defined processing callable is able to follow different streams of processing indexed by the first parameter. ForeachSlot works just as well with single-thread execution: in that case slot will always be 0.

Definition at line 816 of file TDFInterface.hxx.

◆ GetColumnNames()

template<typename Proxied>
ColumnNames_t ROOT::Experimental::TDF::TInterface< Proxied >::GetColumnNames ( )
inline

Returns the names of the available columns.

This is not an action nor a transformation, just a simple utility to get columns names out of the TDataFrame nodes.

Definition at line 1486 of file TDFInterface.hxx.

◆ GetDataFrameChecked()

template<typename Proxied>
std::shared_ptr<TLoopManager> ROOT::Experimental::TDF::TInterface< Proxied >::GetDataFrameChecked ( )
inlineprotected

Get the TLoopManager if reachable. If not, throw.

Definition at line 1826 of file TDFInterface.hxx.

◆ GetNodeTypeName() [1/4]

template<typename Proxied>
static std::string ROOT::Experimental::TDF::TInterface< Proxied >::GetNodeTypeName ( )
inlinestaticprivate

Return string containing fully qualified type name of the node pointed by fProxied.

The method is only defined for TInterface<{TFilterBase,TCustomColumnBase,TRangeBase,TLoopManager}> as it should only be called on "upcast" TInterfaces.

◆ GetNodeTypeName() [2/4]

template<>
std::string ROOT::Experimental::TDF::TInterface< TDFDetail::TFilterBase >::GetNodeTypeName ( )
inlineprivate

Definition at line 1854 of file TDFInterface.hxx.

◆ GetNodeTypeName() [3/4]

template<>
std::string ROOT::Experimental::TDF::TInterface< TDFDetail::TLoopManager >::GetNodeTypeName ( )
inlineprivate

Definition at line 1860 of file TDFInterface.hxx.

◆ GetNodeTypeName() [4/4]

template<>
std::string ROOT::Experimental::TDF::TInterface< TDFDetail::TRangeBase >::GetNodeTypeName ( )
inlineprivate

Definition at line 1866 of file TDFInterface.hxx.

◆ GetProxiedPtr()

template<typename Proxied>
const std::shared_ptr<Proxied>& ROOT::Experimental::TDF::TInterface< Proxied >::GetProxiedPtr ( ) const
inlineprotected

Definition at line 1850 of file TDFInterface.hxx.

◆ Histo1D() [1/5]

template<typename Proxied>
template<typename V = TDFDetail::TInferType>
TResultProxy<::TH1D> ROOT::Experimental::TDF::TInterface< Proxied >::Histo1D ( const TH1DModel model = {"", "", 128u, 0., 0.},
std::string_view  vName = "" 
)
inline

Fill and return a one-dimensional histogram with the values of a column (lazy action)

Template Parameters
VThe type of the column used to fill the histogram.
Parameters
[in]modelThe returned histogram will be constructed using this as a model.
[in]vNameThe name of the column that will fill the histogram.

Columns can be of a container type (e.g. std::vector<double>), in which case the histogram is filled with each one of the elements of the container. In case multiple columns of container type are provided (e.g. values and weights) they must have the same length for each one of the events (but possibly different lengths between events). This action is lazy: upon invocation of this method the calculation is booked but not executed. See TResultProxy documentation. The user gives up ownership of the model histogram.

Definition at line 960 of file TDFInterface.hxx.

◆ Histo1D() [2/5]

template<typename Proxied>
template<typename V = TDFDetail::TInferType>
TResultProxy<::TH1D> ROOT::Experimental::TDF::TInterface< Proxied >::Histo1D ( std::string_view  vName)
inline

Definition at line 975 of file TDFInterface.hxx.

◆ Histo1D() [3/5]

template<typename Proxied>
template<typename V = TDFDetail::TInferType, typename W = TDFDetail::TInferType>
TResultProxy<::TH1D> ROOT::Experimental::TDF::TInterface< Proxied >::Histo1D ( const TH1DModel model,
std::string_view  vName,
std::string_view  wName 
)
inline

Fill and return a one-dimensional histogram with the weighted values of a column (lazy action)

Template Parameters
VThe type of the column used to fill the histogram.
WThe type of the column used as weights.
Parameters
[in]modelThe returned histogram will be constructed using this as a model.
[in]vNameThe name of the column that will fill the histogram.
[in]wNameThe name of the column that will provide the weights.

See the description of the first Histo1D overload for more details.

Definition at line 990 of file TDFInterface.hxx.

◆ Histo1D() [4/5]

template<typename Proxied>
template<typename V = TDFDetail::TInferType, typename W = TDFDetail::TInferType>
TResultProxy<::TH1D> ROOT::Experimental::TDF::TInterface< Proxied >::Histo1D ( std::string_view  vName,
std::string_view  wName 
)
inline

Fill and return a one-dimensional histogram with the weighted values of a column (lazy action)

Template Parameters
VThe type of the column used to fill the histogram.
WThe type of the column used as weights.
Parameters
[in]vNameThe name of the column that will fill the histogram.
[in]wNameThe name of the column that will provide the weights.

This overload uses a default model histogram TH1D("", "", 128u, 0., 0.). See the description of the first Histo1D overload for more details.

Definition at line 1014 of file TDFInterface.hxx.

◆ Histo1D() [5/5]

template<typename Proxied>
template<typename V , typename W >
TResultProxy<::TH1D> ROOT::Experimental::TDF::TInterface< Proxied >::Histo1D ( const TH1DModel model = {"", "", 128u, 0., 0.})
inline

Fill and return a one-dimensional histogram with the weighted values of a column (lazy action)

Template Parameters
VThe type of the column used to fill the histogram.
WThe type of the column used as weights.
Parameters
[in]modelThe returned histogram will be constructed using this as a model.

This overload will use the first two default columns as column names. See the description of the first Histo1D overload for more details.

Definition at line 1028 of file TDFInterface.hxx.

◆ Histo2D() [1/3]

template<typename Proxied>
template<typename V1 = TDFDetail::TInferType, typename V2 = TDFDetail::TInferType>
TResultProxy<::TH2D> ROOT::Experimental::TDF::TInterface< Proxied >::Histo2D ( const TH2DModel model,
std::string_view  v1Name = "",
std::string_view  v2Name = "" 
)
inline

Fill and return a two-dimensional histogram (lazy action)

Template Parameters
V1The type of the column used to fill the x axis of the histogram.
V2The type of the column used to fill the y axis of the histogram.
Parameters
[in]modelThe returned histogram will be constructed using this as a model.
[in]v1NameThe name of the column that will fill the x axis.
[in]v2NameThe name of the column that will fill the y axis.

Columns can be of a container type (e.g. std::vector<double>), in which case the histogram is filled with each one of the elements of the container. In case multiple columns of container type are provided (e.g. values and weights) they must have the same length for each one of the events (but possibly different lengths between events). This action is lazy: upon invocation of this method the calculation is booked but not executed. See TResultProxy documentation. The user gives up ownership of the model histogram.

Definition at line 1049 of file TDFInterface.hxx.

◆ Histo2D() [2/3]

template<typename Proxied>
template<typename V1 = TDFDetail::TInferType, typename V2 = TDFDetail::TInferType, typename W = TDFDetail::TInferType>
TResultProxy<::TH2D> ROOT::Experimental::TDF::TInterface< Proxied >::Histo2D ( const TH2DModel model,
std::string_view  v1Name,
std::string_view  v2Name,
std::string_view  wName 
)
inline

Fill and return a weighted two-dimensional histogram (lazy action)

Template Parameters
V1The type of the column used to fill the x axis of the histogram.
V2The type of the column used to fill the y axis of the histogram.
WThe type of the column used for the weights of the histogram.
Parameters
[in]modelThe returned histogram will be constructed using this as a model.
[in]v1NameThe name of the column that will fill the x axis.
[in]v2NameThe name of the column that will fill the y axis.
[in]wNameThe name of the column that will provide the weights.

This action is lazy: upon invocation of this method the calculation is booked but not executed. See TResultProxy documentation. The user gives up ownership of the model histogram.

Definition at line 1082 of file TDFInterface.hxx.

◆ Histo2D() [3/3]

template<typename Proxied>
template<typename V1 , typename V2 , typename W >
TResultProxy<::TH2D> ROOT::Experimental::TDF::TInterface< Proxied >::Histo2D ( const TH2DModel model)
inline

Definition at line 1100 of file TDFInterface.hxx.

◆ Histo3D() [1/3]

template<typename Proxied>
template<typename V1 = TDFDetail::TInferType, typename V2 = TDFDetail::TInferType, typename V3 = TDFDetail::TInferType>
TResultProxy<::TH3D> ROOT::Experimental::TDF::TInterface< Proxied >::Histo3D ( const TH3DModel model,
std::string_view  v1Name = "",
std::string_view  v2Name = "",
std::string_view  v3Name = "" 
)
inline

Fill and return a three-dimensional histogram (lazy action)

Template Parameters
V1The type of the column used to fill the x axis of the histogram. Inferred if not present.
V2The type of the column used to fill the y axis of the histogram. Inferred if not present.
V3The type of the column used to fill the z axis of the histogram. Inferred if not present.
Parameters
[in]modelThe returned histogram will be constructed using this as a model.
[in]v1NameThe name of the column that will fill the x axis.
[in]v2NameThe name of the column that will fill the y axis.
[in]v3NameThe name of the column that will fill the z axis.

This action is lazy: upon invocation of this method the calculation is booked but not executed. See TResultProxy documentation. The user gives up ownership of the model histogram.

Definition at line 1120 of file TDFInterface.hxx.

◆ Histo3D() [2/3]

template<typename Proxied>
template<typename V1 = TDFDetail::TInferType, typename V2 = TDFDetail::TInferType, typename V3 = TDFDetail::TInferType, typename W = TDFDetail::TInferType>
TResultProxy<::TH3D> ROOT::Experimental::TDF::TInterface< Proxied >::Histo3D ( const TH3DModel model,
std::string_view  v1Name,
std::string_view  v2Name,
std::string_view  v3Name,
std::string_view  wName 
)
inline

Fill and return a three-dimensional histogram (lazy action)

Template Parameters
V1The type of the column used to fill the x axis of the histogram. Inferred if not present.
V2The type of the column used to fill the y axis of the histogram. Inferred if not present.
V3The type of the column used to fill the z axis of the histogram. Inferred if not present.
WThe type of the column used for the weights of the histogram. Inferred if not present.
Parameters
[in]modelThe returned histogram will be constructed using this as a model.
[in]v1NameThe name of the column that will fill the x axis.
[in]v2NameThe name of the column that will fill the y axis.
[in]v3NameThe name of the column that will fill the z axis.
[in]wNameThe name of the column that will provide the weights.

This action is lazy: upon invocation of this method the calculation is booked but not executed. See TResultProxy documentation. The user gives up ownership of the model histogram.

Definition at line 1155 of file TDFInterface.hxx.

◆ Histo3D() [3/3]

template<typename Proxied>
template<typename V1 , typename V2 , typename V3 , typename W >
TResultProxy<::TH3D> ROOT::Experimental::TDF::TInterface< Proxied >::Histo3D ( const TH3DModel model)
inline

Definition at line 1174 of file TDFInterface.hxx.

◆ Max()

template<typename Proxied>
template<typename T = TDFDetail::TInferType>
TResultProxy<TDFDetail::MaxReturnType_t<T> > ROOT::Experimental::TDF::TInterface< Proxied >::Max ( std::string_view  columnName = "")
inline

Return the maximum of processed column values (lazy action)

Template Parameters
TThe type of the branch/column.
Parameters
[in]columnNameThe name of the branch/column to be treated.

If T is not specified, TDataFrame will infer it from the data and just-in-time compile the correct template specialization of this method. If the type of the column is inferred, the return type is double, the type of the column otherwise.

This action is lazy: upon invocation of this method the calculation is booked but not executed. See TResultProxy documentation.

Definition at line 1405 of file TDFInterface.hxx.

◆ Mean()

template<typename Proxied>
template<typename T = TDFDetail::TInferType>
TResultProxy<double> ROOT::Experimental::TDF::TInterface< Proxied >::Mean ( std::string_view  columnName = "")
inline

Return the mean of processed column values (lazy action)

Template Parameters
TThe type of the branch/column.
Parameters
[in]columnNameThe name of the branch/column to be treated.

If T is not specified, TDataFrame will infer it from the data and just-in-time compile the correct template specialization of this method.

This action is lazy: upon invocation of this method the calculation is booked but not executed. See TResultProxy documentation.

Definition at line 1424 of file TDFInterface.hxx.

◆ Min()

template<typename Proxied>
template<typename T = TDFDetail::TInferType>
TResultProxy<TDFDetail::MinReturnType_t<T> > ROOT::Experimental::TDF::TInterface< Proxied >::Min ( std::string_view  columnName = "")
inline

Return the minimum of processed column values (lazy action)

Template Parameters
TThe type of the branch/column.
Parameters
[in]columnNameThe name of the branch/column to be treated.

If T is not specified, TDataFrame will infer it from the data and just-in-time compile the correct template specialization of this method. If the type of the column is inferred, the return type is double, the type of the column otherwise.

This action is lazy: upon invocation of this method the calculation is booked but not executed. See TResultProxy documentation.

Definition at line 1385 of file TDFInterface.hxx.

◆ operator=()

template<typename Proxied>
TInterface& ROOT::Experimental::TDF::TInterface< Proxied >::operator= ( const TInterface< Proxied > &  )
default

Copy-assignment operator for TInterface.

◆ Profile1D() [1/3]

template<typename Proxied>
template<typename V1 = TDFDetail::TInferType, typename V2 = TDFDetail::TInferType>
TResultProxy<::TProfile> ROOT::Experimental::TDF::TInterface< Proxied >::Profile1D ( const TProfile1DModel model,
std::string_view  v1Name = "",
std::string_view  v2Name = "" 
)
inline

Fill and return a one-dimensional profile (lazy action)

Template Parameters
V1The type of the column the values of which are used to fill the profile. Inferred if not present.
V2The type of the column the values of which are used to fill the profile. Inferred if not present.
Parameters
[in]modelThe model to be considered to build the new return value.
[in]v1NameThe name of the column that will fill the x axis.
[in]v2NameThe name of the column that will fill the y axis.

This action is lazy: upon invocation of this method the calculation is booked but not executed. See TResultProxy documentation. The user gives up ownership of the model profile object.

Definition at line 1192 of file TDFInterface.hxx.

◆ Profile1D() [2/3]

template<typename Proxied>
template<typename V1 = TDFDetail::TInferType, typename V2 = TDFDetail::TInferType, typename W = TDFDetail::TInferType>
TResultProxy<::TProfile> ROOT::Experimental::TDF::TInterface< Proxied >::Profile1D ( const TProfile1DModel model,
std::string_view  v1Name,
std::string_view  v2Name,
std::string_view  wName 
)
inline

Fill and return a one-dimensional profile (lazy action)

Template Parameters
V1The type of the column the values of which are used to fill the profile. Inferred if not present.
V2The type of the column the values of which are used to fill the profile. Inferred if not present.
WThe type of the column the weights of which are used to fill the profile. Inferred if not present.
Parameters
[in]modelThe model to be considered to build the new return value.
[in]v1NameThe name of the column that will fill the x axis.
[in]v2NameThe name of the column that will fill the y axis.
[in]wNameThe name of the column that will provide the weights.

This action is lazy: upon invocation of this method the calculation is booked but not executed. See TResultProxy documentation. The user gives up ownership of the model profile object.

Definition at line 1226 of file TDFInterface.hxx.

◆ Profile1D() [3/3]

template<typename Proxied>
template<typename V1 , typename V2 , typename W >
TResultProxy<::TProfile> ROOT::Experimental::TDF::TInterface< Proxied >::Profile1D ( const TProfile1DModel model)
inline

Definition at line 1245 of file TDFInterface.hxx.

◆ Profile2D() [1/3]

template<typename Proxied>
template<typename V1 = TDFDetail::TInferType, typename V2 = TDFDetail::TInferType, typename V3 = TDFDetail::TInferType>
TResultProxy<::TProfile2D> ROOT::Experimental::TDF::TInterface< Proxied >::Profile2D ( const TProfile2DModel model,
std::string_view  v1Name = "",
std::string_view  v2Name = "",
std::string_view  v3Name = "" 
)
inline

Fill and return a two-dimensional profile (lazy action)

Template Parameters
V1The type of the column used to fill the x axis of the histogram. Inferred if not present.
V2The type of the column used to fill the y axis of the histogram. Inferred if not present.
V2The type of the column used to fill the z axis of the histogram. Inferred if not present.
Parameters
[in]modelThe returned profile will be constructed using this as a model.
[in]v1NameThe name of the column that will fill the x axis.
[in]v2NameThe name of the column that will fill the y axis.
[in]v3NameThe name of the column that will fill the z axis.

This action is lazy: upon invocation of this method the calculation is booked but not executed. See TResultProxy documentation. The user gives up ownership of the model profile.

Definition at line 1265 of file TDFInterface.hxx.

◆ Profile2D() [2/3]

template<typename Proxied>
template<typename V1 = TDFDetail::TInferType, typename V2 = TDFDetail::TInferType, typename V3 = TDFDetail::TInferType, typename W = TDFDetail::TInferType>
TResultProxy<::TProfile2D> ROOT::Experimental::TDF::TInterface< Proxied >::Profile2D ( const TProfile2DModel model,
std::string_view  v1Name,
std::string_view  v2Name,
std::string_view  v3Name,
std::string_view  wName 
)
inline

Fill and return a two-dimensional profile (lazy action)

Template Parameters
V1The type of the column used to fill the x axis of the histogram. Inferred if not present.
V2The type of the column used to fill the y axis of the histogram. Inferred if not present.
V3The type of the column used to fill the z axis of the histogram. Inferred if not present.
WThe type of the column used for the weights of the histogram. Inferred if not present.
Parameters
[in]modelThe returned histogram will be constructed using this as a model.
[in]v1NameThe name of the column that will fill the x axis.
[in]v2NameThe name of the column that will fill the y axis.
[in]v3NameThe name of the column that will fill the z axis.
[in]wNameThe name of the column that will provide the weights.

This action is lazy: upon invocation of this method the calculation is booked but not executed. See TResultProxy documentation. The user gives up ownership of the model profile.

Definition at line 1301 of file TDFInterface.hxx.

◆ Profile2D() [3/3]

template<typename Proxied>
template<typename V1 , typename V2 , typename V3 , typename W >
TResultProxy<::TProfile2D> ROOT::Experimental::TDF::TInterface< Proxied >::Profile2D ( const TProfile2DModel model)
inline

Definition at line 1321 of file TDFInterface.hxx.

◆ Range() [1/2]

template<typename Proxied>
TInterface<TDFDetail::TRange<Proxied> > ROOT::Experimental::TDF::TInterface< Proxied >::Range ( unsigned int  start,
unsigned int  stop,
unsigned int  stride = 1 
)
inline

Creates a node that filters entries based on range.

Parameters
[in]startHow many entries to discard before resuming processing.
[in]stopTotal number of entries that will be processed before stopping. 0 means "never stop".
[in]strideProcess one entry every stride entries. Must be strictly greater than 0.

Ranges are only available if EnableImplicitMT has not been called. Multi-thread ranges are not supported.

Definition at line 757 of file TDFInterface.hxx.

◆ Range() [2/2]

template<typename Proxied>
TInterface<TDFDetail::TRange<Proxied> > ROOT::Experimental::TDF::TInterface< Proxied >::Range ( unsigned int  stop)
inline

Creates a node that filters entries based on range.

Parameters
[in]stopTotal number of entries that will be processed before stopping. 0 means "never stop".

See the other Range overload for a detailed description.

Definition at line 778 of file TDFInterface.hxx.

◆ Reduce() [1/2]

template<typename Proxied>
template<typename F , typename T = typename TTraits::CallableTraits<F>::ret_type>
TResultProxy<T> ROOT::Experimental::TDF::TInterface< Proxied >::Reduce ( F  f,
std::string_view  columnName = "" 
)
inline

Execute a user-defined reduce operation on the values of a column.

Template Parameters
FThe type of the reduce callable. Automatically deduced.
TThe type of the column to apply the reduction to. Automatically deduced.
Parameters
[in]fA callable with signature T(T,T)
[in]columnNameThe column to be reduced. If omitted, the first default column is used instead.

A reduction takes two values of a column and merges them into one (e.g. by summing them, taking the maximum, etc). This action performs the specified reduction operation on all processed column values, returning a single value of the same type. The callable f must satisfy the general requirements of a processing function besides having signature T(T,T) where T is the type of column columnName.

The returned reduced value of each thread (e.g. the initial value of a sum) is initialized to a default-constructed T object. This is commonly expected to be the neutral/identity element for the specific reduction operation f (e.g. 0 for a sum, 1 for a product). If a default-constructed T does not satisfy this requirement, users should explicitly specify an initialization value for T by calling the appropriate Reduce overload.

This action is lazy: upon invocation of this method the calculation is booked but not executed. See TResultProxy documentation.

Definition at line 855 of file TDFInterface.hxx.

◆ Reduce() [2/2]

template<typename Proxied>
template<typename F , typename T = typename TTraits::CallableTraits<F>::ret_type>
TResultProxy<T> ROOT::Experimental::TDF::TInterface< Proxied >::Reduce ( F  f,
std::string_view  columnName,
const T &  redIdentity 
)
inline

Execute a user-defined reduce operation on the values of a column.

Template Parameters
FThe type of the reduce callable. Automatically deduced.
TThe type of the column to apply the reduction to. Automatically deduced.
Parameters
[in]fA callable with signature T(T,T)
[in]columnNameThe column to be reduced. If omitted, the first default column is used instead.
[in]redIdentityThe reduced object of each thread is initialised to this value.

See the description of the first Reduce overload for more information.

Definition at line 873 of file TDFInterface.hxx.

◆ Report()

template<typename Proxied>
void ROOT::Experimental::TDF::TInterface< Proxied >::Report ( )
inline

Print filtering statistics on screen.

Calling Report on the main TDataFrame object prints stats for all named filters in the call graph. Calling this method on a stored chain state (i.e. a graph node different from the first) prints the stats for all named filters in the chain section between the original TDataFrame and that node (included). Stats are printed in the same order as the named filters have been added to the graph.

Definition at line 1464 of file TDFInterface.hxx.

◆ Snapshot() [1/3]

template<typename Proxied>
template<typename... BranchTypes>
TInterface<TLoopManager> ROOT::Experimental::TDF::TInterface< Proxied >::Snapshot ( std::string_view  treename,
std::string_view  filename,
const ColumnNames_t columnList,
const TSnapshotOptions options = TSnapshotOptions() 
)
inline

Save selected columns to disk, in a new TTree treename in file filename.

Template Parameters
BranchTypesvariadic list of branch/column types
Parameters
[in]treenameThe name of the output TTree
[in]filenameThe name of the output TFile
[in]columnListThe list of names of the columns/branches to be written
[in]optionsTSnapshotOptions struct with extra options to pass to TFile and TTree

This function returns a TDataFrame built with the output tree as a source.

Definition at line 602 of file TDFInterface.hxx.

◆ Snapshot() [2/3]

template<typename Proxied>
TInterface<TLoopManager> ROOT::Experimental::TDF::TInterface< Proxied >::Snapshot ( std::string_view  treename,
std::string_view  filename,
const ColumnNames_t columnList,
const TSnapshotOptions options = TSnapshotOptions() 
)
inline

Save selected columns to disk, in a new TTree treename in file filename.

Parameters
[in]treenameThe name of the output TTree
[in]filenameThe name of the output TFile
[in]columnListThe list of names of the columns/branches to be written
[in]optionsTSnapshotOptions struct with extra options to pass to TFile and TTree

This function returns a TDataFrame built with the output tree as a source. The types of the columns are automatically inferred and do not need to be specified.

Definition at line 617 of file TDFInterface.hxx.

◆ Snapshot() [3/3]

template<typename Proxied>
TInterface<TLoopManager> ROOT::Experimental::TDF::TInterface< Proxied >::Snapshot ( std::string_view  treename,
std::string_view  filename,
std::string_view  columnNameRegexp = "",
const TSnapshotOptions options = TSnapshotOptions() 
)
inline

Save selected columns to disk, in a new TTree treename in file filename.

Parameters
[in]treenameThe name of the output TTree
[in]filenameThe name of the output TFile
[in]columnNameRegexpThe regular expression to match the column names to be selected. The presence of a '^' and a '$' at the end of the string is implicitly assumed if they are not specified. See the documentation of TRegexp for more details. An empty string signals the selection of all columns.
[in]optionsTSnapshotOptions struct with extra options to pass to TFile and TTree

This function returns a TDataFrame built with the output tree as a source. The types of the columns are automatically inferred and do not need to be specified.

Definition at line 669 of file TDFInterface.hxx.

◆ SnapshotImpl()

template<typename Proxied>
template<typename... BranchTypes>
TInterface<TLoopManager> ROOT::Experimental::TDF::TInterface< Proxied >::SnapshotImpl ( std::string_view  treename,
std::string_view  filename,
const ColumnNames_t columnList,
const TSnapshotOptions options 
)
inlineprivate

Implementation of snapshot.

Parameters
[in]treenameThe name of the TTree
[in]filenameThe name of the TFile
[in]columnListThe list of names of the branches to be written The implementation exploits Foreach. The association of the addresses to the branches takes place at the first event. This is possible because since there are no copies, the address of the value passed by reference is the address pointing to the storage of the read/created object in/by the TTreeReaderValue/TemporaryBranch

Definition at line 1719 of file TDFInterface.hxx.

◆ Sum()

template<typename Proxied>
template<typename T = TDFDetail::TInferType>
TResultProxy<TDFDetail::SumReturnType_t<T> > ROOT::Experimental::TDF::TInterface< Proxied >::Sum ( std::string_view  columnName = "",
const TDFDetail::SumReturnType_t< T > &  initValue = TDFDetail::SumReturnType_t<T>{} 
)
inline

Return the sum of processed column values (lazy action)

Template Parameters
TThe type of the branch/column.
Parameters
[in]columnNameThe name of the branch/column.
[in]initValueOptional initial value for the sum. If not present, the column values must be default-constructible.

If T is not specified, TDataFrame will infer it from the data and just-in-time compile the correct template specialization of this method. If the type of the column is inferred, the return type is double, the type of the column otherwise.

This action is lazy: upon invocation of this method the calculation is booked but not executed. See TResultProxy documentation.

Definition at line 1446 of file TDFInterface.hxx.

◆ Take()

template<typename Proxied>
template<typename T , typename COLL = std::vector<T>>
TResultProxy<typename TDFDetail::ColType_t<T, COLL> > ROOT::Experimental::TDF::TInterface< Proxied >::Take ( std::string_view  column = "")
inline

Return a collection of values of a column (lazy action, returns a std::vector by default)

Template Parameters
TThe type of the column.
COLLThe type of collection used to store the values.
Parameters
[in]columnThe name of the column to collect the values of.

If the type of the column is TArrayBranch<T>, i.e. in the ROOT dataset this is a C-style array, the type stored in the return container is a std::vector<T> to guarantee the lifetime of the data involved. This action is lazy: upon invocation of this method the calculation is booked but not executed. See TResultProxy documentation.

Definition at line 924 of file TDFInterface.hxx.

Friends And Related Function Documentation

◆ TInterface

template<typename Proxied>
template<typename T >
friend class TInterface
friend

Definition at line 341 of file TDFInterface.hxx.

◆ cling::printValue

template<typename Proxied>
std::string cling::printValue ( ::ROOT::Experimental::TDataFrame tdf)
friend

Member Data Documentation

◆ fDataSource

template<typename Proxied>
TDataSource* const ROOT::Experimental::TDF::TInterface< Proxied >::fDataSource = nullptr
private

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

Definition at line 347 of file TDFInterface.hxx.

◆ fImplWeakPtr

template<typename Proxied>
const std::weak_ptr<TLoopManager> ROOT::Experimental::TDF::TInterface< Proxied >::fImplWeakPtr
private

Weak pointer to the TLoopManager at the root of the graph.

Definition at line 344 of file TDFInterface.hxx.

◆ fProxiedPtr

template<typename Proxied>
const std::shared_ptr<Proxied> ROOT::Experimental::TDF::TInterface< Proxied >::fProxiedPtr
private

Smart pointer to the graph node encapsulated by this TInterface.

Definition at line 343 of file TDFInterface.hxx.

◆ fValidCustomColumns

template<typename Proxied>
ColumnNames_t ROOT::Experimental::TDF::TInterface< Proxied >::fValidCustomColumns
private

Names of columns Defined for this branch of the functional graph.

Definition at line 345 of file TDFInterface.hxx.

Libraries for ROOT::Experimental::TDF::TInterface< Proxied >:
[legend]

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