Esempio n. 1
0
    if len(tgt) >= 6:
        ci = ci * tgt[5]
    legend.AddEntry(hists[tgt[0]], '%s = %.3g' % (tgt[4], ci), 'L')


plot.FixTopRange(pads[0], plot.GetPadYMax(pads[0]), 0.43)
legend.Draw()

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

ratio_hists = []
for h in hists:
    ratio_hists.append(plot.MakeRatioHist(h, hists[0], False, False))
for tgt in targets:
    ratio_hists[tgt[0]].Draw('HISTSAME')

plot.SetupTwoPadSplitAsRatio(
    pads, plot.GetAxisHist(
        pads[0]), plot.GetAxisHist(pads[1]), 'Ratio to SM', True, 0.0, 5.0)

# Go back and tidy up the axes and frame
pads[0].cd()
pads[0].GetFrame().Draw()
pads[0].RedrawAxis()

# CMS logo
plot.DrawCMSLogo(pads[0], 'Les Houches', '2019', 11, 0.045, 0.05, 1.0, '', 1.0)
plot.DrawTitle(pads[0], 'pp #rightarrow H / Hj', 1)
Esempio n. 2
0
    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')

for h in hists:
    ratio_hists.append(plot.MakeRatioHist(h, hists[0], False, False))
    ratio_hists[-1].Draw('HISTSAME')

plot.SetupTwoPadSplitAsRatio(pads, plot.GetAxisHist(pads[0]),
                             plot.GetAxisHist(pads[1]), 'Ratio to SM', True,
                             float(args.ratio.split(',')[0]),
                             float(args.ratio.split(',')[1]))

# Go back and tidy up the axes and frame
pads[0].cd()
pads[0].GetFrame().Draw()
pads[0].RedrawAxis()
# h_axes[1].SetMinimum(args.x_min)  ## MY LINE

if args.x_min > 1.:
    pads[0].RangeAxis(args.x_min, 1., 300., 10000.)

plot.FixTopRange(pads[0], plot.GetPadYMax(pads[0]), 0.30)
legend.Draw()
plot.FixBoxPadding(pads[0], legend, 0.05)

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

r_data = plot.MakeRatioHist(h_data, h_tot, True, False)
r_tot = plot.MakeRatioHist(h_tot, h_tot, True, False)
r_tot.Draw('E2SAME')
r_data.Draw('SAME')

plot.SetupTwoPadSplitAsRatio(pads, plot.GetAxisHist(pads[0]),
                             plot.GetAxisHist(pads[1]), 'Obs/Exp', True, 0.61,
                             1.39)

# Go back and tidy up the axes and frame
pads[0].cd()
pads[0].GetFrame().Draw()
pads[0].RedrawAxis()

# CMS logo
plot.DrawCMSLogo(pads[0], 'CMS', 'Preliminary', 11, 0.045, 0.05, 1.0, '', 1.0)