Logo ROOT   6.19/01
Reference Guide
df025_RNode.C File Reference

Detailed Description

View in nbviewer Open in SWAN RNode is a generic type which represents any transformation node in the computation graph.

This tutorial shows how to take advantage of the RNode class.

/// This function does not need to be a template: the RNode type accommodates all
/// possible nodes.
ROOT::RDF::RNode AddFilter(ROOT::RDF::RNode node, string_view filterStr)
{
return node.Filter(filterStr);
}
/// Trivial helper function which returns the demangled typename from a typeid
template<typename T>
std::string GetName(T&)
{
int dummy;
return TClassEdit::DemangleName(typeid(T).name(), dummy);
}
void df025_RNode()
{
std::cout << "Type name of input node: " << GetName(df) << std::endl;
auto f1 = AddFilter(df, "rdfentry_ > 0");
auto f2 = f1.Filter([](ULong64_t e) { return e > 1; }, {"rdfentry_"});
std::cout << "Type name of input node: " << GetName(f2) << std::endl;
auto f3 = AddFilter(f2, "rdfentry_ > 2");
std::cout << "Entries passing the selection: " << *f3.Count() << std::endl;
}
Type name of input node: ROOT::RDataFrame
Type name of input node: ROOT::RDF::RInterface<ROOT::Detail::RDF::RFilter<df025_RNode()::$_0, ROOT::Detail::RDF::RNodeBase>, void>
Entries passing the selection: 5
Date
December 2018
Author
Danilo Piparo

Definition in file df025_RNode.C.