This tutorial shows how to get information about the efficiency of the filters applied.
import ROOT
fill_tree_code ='''
using FourVector = ROOT::Math::XYZTVector;
using FourVectors = std::vector<FourVector>;
using CylFourVector = ROOT::Math::RhoEtaPhiVector;
void fill_tree(const char *filename, const char *treeName)
{
TFile f(filename, "RECREATE");
TTree t(treeName, treeName);
double b1;
int b2;
t.Branch("b1", &b1);
t.Branch("b2", &b2);
for (int i = 0; i < 50; ++i) {
b1 = i;
b2 = i * i;
t.Fill();
}
t.Write();
f.Close();
return;
}
'''
fileName = 'tdf004_cutFlowReport_py.root'
treeName = 'myTree'
ROOT.gInterpreter.Declare(fill_tree_code)
ROOT.fill_tree(fileName, treeName)
TDF = ROOT.ROOT.Experimental.TDataFrame
d = TDF(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:')
d.Report()
- Date
- May 2017
- Author
- Danilo Piparo
Definition in file tdf004_cutFlowReport.py.