Logo ROOT   6.10/09
Reference Guide
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | 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 93 of file TDFInterface.hxx.

Public Member Functions

TResultProxy< unsigned int > Count ()
 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< TCustomColumnBaseDefine (std::string_view name, F expression, const ColumnNames_t &bl={})
 Creates a temporary branch. More...
 
TInterface< TCustomColumnBaseDefine (std::string_view name, std::string_view expression)
 Creates a temporary branch. More...
 
template<typename FirstBranch , typename... OtherBranches, typename T >
TResultProxy< T > Fill (T &&model, const ColumnNames_t &bl)
 Fill and return any entity with a Fill method (lazy action) More...
 
template<typename T >
TResultProxy< T > Fill (T &&model, const ColumnNames_t &bl)
 
template<typename F , typename std::enable_if<!std::is_convertible< F, std::string >::value, int >::type = 0>
TInterface< TFilterBaseFilter (F f, const ColumnNames_t &bn={}, 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< TFilterBaseFilter (F f, std::string_view name)
 Append a filter to the call graph. More...
 
template<typename F >
TInterface< TFilterBaseFilter (F f, const std::initializer_list< std::string > &bn)
 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 &bl={})
 Execute a user-defined function on each entry (instant action) More...
 
template<typename F >
void ForeachSlot (F f, const ColumnNames_t &bl={})
 Execute a user-defined function requiring a processing slot index on each entry (instant action) More...
 
template<typename V = TDFDetail::TInferType>
TResultProxy<::TH1FHisto1D (::TH1F &&model=::TH1F{"", "", 128u, 0., 0.}, std::string_view vName="")
 Fill and return a one-dimensional histogram with the values of a branch (lazy action) More...
 
template<typename V = TDFDetail::TInferType>
TResultProxy<::TH1FHisto1D (std::string_view vName)
 
template<typename V = TDFDetail::TInferType, typename W = TDFDetail::TInferType>
TResultProxy<::TH1FHisto1D (::TH1F &&model, std::string_view vName, std::string_view wName)
 Fill and return a one-dimensional histogram with the values of a branch (lazy action) More...
 
template<typename V = TDFDetail::TInferType, typename W = TDFDetail::TInferType>
TResultProxy<::TH1FHisto1D (std::string_view vName, std::string_view wName)
 
template<typename V , typename W >
TResultProxy<::TH1FHisto1D (::TH1F &&model=::TH1F{"", "", 128u, 0., 0.})
 
template<typename V1 = TDFDetail::TInferType, typename V2 = TDFDetail::TInferType>
TResultProxy<::TH2FHisto2D (::TH2F &&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<::TH2FHisto2D (::TH2F &&model, std::string_view v1Name, std::string_view v2Name, std::string_view wName)
 Fill and return a two-dimensional histogram (lazy action) More...
 
template<typename V1 , typename V2 , typename W >
TResultProxy<::TH2FHisto2D (::TH2F &&model)
 
template<typename V1 = TDFDetail::TInferType, typename V2 = TDFDetail::TInferType, typename V3 = TDFDetail::TInferType>
TResultProxy<::TH3FHisto3D (::TH3F &&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<::TH3FHisto3D (::TH3F &&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<::TH3FHisto3D (::TH3F &&model)
 
template<typename T = TDFDetail::TInferType>
TResultProxy< double > Max (std::string_view branchName="")
 Return the maximum of processed branch values (lazy action) More...
 
template<typename T = TDFDetail::TInferType>
TResultProxy< double > Mean (std::string_view branchName="")
 Return the mean of processed branch values (lazy action) More...
 
template<typename T = TDFDetail::TInferType>
TResultProxy< double > Min (std::string_view branchName="")
 Return the minimum of processed branch values (lazy action) More...
 
template<typename V1 = TDFDetail::TInferType, typename V2 = TDFDetail::TInferType>
TResultProxy<::TProfileProfile1D (::TProfile &&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 (::TProfile &&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 (::TProfile &&model)
 
template<typename V1 = TDFDetail::TInferType, typename V2 = TDFDetail::TInferType, typename V3 = TDFDetail::TInferType>
TResultProxy<::TProfile2DProfile2D (::TProfile2D &&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 (::TProfile2D &&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 (::TProfile2D &&model)
 
TInterface< TRangeBaseRange (unsigned int start, unsigned int stop, unsigned int stride=1)
 Creates a node that filters entries based on range. More...
 
TInterface< TRangeBaseRange (unsigned int stop)
 Creates a node that filters entries based on range. More...
 
template<typename F , typename T = typename TDFInternal::TFunctionTraits<F>::Ret_t>
TResultProxy< T > Reduce (F f, std::string_view branchName={})
 Execute a user-defined reduce operation on the values of a branch. More...
 
template<typename F , typename T = typename TDFInternal::TFunctionTraits<F>::Ret_t>
TResultProxy< T > Reduce (F f, std::string_view branchName, const T &initValue)
 Execute a user-defined reduce operation on the values of a branch. 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 &bnames)
 Create a snapshot of the dataset on disk in the form of a TTree. More...
 
TInterface< TLoopManagerSnapshot (std::string_view treename, std::string_view filename, const ColumnNames_t &bnames)
 Create a snapshot of the dataset on disk in the form of a TTree. More...
 
TInterface< TLoopManagerSnapshot (std::string_view treename, std::string_view filename, std::string_view columnNameRegexp="")
 Create a snapshot of the dataset on disk in the form of a TTree. More...
 
template<typename T , typename COLL = std::vector<T>>
TResultProxy< COLL > Take (std::string_view branchName="")
 Return a collection of values of a branch (lazy action) More...
 

Protected Member Functions

 TInterface (const std::shared_ptr< Proxied > &proxied, const std::weak_ptr< TLoopManager > &impl)
 
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 ColumnNames_t GetDefaultBranchNames (unsigned int nExpectedBranches, std::string_view actionNameForErr)
 
template<typename... Args, int... S>
TInterface< TLoopManagerSnapshotImpl (std::string_view treename, std::string_view filename, const ColumnNames_t &bnames, TDFInternal::TStaticSeq< S... >)
 Implementation of snapshot. More...
 

Protected Attributes

std::weak_ptr< TLoopManagerfImplWeakPtr
 
std::shared_ptr< Proxied > fProxiedPtr
 

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

template<typename ActionType , typename... BranchTypes, typename ActionResultType , typename std::enable_if<!TDFInternal::TNeedJitting< BranchTypes... >::value, int >::type = 0>
TResultProxy< ActionResultType > CreateAction (const ColumnNames_t &bl, 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 &bl, const std::shared_ptr< ActionResultType > &r)
 
template<typename T1 , typename T2 = void, typename T3 = void, typename T4 = void>
ColumnNames_t GetBranchNames (const std::vector< std::string_view > &bl, std::string_view actionNameForErr)
 Returns the default branches if needed, takes care of the error handling. More...
 
const char * GetNodeTypeName ()
 
template<>
const char * GetNodeTypeName ()
 
template<>
const char * GetNodeTypeName ()
 
template<>
const char * GetNodeTypeName ()
 
template<>
const char * GetNodeTypeName ()
 

Friends

template<typename T >
class TInterface
 
std::string cling::printValue (ROOT::Experimental::TDataFrame *tdf)
 
template<typename TDFNode , typename ActionType , typename... BranchTypes, typename ActionResultType >
void TDFInternal::CallBuildAndBook (TDFNode *, const TDFDetail::ColumnNames_t &, unsigned int nSlots, const std::shared_ptr< ActionResultType > &)
 

#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 94 of file TDFInterface.hxx.

◆ TCustomColumnBase

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

Definition at line 97 of file TDFInterface.hxx.

◆ TFilterBase

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

Definition at line 95 of file TDFInterface.hxx.

◆ TLoopManager

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

Definition at line 98 of file TDFInterface.hxx.

◆ TRangeBase

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

Definition at line 96 of file TDFInterface.hxx.

Constructor & Destructor Documentation

◆ TInterface() [1/2]

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

Definition at line 1218 of file TDFInterface.hxx.

◆ TInterface() [2/2]

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 1225 of file TDFInterface.hxx.

Member Function Documentation

◆ Count()

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

Return the number of entries processed (lazy action)

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

Definition at line 491 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 bl,
const std::shared_ptr< ActionResultType > &  r 
)
inlineprivate

Definition at line 1016 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 bl,
const std::shared_ptr< ActionResultType > &  r 
)
inlineprivate

Definition at line 1028 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<TCustomColumnBase> ROOT::Experimental::TDF::TInterface< Proxied >::Define ( std::string_view  name,
F  expression,
const ColumnNames_t bl = {} 
)
inline

Creates a temporary branch.

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

Create a temporary branch 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
  • branch aliasing, i.e. changing the name of a branch

An exception is thrown if the name of the new branch is already in use for another branch in the TTree.

Definition at line 215 of file TDFInterface.hxx.

◆ Define() [2/2]

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

Creates a temporary branch.

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

The expression is just in time compiled and used to produce new values. The variable names to be used inside are the names of the branches. Only valid C++ is accepted. Refer to the first overload of this method for the full documentation.

Definition at line 240 of file TDFInterface.hxx.

◆ Fill() [1/2]

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

Fill and return any entity with a Fill method (lazy action)

Template Parameters
BranchTypesThe types of the branches the values of which are used to fill the object.
Parameters
[in]modelThe model to be considered to build the new return value.
[in]blThe name of the branches read to fill the object.

The returned object is independent of the input one. 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 object. It is compulsory to express the branches to be considered.

Definition at line 831 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

Definition at line 841 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<TFilterBase> ROOT::Experimental::TDF::TInterface< Proxied >::Filter ( F  f,
const ColumnNames_t bn = {},
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]bnNames of the 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 127 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<TFilterBase> 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 150 of file TDFInterface.hxx.

◆ Filter() [3/4]

template<typename Proxied>
template<typename F >
TInterface<TFilterBase> ROOT::Experimental::TDF::TInterface< Proxied >::Filter ( F  f,
const std::initializer_list< std::string > &  bn 
)
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]bnNames of the branches in input to the filter function.

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

Definition at line 165 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. The variable names to be used inside are the names of the branches. Only valid C++ is accepted. Refer to the first overload of this method for the full documentation.

Definition at line 179 of file TDFInterface.hxx.

◆ Foreach()

template<typename Proxied>
template<typename F >
void ROOT::Experimental::TDF::TInterface< Proxied >::Foreach ( F  f,
const ColumnNames_t bl = {} 
)
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]blNames of the 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 400 of file TDFInterface.hxx.

◆ ForeachSlot()

template<typename Proxied>
template<typename F >
void ROOT::Experimental::TDF::TInterface< Proxied >::ForeachSlot ( F  f,
const ColumnNames_t bl = {} 
)
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]blNames of the 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 424 of file TDFInterface.hxx.

◆ GetBranchNames()

template<typename Proxied>
template<typename T1 , typename T2 = void, typename T3 = void, typename T4 = void>
ColumnNames_t ROOT::Experimental::TDF::TInterface< Proxied >::GetBranchNames ( const std::vector< std::string_view > &  bl,
std::string_view  actionNameForErr 
)
inlineprivate

Returns the default branches if needed, takes care of the error handling.

Definition at line 922 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 1042 of file TDFInterface.hxx.

◆ GetDefaultBranchNames()

template<typename Proxied>
const ColumnNames_t ROOT::Experimental::TDF::TInterface< Proxied >::GetDefaultBranchNames ( unsigned int  nExpectedBranches,
std::string_view  actionNameForErr 
)
inlineprotected

Definition at line 1051 of file TDFInterface.hxx.

◆ GetNodeTypeName() [1/5]

template<typename Proxied>
const char* ROOT::Experimental::TDF::TInterface< Proxied >::GetNodeTypeName ( )
inlineprivate

Definition at line 918 of file TDFInterface.hxx.

◆ GetNodeTypeName() [2/5]

template<>
const char * ROOT::Experimental::TDF::TInterface< TDFDetail::TFilterBase >::GetNodeTypeName ( )
inlineprivate

Definition at line 1234 of file TDFInterface.hxx.

◆ GetNodeTypeName() [3/5]

template<>
const char * ROOT::Experimental::TDF::TInterface< TDFDetail::TCustomColumnBase >::GetNodeTypeName ( )
inlineprivate

Definition at line 1240 of file TDFInterface.hxx.

◆ GetNodeTypeName() [4/5]

template<>
const char * ROOT::Experimental::TDF::TInterface< TDFDetail::TLoopManager >::GetNodeTypeName ( )
inlineprivate

Definition at line 1246 of file TDFInterface.hxx.

◆ GetNodeTypeName() [5/5]

template<>
const char * ROOT::Experimental::TDF::TInterface< TDFDetail::TRangeBase >::GetNodeTypeName ( )
inlineprivate

Definition at line 1252 of file TDFInterface.hxx.

◆ Histo1D() [1/5]

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

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

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

The default branches, if available, will be used instead of branches whose names are left empty. Branches 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 branches 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 540 of file TDFInterface.hxx.

◆ Histo1D() [2/5]

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

Definition at line 550 of file TDFInterface.hxx.

◆ Histo1D() [3/5]

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

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

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

The default branches, if available, will be used instead of branches whose names are left empty. Branches 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 branches 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 571 of file TDFInterface.hxx.

◆ Histo1D() [4/5]

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

Definition at line 579 of file TDFInterface.hxx.

◆ Histo1D() [5/5]

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

Definition at line 585 of file TDFInterface.hxx.

◆ Histo2D() [1/3]

template<typename Proxied>
template<typename V1 = TDFDetail::TInferType, typename V2 = TDFDetail::TInferType>
TResultProxy<::TH2F> ROOT::Experimental::TDF::TInterface< Proxied >::Histo2D ( ::TH2F &&  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 branch used to fill the x axis of the histogram.
V2The type of the branch 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 branch that will fill the x axis.
[in]v2NameThe name of the branch 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 histogram.

Definition at line 602 of file TDFInterface.hxx.

◆ Histo2D() [2/3]

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

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

Template Parameters
V1The type of the branch used to fill the x axis of the histogram.
V2The type of the branch used to fill the y axis of the histogram.
WThe type of the branch 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 branch that will fill the x axis.
[in]v2NameThe name of the branch that will fill the y axis.
[in]wNameThe name of the branch 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 627 of file TDFInterface.hxx.

◆ Histo2D() [3/3]

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

Definition at line 639 of file TDFInterface.hxx.

◆ Histo3D() [1/3]

template<typename Proxied>
template<typename V1 = TDFDetail::TInferType, typename V2 = TDFDetail::TInferType, typename V3 = TDFDetail::TInferType>
TResultProxy<::TH3F> ROOT::Experimental::TDF::TInterface< Proxied >::Histo3D ( ::TH3F &&  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 branch used to fill the x axis of the histogram.
V2The type of the branch used to fill the y axis of the histogram.
V3The type of the branch used to fill the z axis of the histogram.
Parameters
[in]modelThe returned histogram will be constructed using this as a model.
[in]v1NameThe name of the branch that will fill the x axis.
[in]v2NameThe name of the branch that will fill the y axis.
[in]v3NameThe name of the branch 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 659 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<::TH3F> ROOT::Experimental::TDF::TInterface< Proxied >::Histo3D ( ::TH3F &&  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 branch used to fill the x axis of the histogram.
V2The type of the branch used to fill the y axis of the histogram.
V3The type of the branch used to fill the z axis of the histogram.
WThe type of the branch 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 branch that will fill the x axis.
[in]v2NameThe name of the branch that will fill the y axis.
[in]v3NameThe name of the branch that will fill the z axis.
[in]wNameThe name of the branch 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 687 of file TDFInterface.hxx.

◆ Histo3D() [3/3]

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

Definition at line 699 of file TDFInterface.hxx.

◆ Max()

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

Return the maximum of processed branch values (lazy action)

Template Parameters
TThe type of the branch.
Parameters
[in]branchNameThe name of the branch to be treated.

If no branch type is specified, the implementation will try to guess one.

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

Definition at line 877 of file TDFInterface.hxx.

◆ Mean()

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

Return the mean of processed branch values (lazy action)

Template Parameters
TThe type of the branch.
Parameters
[in]branchNameThe name of the branch to be treated.

If no branch type is specified, the implementation will try to guess one.

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

Definition at line 894 of file TDFInterface.hxx.

◆ Min()

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

Return the minimum of processed branch values (lazy action)

Template Parameters
TThe type of the branch.
Parameters
[in]branchNameThe name of the branch to be treated.

If no branch type is specified, the implementation will try to guess one.

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

Definition at line 860 of file TDFInterface.hxx.

◆ Profile1D() [1/3]

template<typename Proxied>
template<typename V1 = TDFDetail::TInferType, typename V2 = TDFDetail::TInferType>
TResultProxy<::TProfile> ROOT::Experimental::TDF::TInterface< Proxied >::Profile1D ( ::TProfile &&  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 branch the values of which are used to fill the profile.
V2The type of the branch the values of which are used to fill the profile.
Parameters
[in]modelThe model to be considered to build the new return value.
[in]v1NameThe name of the branch that will fill the x axis.
[in]v2NameThe name of the branch 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 716 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 ( ::TProfile &&  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 branch the values of which are used to fill the profile.
V2The type of the branch the values of which are used to fill the profile.
WThe type of the branch the weights of which are used to fill the profile.
Parameters
[in]modelThe model to be considered to build the new return value.
[in]v1NameThe name of the branch that will fill the x axis.
[in]v2NameThe name of the branch that will fill the y axis.
[in]wNameThe name of the branch 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 742 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 ( ::TProfile &&  model)
inline

Definition at line 754 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 ( ::TProfile2D &&  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 branch used to fill the x axis of the histogram.
V2The type of the branch used to fill the y axis of the histogram.
V2The type of the branch used to fill the z axis of the histogram.
Parameters
[in]modelThe returned profile will be constructed using this as a model.
[in]v1NameThe name of the branch that will fill the x axis.
[in]v2NameThe name of the branch that will fill the y axis.
[in]v3NameThe name of the branch 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 774 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 ( ::TProfile2D &&  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 branch used to fill the x axis of the histogram.
V2The type of the branch used to fill the y axis of the histogram.
V3The type of the branch used to fill the z axis of the histogram.
WThe type of the branch 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 branch that will fill the x axis.
[in]v2NameThe name of the branch that will fill the y axis.
[in]v3NameThe name of the branch that will fill the z axis.
[in]wNameThe name of the branch 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 802 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 ( ::TProfile2D &&  model)
inline

Definition at line 814 of file TDFInterface.hxx.

◆ Range() [1/2]

template<typename Proxied>
TInterface<TRangeBase> 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 364 of file TDFInterface.hxx.

◆ Range() [2/2]

template<typename Proxied>
TInterface<TRangeBase> 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 386 of file TDFInterface.hxx.

◆ Reduce() [1/2]

template<typename Proxied>
template<typename F , typename T = typename TDFInternal::TFunctionTraits<F>::Ret_t>
TResultProxy<T> ROOT::Experimental::TDF::TInterface< Proxied >::Reduce ( F  f,
std::string_view  branchName = {} 
)
inline

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

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

A reduction takes two values of a branch and merges them into one (e.g. by summing them, taking the maximum, etc). This action performs the specified reduction operation on all branch 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 branch.

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

Definition at line 454 of file TDFInterface.hxx.

◆ Reduce() [2/2]

template<typename Proxied>
template<typename F , typename T = typename TDFInternal::TFunctionTraits<F>::Ret_t>
TResultProxy<T> ROOT::Experimental::TDF::TInterface< Proxied >::Reduce ( F  f,
std::string_view  branchName,
const T &  initValue 
)
inline

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

Template Parameters
FThe type of the reduce callable. Automatically deduced.
TThe type of the branch to apply the reduction to. Automatically deduced.
Parameters
[in]fA callable with signature T(T,T)
[in]branchNameThe branch to be reduced. If omitted, the default branch is used instead.
[in]initValueThe reduced object is initialised to this value rather than being default-constructed

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

Definition at line 471 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 910 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 bnames 
)
inline

Create a snapshot of the dataset on disk in the form of a TTree.

Template Parameters
BranchTypesvariadic list of branch/column types
Parameters
[in]treenameThe name of the output TTree
[in]filenameThe name of the output TFile
[in]bnamesThe list of names of the branches to be written

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

Definition at line 264 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 bnames 
)
inline

Create a snapshot of the dataset on disk in the form of a TTree.

Parameters
[in]treenameThe name of the output TTree
[in]filenameThe name of the output TFile
[in]bnamesThe list of names of the branches to be written

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

Definition at line 279 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 = "" 
)
inline

Create a snapshot of the dataset on disk in the form of a TTree.

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.

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

Definition at line 317 of file TDFInterface.hxx.

◆ SnapshotImpl()

template<typename Proxied>
template<typename... Args, int... S>
TInterface<TLoopManager> ROOT::Experimental::TDF::TInterface< Proxied >::SnapshotImpl ( std::string_view  treename,
std::string_view  filename,
const ColumnNames_t bnames,
TDFInternal::TStaticSeq< S... >   
)
inlineprotected

Implementation of snapshot.

Parameters
[in]treenameThe name of the TTree
[in]filenameThe name of the TFile
[in]bnamesThe 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 1082 of file TDFInterface.hxx.

◆ Take()

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

Return a collection of values of a branch (lazy action)

Template Parameters
TThe type of the branch.
COLLThe type of collection used to store the values.
Parameters
[in]branchNameThe name of the branch of which the values are to be collected

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

Definition at line 512 of file TDFInterface.hxx.

Friends And Related Function Documentation

◆ TInterface

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

Definition at line 101 of file TDFInterface.hxx.

◆ cling::printValue

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

◆ TDFInternal::CallBuildAndBook

template<typename Proxied>
template<typename TDFNode , typename ActionType , typename... BranchTypes, typename ActionResultType >
void TDFInternal::CallBuildAndBook ( TDFNode *  ,
const TDFDetail::ColumnNames_t &  ,
unsigned int  nSlots,
const std::shared_ptr< ActionResultType > &   
)
friend

Member Data Documentation

◆ fImplWeakPtr

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

Definition at line 1230 of file TDFInterface.hxx.

◆ fProxiedPtr

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

Definition at line 1229 of file TDFInterface.hxx.


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