Write ROOT data with RDataFrame.
This tutorial shows how to write out datasets in ROOT format using RDataFrame.
import ROOT
.Define("b2", "(float) rdfentry_ * rdfentry_").Snapshot(treeName, fileName)
fileName = "df007_snapshot_py.root"
outFileName = "df007_snapshot_output_py.root"
outFileNameAllColumns = "df007_snapshot_output_allColumns_py.root"
treeName = "myTree"
getVector_code ='''
std::vector<float> getVector (float b2)
{
std::vector<float> v;
for (int i = 0; i < 3; i++) v.push_back(b2*i);
return v;
}
'''
.Define("b2_vector", "getVector( b2 )")
["b1", "b1_square", "b2_vector"])
t = f1[treeName]
print("These are the columns b1, b1_square and b2_vector:")
t = f2[treeName]
print("These are all the columns available to this dataframe:")
snapshot_df =
d2.Snapshot(treeName, outFileName, [
"b1_square"]);
print("Saved figure to df007_snapshot.png")
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 ,...
- Date
- April 2017
- Author
- Danilo Piparo (CERN)
Definition in file df007_snapshot.py.