This tutorial illustrates how simpler it can be to use a RDataFrame to create a dataset with respect to the usage of the TTree interfaces.
void classicWay()
{
TFile f(
"df009_FromScratchVSTTree_classic.root",
"RECREATE");
TTree t(
"treeName",
"treeName");
double b1;
int b2;
for (int i = 0; i < 10; ++i) {
b1 = i;
b2 = i * i;
}
}
void RDFWay()
{
auto b = 0.;
tdf.Define("b1", [&b]() { return b++; })
.Define("b2", "(int) b1 * b1")
.Snapshot("treeName", "df009_FromScratchVSTTree_tdf.root");
}
void df009_FromScratchVSTTree()
{
classicWay();
RDFWay();
}
- Date
- August 2017
- Author
- Danilo Piparo
Definition in file df009_FromScratchVSTTree.C.