exp_draw_option = 'l' if args.noobs and args.showpoints: exp_draw_option += 'p' exp.Draw(exp_draw_option) if not args.noobs: obs = limitplot.build_obs_line(limit_data, key) obs_draw_option = 'l' if args.showpoints: obs_draw_option += 'p' obs.Draw(obs_draw_option) cms_label = styling.cms_preliminary( args.lumi, is_preliminary=args.preliminary, lumi_on_top = True, ) # Add legend legend_args = [ float(x) for x in args.legendpos.split(',') ] + ["", "NDC"] legend = ROOT.TLegend(*legend_args) legend.SetBorderSize(0) legend.SetFillStyle(0) if not args.noobs: legend.AddEntry(obs,"Observed", 'lp') legend.AddEntry(exp, "Expected", 'l') legend.AddEntry(onesig, "#pm 1 #sigma", 'f') legend.AddEntry(twosig, "#pm 2 #sigma", 'f') legend.Draw()
) data = plotter.get_histogram( fr_info['pd'], '/%s/final/Ntuple:%s' % (fr_info['ntuple'], name), show_overflows = True, rebin = rebin, ) stack.Draw() stack.GetXaxis().SetTitle(xtitle) data.Draw("pe, same") legend.Draw() stack.SetMaximum(max(stack.GetMaximum(), data.GetMaximum())*1.5) stack.GetHistogram().SetTitle( xtitle + ' in ' + fr_info['evtType'] + ' events') cms_label = styling.cms_preliminary(int_lumi) saveplot(fr_type + '_' + name) # Make efficiency curve data_num = plotter.get_histogram( fr_info['pd'], '/%s/final/Ntuple:%s' % ( fr_info['ntuple'], fr_type + 'Num' + fr_info['varname']), show_overflows = True, rebin = fr_info['rebin'], ) log.info("Data numerator has %i entries", data_num.Integral()) data_denom = plotter.get_histogram( fr_info['pd'], '/%s/final/Ntuple:%s' % (
label.SetBorderSize(1) label.SetFillColor(ROOT.EColor.kWhite) label.AddText(object_info['label']) label.Draw() legend = ROOT.TLegend(*legend_pos) legend.SetBorderSize(1) legend.SetFillColor(ROOT.EColor.kWhite) legend.AddEntry(curves['data'], object_info['comb_label'] + " events", "p") legend.AddEntry(curves['nom'], object_info['comb_label'] + " fit", "l") legend.AddEntry(curves['band'], "1#sigma fit error", "f") legend.AddEntry(curves['scale'], "#pm %i%%" % scale_err, "l") legend.Draw() canvas.Update() canvas.SetLogy(True) cms_label = styling.cms_preliminary(4684) canvas.SaveAs("plots/combineFakeRates/%s_combined_eff_roofit.pdf" % object) ############################################################################ ### Compare all regions to fitted fake rate ############################### ############################################################################ for type, type_info in scenarios.iteritems(): roo_frame = jet_pt.frame(ROOT.RooFit.Title("Efficiency")) roo_frame.SetAxisRange(object_info['min_x'], 100) roo_data = ROOT.RooDataHist( "data", "data", ROOT.RooArgList(jet_pt), ROOT.RooFit.Index(roo_cut), ROOT.RooFit.Import("accept", type_info['data_pass']), ROOT.RooFit.Import("reject", type_info['data_fail']),
exp_draw_option = 'l' if args.noobs and args.showpoints: exp_draw_option += 'p' exp.Draw(exp_draw_option) if not args.noobs: obs = limitplot.build_obs_line(limit_data, key) obs_draw_option = 'l' if args.showpoints: obs_draw_option += 'p' obs.Draw(obs_draw_option) cms_label = styling.cms_preliminary( args.lumi, is_preliminary=args.preliminary, lumi_on_top=True, ) # Add legend legend_args = [float(x) for x in args.legendpos.split(',')] + ["", "NDC"] # Translate the legend in X,Y, if desired. nudge = [float(x) for x in args.legendnudge.split(',')] legend_args[0] += nudge[0] legend_args[2] += nudge[0] legend_args[1] += nudge[1] legend_args[3] += nudge[1] legend = ROOT.TLegend(*legend_args) legend.SetBorderSize(1)