def CMSPrelim(plot, pad, channel, legend='right', writeExtraText=True, extraText='Preliminary'): pad.cd() year, lumi, energy, unit = HistDrawer.datasetInfo(plot) theStr = '{lumi:3.3} {unit}^{{-1}} ({energy:d} TeV)'.format( year=year, unit=unit, lumi=lumi, energy=energy) # CMS_lumi(pad, theStr, iPosX=0, writeExtraText=writeExtraText, extraText=extraText) # CMS outside canvas if legend == 'right': CMS_lumi(pad, theStr, iPosX=10, writeExtraText=writeExtraText, extraText=extraText) else: CMS_lumi(pad, theStr, iPosX=13, writeExtraText=writeExtraText, extraText=extraText) lowY = 0.68 if writeExtraText: lowY = 0.74 r = pad.GetRightMargin() l = pad.GetLeftMargin() posX = l + 0.045 * (1 - l - r) posXhigh = 0.25 if writeExtraText: r = pad.GetRightMargin() + .3 l = pad.GetLeftMargin() + .15 posXhigh = 0.75 if legend == 'left': posX = 1. - r - 0.16 - 0.21 posXhigh = 1. - r - 0.02 - 0.21 if writeExtraText: posX = 1. - r - 0.16 - .2 posXhigh = 1. - r - 0.02 - .2 plot.chan = TPaveText(posX, lowY, posXhigh, lowY + 0.18, "NDC") if writeExtraText: plot.chan = TPaveText(posX, lowY, posXhigh, lowY + 0.22, "NDC") plot.chan.SetBorderSize(0) plot.chan.SetFillStyle(0) plot.chan.SetTextAlign(12) # plot.chan.SetTextSize(0.6*pad.GetTopMargin()) # To have it the same size as CMS_lumi plot.chan.SetTextSize(0.7 * pad.GetTopMargin()) # make larger than CMS_lumi plot.chan.SetTextFont(42) plot.chan.AddText(channel) plot.chan.Draw('same')
def CMSPrelim(plot, pad, channel, legend='right'): pad.cd() year, lumi, energy, unit = HistDrawer.datasetInfo(plot) theStr = '{lumi:3.3} {unit}^{{-1}} ({energy:d} TeV)'.format( year=year, unit=unit, lumi=lumi, energy=energy) CMS_lumi(pad, theStr, iPosX=0) lowY = 0.77 r = pad.GetRightMargin() l = pad.GetLeftMargin() posX = l + 0.045 * (1 - l - r) posXhigh = 0.25 if legend == 'left': posX = 1. - r - 0.16 posXhigh = 1. - r - 0.02 plot.chan = TPaveText(posX, lowY, posXhigh, lowY + 0.18, "NDC") plot.chan.SetBorderSize(0) plot.chan.SetFillStyle(0) plot.chan.SetTextAlign(12) plot.chan.SetTextSize( 0.6 * pad.GetTopMargin()) # To have it the same size as CMS_lumi plot.chan.SetTextFont(42) plot.chan.AddText(channel) plot.chan.Draw('same')