Manipulate RDF objects in functions, loops and conditional branches.
Each RDataFrame object has its own type. It helps with performance, but sometimes it gets in the way of writing simple code that manages RDF objects. Luckily, every RDF object can be converted to the generic RNode type. This tutorial shows how to take advantage of RNode to easily manipulate RDataFrames.
{
return node.
Filter(filterStr);
}
void df025_RNode()
{
auto f1 = AddFilter(df,
"rdfentry_ > 0");
auto f2 =
f1.Filter([](
ULong64_t e) {
return e > 1; }, {
"rdfentry_"});
bool someCondition = true;
if (someCondition)
maybe_filtered = maybe_filtered.Filter("rdfentry_ > 3");
for (auto i = 0; i < 3; ++i)
with_columns = with_columns.Define("x" + std::to_string(i), "42");
std::cout << "Entries passing the selection: " << with_columns.Count().GetValue() << std::endl;
}
unsigned long long ULong64_t
The public interface to the RDataFrame federation of classes.
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.
ROOT's RDataFrame offers a modern, high-level interface for analysis of data stored in TTree ,...
RInterface<::ROOT::Detail::RDF::RNodeBase, void > RNode
Entries passing the selection: 4
- Date
- June 2020
- Authors
- Danilo Piparo, Enrico Guiraud (CERN)
Definition in file df025_RNode.C.