Write ROOT data with RDataFrame.
This tutorial shows how to write out datasets in ROOT format using RDataFrame.
{
int i(0);
d.Define(
"b1", [&i]() {
return i; })
.Define("b2",
[&i]() {
++i;
})
}
{
auto fileName = "df007_snapshot.root";
auto d_cut =
d.Filter(
"b1 % 2 == 0");
auto d2 =
d_cut.Define(
"b1_square",
"b1 * b1")
.Define("b2_vector",
[](float b2) {
for (int i = 0; i < 3; i++)
},
{"b2"});
std::cout << "These are the columns b1, b1_square and b2_vector:" << std::endl;
for (
auto branch : *t->GetListOfBranches()) {
std::cout <<
"Branch: " <<
branch->GetName() << std::endl;
}
std::cout << "These are all the columns available to this dataframe:" << std::endl;
for (
auto branch : *t->GetListOfBranches()) {
std::cout <<
"Branch: " <<
branch->GetName() << std::endl;
}
f2.Close();
return 0;
}
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
ROOT's RDataFrame offers a modern, high-level interface for analysis of data stored in TTree ,...
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
A TTree represents a columnar dataset.
- Date
- April 2017
- Author
- Danilo Piparo (CERN)
Definition in file df007_snapshot.C.