Exemplo n.º 1
0
    hist_errs.append(h_err)
    plot.Set(h_err,
             LineColor=int(opt_part[0]),
             LineWidth=2,
             MarkerColor=int(opt_part[0]),
             MarkerSize=0,
             FillColorAlpha=(int(opt_part[0]), 0.3))
    plot.Set(h, LineColor=int(opt_part[0]), LineWidth=2)
    if args.show_unc:
        legend.AddEntry(h_err, ', '.join(labels), 'LF')
        h_err.Draw('E2SAME')
    else:
        legend.AddEntry(h, ', '.join(labels), 'L')
    h.Draw('HISTSAME')

plot.FixTopRange(pads[0], plot.GetPadYMax(pads[0]), 0.30)
print h_axes[0].GetMinimum(), h_axes[0].GetMaximum()
legend.Draw()

# # Do the ratio plot
pads[1].cd()
pads[1].SetGrid(0, 1)
h_axes[1].Draw()

ratio_hists = []
ratio_hist_errs = []
if args.show_unc:
    for h in hist_errs:
        ratio_hist_errs.append(plot.MakeRatioHist(h, hists[0], True, False))
        ratio_hist_errs[-1].Draw('E2SAME')
Exemplo n.º 2
0
        arr.SetFillColor(ROOT.kBlue)
        arr.SetFillStyle(1001)
        arr.SetLineWidth(6)
        arr.SetLineStyle(1)
        arr.SetAngle(60)
        toy_hist.Draw()
        arr.Draw("<|same")
        pads[0].RedrawAxis()
        pads[0].RedrawAxis('g')
        pads[0].GetFrame().Draw()

        # axis[0].GetYaxis().SetTitle(args.y_title)
        # axis[0].GetXaxis().SetTitle(args.x_title)
        # axis[0].GetXaxis().SetLabelOffset(axis[0].GetXaxis().GetLabelOffset()*2)

        y_min, y_max = (plot.GetPadYMin(pads[0]), plot.GetPadYMax(pads[0]))
        plot.FixBothRanges(pads[0], 0, 0, y_max, 0.25)

        ratio_graph_sets = []
        ratio_graphs = []

        pads[0].cd()
        if legend.GetNRows() == 1:
            legend.SetY1(legend.GetY2() - 0.5 *
                         (legend.GetY2() - legend.GetY1()))
        legend.Draw()

        box = ROOT.TPave(pads[0].GetLeftMargin(), 0.81,
                         1 - pads[0].GetRightMargin(),
                         1 - pads[0].GetTopMargin(), 1, 'NDC')
        box.Draw()