Display cut/Filter efficiencies with RDataFrame.
This tutorial shows how to get information about the efficiency of the filters applied
import ROOT
def fill_tree(treeName, fileName):
df.Define("b1", "(double) rdfentry_")\
.Define("b2", "(int) rdfentry_ * rdfentry_").Snapshot(treeName, fileName)
fileName = 'df004_cutFlowReport_py.root'
treeName = 'myTree'
fill_tree(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()
ROOT's RDataFrame offers a modern, high-level interface for analysis of data stored in TTree ,...
Cut1 : pass=24 all=50 -- eff=48.00 % cumulative eff=48.00 %
Cut2 : pass=25 all=50 -- eff=50.00 % cumulative eff=50.00 %
Cut3 : pass=23 all=25 -- eff=92.00 % cumulative eff=46.00 %
Cut3 stats:
All stats:
- Date
- May 2017
- Author
- Danilo Piparo (CERN)
Definition in file df004_cutFlowReport.py.