14 f = ROOT.TFile(args.input)
18 signal_base =
get_integral(f, args.variable, args.base_cut, args.signal_names)
19 background_base =
get_integral(f, args.variable, args.base_cut, args.background_names)
22 puritys.append(signal_base / (signal_base + background_base))
25 this_signal =
get_integral(f, args.variable, cut, args.signal_names)
26 this_background =
get_integral(f, args.variable, cut, args.background_names)
27 this_eff = this_signal / signal_base
28 this_purity = this_signal / (this_signal + this_background)
30 puritys.append(this_purity)
32 effs = array(
'd', effs)
33 puritys = array(
'd', puritys)
34 xvals = array(
'd', range(len(effs)))
36 g_eff = ROOT.TGraph(len(effs), xvals, effs)
37 g_eff.SetName(
"Efficiency")
38 g_eff.SetTitle(
"Efficiency")
40 g_purity = ROOT.TGraph(len(puritys), xvals, puritys)
41 g_purity.SetName(
"Purity")
42 g_purity.SetTitle(
"Purity")
44 canvas = ROOT.TCanvas(
"canvas",
"Canvas", 250,100,700,500)
47 g_eff.SetLineColor(ROOT.kGreen)
49 for i
in range(len(effs)):
50 g_eff.GetXaxis().SetBinLabel(g_eff.GetXaxis().FindBin(i), args.names[i])
52 g_purity.SetLineColor(ROOT.kRed)
54 legend = ROOT.gPad.BuildLegend(0.75,0.75,0.95,0.95,
"")