11#ifndef ROOT_RDF_TINTERFACE
12#define ROOT_RDF_TINTERFACE
48#include "RConfigure.h"
57#include <initializer_list>
67#include <unordered_set>
91template <
typename Proxied>
123template <
typename Proxied>
131 template <
typename T>
138 friend std::vector<std::pair<std::uint64_t, std::uint64_t>>
242 RDFInternal::CheckFilter(
f);
243 using ColTypes_t =
typename TTraits::CallableTraits<F>::arg_types;
244 constexpr auto nColumns = ColTypes_t::list_size;
278 template <
typename F>
359 throw std::runtime_error(
"Unknown column: \"" + std::string(column) +
"\"");
410 throw std::runtime_error(
"Unknown column: \"" + std::string(column) +
"\"");
487 template <
typename F>
518 template <
typename F>
549 constexpr auto where =
"Define";
595 template <
typename F>
614 template <
typename F>
618 "RedefineSlotEntry");
637 constexpr auto where =
"Redefine";
686 template <
typename T>
689 constexpr auto where{
"DefaultValueFor"};
707 auto newColumn = std::make_shared<ROOT::Internal::RDF::RDefaultValueFor<T>>(
861 template <
typename F>
900 template <
typename F>
948 template <
typename F>
969 template <
typename F>
1009 template <
typename F>
1039 template <
typename F>
1294 constexpr auto where =
"Alias";
1330 if (
stride == 0 || (end != 0 && end < begin))
1331 throw std::runtime_error(
"Range: stride must be strictly greater than 0 and end must be greater than begin.");
1375 auto cSPtr = std::make_shared<ULong64_t>(0);
1376 using Helper_t = RDFInternal::CountHelper;
1403 template <
typename T,
typename COLL = std::vector<T>>
1411 using Helper_t = RDFInternal::TakeHelper<T, T, COLL>;
1413 auto valuesPtr = std::make_shared<COLL>();
1446 template <
typename V = RDFDetail::RInferredType>
1453 std::shared_ptr<::TH1D>
h(
nullptr);
1455 ROOT::Internal::RDF::RIgnoreErrorLevelRAII
iel(
kError);
1456 h = model.GetHistogram();
1459 if (
h->GetXaxis()->GetXmax() ==
h->GetXaxis()->GetXmin())
1481 template <
typename V = RDFDetail::RInferredType>
1507 template <
typename V = RDFDetail::RInferredType,
typename W = RDFDetail::RInferredType>
1514 std::shared_ptr<::TH1D>
h(
nullptr);
1516 ROOT::Internal::RDF::RIgnoreErrorLevelRAII
iel(
kError);
1520 if (
h->GetXaxis()->GetXmax() ==
h->GetXaxis()->GetXmin())
1544 template <
typename V = RDFDetail::RInferredType,
typename W = RDFDetail::RInferredType>
1564 template <
typename V,
typename W>
1598 template <
typename V1 = RDFDetail::RInferredType,
typename V2 = RDFDetail::RInferredType>
1601 std::shared_ptr<::TH2D>
h(
nullptr);
1603 ROOT::Internal::RDF::RIgnoreErrorLevelRAII
iel(
kError);
1606 if (!RDFInternal::HistoUtils<::TH2D>::HasAxisLimits(*
h)) {
1607 throw std::runtime_error(
"2D histograms with no axes limits are not supported yet.");
1644 std::shared_ptr<::TH2D>
h(
nullptr);
1646 ROOT::Internal::RDF::RIgnoreErrorLevelRAII
iel(
kError);
1649 if (!RDFInternal::HistoUtils<::TH2D>::HasAxisLimits(*
h)) {
1650 throw std::runtime_error(
"2D histograms with no axes limits are not supported yet.");
1659 template <
typename V1,
typename V2,
typename W>
1697 std::string_view
v3Name =
"")
1699 std::shared_ptr<::TH3D>
h(
nullptr);
1701 ROOT::Internal::RDF::RIgnoreErrorLevelRAII
iel(
kError);
1704 if (!RDFInternal::HistoUtils<::TH3D>::HasAxisLimits(*
h)) {
1705 throw std::runtime_error(
"3D histograms with no axes limits are not supported yet.");
1748 std::shared_ptr<::TH3D>
h(
nullptr);
1750 ROOT::Internal::RDF::RIgnoreErrorLevelRAII
iel(
kError);
1753 if (!RDFInternal::HistoUtils<::TH3D>::HasAxisLimits(*
h)) {
1754 throw std::runtime_error(
"3D histograms with no axes limits are not supported yet.");
1763 template <
typename V1,
typename V2,
typename V3,
typename W>
1797 std::shared_ptr<::THnD>
h(
nullptr);
1799 ROOT::Internal::RDF::RIgnoreErrorLevelRAII
iel(
kError);
1801 const auto hDims =
h->GetNdimensions();
1805 throw std::invalid_argument(
"The weight column was passed as an argument and at the same time the list of "
1806 "input columns contains one column more than the number of dimensions of the "
1807 "histogram. Call as 'HistoND(model, cols, weightCol)'.");
1810 Warning(
"HistoND",
"Passing the column with the weights as the last column in the list is deprecated. "
1811 "Instead, pass it as a separate argument, e.g. 'HistoND(model, cols, weightCol)'.");
1817 throw std::invalid_argument(
"Wrong number of columns for the specified number of histogram axes.");
1820 if (!
wName.empty()) {
1854 std::shared_ptr<::THnD>
h(
nullptr);
1856 ROOT::Internal::RDF::RIgnoreErrorLevelRAII
iel(
kError);
1858 const auto hDims =
h->GetNdimensions();
1862 throw std::invalid_argument(
"The weight column was passed as an argument and at the same time the list of "
1863 "input columns contains one column more than the number of dimensions of the "
1864 "histogram. Call as 'HistoND(model, cols, weightCol)'.");
1867 Warning(
"HistoND",
"Passing the column with the weights as the last column in the list is deprecated. "
1868 "Instead, pass it as a separate argument, e.g. 'HistoND(model, cols, weightCol)'.");
1874 throw std::invalid_argument(
"Wrong number of columns for the specified number of histogram axes.");
1877 if (!
wName.empty()) {
1918 std::shared_ptr<::THnSparseD>
h(
nullptr);
1920 ROOT::Internal::RDF::RIgnoreErrorLevelRAII
iel(
kError);
1922 const auto hDims =
h->GetNdimensions();
1926 throw std::invalid_argument(
"The weight column was passed as an argument and at the same time the list of "
1927 "input columns contains one column more than the number of dimensions of the "
1928 "histogram. Call as 'HistoNSparseD(model, cols, weightCol)'.");
1932 "Passing the column with the weights as the last column in the list is deprecated. "
1933 "Instead, pass it as a separate argument, e.g. 'HistoNSparseD(model, cols, weightCol)'.");
1939 throw std::invalid_argument(
"Wrong number of columns for the specified number of histogram axes.");
1942 if (!
wName.empty()) {
1977 std::shared_ptr<::THnSparseD>
h(
nullptr);
1979 ROOT::Internal::RDF::RIgnoreErrorLevelRAII
iel(
kError);
1981 const auto hDims =
h->GetNdimensions();
1985 throw std::invalid_argument(
"The weight column was passed as an argument and at the same time the list of "
1986 "input columns contains one column more than the number of dimensions of the "
1987 "histogram. Call as 'HistoNSparseD(model, cols, weightCol)'.");
1991 "Passing the column with the weights as the last column in the list is deprecated. "
1992 "Instead, pass it as a separate argument, e.g. 'HistoNSparseD(model, cols, weightCol)'.");
1998 throw std::invalid_argument(
"Wrong number of columns for the specified number of histogram axes.");
2001 if (!
wName.empty()) {
2029 template <
typename BinContentType =
double,
typename V = RDFDetail::RInferredType>
2033 std::shared_ptr
h = std::make_shared<ROOT::Experimental::RHist<BinContentType>>(
nNormalBins,
interval);
2060 std::string
msg =
"Wrong number of columns for the specified number of histogram axes: ";
2061 msg +=
"expected " + std::to_string(axes.size()) +
", got " + std::to_string(
columnList.size());
2062 throw std::invalid_argument(
msg);
2065 std::shared_ptr
h = std::make_shared<ROOT::Experimental::RHist<BinContentType>>(std::move(axes));
2094 std::string
msg =
"Wrong number of columns for the passed histogram: ";
2095 msg +=
"expected " + std::to_string(
h->GetNDimensions()) +
", got " + std::to_string(
columnList.size());
2096 throw std::invalid_argument(
msg);
2124 std::shared_ptr
h = std::make_shared<ROOT::Experimental::RHist<BinContentType>>(
nNormalBins,
interval);
2155 "weighted filling is not supported for integral bin content types");
2158 std::string
msg =
"Wrong number of columns for the specified number of histogram axes: ";
2159 msg +=
"expected " + std::to_string(axes.size()) +
", got " + std::to_string(
columnList.size());
2160 throw std::invalid_argument(
msg);
2163 std::shared_ptr
h = std::make_shared<ROOT::Experimental::RHist<BinContentType>>(std::move(axes));
2191 std::string_view
wName)
2194 "weighted filling is not supported for integral bin content types");
2199 std::string
msg =
"Wrong number of columns for the passed histogram: ";
2200 msg +=
"expected " + std::to_string(
h->GetNDimensions()) +
", got " + std::to_string(
columnList.size());
2201 throw std::invalid_argument(
msg);
2236 std::string
msg =
"Wrong number of columns for the passed histogram: ";
2237 msg +=
"expected " + std::to_string(
h->GetNDimensions()) +
", got " + std::to_string(
columnList.size());
2238 throw std::invalid_argument(
msg);
2268 std::string_view
wName)
2271 "weighted filling is not supported for integral bin content types");
2276 std::string
msg =
"Wrong number of columns for the passed histogram: ";
2277 msg +=
"expected " + std::to_string(
h->GetNDimensions()) +
", got " + std::to_string(
columnList.size());
2278 throw std::invalid_argument(
msg);
2318 template <
typename X = RDFDetail::RInferredType,
typename Y = RDFDetail::RInferredType>
2321 auto graph = std::make_shared<::TGraph>();
2385 std::string_view
exh =
"", std::string_view
eyl =
"", std::string_view
eyh =
"")
2387 auto graph = std::make_shared<::TGraphAsymmErrors>();
2429 template <
typename V1 = RDFDetail::RInferredType,
typename V2 = RDFDetail::RInferredType>
2433 std::shared_ptr<::TProfile>
h(
nullptr);
2435 ROOT::Internal::RDF::RIgnoreErrorLevelRAII
iel(
kError);
2439 if (!RDFInternal::HistoUtils<::TProfile>::HasAxisLimits(*
h)) {
2440 throw std::runtime_error(
"Profiles with no axes limits are not supported yet.");
2478 std::shared_ptr<::TProfile>
h(
nullptr);
2480 ROOT::Internal::RDF::RIgnoreErrorLevelRAII
iel(
kError);
2484 if (!RDFInternal::HistoUtils<::TProfile>::HasAxisLimits(*
h)) {
2485 throw std::runtime_error(
"Profile histograms with no axes limits are not supported yet.");
2497 template <
typename V1,
typename V2,
typename W>
2533 std::string_view
v2Name =
"", std::string_view
v3Name =
"")
2535 std::shared_ptr<::TProfile2D>
h(
nullptr);
2537 ROOT::Internal::RDF::RIgnoreErrorLevelRAII
iel(
kError);
2541 if (!RDFInternal::HistoUtils<::TProfile2D>::HasAxisLimits(*
h)) {
2542 throw std::runtime_error(
"2D profiles with no axes limits are not supported yet.");
2583 std::shared_ptr<::TProfile2D>
h(
nullptr);
2585 ROOT::Internal::RDF::RIgnoreErrorLevelRAII
iel(
kError);
2589 if (!RDFInternal::HistoUtils<::TProfile2D>::HasAxisLimits(*
h)) {
2590 throw std::runtime_error(
"2D profiles with no axes limits are not supported yet.");
2601 template <
typename V1,
typename V2,
typename V3,
typename W>
2644 auto h = std::make_shared<std::decay_t<T>>(std::forward<T>(model));
2645 if (!RDFInternal::HistoUtils<T>::HasAxisLimits(*
h)) {
2646 throw std::runtime_error(
"The absence of axes limits is not supported yet.");
2667 template <
typename V = RDFDetail::RInferredType>
2671 if (!
value.empty()) {
2675 if (std::is_same<V, RDFDetail::RInferredType>::value) {
2699 template <
typename V = RDFDetail::RInferredType,
typename W = RDFDetail::RInferredType>
2703 constexpr auto vIsInferred = std::is_same<V, RDFDetail::RInferredType>::value;
2704 constexpr auto wIsInferred = std::is_same<W, RDFDetail::RInferredType>::value;
2713 std::string error(
"The ");
2715 error +=
"column type is explicit, while the ";
2717 error +=
" is specified to be inferred. This case is not supported: please specify both types or none.";
2718 throw std::runtime_error(error);
2745 template <
typename T = RDFDetail::RInferredType>
2749 using RetType_t = RDFDetail::MinReturnType_t<T>;
2750 auto minV = std::make_shared<RetType_t>(std::numeric_limits<RetType_t>::max());
2775 template <
typename T = RDFDetail::RInferredType>
2779 using RetType_t = RDFDetail::MaxReturnType_t<T>;
2780 auto maxV = std::make_shared<RetType_t>(std::numeric_limits<RetType_t>::lowest());
2806 template <
typename T = RDFDetail::RInferredType>
2810 auto meanV = std::make_shared<double>(0);
2834 template <
typename T = RDFDetail::RInferredType>
2865 template <
typename T = RDFDetail::RInferredType>
2868 const RDFDetail::SumReturnType_t<T> &
initValue = RDFDetail::SumReturnType_t<T>{})
2871 auto sumV = std::make_shared<RDFDetail::SumReturnType_t<T>>(
initValue);
2911 auto rep = std::make_shared<RCutFlowReport>();
3025 [[deprecated(
"Snapshot is not any more a template. You can safely remove the template parameters.")]]
3133 bool isRNTuple =
false) ->
const std::type_info * {
3136 }
catch (
const std::runtime_error &err) {
3140 if (std::string(err.what()).find(
"Cannot extract type_info of type") != std::string::npos) {
3143 if (
colTypeName.rfind(
"CLING_UNKNOWN_TYPE", 0) == 0)
3145 std::string
msg{
"No runtime type information is available for column \"" +
colName +
3147 "\". Thus, it cannot be written to disk with Snapshot. Make sure to generate and load "
3148 "ROOT dictionaries for the type of this column."};
3150 throw std::runtime_error(
msg);
3165 auto snapHelperArgs = std::make_shared<RDFInternal::SnapshotHelperArgs>(RDFInternal::SnapshotHelperArgs{
3173 std::vector<const std::type_info *>
colTypeIDs;
3193 "The default Snapshot output data format is TTree, but the input data format is RNTuple. If you "
3194 "want to Snapshot to RNTuple or suppress this warning, set the appropriate fOutputFormat option in "
3195 "RSnapshotOptions. Note that this current default behaviour might change in the future.");
3200 auto newRDF = std::make_shared<RInterface<RLoopManager>>(
3203 auto snapHelperArgs = std::make_shared<RDFInternal::SnapshotHelperArgs>(RDFInternal::SnapshotHelperArgs{
3211 std::vector<const std::type_info *>
colTypeIDs;
3257 [](
const std::string &
name) { return name.size() < 13 || name.substr(0, 13) !=
"R_rdf_sizeof_"; });
3271 catch (
const std::runtime_error &
e){
3301 std::initializer_list<std::string>
columnList,
3346 auto staticSeq = std::make_index_sequence<
sizeof...(ColumnTypes)>();
3373 cacheCall <<
"*reinterpret_cast<ROOT::RDF::RInterface<ROOT::Detail::RDF::RLoopManager>*>("
3375 <<
") = reinterpret_cast<ROOT::RDF::RInterface<ROOT::Detail::RDF::RNodeBase>*>("
3388 cacheCall <<
">(*reinterpret_cast<std::vector<std::string>*>("
3412 [](
const std::string &
name) { return name.size() < 13 || name.substr(0, 13) !=
"R_rdf_sizeof_"; });
3451 template <
typename F>
3454 using arg_types =
typename TTraits::CallableTraits<
decltype(
f)>::arg_types_nodecay;
3455 using ret_type =
typename TTraits::CallableTraits<
decltype(
f)>::ret_type;
3481 template <
typename F>
3485 constexpr auto nColumns = ColTypes_t::list_size;
3490 using Helper_t = RDFInternal::ForeachSlotHelper<F>;
3569 typename ArgTypes =
typename TTraits::CallableTraits<AccFun>::arg_types,
3570 typename ArgTypesNoDecay =
typename TTraits::CallableTraits<AccFun>::arg_types_nodecay,
3571 typename U = TTraits::TakeFirstParameter_t<ArgTypes>,
3572 typename T = TTraits::TakeFirstParameter_t<TTraits::RemoveFirstParameter_t<ArgTypes>>>
3582 using Helper_t = RDFInternal::AggregateHelper<AccFun, MergeFun, R, T, U>;
3584 auto action = std::make_unique<Action_t>(
3604 typename ArgTypes =
typename TTraits::CallableTraits<AccFun>::arg_types,
3605 typename U = TTraits::TakeFirstParameter_t<ArgTypes>,
3606 typename T = TTraits::TakeFirstParameter_t<TTraits::RemoveFirstParameter_t<ArgTypes>>>
3610 std::is_default_constructible<U>::value,
3611 "aggregated object cannot be default-constructed. Please provide an initialisation value (aggIdentity)");
3681 using HelperT = std::decay_t<Helper>;
3684 static_assert(std::is_base_of<AH, HelperT>::value && std::is_convertible<HelperT *, AH *>::value,
3685 "Action helper of type T must publicly inherit from ROOT::Detail::RDF::RActionImpl<T>");
3687 auto hPtr = std::make_shared<HelperT>(std::forward<Helper>(
helper));
3690 if (std::is_same<FirstColumn, RDFDetail::RInferredType>::value &&
columns.empty()) {
3733 std::is_default_constructible<T>::value,
3734 "reduce object cannot be default-constructed. Please provide an initialisation value (redIdentity)");
3766 if (
where.compare(0, 8,
"Redefine") != 0) {
3776 using ArgTypes_t =
typename TTraits::CallableTraits<F>::arg_types;
3778 std::is_same<DefineType, RDFDetail::ExtraArgsForDefine::Slot>::value,
ArgTypes_t>
::type;
3780 std::is_same<DefineType, RDFDetail::ExtraArgsForDefine::SlotAndEntry>::value,
ColTypesTmp_t>
::type;
3782 constexpr auto nColumns = ColTypes_t::list_size;
3812 bool IsFStringConv = std::is_convertible<F, std::string>::value,
3814 std::enable_if_t<!IsFStringConv && !IsRetTypeDefConstr, RInterface<Proxied>>
3817 static_assert(std::is_default_constructible<typename TTraits::CallableTraits<F>::ret_type>
::value,
3818 "Error in `Define`: type returned by expression is not default-constructible");
3881 template <
typename...
ColTypes, std::size_t... S>
3888 RDFInternal::TEvalAnd<std::is_copy_constructible<ColTypes>::value...>
::value;
3889 static_assert(
areCopyConstructible,
"Columns of a type which is not copy constructible cannot be cached yet.");
3902 template <
bool IsSingleColumn,
typename F>
3907 using F_t = std::decay_t<F>;
3908 using ColTypes_t =
typename TTraits::CallableTraits<F_t>::arg_types;
3909 using RetType =
typename TTraits::CallableTraits<F_t>::ret_type;
3910 constexpr auto nColumns = ColTypes_t::list_size;
3925 auto variation = std::make_shared<RDFInternal::RVariation<F_t, IsSingleColumn>>(
3956 throw std::logic_error(
"A column name was passed to the same Vary invocation multiple times.");
3973 template <
typename Helper,
typename ActionResultType>
3975 const std::shared_ptr<Helper> &
hPtr,
3985 const std::shared_ptr<Helper>& ,
3988 throw std::logic_error(std::string(
"An action was booked with no input columns, but the action requires "
3989 "columns! The action helper type was ") +
3990 typeid(Helper).
name());
Basic types used by ROOT and required by TInterpreter.
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int)
long long Long64_t
Portable signed long integer 8 bytes.
unsigned long long ULong64_t
Portable unsigned long integer 8 bytes.
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Base class for action helpers, see RInterface::Book() for more information.
implementation of FilterAvailable and FilterMissing operations
The head node of a RDF computation graph.
A histogram data structure to bin data along multiple dimensions.
A histogram for aggregation of data along multiple dimensions.
Helper class that provides the operation graph nodes.
A RDataFrame node that produces a result.
A binder for user-defined columns, variations and aliases.
std::vector< std::string_view > GenerateColumnNames() const
Return the list of the names of the defined columns (Defines + Aliases).
RDFDetail::RDefineBase * GetDefine(std::string_view colName) const
Return the RDefine for the requested column name, or nullptr.
The dataset specification for RDataFrame.
virtual const std::vector< std::string > & GetColumnNames() const =0
Returns a reference to the collection of the dataset's column names.
The base public interface to the RDataFrame federation of classes.
std::string GetColumnType(std::string_view column)
Return the type of a given column as a string.
ColumnNames_t GetValidatedColumnNames(const unsigned int nColumns, const ColumnNames_t &columns)
ColumnNames_t GetColumnTypeNamesList(const ColumnNames_t &columnList)
std::shared_ptr< ROOT::Detail::RDF::RLoopManager > fLoopManager
< The RLoopManager at the root of this computation graph. Never null.
RResultPtr< ActionResultType > CreateAction(const ColumnNames_t &columns, const std::shared_ptr< ActionResultType > &r, const std::shared_ptr< HelperArgType > &helperArg, const std::shared_ptr< RDFNode > &proxiedPtr, const int=-1)
Create RAction object, return RResultPtr for the action Overload for the case in which all column typ...
RDataSource * GetDataSource() const
void CheckAndFillDSColumns(ColumnNames_t validCols, TTraits::TypeList< ColumnTypes... > typeList)
void CheckIMTDisabled(std::string_view callerName)
ColumnNames_t GetColumnNames()
Returns the names of the available columns.
RDFDetail::RLoopManager * GetLoopManager() const
RDFInternal::RColumnRegister fColRegister
Contains the columns defined up to this node.
The public interface to the RDataFrame federation of classes.
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<::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).
RResultPtr<::THnD > HistoND(const THnDModel &model, const ColumnNames_t &columnList, std::string_view wName="")
Fill and return an N-dimensional histogram (lazy action).
RResultPtr<::TGraph > Graph(std::string_view x="", std::string_view y="")
Fill and return a TGraph object (lazy action).
RInterface< Proxied > 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 a single existing column using custom variation tags.
RInterface< Proxied > Vary(const std::vector< std::string > &colNames, std::string_view expression, std::size_t nVariations, std::string_view variationName)
Register systematic variations for multiple existing columns using auto-generated variation tags.
RResultPtr< ROOT::Experimental::RHist< BinContentType > > Hist(std::uint64_t nNormalBins, std::pair< double, double > interval, std::string_view vName, std::string_view wName)
Fill and return a one-dimensional RHist with weights (lazy action).
RInterface(const RInterface &)=default
Copy-ctor for RInterface.
RResultPtr< RDFDetail::MaxReturnType_t< T > > Max(std::string_view columnName="")
Return the maximum of processed column values (lazy action).
auto CallCreateActionWithoutColsIfPossible(const std::shared_ptr< ActionResultType > &resPtr, const std::shared_ptr< Helper > &hPtr, TTraits::TypeList< RDFDetail::RInferredType >) -> decltype(hPtr->Exec(0u), RResultPtr< ActionResultType >{})
RInterface(RInterface &&)=default
Move-ctor for RInterface.
RInterface< Proxied > Vary(std::string_view colName, std::string_view expression, const std::vector< std::string > &variationTags, std::string_view variationName="")
Register systematic variations for a single existing column using custom variation tags.
RInterface< RDFDetail::RFilter< F, Proxied > > Filter(F f, const std::initializer_list< std::string > &columns)
Append a filter to the call graph.
RInterface< RLoopManager > Cache(std::initializer_list< std::string > columnList)
Save selected columns in memory.
RInterface< Proxied > Vary(std::string_view colName, F &&expression, const ColumnNames_t &inputColumns, std::size_t nVariations, std::string_view variationName="")
Register systematic variations for a single existing column using auto-generated variation tags.
RInterface< Proxied > Vary(std::initializer_list< std::string > colNames, std::string_view expression, std::size_t nVariations, std::string_view variationName)
Register systematic variations for multiple existing columns using auto-generated variation tags.
RResultPtr< RInterface< RLoopManager > > Snapshot(std::string_view treename, std::string_view filename, const ColumnNames_t &columnList, const RSnapshotOptions &options=RSnapshotOptions())
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).
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 or RNTuple treename in file filename.
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.
RInterface(const std::shared_ptr< RLoopManager > &proxied)
Build a RInterface from a RLoopManager.
RResultPtr<::THnSparseD > HistoNSparseD(const THnSparseDModel &model, const ColumnNames_t &columnList, std::string_view wName="")
Fill and return a sparse N-dimensional histogram (lazy action).
RInterface< Proxied > Redefine(std::string_view name, F expression, const ColumnNames_t &columns={})
Overwrite the value and/or type of an existing column.
std::shared_ptr< Proxied > fProxiedPtr
Smart pointer to the graph node encapsulated by this RInterface.
RInterface< Proxied > 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 multiple existing columns using custom variation tags.
RInterface< Proxied > Vary(std::string_view colName, std::string_view expression, std::size_t nVariations, std::string_view variationName="")
Register systematic variations for a single existing column using auto-generated variation tags.
RResultPtr<::TH1D > Histo1D(std::string_view vName)
Fill and return a one-dimensional histogram with the values of a column (lazy action).
RInterface< RDFDetail::RRange< Proxied > > Range(unsigned int begin, unsigned int end, unsigned int stride=1)
Creates a node that filters entries based on range: [begin, end).
RInterface< Proxied > DefinePerSampleImpl(std::string_view name, F expression, bool redefine)
Implementation of DefinePerSample and RedefinePerSample (non-jitted).
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.
RResultPtr< ROOT::Experimental::RHist< BinContentType > > Hist(std::vector< ROOT::Experimental::RAxisVariant > axes, const ColumnNames_t &columnList)
Fill and return an RHist (lazy action).
RResultPtr<::TProfile > Profile1D(const TProfile1DModel &model, std::string_view v1Name="", std::string_view v2Name="")
Fill and return a one-dimensional profile (lazy action).
const std::shared_ptr< Proxied > & GetProxiedPtr() const
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).
RResultPtr< T > Reduce(F f, std::string_view columnName="")
Execute a user-defined reduce operation on the values of a column.
RResultPtr< T > Reduce(F f, std::string_view columnName, const T &redIdentity)
Execute a user-defined reduce operation on the values of a column.
RInterface< Proxied > Vary(const std::vector< std::string > &colNames, F &&expression, const ColumnNames_t &inputColumns, const std::vector< std::string > &variationTags, std::string_view variationName)
Register systematic variations for multiple existing columns using custom variation tags.
RInterface< RLoopManager > Cache(const ColumnNames_t &columnList)
Save selected columns in memory.
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).
RResultPtr< RDisplay > Display(std::string_view columnNameRegexp="", size_t nRows=5, size_t nMaxCollectionElements=10)
Provides a representation of the columns in the dataset.
RInterface & operator=(const RInterface &)=default
Copy-assignment operator for RInterface.
RInterface< Proxied > VaryImpl(const std::vector< std::string > &colNames, F &&expression, const ColumnNames_t &inputColumns, const std::vector< std::string > &variationTags, std::string_view variationName)
RResultPtr<::THnSparseD > HistoNSparseD(const THnSparseDModel &model, const ColumnNames_t &columnList, std::string_view wName="")
Fill and return a sparse N-dimensional histogram (lazy action).
RInterface< Proxied > Define(std::string_view name, std::string_view expression)
Define a new column.
RInterface< RDFDetail::RFilterWithMissingValues< Proxied > > FilterAvailable(std::string_view column)
Discard entries with missing values.
std::enable_if_t<!IsFStringConv &&!IsRetTypeDefConstr, RInterface< Proxied > > DefineImpl(std::string_view, F, const ColumnNames_t &, const std::string &)
RInterface< Proxied > Redefine(std::string_view name, std::string_view expression)
Overwrite the value and/or type of an existing column.
std::vector< std::string > GetFilterNames()
Returns the names of the filters created.
RInterface< RLoopManager > Cache(std::string_view columnNameRegexp="")
Save selected columns in memory.
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).
RInterface< Proxied > Vary(std::initializer_list< std::string > colNames, F &&expression, const ColumnNames_t &inputColumns, const std::vector< std::string > &variationTags, std::string_view variationName)
Register systematic variations for multiple existing columns using custom variation tags.
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).
RInterface< Proxied > DefinePerSampleJitImpl(std::string_view name, std::string_view expression, bool redefine)
Implementation of DefinePerSample and RedefinePerSample (jitted).
friend class RDFInternal::GraphDrawing::GraphCreatorHelper
RResultPtr< ROOT::Experimental::RHistEngine< BinContentType > > Hist(std::shared_ptr< ROOT::Experimental::RHistEngine< BinContentType > > h, const ColumnNames_t &columnList)
Fill the provided RHistEngine (lazy action).
RInterface< RLoopManager > CacheImpl(const ColumnNames_t &columnList, std::index_sequence< S... >)
Implementation of cache.
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::RFilter< F, Proxied > > Filter(F f, std::string_view name)
Append a filter to the call graph.
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 > RedefinePerSample(std::string_view name, std::string_view expression)
Redefine an existing column that is updated when the input sample changes.
std::enable_if_t< std::is_default_constructible< RetType >::value, RInterface< Proxied > > DefineImpl(std::string_view name, F &&expression, const ColumnNames_t &columns, const std::string &where)
RResultPtr< ROOT::Experimental::RHist< BinContentType > > Hist(std::shared_ptr< ROOT::Experimental::RHist< BinContentType > > h, const ColumnNames_t &columnList)
Fill the provided RHist (lazy action).
RInterface(const std::shared_ptr< Proxied > &proxied, RLoopManager &lm, const RDFInternal::RColumnRegister &colRegister)
RResultPtr< COLL > Take(std::string_view column="")
Return a collection of values of a column (lazy action, returns a std::vector by default).
RInterface< Proxied > Alias(std::string_view alias, std::string_view columnName)
Allow to refer to a column with a different name.
RResultPtr< RDFDetail::MinReturnType_t< T > > Min(std::string_view columnName="")
Return the minimum of processed column values (lazy action).
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 or RNTuple treename in file filename.
RResultPtr< ROOT::Experimental::RHistEngine< BinContentType > > Hist(std::shared_ptr< ROOT::Experimental::RHistEngine< BinContentType > > h, const ColumnNames_t &columnList, std::string_view wName)
Fill the provided RHistEngine with weights (lazy action).
RResultPtr< RCutFlowReport > Report()
Gather filtering statistics.
RResultPtr<::TH3D > Histo3D(const TH3DModel &model)
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).
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).
RInterface< Proxied > DefinePerSample(std::string_view name, std::string_view expression)
Define a new column that is updated when the input sample changes.
RInterface< Proxied > 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.
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).
RInterface< Proxied > DefineSlot(std::string_view name, F expression, const ColumnNames_t &columns={})
Define a new column with a value dependent on the processing slot.
RInterface< RDFDetail::RFilterWithMissingValues< Proxied > > FilterMissing(std::string_view column)
Keep only the entries that have missing values.
RResultPtr< TStatistic > Stats(std::string_view value="")
Return a TStatistic object, filled once per event (lazy action).
RInterface< Proxied > JittedVaryImpl(const std::vector< std::string > &colNames, std::string_view expression, const std::vector< std::string > &variationTags, std::string_view variationName, bool isSingleColumn)
RInterface< Proxied > DefaultValueFor(std::string_view column, const T &defaultValue)
In case the value in the given column is missing, provide a default value.
RResultPtr< TStatistic > Stats(std::string_view value, std::string_view weight)
Return a TStatistic object, filled once per event (lazy action).
RResultPtr<::TProfile2D > Profile2D(const TProfile2DModel &model)
Fill and return a two-dimensional profile (lazy action).
RInterface< Proxied > RedefineSlot(std::string_view name, F expression, const ColumnNames_t &columns={})
Overwrite the value and/or type of an existing column.
void Foreach(F f, const ColumnNames_t &columns={})
Execute a user-defined function on each entry (instant action).
RResultPtr<::TH2D > Histo2D(const TH2DModel &model, std::string_view v1Name="", std::string_view v2Name="")
Fill and return a two-dimensional histogram (lazy action).
RResultPtr< ActionResultType > CallCreateActionWithoutColsIfPossible(const std::shared_ptr< ActionResultType > &, const std::shared_ptr< Helper > &, Others...)
RInterface< Proxied > Define(std::string_view name, F expression, const ColumnNames_t &columns={})
Define a new column.
void ForeachSlot(F f, const ColumnNames_t &columns={})
Execute a user-defined function requiring a processing slot index on each entry (instant action).
RResultPtr<::TGraphAsymmErrors > GraphAsymmErrors(std::string_view x="", std::string_view y="", std::string_view exl="", std::string_view exh="", std::string_view eyl="", std::string_view eyh="")
Fill and return a TGraphAsymmErrors object (lazy action).
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.
RResultPtr< ROOT::Experimental::RHist< BinContentType > > Hist(std::shared_ptr< ROOT::Experimental::RHist< BinContentType > > h, const ColumnNames_t &columnList, std::string_view wName)
Fill the provided RHist with weights (lazy action).
RResultPtr<::TProfile > Profile1D(const TProfile1DModel &model)
Fill and return a one-dimensional profile (lazy action).
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 or RNTuple treename in file filename.
RInterface & operator=(RInterface &&)=default
Move-assignment operator for RInterface.
RResultPtr<::TH2D > Histo2D(const TH2DModel &model)
RResultPtr< double > Mean(std::string_view columnName="")
Return the mean of processed column values (lazy action).
RInterface< RDFDetail::RFilter< F, Proxied > > Filter(F f, const ColumnNames_t &columns={}, std::string_view name="")
Append a filter to the call graph.
RInterface< RLoopManager > Cache(const ColumnNames_t &columnList)
Save selected columns in memory.
RInterface< Proxied > DefinePerSample(std::string_view name, F expression)
Define a new column that is updated when the input sample changes.
RInterface< Proxied > Vary(std::initializer_list< std::string > colNames, F &&expression, const ColumnNames_t &inputColumns, std::size_t nVariations, std::string_view variationName)
Register systematic variations for for multiple existing columns using custom variation tags.
RInterface< RDFDetail::RRange< Proxied > > Range(unsigned int end)
Creates a node that filters entries based on range.
RInterface< Proxied > RedefineSlotEntry(std::string_view name, F expression, const ColumnNames_t &columns={})
Overwrite the value and/or type of an existing column.
RInterface< RDFDetail::RJittedFilter > Filter(std::string_view expression, std::string_view name="")
Append a filter to the call graph.
RResultPtr< ROOT::Experimental::RHist< BinContentType > > Hist(std::uint64_t nNormalBins, std::pair< double, double > interval, std::string_view vName)
Fill and return a one-dimensional RHist (lazy action).
RResultPtr< ROOT::Experimental::RHist< BinContentType > > Hist(std::vector< ROOT::Experimental::RAxisVariant > axes, const ColumnNames_t &columnList, std::string_view wName)
Fill and return an RHist with weights (lazy action).
RResultPtr< ULong64_t > Count()
Return the number of entries processed (lazy action).
RInterface< Proxied > RedefinePerSample(std::string_view name, F expression)
Redefine an existing column that is updated when the input sample changes.
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).
RInterface< Proxied > 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 multiple existing columns using auto-generated tags.
RResultPtr<::THnD > HistoND(const THnDModel &model, const ColumnNames_t &columnList, std::string_view wName="")
Fill and return an N-dimensional histogram (lazy action).
RResultPtr< double > StdDev(std::string_view columnName="")
Return the unbiased standard deviation of processed column values (lazy action).
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).
A RDataSource implementation which is built on top of result proxies.
ROOT's RDataFrame offers a modern, high-level interface for analysis of data stored in TTree ,...
const_iterator begin() const
const_iterator end() const
typename RemoveFirstParameter< T >::type RemoveFirstParameter_t
TDirectory::TContext keeps track and restore the current directory.
A TGraph is an object made of two arrays X and Y with npoints each.
Statistical variable, defined by its mean and variance (RMS).
void CheckForNoVariations(const std::string &where, std::string_view definedColView, const RColumnRegister &colRegister)
Throw if the column has systematic variations attached.
ParsedTreePath ParseTreePath(std::string_view fullTreeName)
const std::type_info & TypeName2TypeID(const std::string &name)
Return the type_info associated to a name.
void ChangeEmptyEntryRange(const ROOT::RDF::RNode &node, std::pair< ULong64_t, ULong64_t > &&newRange)
std::shared_ptr< RJittedDefine > BookDefinePerSampleJit(std::string_view name, std::string_view expression, RLoopManager &lm, const RColumnRegister &colRegister)
Book the jitting of a DefinePerSample call.
void CheckValidCppVarName(std::string_view var, const std::string &where)
void ChangeSpec(const ROOT::RDF::RNode &node, ROOT::RDF::Experimental::RDatasetSpec &&spec)
Changes the input dataset specification of an RDataFrame.
const std::vector< std::string > & GetTopLevelFieldNames(const ROOT::RDF::RDataSource &ds)
void RemoveDuplicates(ColumnNames_t &columnNames)
std::shared_ptr< RNodeBase > UpcastNode(std::shared_ptr< RNodeBase > ptr)
std::string TypeID2TypeName(const std::type_info &id)
Returns the name of a type starting from its type_info An empty string is returned in case of failure...
void CheckSnapshotOptionsFormatCompatibility(const ROOT::RDF::RSnapshotOptions &opts)
void CheckForDefinition(const std::string &where, std::string_view definedColView, const RColumnRegister &colRegister, const ColumnNames_t &dataSourceColumns)
Throw if column definedColView is not already there.
std::vector< std::string > GetFilterNames(const std::shared_ptr< RLoopManager > &loopManager)
std::string GetDataSourceLabel(const ROOT::RDF::RNode &node)
std::string PrettyPrintAddr(const void *const addr)
std::shared_ptr< RDFDetail::RJittedFilter > BookFilterJit(std::shared_ptr< RDFDetail::RNodeBase > prevNode, std::string_view name, std::string_view expression, const RColumnRegister &colRegister, TTree *tree, RDataSource *ds)
Book the jitting of a Filter call.
void TriggerRun(ROOT::RDF::RNode node)
Trigger the execution of an RDataFrame computation graph.
void CheckTypesAndPars(unsigned int nTemplateParams, unsigned int nColumnNames)
std::string DemangleTypeIdName(const std::type_info &typeInfo)
bool AtLeastOneEmptyString(const std::vector< std::string_view > strings)
std::pair< std::vector< std::string >, std::vector< std::string > > AddSizeBranches(ROOT::RDF::RDataSource *ds, std::vector< std::string > &&colsWithoutAliases, std::vector< std::string > &&colsWithAliases)
Return copies of colsWithoutAliases and colsWithAliases with size branches for variable-sized array b...
std::string ColumnName2ColumnTypeName(const std::string &colName, TTree *, RDataSource *, RDefineBase *, bool vector2RVec=true)
Return a string containing the type of the given branch.
void SetTTreeLifeline(ROOT::RDF::RNode &node, std::any lifeline)
void RemoveRNTupleSubfields(ColumnNames_t &columnNames)
std::vector< std::pair< std::uint64_t, std::uint64_t > > GetDatasetGlobalClusterBoundaries(const RNode &node)
Retrieve the cluster boundaries for each cluster in the dataset, across files, with a global offset.
ColumnNames_t FilterArraySizeColNames(const ColumnNames_t &columnNames, const std::string &action)
Take a list of column names, return that list with entries starting by '#' filtered out.
void WarnHist()
Warn once about experimental filling of RHist.
void CheckForDuplicateSnapshotColumns(const ColumnNames_t &cols)
ColumnNames_t ConvertRegexToColumns(const ColumnNames_t &colNames, std::string_view columnNameRegexp, std::string_view callerName)
void CheckForRedefinition(const std::string &where, std::string_view definedColView, const RColumnRegister &colRegister, const ColumnNames_t &dataSourceColumns)
Throw if column definedColView is already there.
std::shared_ptr< RJittedDefine > BookDefineJit(std::string_view name, std::string_view expression, RLoopManager &lm, RDataSource *ds, const RColumnRegister &colRegister)
Book the jitting of a Define call.
std::shared_ptr< RJittedVariation > BookVariationJit(const std::vector< std::string > &colNames, std::string_view variationName, const std::vector< std::string > &variationTags, std::string_view expression, RLoopManager &lm, RDataSource *ds, const RColumnRegister &colRegister, bool isSingleColumn, const std::string &varyColType)
Book the jitting of a Vary call.
void ChangeBeginAndEndEntries(const RNode &node, Long64_t begin, Long64_t end)
RInterface<::ROOT::Detail::RDF::RNodeBase > RNode
std::vector< std::string > ColumnNames_t
ROOT type_traits extensions.
void EnableImplicitMT(UInt_t numthreads=0)
Enable ROOT's implicit multi-threading for all objects and methods that provide an internal paralleli...
Bool_t IsImplicitMTEnabled()
Returns true if the implicit multi-threading in ROOT is enabled.
void DisableImplicitMT()
Disables the implicit multi-threading in ROOT (see EnableImplicitMT).
A special bin content type to compute the bin error in weighted filling.
type is TypeList if MustRemove is false, otherwise it is a TypeList with the first type removed
Tag to let data sources use the native data type when creating a column reader.
A collection of options to steer the creation of the dataset on disk through Snapshot().
A struct which stores some basic parameters of a TH1D.
std::shared_ptr<::TH1D > GetHistogram() const
A struct which stores some basic parameters of a TH2D.
std::shared_ptr<::TH2D > GetHistogram() const
A struct which stores some basic parameters of a TH3D.
std::shared_ptr<::TH3D > GetHistogram() const
A struct which stores some basic parameters of a THnD.
std::shared_ptr<::THnD > GetHistogram() const
A struct which stores some basic parameters of a THnSparseD.
std::shared_ptr<::THnSparseD > GetHistogram() const
A struct which stores some basic parameters of a TProfile.
std::shared_ptr<::TProfile > GetProfile() const
A struct which stores some basic parameters of a TProfile2D.
std::shared_ptr<::TProfile2D > GetProfile() const
Lightweight storage for a collection of types.