def rejection(eff): htot = asrootpy(eff.GetTotalHistogram()).Clone() hpass = asrootpy(eff.GetPassedHistogram()) if hpass.Integral !=0: rej = htot/hpass else: rej = htot rej = Graph(rej) name = '_'.join(eff.name.split('_')[1:]) rej.name = 'rej_{0}'.format(name) rej.title = eff.title return rej
def rejection(eff): htot = asrootpy(eff.GetTotalHistogram()).Clone() hpass = asrootpy(eff.GetPassedHistogram()) if hpass.Integral != 0: rej = htot / hpass else: rej = htot rej = Graph(rej) name = '_'.join(eff.name.split('_')[1:]) rej.name = 'rej_{0}'.format(name) rej.title = eff.title return rej
colors = ['black', '#4169e1', '#cc2c44', '#008000', '#ff9a00', '#b000ff'] if len(colors) < len(args.limits): raise RuntimeError('I have more limits than colors to display them!') limits = [] for info in args.limits: fname, label = tuple(info.split(':')) jmap = prettyjson.loads(open(fname).read()) graph = Graph(len(jmap.keys())) points = [(float(p), float(vals[args.show])) for p, vals in jmap.iteritems()] points.sort() for idx, info in enumerate(points): p, val = info graph.SetPoint(idx, p, val) graph.title = label limits.append(graph) outdir = os.path.dirname(args.out) base = os.path.basename(args.out) plotter = BasePlotter(outdir) plotter.overlay( limits, legend_def=LegendDefinition(position='NE'), xtitle='mass', ytitle='limit', linecolor=colors, linewidth=2, drawstyle=['AL'] + ['L' for _ in colors], legendstyle='l', )
from rootpy.plotting import Graph, Canvas, Legend from rootpy.plotting.style import set_style from rootpy import ROOT set_style('ATLAS', shape='rect') ROOT.gROOT.SetBatch(True) gr_vbf = Graph(len(MASSES)) gr_ggh = Graph(len(MASSES)) for ip, (m, eff_vbf, eff_ggh) in enumerate(zip(MASSES, EFFS_VBF, EFFS_GGH)): gr_vbf.SetPoint(ip, m, eff_vbf) gr_ggh.SetPoint(ip, m, eff_ggh) gr_vbf.title = 'VBFH#rightarrow #tau#tau' gr_vbf.color = 'red' gr_vbf.xaxis.title = 'm_H [GeV]' gr_vbf.yaxis.title = 'Filter Efficiency' gr_vbf.yaxis.SetRangeUser(0, 0.6) gr_ggh.title = 'ggH#rightarrow #tau#tau' gr_ggh.color = 'blue' gr_ggh.xaxis.title = 'm_{H} [GeV]' c = Canvas() gr_vbf.Draw('APL') gr_ggh.Draw('SAMEPL') leg = Legend([gr_vbf, gr_ggh], pad=c, anchor='upper left') leg.Draw('same') c.SaveAs('filter_eff.png')