This tutorial illustrates how use the RDataFrame in combination with a RDataSource.
In this case we use a TRootDS. This data source allows to read a ROOT dataset from a RDataFrame in a different way, not based on the regular RDataFrame code. This allows to perform all sorts of consistency checks and illustrate the usage of the RDataSource in a didactic context.
import ROOT
def fill_tree(treeName, fileName):
tdf = ROOT.ROOT.RDataFrame(10000)
tdf.Define("b1", "(int) tdfentry_").Snapshot(treeName, fileName)
fileName = "df011_rootDataSource_py.root"
treeName = "myTree"
fill_tree(treeName, fileName)
MakeRootDataFrame = ROOT.ROOT.RDF.MakeRootDataFrame
h = d.Define("x", "1./(b1 + 1.)").Histo1D(("h_s", "h_s", 128, 0, .6), "x")
c = ROOT.TCanvas()
c.SetLogy()
h.DrawClone()
RDataFrame MakeRootDataFrame(std::string_view treeName, std::string_view fileNameGlob)
- Date
- September 2017
- Author
- Danilo Piparo
Definition in file df011_ROOTDataSource.py.