The public interface to the RDataFrame federation of classes.
Proxied | One of the "node" base types (e.g. RLoopManager, RFilterBase). The user never specifies this type manually. |
DataSource | The type of the RDataSource which is providing the data to the data frame. There is no source by default. |
The documentation of each method features a one liner illustrating how to use the method, for example showing how the majority of the template parameters are automatically deduced requiring no or very little effort by the user.
Definition at line 104 of file RInterface.hxx.
Public Member Functions | |
RInterface (const RInterface &)=default | |
Copy-ctor for RInterface. | |
template<typename T = Proxied, typename = std::enable_if_t<std::is_same<T, RLoopManager>::value, int>> | |
RInterface (const std::shared_ptr< RLoopManager > &proxied) | |
Build a RInterface from a RLoopManager. | |
RInterface (RInterface &&)=default | |
Move-ctor for RInterface. | |
template<typename AccFun , typename MergeFun , typename R = typename TTraits::CallableTraits<AccFun>::ret_type, typename ArgTypes = typename TTraits::CallableTraits<AccFun>::arg_types, typename ArgTypesNoDecay = typename TTraits::CallableTraits<AccFun>::arg_types_nodecay, typename U = TTraits::TakeFirstParameter_t<ArgTypes>, typename T = TTraits::TakeFirstParameter_t<TTraits::RemoveFirstParameter_t<ArgTypes>>> | |
RResultPtr< U > | Aggregate (AccFun aggregator, MergeFun merger, std::string_view columnName, const U &aggIdentity) |
Execute a user-defined accumulation operation on the processed column values in each processing slot. | |
template<typename AccFun , typename MergeFun , typename R = typename TTraits::CallableTraits<AccFun>::ret_type, typename ArgTypes = typename TTraits::CallableTraits<AccFun>::arg_types, typename U = TTraits::TakeFirstParameter_t<ArgTypes>, typename T = TTraits::TakeFirstParameter_t<TTraits::RemoveFirstParameter_t<ArgTypes>>> | |
RResultPtr< U > | Aggregate (AccFun aggregator, MergeFun merger, std::string_view columnName="") |
Execute a user-defined accumulation operation on the processed column values in each processing slot. | |
RInterface< Proxied, DS_t > | Alias (std::string_view alias, std::string_view columnName) |
Allow to refer to a column with a different name. | |
template<typename FirstColumn = RDFDetail::RInferredType, typename... OtherColumns, typename Helper > | |
RResultPtr< typename std::decay_t< Helper >::Result_t > | Book (Helper &&helper, const ColumnNames_t &columns={}) |
Book execution of a custom action using a user-defined helper object. | |
template<typename... ColumnTypes> | |
RInterface< RLoopManager > | Cache (const ColumnNames_t &columnList) |
Save selected columns in memory. | |
RInterface< RLoopManager > | Cache (const ColumnNames_t &columnList) |
Save selected columns in memory. | |
RInterface< RLoopManager > | Cache (std::initializer_list< std::string > columnList) |
Save selected columns in memory. | |
RInterface< RLoopManager > | Cache (std::string_view columnNameRegexp="") |
Save selected columns in memory. | |
RResultPtr< ULong64_t > | Count () |
Return the number of entries processed (lazy action). | |
template<typename F , typename std::enable_if_t<!std::is_convertible< F, std::string >::value, int > = 0> | |
RInterface< Proxied, DS_t > | Define (std::string_view name, F expression, const ColumnNames_t &columns={}) |
Define a new column. | |
RInterface< Proxied, DS_t > | Define (std::string_view name, std::string_view expression) |
Define a new column. | |
template<typename F , typename RetType_t = typename TTraits::CallableTraits<F>::ret_type> | |
RInterface< Proxied, DS_t > | DefinePerSample (std::string_view name, F expression) |
Define a new column that is updated when the input sample changes. | |
RInterface< Proxied, DS_t > | DefinePerSample (std::string_view name, std::string_view expression) |
Define a new column that is updated when the input sample changes. | |
template<typename F > | |
RInterface< Proxied, DS_t > | DefineSlot (std::string_view name, F expression, const ColumnNames_t &columns={}) |
Define a new column with a value dependent on the processing slot. | |
template<typename F > | |
RInterface< Proxied, DS_t > | DefineSlotEntry (std::string_view name, F expression, const ColumnNames_t &columns={}) |
Define a new column with a value dependent on the processing slot and the current entry. | |
RDFDescription | Describe () |
Return information about the dataframe. | |
template<typename... ColumnTypes> | |
RResultPtr< RDisplay > | Display (const ColumnNames_t &columnList, size_t nRows=5, size_t nMaxCollectionElements=10) |
Provides a representation of the columns in the dataset. | |
RResultPtr< RDisplay > | Display (const ColumnNames_t &columnList, size_t nRows=5, size_t nMaxCollectionElements=10) |
Provides a representation of the columns in the dataset. | |
RResultPtr< RDisplay > | Display (std::initializer_list< std::string > columnList, size_t nRows=5, size_t nMaxCollectionElements=10) |
Provides a representation of the columns in the dataset. | |
RResultPtr< RDisplay > | Display (std::string_view columnNameRegexp="", size_t nRows=5, size_t nMaxCollectionElements=10) |
Provides a representation of the columns in the dataset. | |
template<typename FirstColumn = RDFDetail::RInferredType, typename... OtherColumns, typename T > | |
RResultPtr< std::decay_t< 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). | |
template<typename F , std::enable_if_t<!std::is_convertible< F, std::string >::value, int > = 0> | |
RInterface< RDFDetail::RFilter< F, Proxied >, DS_t > | Filter (F f, const ColumnNames_t &columns={}, std::string_view name="") |
Append a filter to the call graph. | |
template<typename F > | |
RInterface< RDFDetail::RFilter< F, Proxied >, DS_t > | Filter (F f, const std::initializer_list< std::string > &columns) |
Append a filter to the call graph. | |
template<typename F , std::enable_if_t<!std::is_convertible< F, std::string >::value, int > = 0> | |
RInterface< RDFDetail::RFilter< F, Proxied >, DS_t > | Filter (F f, std::string_view name) |
Append a filter to the call graph. | |
RInterface< RDFDetail::RJittedFilter, DS_t > | Filter (std::string_view expression, std::string_view name="") |
Append a filter to the call graph. | |
template<typename F > | |
void | Foreach (F f, const ColumnNames_t &columns={}) |
Execute a user-defined function on each entry (instant action). | |
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). | |
ColumnNames_t | GetColumnNames () |
Returns the names of the available columns. | |
std::string | GetColumnType (std::string_view column) |
Return the type of a given column as a string. | |
ColumnNames_t | GetDefinedColumnNames () |
Returns the names of the defined columns. | |
std::vector< std::string > | GetFilterNames () |
Returns the names of the filters created. | |
unsigned int | GetNRuns () const |
Gets the number of event loops run. | |
unsigned int | GetNSlots () const |
Gets the number of data processing slots. | |
RVariationsDescription | GetVariations () |
Return a descriptor for the systematic variations registered in this branch of the computation graph. | |
template<typename V1 = RDFDetail::RInferredType, typename V2 = RDFDetail::RInferredType> | |
RResultPtr<::TGraph > | Graph (std::string_view v1Name="", std::string_view v2Name="") |
Fill and return a graph (lazy action). | |
bool | HasColumn (std::string_view columnName) |
Checks if a column is present in the dataset. | |
template<typename V = RDFDetail::RInferredType, typename W = RDFDetail::RInferredType> | |
RResultPtr<::TH1D > | Histo1D (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). | |
template<typename V , typename W > | |
RResultPtr<::TH1D > | Histo1D (const TH1DModel &model={"", "", 128u, 0., 0.}) |
Fill and return a one-dimensional histogram with the weighted values of a column (lazy action). | |
template<typename V = RDFDetail::RInferredType> | |
RResultPtr<::TH1D > | Histo1D (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). | |
template<typename V = RDFDetail::RInferredType> | |
RResultPtr<::TH1D > | Histo1D (std::string_view vName) |
Fill and return a one-dimensional histogram with the values of a column (lazy action). | |
template<typename V = RDFDetail::RInferredType, typename W = RDFDetail::RInferredType> | |
RResultPtr<::TH1D > | Histo1D (std::string_view vName, std::string_view wName) |
Fill and return a one-dimensional histogram with the weighted values of a column (lazy action). | |
template<typename V1 , typename V2 , typename W > | |
RResultPtr<::TH2D > | Histo2D (const TH2DModel &model) |
template<typename V1 = RDFDetail::RInferredType, typename V2 = RDFDetail::RInferredType, typename W = RDFDetail::RInferredType> | |
RResultPtr<::TH2D > | Histo2D (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). | |
template<typename V1 = RDFDetail::RInferredType, typename V2 = RDFDetail::RInferredType> | |
RResultPtr<::TH2D > | Histo2D (const TH2DModel &model, std::string_view v1Name="", std::string_view v2Name="") |
Fill and return a two-dimensional histogram (lazy action). | |
template<typename V1 , typename V2 , typename V3 , typename W > | |
RResultPtr<::TH3D > | Histo3D (const TH3DModel &model) |
template<typename V1 = RDFDetail::RInferredType, typename V2 = RDFDetail::RInferredType, typename V3 = RDFDetail::RInferredType, typename W = RDFDetail::RInferredType> | |
RResultPtr<::TH3D > | Histo3D (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). | |
template<typename V1 = RDFDetail::RInferredType, typename V2 = RDFDetail::RInferredType, typename V3 = RDFDetail::RInferredType> | |
RResultPtr<::TH3D > | Histo3D (const TH3DModel &model, std::string_view v1Name="", std::string_view v2Name="", std::string_view v3Name="") |
Fill and return a three-dimensional histogram (lazy action). | |
template<typename FirstColumn , typename... OtherColumns> | |
RResultPtr<::THnD > | HistoND (const THnDModel &model, const ColumnNames_t &columnList) |
Fill and return an N-dimensional histogram (lazy action). | |
RResultPtr<::THnD > | HistoND (const THnDModel &model, const ColumnNames_t &columnList) |
Fill and return an N-dimensional histogram (lazy action). | |
template<typename T = RDFDetail::RInferredType> | |
RResultPtr< RDFDetail::MaxReturnType_t< T > > | Max (std::string_view columnName="") |
Return the maximum of processed column values (lazy action). | |
template<typename T = RDFDetail::RInferredType> | |
RResultPtr< double > | Mean (std::string_view columnName="") |
Return the mean of processed column values (lazy action). | |
template<typename T = RDFDetail::RInferredType> | |
RResultPtr< RDFDetail::MinReturnType_t< T > > | Min (std::string_view columnName="") |
Return the minimum of processed column values (lazy action). | |
operator RNode () const | |
Cast any RDataFrame node to a common type ROOT::RDF::RNode. | |
RInterface & | operator= (const RInterface &)=default |
Copy-assignment operator for RInterface. | |
RInterface & | operator= (RInterface &&)=default |
Move-assignment operator for RInterface. | |
template<typename V1 , typename V2 , typename W > | |
RResultPtr<::TProfile > | Profile1D (const TProfile1DModel &model) |
Fill and return a one-dimensional profile (lazy action). | |
template<typename V1 = RDFDetail::RInferredType, typename V2 = RDFDetail::RInferredType, typename W = RDFDetail::RInferredType> | |
RResultPtr<::TProfile > | Profile1D (const TProfile1DModel &model, std::string_view v1Name, std::string_view v2Name, std::string_view wName) |
Fill and return a one-dimensional profile (lazy action). | |
template<typename V1 = RDFDetail::RInferredType, typename V2 = RDFDetail::RInferredType> | |
RResultPtr<::TProfile > | Profile1D (const TProfile1DModel &model, std::string_view v1Name="", std::string_view v2Name="") |
Fill and return a one-dimensional profile (lazy action). | |
template<typename V1 , typename V2 , typename V3 , typename W > | |
RResultPtr<::TProfile2D > | Profile2D (const TProfile2DModel &model) |
Fill and return a two-dimensional profile (lazy action). | |
template<typename V1 = RDFDetail::RInferredType, typename V2 = RDFDetail::RInferredType, typename V3 = RDFDetail::RInferredType, typename W = RDFDetail::RInferredType> | |
RResultPtr<::TProfile2D > | Profile2D (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). | |
template<typename V1 = RDFDetail::RInferredType, typename V2 = RDFDetail::RInferredType, typename V3 = RDFDetail::RInferredType> | |
RResultPtr<::TProfile2D > | Profile2D (const TProfile2DModel &model, std::string_view v1Name="", std::string_view v2Name="", std::string_view v3Name="") |
Fill and return a two-dimensional profile (lazy action). | |
RInterface< RDFDetail::RRange< Proxied >, DS_t > | Range (unsigned int begin, unsigned int end, unsigned int stride=1) |
Creates a node that filters entries based on range: [begin, end). | |
RInterface< RDFDetail::RRange< Proxied >, DS_t > | Range (unsigned int end) |
Creates a node that filters entries based on range. | |
template<typename F , std::enable_if_t<!std::is_convertible< F, std::string >::value, int > = 0> | |
RInterface< Proxied, DS_t > | Redefine (std::string_view name, F expression, const ColumnNames_t &columns={}) |
Overwrite the value and/or type of an existing column. | |
RInterface< Proxied, DS_t > | Redefine (std::string_view name, std::string_view expression) |
Overwrite the value and/or type of an existing column. | |
template<typename F > | |
RInterface< Proxied, DS_t > | RedefineSlot (std::string_view name, F expression, const ColumnNames_t &columns={}) |
Overwrite the value and/or type of an existing column. | |
template<typename F > | |
RInterface< Proxied, DS_t > | RedefineSlotEntry (std::string_view name, F expression, const ColumnNames_t &columns={}) |
Overwrite the value and/or type of an existing column. | |
template<typename F , typename T = typename TTraits::CallableTraits<F>::ret_type> | |
RResultPtr< T > | Reduce (F f, std::string_view columnName, const T &redIdentity) |
Execute a user-defined reduce operation on the values of a column. | |
template<typename F , typename T = typename TTraits::CallableTraits<F>::ret_type> | |
RResultPtr< T > | Reduce (F f, std::string_view columnName="") |
Execute a user-defined reduce operation on the values of a column. | |
RResultPtr< RCutFlowReport > | Report () |
Gather filtering statistics. | |
template<typename... ColumnTypes> | |
RResultPtr< RInterface< RLoopManager > > | Snapshot (std::string_view treename, std::string_view filename, const ColumnNames_t &columnList, const RSnapshotOptions &options=RSnapshotOptions()) |
Save selected columns to disk, in a new TTree treename in file filename . | |
RResultPtr< RInterface< RLoopManager > > | Snapshot (std::string_view treename, std::string_view filename, const ColumnNames_t &columnList, const RSnapshotOptions &options=RSnapshotOptions()) |
Save selected columns to disk, in a new TTree treename in file filename . | |
RResultPtr< RInterface< RLoopManager > > | Snapshot (std::string_view treename, std::string_view filename, std::initializer_list< std::string > columnList, const RSnapshotOptions &options=RSnapshotOptions()) |
Save selected columns to disk, in a new TTree treename in file filename . | |
RResultPtr< RInterface< RLoopManager > > | Snapshot (std::string_view treename, std::string_view filename, std::string_view columnNameRegexp="", const RSnapshotOptions &options=RSnapshotOptions()) |
Save selected columns to disk, in a new TTree treename in file filename . | |
template<typename V = RDFDetail::RInferredType, typename W = RDFDetail::RInferredType> | |
RResultPtr< TStatistic > | Stats (std::string_view value, std::string_view weight) |
Return a TStatistic object, filled once per event (lazy action). | |
template<typename V = RDFDetail::RInferredType> | |
RResultPtr< TStatistic > | Stats (std::string_view value="") |
Return a TStatistic object, filled once per event (lazy action). | |
template<typename T = RDFDetail::RInferredType> | |
RResultPtr< double > | StdDev (std::string_view columnName="") |
Return the unbiased standard deviation of processed column values (lazy action). | |
template<typename T = RDFDetail::RInferredType> | |
RResultPtr< RDFDetail::SumReturnType_t< T > > | Sum (std::string_view columnName="", const RDFDetail::SumReturnType_t< T > &initValue=RDFDetail::SumReturnType_t< T >{}) |
Return the sum of processed column values (lazy action). | |
template<typename T , typename COLL = std::vector<T>> | |
RResultPtr< COLL > | Take (std::string_view column="") |
Return a collection of values of a column (lazy action, returns a std::vector by default). | |
template<typename F > | |
RInterface< Proxied, DS_t > | Vary (const std::vector< std::string > &colNames, F &&expression, const ColumnNames_t &inputColumns, const std::vector< std::string > &variationTags, std::string_view variationName) |
Register a systematic variation that affects multiple columns simultaneously. | |
template<typename F > | |
RInterface< Proxied, DS_t > | Vary (const std::vector< std::string > &colNames, F &&expression, const ColumnNames_t &inputColumns, std::size_t nVariations, std::string_view variationName) |
Register systematic variations for one or more existing columns using auto-generated tags. | |
RInterface< Proxied, DS_t > | Vary (const std::vector< std::string > &colNames, std::string_view expression, const std::vector< std::string > &variationTags, std::string_view variationName) |
Register systematic variations for one or more existing columns. | |
RInterface< Proxied, DS_t > | Vary (const std::vector< std::string > &colNames, std::string_view expression, std::size_t nVariations, std::string_view variationName) |
Register systematic variations for one or more existing columns. | |
template<typename F > | |
RInterface< Proxied, DS_t > | Vary (std::string_view colName, F &&expression, const ColumnNames_t &inputColumns, const std::vector< std::string > &variationTags, std::string_view variationName="") |
Register systematic variations for an existing columns using auto-generated variation tags. | |
template<typename F > | |
RInterface< Proxied, DS_t > | Vary (std::string_view colName, F &&expression, const ColumnNames_t &inputColumns, std::size_t nVariations, std::string_view variationName="") |
Register systematic variations for an existing column. | |
RInterface< Proxied, DS_t > | Vary (std::string_view colName, std::string_view expression, const std::vector< std::string > &variationTags, std::string_view variationName="") |
Register systematic variations for an existing column. | |
RInterface< Proxied, DS_t > | Vary (std::string_view colName, std::string_view expression, std::size_t nVariations, std::string_view variationName="") |
Register systematic variations for an existing column. | |
Protected Member Functions | |
RInterface (const std::shared_ptr< Proxied > &proxied, RLoopManager &lm, const RDFInternal::RColumnRegister &columns, RDataSource *ds) | |
template<typename... ColumnTypes> | |
void | CheckAndFillDSColumns (ColumnNames_t validCols, TTraits::TypeList< ColumnTypes... > typeList) |
RLoopManager * | GetLoopManager () const |
const std::shared_ptr< Proxied > & | GetProxiedPtr () const |
ColumnNames_t | GetValidatedColumnNames (const unsigned int nColumns, const ColumnNames_t &columns) |
Private Types | |
using | DS_t = DataSource |
using | RFilterBase = RDFDetail::RFilterBase |
using | RLoopManager = RDFDetail::RLoopManager |
using | RRangeBase = RDFDetail::RRangeBase |
Private Member Functions | |
void | AddDefaultColumns () |
template<typename... ColTypes, std::size_t... S> | |
RInterface< RLoopManager > | CacheImpl (const ColumnNames_t &columnList, std::index_sequence< S... >) |
Implementation of cache. | |
template<typename Helper , typename ActionResultType , typename... Others> | |
RResultPtr< ActionResultType > | CallCreateActionWithoutColsIfPossible (const std::shared_ptr< ActionResultType > &, const std::shared_ptr< Helper > &, Others...) |
template<typename Helper , typename ActionResultType > | |
auto | CallCreateActionWithoutColsIfPossible (const std::shared_ptr< ActionResultType > &resPtr, const std::shared_ptr< Helper > &hPtr, TTraits::TypeList< RDFDetail::RInferredType >) -> decltype(hPtr->Exec(0u), RResultPtr< ActionResultType >{}) |
void | CheckIMTDisabled (std::string_view callerName) |
template<typename ActionTag , typename... ColTypes, typename ActionResultType , typename HelperArgType = ActionResultType, std::enable_if_t< RDFInternal::RNeedJitting< ColTypes... >::value, int > = 0> | |
RResultPtr< ActionResultType > | CreateAction (const ColumnNames_t &columns, const std::shared_ptr< ActionResultType > &r, const std::shared_ptr< HelperArgType > &helperArg, const int nColumns=-1) |
Create RAction object, return RResultPtr for the action Overload for the case in which one or more column types were not specified (RTTI + jitting). | |
template<typename ActionTag , typename... ColTypes, typename ActionResultType , typename HelperArgType = ActionResultType, std::enable_if_t<!RDFInternal::RNeedJitting< ColTypes... >::value, int > = 0> | |
RResultPtr< ActionResultType > | CreateAction (const ColumnNames_t &columns, const std::shared_ptr< ActionResultType > &r, const std::shared_ptr< HelperArgType > &helperArg, const int=-1) |
Create RAction object, return RResultPtr for the action Overload for the case in which all column types were specified (no jitting). | |
template<typename F , typename DefineType , typename RetType = typename TTraits::CallableTraits<F>::ret_type> | |
std::enable_if_t< std::is_default_constructible< RetType >::value, RInterface< Proxied, DS_t > > | DefineImpl (std::string_view name, F &&expression, const ColumnNames_t &columns, const std::string &where) |
template<typename F , typename DefineType , typename RetType = typename TTraits::CallableTraits<F>::ret_type, bool IsFStringConv = std::is_convertible<F, std::string>::value, bool IsRetTypeDefConstr = std::is_default_constructible<RetType>::value> | |
std::enable_if_t<!IsFStringConv &&!IsRetTypeDefConstr, RInterface< Proxied, DS_t > > | DefineImpl (std::string_view, F, const ColumnNames_t &) |
std::string | DescribeDataset () const |
std::vector< std::string > | GetColumnTypeNamesList (const ColumnNames_t &columnList) |
template<typename... ColumnTypes> | |
RResultPtr< RInterface< RLoopManager > > | SnapshotImpl (std::string_view fullTreeName, std::string_view filename, const ColumnNames_t &columnList, const RSnapshotOptions &options) |
Private Attributes | |
RDFInternal::RColumnRegister | fColRegister |
Contains the columns defined up to this node. | |
RDataSource * | fDataSource = nullptr |
Non-owning pointer to a data-source object. Null if no data-source. RLoopManager has ownership of the object. | |
RLoopManager * | fLoopManager |
std::shared_ptr< Proxied > | fProxiedPtr |
Smart pointer to the graph node encapsulated by this RInterface. | |
Friends | |
template<typename T , typename W > | |
class | RInterface |
class | RDFInternal::GraphDrawing::GraphCreatorHelper |
void | RDFInternal::TriggerRun (RNode &node) |
#include <ROOT/RDF/RInterface.hxx>
|
private |
Definition at line 105 of file RInterface.hxx.
|
private |
Definition at line 106 of file RInterface.hxx.
|
private |
Definition at line 108 of file RInterface.hxx.
|
private |
Definition at line 107 of file RInterface.hxx.
|
default |
Copy-ctor for RInterface.
|
default |
Move-ctor for RInterface.
|
inline |
Build a RInterface from a RLoopManager.
This constructor is only available for RInterface<RLoopManager>.
Definition at line 226 of file RInterface.hxx.
|
inlineprotected |
Definition at line 3299 of file RInterface.hxx.
|
inlineprivate |
Definition at line 3064 of file RInterface.hxx.
|
inline |
Execute a user-defined accumulation operation on the processed column values in each processing slot.
F | The type of the aggregator callable. Automatically deduced. |
U | The type of the aggregator variable. Must be default-constructible, copy-constructible and copy-assignable. Automatically deduced. |
T | The type of the column to apply the reduction to. Automatically deduced. |
[in] | aggregator | A callable with signature U(U,T) or void(U&,T) , where T is the type of the column, U is the type of the aggregator variable |
[in] | merger | A callable with signature U(U,U) or void(std::vector<U>&) used to merge the results of the accumulations of each thread |
[in] | columnName | The column to be aggregated. If omitted, the first default column is used instead. |
[in] | aggIdentity | The aggregator variable of each thread is initialised to this value (or is default-constructed if the parameter is omitted) |
An aggregator callable takes two values, an aggregator variable and a column value. The aggregator variable is initialized to aggIdentity or default-constructed if aggIdentity is omitted. This action calls the aggregator callable for each processed entry, passing in the aggregator variable and the value of the column columnName. If the signature is U(U,T)
the aggregator variable is then copy-assigned the result of the execution of the callable. Otherwise the signature of aggregator must be void(U&,T)
.
The merger callable is used to merge the partial accumulation results of each processing thread. It is only called in multi-thread executions. If its signature is U(U,U)
the aggregator variables of each thread are merged two by two. If its signature is void(std::vector<U>& a)
it is assumed that it merges all aggregators in a[0].
This action is lazy: upon invocation of this method the calculation is booked but not executed. Also see RResultPtr.
Example usage:
Definition at line 2867 of file RInterface.hxx.
|
inline |
Execute a user-defined accumulation operation on the processed column values in each processing slot.
F | The type of the aggregator callable. Automatically deduced. |
U | The type of the aggregator variable. Must be default-constructible, copy-constructible and copy-assignable. Automatically deduced. |
T | The type of the column to apply the reduction to. Automatically deduced. |
[in] | aggregator | A callable with signature U(U,T) or void(U,T) , where T is the type of the column, U is the type of the aggregator variable |
[in] | merger | A callable with signature U(U,U) or void(std::vector<U>&) used to merge the results of the accumulations of each thread |
[in] | columnName | The column to be aggregated. If omitted, the first default column is used instead. |
See previous Aggregate overload for more information.
Definition at line 2901 of file RInterface.hxx.
|
inline |
Allow to refer to a column with a different name.
[in] | alias | name of the column alias |
[in] | columnName | of the column to be aliased |
Aliasing an alias is supported.
Definition at line 1000 of file RInterface.hxx.
|
inline |
Book execution of a custom action using a user-defined helper object.
FirstColumn | The type of the first column used by this action. Inferred together with OtherColumns if not present. |
OtherColumns | A list of the types of the other columns used by this action |
Helper | The type of the user-defined helper. See below for the required interface it should expose. |
[in] | helper | The Action Helper to be scheduled. |
[in] | columns | The names of the columns on which the helper acts. |
This method books a custom action for execution. The behavior of the action is completely dependent on the Helper object provided by the caller. The minimum required interface for the helper is the following (more methods can be present, e.g. a constructor that takes the number of worker threads is usually useful):
In case this is called without specifying column types, jitting is used, and the Helper class needs to be known to the interpreter.
See ActionHelpers.hxx for the helpers used by standard RDF actions. This action is lazy: upon invocation of this method the calculation is booked but not executed. Also see RResultPtr.
Definition at line 2952 of file RInterface.hxx.
|
inline |
Save selected columns in memory.
ColumnTypes | variadic list of branch/column types. |
[in] | columnList | columns to be cached in memory. |
RDataFrame
that wraps the cached dataset.This action returns a new RDataFrame
object, completely detached from the originating RDataFrame
. The new dataframe only contains the cached columns and stores their content in memory for fast, zero-copy subsequent access.
Use Cache
if you know you will only need a subset of the (Filter
ed) data that fits in memory and that will be accessed many times.
#columnname
. These are special columns made available by some data sources (e.g. RNTupleDS) that represent the size of column columnname
, and are not meant to be written out with that name (which is not a valid C++ variable name). Instead, go through an Alias(): df.Alias("nbar", "#bar").Cache<std::size_t>(..., {"nbar"})
.Types and columns specified:
Types inferred and columns specified (this invocation relies on jitting):
Types inferred and columns selected with a regexp (this invocation relies on jitting):
Definition at line 1237 of file RInterface.hxx.
|
inline |
Save selected columns in memory.
[in] | columnList | columns to be cached in memory |
RDataFrame
that wraps the cached dataset.See the previous overloads for more information.
Definition at line 1249 of file RInterface.hxx.
|
inline |
Save selected columns in memory.
[in] | columnList | columns to be cached in memory. |
RDataFrame
that wraps the cached dataset.See the previous overloads for more information.
Definition at line 1323 of file RInterface.hxx.
|
inline |
Save selected columns in memory.
[in] | columnNameRegexp | The 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. The dialect supported is PCRE via the TPRegexp class. An empty string signals the selection of all columns. |
RDataFrame
that wraps the cached dataset.The existing columns are matched against the regular expression. If the string provided is empty, all columns are selected. See the previous overloads for more information.
Definition at line 1298 of file RInterface.hxx.
|
inlineprivate |
Implementation of cache.
Definition at line 3257 of file RInterface.hxx.
|
inlineprivate |
Definition at line 3288 of file RInterface.hxx.
|
inlineprivate |
Definition at line 3278 of file RInterface.hxx.
|
inlineprotected |
Definition at line 3315 of file RInterface.hxx.
|
inlineprivate |
Definition at line 3100 of file RInterface.hxx.
|
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. Also see RResultPtr.
Definition at line 1506 of file RInterface.hxx.
|
inlineprivate |
Create RAction object, return RResultPtr for the action Overload for the case in which one or more column types were not specified (RTTI + jitting).
This overload has a nColumns
optional argument. If present, the number of required columns for this action is taken equal to nColumns, otherwise it is assumed to be sizeof...(ColTypes).
Definition at line 3140 of file RInterface.hxx.
|
inlineprivate |
Create RAction object, return RResultPtr for the action Overload for the case in which all column types were specified (no jitting).
For most actions, r
and helperArg
will refer to the same object, because the only argument to forward to the action helper is the result value itself. We need the distinction for actions such as Snapshot or Cache, for which the constructor arguments of the action helper are different from the returned value.
Definition at line 3118 of file RInterface.hxx.
|
inline |
Define a new column.
[in] | name | The name of the defined column. |
[in] | expression | Function, lambda expression, functor class or any other callable object producing the defined value. Returns the value that will be assigned to the defined column. |
[in] | columns | Names of the columns/branches in input to the producer function. |
Define a 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:
An exception is thrown if the name of the new column is already in use in this branch of the computation graph.
Definition at line 390 of file RInterface.hxx.
|
inline |
Define a new column.
[in] | name | The name of the defined column. |
[in] | expression | An expression in C++ which represents the defined value |
The expression is just-in-time compiled and used to produce the column 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 467 of file RInterface.hxx.
|
inlineprivate |
Definition at line 3168 of file RInterface.hxx.
|
inlineprivate |
Definition at line 3219 of file RInterface.hxx.
|
inline |
Define a new column that is updated when the input sample changes.
[in] | name | The name of the defined column. |
[in] | expression | A C++ callable that computes the new value of the defined column. |
The signature of the callable passed as second argument should be T(unsigned int slot, const ROOT::RDF::RSampleInfo &id)
where:
T
is the type of the defined columnslot
is a number in the range [0, nThreads) that is different for each processing thread. This can simplify the definition of thread-safe callables if you are interested in using parallel capabilities of RDataFrame.id
is an instance of a ROOT::RDF::RSampleInfo object which contains information about the sample which is being processed (see the class docs for more information).DefinePerSample() is useful to e.g. define a quantity that depends on which TTree in which TFile is being processed or to inject a callback into the event loop that is only called when the processing of a new sample starts rather than at every entry.
Definition at line 604 of file RInterface.hxx.
|
inline |
Define a new column that is updated when the input sample changes.
[in] | name | The name of the defined column. |
[in] | expression | A valid C++ expression as a string, which will be used to compute the defined value. |
The expression is just-in-time compiled and used to produce the column entries. It must be valid C++ syntax and the usage of the special variable names rdfslot_
and rdfsampleinfo_
is permitted, where these variables will take the same values as the slot
and id
parameters described at the DefinePerSample(std::string_view name, F expression) overload. See the documentation of that overload for more information.
rdfslot_
and rdfsampleinfo_
as input parameters. This is for example the correct way to call this overload when working in PyROOT: Definition at line 658 of file RInterface.hxx.
|
inline |
Define a new column with a value dependent on the processing slot.
[in] | name | The name of the defined column. |
[in] | expression | Function, lambda expression, functor class or any other callable object producing the defined value. Returns the value that will be assigned to the defined column. |
[in] | columns | Names of the columns/branches in input to the producer function (excluding the slot number). |
This alternative implementation of Define
is meant as a helper to evaluate new column values in a thread-safe manner. 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". RDataFrame guarantees that different threads will invoke the expression with different slot numbers - slot numbers will range from zero to ROOT::GetThreadPoolSize()-1.
The following two calls are equivalent, although DefineSlot
is slightly more performant:
See Define for more information.
Definition at line 419 of file RInterface.hxx.
|
inline |
Define a new column with a value dependent on the processing slot and the current entry.
[in] | name | The name of the defined column. |
[in] | expression | Function, lambda expression, functor class or any other callable object producing the defined value. Returns the value that will be assigned to the defined column. |
[in] | columns | Names 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". RDataFrame guarantees that different threads will invoke the expression with different slot numbers - slot numbers will range from zero to ROOT::GetThreadPoolSize()-1. The second parameter is reserved for a ULong64_t
representing the current entry being processed by the current thread.
The following two Define
s are equivalent, although DefineSlotEntry
is slightly more performant:
See Define for more information.
Definition at line 449 of file RInterface.hxx.
|
inline |
Return information about the dataframe.
This convenience function describes the dataframe and combines the following information:
This is not an action nor a transformation, just a query to the RDataFrame object. The result is dependent on the node from which this method is called, e.g. the list of defined columns returned by GetDefinedColumnNames().
Please note that this is a convenience feature and the layout of the output can be subject to change and should be parsed via RDFDescription methods.
Definition at line 2634 of file RInterface.hxx.
|
inlineprivate |
Definition at line 126 of file RInterface.hxx.
|
inline |
Provides a representation of the columns in the dataset.
ColumnTypes | variadic list of branch/column types. |
[in] | columnList | Names of the columns to be displayed. |
[in] | nRows | Number of events for each column to be displayed. |
[in] | nMaxCollectionElements | Maximum number of collection elements to display per row. |
RDisplay
instance wrapped in a RResultPtr.This function returns a RResultPtr<RDisplay>containing all the entries to be displayed, organized in a tabular form. RDisplay will either print on the standard output a summarized version through
Print()or will return a complete version through
AsString()`.
This action is lazy: upon invocation of this method the calculation is booked but not executed. Also see RResultPtr.
Example usage:
Definition at line 2997 of file RInterface.hxx.
|
inline |
Provides a representation of the columns in the dataset.
[in] | columnList | Names of the columns to be displayed. |
[in] | nRows | Number of events for each column to be displayed. |
[in] | nMaxCollectionElements | Maximum number of collection elements to display per row. |
RDisplay
instance wrapped in a RResultPtr.This overload automatically infers the column types. See the previous overloads for further details.
Invoked when no types are specified to Display
Definition at line 3020 of file RInterface.hxx.
|
inline |
Provides a representation of the columns in the dataset.
[in] | columnList | Names of the columns to be displayed. |
[in] | nRows | Number of events for each column to be displayed. |
RDisplay
instance wrapped in a RResultPtr.See the previous overloads for further details.
Definition at line 3057 of file RInterface.hxx.
|
inline |
Provides a representation of the columns in the dataset.
[in] | columnNameRegexp | A regular expression to select the columns. |
[in] | nRows | Number of events for each column to be displayed. |
[in] | nMaxCollectionElements | Maximum number of collection elements to display per row. |
RDisplay
instance wrapped in a RResultPtr.The existing columns are matched against the regular expression. If the string provided is empty, all columns are selected. See the previous overloads for further details.
Definition at line 3042 of file RInterface.hxx.
|
inline |
Return an object of type T on which T::Fill
will be called once per event (lazy action).
Type T must provide at least:
Fill
method that accepts as many arguments and with same types as the column names passed as columnList (these types can also be passed as template parameters to this method)Merge
method with signature Merge(TCollection *)
or Merge(const std::vector<T *>&)
that merges the objects passed as argument into the object on which Merge
was called (an analogous of TH1::Merge). Note that if the signature that takes a TCollection*
is used, then T must inherit from TObject (to allow insertion in the TCollection*).FirstColumn | The first type of the column the values of which are used to fill the object. Inferred together with OtherColumns if not present. |
OtherColumns | A list of the other types of the columns the values of which are used to fill the object. |
T | The type of the object to fill. Automatically deduced. |
[in] | model | The model to be considered to build the new return value. |
[in] | columnList | A 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. Also see RResultPtr.
Definition at line 2259 of file RInterface.hxx.
|
inline |
Append a filter to the call graph.
[in] | f | Function, 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] | columns | Names of the columns/branches in input to the filter function. |
[in] | name | Optional 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.
RDataFrame 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 287 of file RInterface.hxx.
|
inline |
Append a filter to the call graph.
[in] | f | Function, 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] | columns | Names 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 326 of file RInterface.hxx.
|
inline |
Append a filter to the call graph.
[in] | f | Function, 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] | name | Optional name of this filter. See Report . |
Refer to the first overload of this method for the full documentation.
Definition at line 310 of file RInterface.hxx.
|
inline |
Append a filter to the call graph.
[in] | expression | The filter expression in C++ |
[in] | name | Optional 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.
Definition at line 346 of file RInterface.hxx.
|
inline |
Execute a user-defined function on each entry (instant action).
[in] | f | Function, lambda expression, functor class or any other callable object performing user defined calculations. |
[in] | columns | Names 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 1388 of file RInterface.hxx.
|
inline |
Execute a user-defined function requiring a processing slot index on each entry (instant action).
[in] | f | Function, lambda expression, functor class or any other callable object performing user defined calculations. |
[in] | columns | Names 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 RDataFrame
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 1418 of file RInterface.hxx.
|
inline |
Returns the names of the available columns.
This is not an action nor a transformation, just a query to the RDataFrame object.
Definition at line 2549 of file RInterface.hxx.
|
inline |
Return the type of a given column as a string.
This is not an action nor a transformation, just a query to the RDataFrame object.
Definition at line 2594 of file RInterface.hxx.
|
inlineprivate |
Definition at line 3090 of file RInterface.hxx.
|
inline |
Returns the names of the defined columns.
This is not an action nor a transformation, just a simple utility to get the columns names that have been defined up to the node. If no column has been defined, e.g. on a root node, it returns an empty collection.
Definition at line 2724 of file RInterface.hxx.
|
inline |
Returns the names of the filters created.
If called on a root node, all the filters in the computation graph will be printed. For any other node, only the filters upstream of that node. Filters without a name are printed as "Unnamed Filter" This is not an action nor a transformation, just a query to the RDataFrame object.
Definition at line 2707 of file RInterface.hxx.
|
inlineprotected |
Definition at line 3305 of file RInterface.hxx.
|
inline |
Gets the number of event loops run.
This method returns the number of events loops run so far by this RDataFrame instance.
Example usage:
Definition at line 2815 of file RInterface.hxx.
|
inline |
Gets the number of data processing slots.
This method returns the number of data processing slots used by this RDataFrame instance. This number is influenced by the global switch ROOT::EnableImplicitMT().
Example usage:
Definition at line 2799 of file RInterface.hxx.
|
inlineprotected |
Definition at line 3307 of file RInterface.hxx.
|
inlineprotected |
Definition at line 3309 of file RInterface.hxx.
|
inline |
Return a descriptor for the systematic variations registered in this branch of the computation graph.
This is not an action nor a transformation, just a simple utility to inspect the systematic variations that have been registered with Vary() up to this node. When called on the root node, it returns an empty descriptor.
Definition at line 2750 of file RInterface.hxx.
|
inline |
Fill and return a graph (lazy action).
V1 | The type of the column used to fill the x axis of the graph. |
V2 | The type of the column used to fill the y axis of the graph. |
[in] | v1Name | The name of the column that will fill the x axis. |
[in] | v2Name | The 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 graph is filled with each one of the elements of the container. If Multithreading is enabled, the order in which points are inserted is undefined. If the Graph has to be drawn, it is suggested to the user to sort it on the x before printing. A name and a title to the graph is given based on the input column names.
This action is lazy: upon invocation of this method the calculation is booked but not executed. Also see RResultPtr.
Definition at line 2001 of file RInterface.hxx.
|
inline |
Checks if a column is present in the dataset.
This method checks if a column is part of the input ROOT dataset, has been defined or can be provided by the data source.
Example usage:
Definition at line 2769 of file RInterface.hxx.
|
inline |
Fill and return a one-dimensional histogram with the weighted values of a column (lazy action).
V | The type of the column used to fill the histogram. |
W | The type of the column used as weights. |
[in] | model | The returned histogram will be constructed using this as a model. |
[in] | vName | The name of the column that will fill the histogram. |
[in] | wName | The name of the column that will provide the weights. |
See the description of the first Histo1D() overload for more details.
Definition at line 1643 of file RInterface.hxx.
|
inline |
Fill and return a one-dimensional histogram with the weighted values of a column (lazy action).
V | The type of the column used to fill the histogram. |
W | The type of the column used as weights. |
[in] | model | The 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 1697 of file RInterface.hxx.
|
inline |
Fill and return a one-dimensional histogram with the values of a column (lazy action).
V | The type of the column used to fill the histogram. |
[in] | model | The returned histogram will be constructed using this as a model. |
[in] | vName | The 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. Also see RResultPtr.
Definition at line 1581 of file RInterface.hxx.
|
inline |
Fill and return a one-dimensional histogram with the values of a column (lazy action).
V | The type of the column used to fill the histogram. |
[in] | vName | The name of the column that will fill the histogram. |
This overload uses a default model histogram TH1D(name, title, 128u, 0., 0.). The "name" and "title" strings are built starting from the input column name. See the description of the first Histo1D() overload for more details.
Definition at line 1617 of file RInterface.hxx.
|
inline |
Fill and return a one-dimensional histogram with the weighted values of a column (lazy action).
V | The type of the column used to fill the histogram. |
W | The type of the column used as weights. |
[in] | vName | The name of the column that will fill the histogram. |
[in] | wName | The name of the column that will provide the weights. |
This overload uses a default model histogram TH1D(name, title, 128u, 0., 0.). The "name" and "title" strings are built starting from the input column names. See the description of the first Histo1D() overload for more details.
Definition at line 1677 of file RInterface.hxx.
|
inline |
Definition at line 1792 of file RInterface.hxx.
|
inline |
Fill and return a weighted two-dimensional histogram (lazy action).
V1 | The type of the column used to fill the x axis of the histogram. |
V2 | The type of the column used to fill the y axis of the histogram. |
W | The type of the column used for the weights of the histogram. |
[in] | model | The returned histogram will be constructed using this as a model. |
[in] | v1Name | The name of the column that will fill the x axis. |
[in] | v2Name | The name of the column that will fill the y axis. |
[in] | wName | The 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. Also see RResultPtr.
See the documentation of the first Histo2D() overload for more details.
Definition at line 1774 of file RInterface.hxx.
|
inline |
Fill and return a two-dimensional histogram (lazy action).
V1 | The type of the column used to fill the x axis of the histogram. |
V2 | The type of the column used to fill the y axis of the histogram. |
[in] | model | The returned histogram will be constructed using this as a model. |
[in] | v1Name | The name of the column that will fill the x axis. |
[in] | v2Name | The 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. Also see RResultPtr.
Definition at line 1731 of file RInterface.hxx.
|
inline |
Definition at line 1894 of file RInterface.hxx.
|
inline |
Fill and return a three-dimensional histogram (lazy action).
V1 | The type of the column used to fill the x axis of the histogram. Inferred if not present. |
V2 | The type of the column used to fill the y axis of the histogram. Inferred if not present. |
V3 | The type of the column used to fill the z axis of the histogram. Inferred if not present. |
W | The type of the column used for the weights of the histogram. Inferred if not present. |
[in] | model | The returned histogram will be constructed using this as a model. |
[in] | v1Name | The name of the column that will fill the x axis. |
[in] | v2Name | The name of the column that will fill the y axis. |
[in] | v3Name | The name of the column that will fill the z axis. |
[in] | wName | The 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. Also see RResultPtr.
See the documentation of the first Histo2D() overload for more details.
Definition at line 1875 of file RInterface.hxx.
|
inline |
Fill and return a three-dimensional histogram (lazy action).
V1 | The type of the column used to fill the x axis of the histogram. Inferred if not present. |
V2 | The type of the column used to fill the y axis of the histogram. Inferred if not present. |
V3 | The type of the column used to fill the z axis of the histogram. Inferred if not present. |
[in] | model | The returned histogram will be constructed using this as a model. |
[in] | v1Name | The name of the column that will fill the x axis. |
[in] | v2Name | The name of the column that will fill the y axis. |
[in] | v3Name | The 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. Also see RResultPtr.
Definition at line 1826 of file RInterface.hxx.
|
inline |
Fill and return an N-dimensional histogram (lazy action).
FirstColumn | The first type of the column the values of which are used to fill the object. Inferred if not present. |
OtherColumns | A list of the other types of the columns the values of which are used to fill the object. |
[in] | model | The returned histogram will be constructed using this as a model. |
[in] | columnList | A list containing the names of the columns that will be passed when calling Fill . (N columns for unweighted filling, or N+1 columns for weighted filling) |
This action is lazy: upon invocation of this method the calculation is booked but not executed. See RResultPtr documentation.
Definition at line 1922 of file RInterface.hxx.
|
inline |
Fill and return an N-dimensional histogram (lazy action).
[in] | model | The returned histogram will be constructed using this as a model. |
[in] | columnList | A list containing the names of the columns that will be passed when calling Fill (N columns for unweighted filling, or N+1 columns for weighted filling) |
This action is lazy: upon invocation of this method the calculation is booked but not executed. Also see RResultPtr.
Definition at line 1955 of file RInterface.hxx.
|
inline |
Return the maximum of processed column values (lazy action).
T | The type of the branch/column. |
[in] | columnName | The name of the branch/column to be treated. |
If T is not specified, RDataFrame 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. Also see RResultPtr.
Definition at line 2393 of file RInterface.hxx.
|
inline |
Return the mean of processed column values (lazy action).
T | The type of the branch/column. |
[in] | columnName | The name of the branch/column to be treated. |
If T is not specified, RDataFrame 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. Also see RResultPtr.
Definition at line 2422 of file RInterface.hxx.
|
inline |
Return the minimum of processed column values (lazy action).
T | The type of the branch/column. |
[in] | columnName | The name of the branch/column to be treated. |
If T is not specified, RDataFrame 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. Also see RResultPtr.
Definition at line 2363 of file RInterface.hxx.
|
inline |
Cast any RDataFrame node to a common type ROOT::RDF::RNode.
Different RDataFrame methods return different C++ types. All nodes, however, can be cast to this common type at the cost of a small performance penalty. This allows, for example, storing RDataFrame nodes in a vector, or passing them around via (non-template, C++11) helper functions. Example usage:
Note that it is not a problem to pass RNode's by value.
Definition at line 250 of file RInterface.hxx.
|
default |
Copy-assignment operator for RInterface.
|
default |
Move-assignment operator for RInterface.
|
inline |
Fill and return a one-dimensional profile (lazy action).
See the first Profile1D() overload for more details.
Definition at line 2115 of file RInterface.hxx.
|
inline |
Fill and return a one-dimensional profile (lazy action).
V1 | The type of the column the values of which are used to fill the profile. Inferred if not present. |
V2 | The type of the column the values of which are used to fill the profile. Inferred if not present. |
W | The type of the column the weights of which are used to fill the profile. Inferred if not present. |
[in] | model | The model to be considered to build the new return value. |
[in] | v1Name | The name of the column that will fill the x axis. |
[in] | v2Name | The name of the column that will fill the y axis. |
[in] | wName | The 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. Also see RResultPtr.
See the first Profile1D() overload for more details.
Definition at line 2093 of file RInterface.hxx.
|
inline |
Fill and return a one-dimensional profile (lazy action).
V1 | The type of the column the values of which are used to fill the profile. Inferred if not present. |
V2 | The type of the column the values of which are used to fill the profile. Inferred if not present. |
[in] | model | The model to be considered to build the new return value. |
[in] | v1Name | The name of the column that will fill the x axis. |
[in] | v2Name | The 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. Also see RResultPtr.
Definition at line 2048 of file RInterface.hxx.
|
inline |
Fill and return a two-dimensional profile (lazy action).
See the first Profile2D() overload for more details.
Definition at line 2219 of file RInterface.hxx.
|
inline |
Fill and return a two-dimensional profile (lazy action).
V1 | The type of the column used to fill the x axis of the histogram. Inferred if not present. |
V2 | The type of the column used to fill the y axis of the histogram. Inferred if not present. |
V3 | The type of the column used to fill the z axis of the histogram. Inferred if not present. |
W | The type of the column used for the weights of the histogram. Inferred if not present. |
[in] | model | The returned histogram will be constructed using this as a model. |
[in] | v1Name | The name of the column that will fill the x axis. |
[in] | v2Name | The name of the column that will fill the y axis. |
[in] | v3Name | The name of the column that will fill the z axis. |
[in] | wName | The 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. Also see RResultPtr.
See the first Profile2D() overload for more details.
Definition at line 2197 of file RInterface.hxx.
|
inline |
Fill and return a two-dimensional profile (lazy action).
V1 | The type of the column used to fill the x axis of the histogram. Inferred if not present. |
V2 | The type of the column used to fill the y axis of the histogram. Inferred if not present. |
V2 | The type of the column used to fill the z axis of the histogram. Inferred if not present. |
[in] | model | The returned profile will be constructed using this as a model. |
[in] | v1Name | The name of the column that will fill the x axis. |
[in] | v2Name | The name of the column that will fill the y axis. |
[in] | v3Name | The 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. Also see RResultPtr.
Definition at line 2149 of file RInterface.hxx.
|
inline |
Creates a node that filters entries based on range: [begin, end).
[in] | begin | Initial entry number considered for this range. |
[in] | end | Final entry number (excluded) considered for this range. 0 means that the range goes until the end of the dataset. |
[in] | stride | Process one entry of the [begin, end) range every stride entries. Must be strictly greater than 0. |
Note that in case of previous Ranges and Filters the selected range refers to the transformed dataset. Ranges are only available if EnableImplicitMT has not been called. Multi-thread ranges are not supported.
Definition at line 1347 of file RInterface.hxx.
|
inline |
Creates a node that filters entries based on range.
[in] | end | Final entry number (excluded) considered for this range. 0 means that the range goes until the end of the dataset. |
See the other Range overload for a detailed description.
Definition at line 1368 of file RInterface.hxx.
|
inline |
Overwrite the value and/or type of an existing column.
[in] | name | The name of the column to redefine. |
[in] | expression | Function, lambda expression, functor class or any other callable object producing the defined value. Returns the value that will be assigned to the defined column. |
[in] | columns | Names of the columns/branches in input to the expression. |
The old value of the column can be used as an input for the expression.
An exception is thrown in case the column to redefine does not already exist. See Define() for more information.
Definition at line 499 of file RInterface.hxx.
|
inline |
Overwrite the value and/or type of an existing column.
[in] | name | The name of the column to redefine. |
[in] | expression | An expression in C++ which represents the defined value |
The expression is just-in-time compiled and used to produce the column entries. It must be valid C++ syntax in which variable names are substituted with the names of branches/columns.
The old value of the column can be used as an input for the expression. An exception is thrown in case the column to re-define does not already exist.
Aliases cannot be overridden. See the corresponding Define() overload for more information.
Definition at line 557 of file RInterface.hxx.
|
inline |
Overwrite the value and/or type of an existing column.
[in] | name | The name of the column to redefine. |
[in] | expression | Function, lambda expression, functor class or any other callable object producing the defined value. Returns the value that will be assigned to the defined column. |
[in] | columns | Names of the columns/branches in input to the producer function (excluding slot). |
The old value of the column can be used as an input for the expression. An exception is thrown in case the column to redefine does not already exist.
See DefineSlot() for more information.
Definition at line 518 of file RInterface.hxx.
|
inline |
Overwrite the value and/or type of an existing column.
[in] | name | The name of the column to redefine. |
[in] | expression | Function, lambda expression, functor class or any other callable object producing the defined value. Returns the value that will be assigned to the defined column. |
[in] | columns | Names of the columns/branches in input to the producer function (excluding slot and entry). |
The old value of the column can be used as an input for the expression. An exception is thrown in case the column to re-define does not already exist.
See DefineSlotEntry() for more information.
Definition at line 537 of file RInterface.hxx.
|
inline |
Execute a user-defined reduce operation on the values of a column.
F | The type of the reduce callable. Automatically deduced. |
T | The type of the column to apply the reduction to. Automatically deduced. |
[in] | f | A callable with signature T(T,T) |
[in] | columnName | The column to be reduced. If omitted, the first default column is used instead. |
[in] | redIdentity | The reduced object of each thread is initialised to this value. |
See the description of the first Reduce overload for more information.
Definition at line 1488 of file RInterface.hxx.
|
inline |
Execute a user-defined reduce operation on the values of a column.
F | The type of the reduce callable. Automatically deduced. |
T | The type of the column to apply the reduction to. Automatically deduced. |
[in] | f | A callable with signature T(T,T) |
[in] | columnName | The 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. Also see RResultPtr.
Definition at line 1465 of file RInterface.hxx.
|
inline |
Gather filtering statistics.
RCutFlowReport
instance wrapped in a RResultPtr.Calling Report
on the main RDataFrame
object gathers 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) gathers the stats for all named filters in the chain section between the original RDataFrame
and that node (included). Stats are gathered in the same order as the named filters have been added to the graph. A RResultPtr<RCutFlowReport> is returned to allow inspection of the effects cuts had.
This action is lazy: upon invocation of this method the calculation is booked but not executed. See RResultPtr documentation.
Definition at line 2515 of file RInterface.hxx.
|
inline |
Save selected columns to disk, in a new TTree treename
in file filename
.
ColumnTypes | variadic list of branch/column types. |
[in] | treename | The name of the output TTree. |
[in] | filename | The name of the output TFile. |
[in] | columnList | The list of names of the columns/branches to be written. |
[in] | options | RSnapshotOptions struct with extra options to pass to TFile and TTree. |
RDataFrame
that wraps the snapshotted dataset.Support for writing of nested branches is limited (although RDataFrame is able to read them) and dot ('.') characters in input column names will be replaced by underscores ('_') in the branches produced by Snapshot. When writing a variable size array through Snapshot, it is required that the column indicating its size is also written out and it appears before the array in the columnList.
By default, in case of TTree or TChain inputs, Snapshot will try to write out all top-level branches. For other types of inputs, all columns returned by GetColumnNames() will be written out. If friend trees or chains are present, by default all friend top-level branches that have names that do not collide with names of branches in the main TTree/TChain will be written out. Since v6.24, Snapshot will also write out friend branches with the same names of branches in the main TTree/TChain with names of the form '<friendname>_<branchname>' in order to differentiate them from the branches in the main tree/chain.
Snapshot supports writing the TTree in a sub-directory inside the TFile. It is sufficient to specify the path to the TTree as part of the TTree name, e.g. df.Snapshot("subdir/t", "f.root")
write TTree t
in the sub-directory subdir
of file f.root
(creating file and sub-directory as needed).
#columnname
. These are special columns made available by some data sources (e.g. RNTupleDS) that represent the size of column columnname
, and are not meant to be written out with that name (which is not a valid C++ variable name). Instead, go through an Alias(): df.Alias("nbar", "#bar").Snapshot(..., {"nbar"})
.To book a Snapshot without triggering the event loop, one needs to set the appropriate flag in RSnapshotOptions
:
Definition at line 1085 of file RInterface.hxx.
|
inline |
Save selected columns to disk, in a new TTree treename
in file filename
.
[in] | treename | The name of the output TTree. |
[in] | filename | The name of the output TFile. |
[in] | columnList | The list of names of the columns/branches to be written. |
[in] | options | RSnapshotOptions struct with extra options to pass to TFile and TTree. |
RDataFrame
that wraps the snapshotted dataset.This function returns a RDataFrame
built with the output tree as a source. The types of the columns are automatically inferred and do not need to be specified.
See above for a more complete description and example usages.
Definition at line 1103 of file RInterface.hxx.
|
inline |
Save selected columns to disk, in a new TTree treename
in file filename
.
[in] | treename | The name of the output TTree. |
[in] | filename | The name of the output TFile. |
[in] | columnList | The list of names of the columns/branches to be written. |
[in] | options | RSnapshotOptions struct with extra options to pass to TFile and TTree. |
RDataFrame
that wraps the snapshotted dataset.This function returns a RDataFrame
built with the output tree as a source. The types of the columns are automatically inferred and do not need to be specified.
See above for a more complete description and example usages.
Definition at line 1193 of file RInterface.hxx.
|
inline |
Save selected columns to disk, in a new TTree treename
in file filename
.
[in] | treename | The name of the output TTree. |
[in] | filename | The name of the output TFile. |
[in] | columnNameRegexp | The 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. The dialect supported is PCRE via the TPRegexp class. An empty string signals the selection of all columns. |
[in] | options | RSnapshotOptions struct with extra options to pass to TFile and TTree |
RDataFrame
that wraps the snapshotted dataset.This function returns a RDataFrame
built with the output tree as a source. The types of the columns are automatically inferred and do not need to be specified.
See above for a more complete description and example usages.
Definition at line 1153 of file RInterface.hxx.
|
inlineprivate |
Definition at line 3227 of file RInterface.hxx.
|
inline |
Return a TStatistic object, filled once per event (lazy action).
V | The type of the value column |
W | The type of the weight column |
[in] | value | The name of the column with the values to fill the statistics with. |
[in] | weight | The name of the column with the weights to fill the statistics with. |
Definition at line 2317 of file RInterface.hxx.
|
inline |
Return a TStatistic object, filled once per event (lazy action).
V | The type of the value column |
[in] | value | The name of the column with the values to fill the statistics with. |
Definition at line 2285 of file RInterface.hxx.
|
inline |
Return the unbiased standard deviation of processed column values (lazy action).
T | The type of the branch/column. |
[in] | columnName | The name of the branch/column to be treated. |
If T is not specified, RDataFrame 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. Also see RResultPtr.
Definition at line 2450 of file RInterface.hxx.
|
inline |
Return the sum of processed column values (lazy action).
T | The type of the branch/column. |
[in] | columnName | The name of the branch/column. |
[in] | initValue | Optional initial value for the sum. If not present, the column values must be default-constructible. |
If T is not specified, RDataFrame 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. Also see RResultPtr.
Definition at line 2482 of file RInterface.hxx.
|
inline |
Return a collection of values of a column (lazy action, returns a std::vector by default).
T | The type of the column. |
COLL | The type of collection used to store the values. |
[in] | column | The name of the column to collect the values of. |
The collection type to be specified for C-style array columns is RVec<T>
: in this case the returned collection is a std::vector<RVec<T>>
.
This action is lazy: upon invocation of this method the calculation is booked but not executed. Also see RResultPtr.
Definition at line 1538 of file RInterface.hxx.
|
inline |
Register a systematic variation that affects multiple columns simultaneously.
This overload of Vary takes a list of column names as first argument rather than a single name and requires that the expression returns an RVec of RVecs of values: one inner RVec for the variations of each affected column. See the documentation of the first Vary overload for more information.
Example usage:
Definition at line 755 of file RInterface.hxx.
|
inline |
Register systematic variations for one or more existing columns using auto-generated tags.
This overload of Vary takes a nVariations parameter instead of a list of tag names. Tag names will be auto-generated as the sequence 0...nVariations-1. See the documentation of the previous overload for more information.
Definition at line 850 of file RInterface.hxx.
|
inline |
Register systematic variations for one or more existing columns.
[in] | colNames | names of the columns for which varied values are provided. |
[in] | expression | a string containing valid C++ code that evaluates to an RVec or RVecs containing the varied values for the specified columns. |
[in] | variationTags | names for each of the varied values, e.g. "up" and "down". |
[in] | variationName | a generic name for this set of varied values, e.g. "ptvariation". |
Definition at line 954 of file RInterface.hxx.
|
inline |
Register systematic variations for one or more existing columns.
[in] | colNames | names of the columns for which varied values are provided. |
[in] | expression | a string containing valid C++ code that evaluates to an RVec or RVecs containing the varied values for the specified columns. |
[in] | nVariations | number of variations returned by the expression. The corresponding tags will be "0", "1", etc. |
[in] | variationName | a generic name for this set of varied values, e.g. "ptvariation". |
Definition at line 926 of file RInterface.hxx.
|
inline |
Register systematic variations for an existing columns using auto-generated variation tags.
This overload of Vary takes a nVariations parameter instead of a list of tag names. Tag names will be auto-generated as the sequence 0...nVariations-1. See the documentation of the previous overload for more information.
Definition at line 730 of file RInterface.hxx.
|
inline |
Register systematic variations for an existing column.
[in] | colNames | names of the columns for which varied values are provided. |
[in] | expression | a callable that evaluates the varied values for the specified columns. The callable can take any column values as input, similarly to what happens with Filter and Define calls. It must return an RVec of varied values, one for each variation tag, in the same order as the tags. |
[in] | inputColumns | the names of the columns to be passed to the callable. |
[in] | variationTags | names for each of the varied values, e.g. "up" and "down". |
[in] | variationName | a generic name for this set of varied values, e.g. "ptvariation". |
Vary provides a natural and flexible syntax to define systematic variations that automatically propagate to Filters, Defines and results. RDataFrame usage of columns with attached variations does not change, but for results that depend on any varied quantity a map/dictionary of varied results can be produced with ROOT::RDF::Experimental::VariationsFor (see the example below).
The dictionary will contain a "nominal" value (accessed with the "nominal" key) for the unchanged result, and values for each of the systematic variations that affected the result (via upstream Filters or via direct or indirect dependencies of the column values on some registered variations). The keys will be a composition of variation names and tags, e.g. "pt:up" and "pt:down" for the example below.
In the following example we add up/down variations of pt and fill a histogram with a quantity that depends on pt. We automatically obtain three histograms in output ("nominal", "pt:up" and "pt:down"):
Definition at line 710 of file RInterface.hxx.
|
inline |
Register systematic variations for an existing column.
[in] | colName | name of the column for which varied values are provided. |
[in] | expression | a string containing valid C++ code that evaluates to an RVec containing the varied values for the specified column. |
[in] | variationTags | names for each of the varied values, e.g. "up" and "down". |
[in] | variationName | a generic name for this set of varied values, e.g. "ptvariation". colName is used if none is provided. |
Definition at line 882 of file RInterface.hxx.
|
inline |
Register systematic variations for an existing column.
[in] | colName | name of the column for which varied values are provided. |
[in] | expression | a string containing valid C++ code that evaluates to an RVec containing the varied values for the specified column. |
[in] | nVariations | number of variations returned by the expression. The corresponding tags will be "0", "1", etc. |
[in] | variationName | a generic name for this set of varied values, e.g. "ptvariation". colName is used if none is provided. |
See the documentation for the previous overload for more information.
Definition at line 900 of file RInterface.hxx.
|
friend |
Definition at line 113 of file RInterface.hxx.
|
friend |
Definition at line 110 of file RInterface.hxx.
|
friend |
|
private |
Contains the columns defined up to this node.
Definition at line 124 of file RInterface.hxx.
|
private |
Non-owning pointer to a data-source object. Null if no data-source. RLoopManager has ownership of the object.
Definition at line 121 of file RInterface.hxx.
|
private |
Definition at line 119 of file RInterface.hxx.
|
private |
Smart pointer to the graph node encapsulated by this RInterface.
The RLoopManager at the root of this computation graph. Never null.
Definition at line 117 of file RInterface.hxx.