16using FourVectors = std::vector<FourVector>;
21void fill_tree(
const char *treeName,
const char *fileName)
25 d.Define(
"b1", [&i]() {
return (
double)i; })
32 .Snapshot(treeName, fileName);
39 auto fileName =
"df004_cutFlowReport.root";
40 auto treeName =
"myTree";
41 fill_tree(treeName, fileName);
48 auto cut1 = [](
double b1) {
return b1 > 25.; };
49 auto cut2 = [](
int b2) {
return 0 == b2 % 2; };
53 auto filtered1 =
d.
Filter(cut1, {
"b1"},
"Cut1");
54 auto filtered2 =
d.Filter(cut2, {
"b2"},
"Cut2");
56 auto augmented1 = filtered2.Define(
"b3", [](
double b1,
int b2) {
return b1 / b2; });
57 auto cut3 = [](
double x) {
return x < .5; };
58 auto filtered3 = augmented1.Filter(cut3, {
"b3"},
"Cut3");
69 std::cout <<
"Cut3 stats:" << std::endl;
70 filtered3.Report()->Print();
74 std::cout <<
"All stats:" << std::endl;
75 auto allCutsReport =
d.Report();
76 allCutsReport->Print();
79 std::cout <<
"Name\tAll\tPass\tEfficiency" << std::endl;
80 for (
auto &&cutInfo : allCutsReport) {
81 std::cout << cutInfo.GetName() <<
"\t" << cutInfo.GetAll() <<
"\t" << cutInfo.GetPass() <<
"\t"
82 << cutInfo.GetEff() <<
" %" << std::endl;
86 auto cutName =
"Cut1";
87 auto cut = allCutsReport->At(
"Cut1");
88 std::cout << cutName <<
" efficiency is " << cut.GetEff() <<
" %" << std::endl;
RInterface< RDFDetail::RFilter< F, Proxied >, DS_t > Filter(F f, const ColumnNames_t &columns={}, std::string_view name="")
Append a filter to the call graph.
ROOT's RDataFrame offers a high level interface for analyses of data stored in TTree,...
DisplacementVector3D< CylindricalEta3D< double >, DefaultCoordinateSystemTag > RhoEtaPhiVector
3D Vector based on the eta based cylindrical coordinates rho, eta, phi in double precision.
LorentzVector< PxPyPzE4D< double > > XYZTVector
LorentzVector based on x,y,x,t (or px,py,pz,E) coordinates in double precision with metric (-,...