This tutorial shows how to get information about the efficiency of the filters applied.
import ROOT
def fill_tree(treeName, fileName):
tdf = ROOT.ROOT.RDataFrame(50)
tdf.Define("b1", "(double) tdfentry_")\
.Define("b2", "(int) tdfentry_ * tdfentry_").Snapshot(treeName, fileName)
fileName = 'df004_cutFlowReport_py.root'
treeName = 'myTree'
fill_tree(treeName, fileName)
RDF = ROOT.ROOT.RDataFrame
d = RDF(treeName, fileName)
filtered1 = d.Filter('b1 > 25', 'Cut1')
filtered2 = d.Filter('0 == b2 % 2', 'Cut2')
augmented1 = filtered2.Define('b3', 'b1 / b2')
filtered3 = augmented1.Filter('b3 < .5','Cut3')
print('Cut3 stats:')
filtered3.Report()
print('All stats:')
allCutsReport = d.Report()
allCutsReport.Print()
- Date
- May 2017
- Author
- Danilo Piparo
Definition in file df004_cutFlowReport.py.