def __init__(self, tree, tree2=None, datatrees=None): if datatrees: for d in datatrees.values(): d.GetEntry(0) self.datatrees = datatrees meanbook = autoBook("means") pullbook = autoBook("pulls") sigmbook = autoBook("sigma") nllsbook = autoBook("nlls") diffbook = autoBook("diff") for e,m in izip(tree, tree2 if tree2 else tree): fit, sigma = lib.combined_result([(e.fit,e.sigma),(m.fit,m.sigma)]) if tree2 else (fit, sigma) alpha = fit / e.fit * e.alpha gen_fit = e.gen_alpha * e.fit / e.alpha label = "%+d"%(100*e.gen_alpha) permil = '#circ#kern[-0.2]{#/}#kern[-0.6]{#lower[0.4]{#circ#circ}}' meanbook.fill(alpha,label, 30, e.gen_alpha - 1.5, e.gen_alpha+1.5, title=';#alpha') pullbook.fill( (fit-gen_fit)/sigma, label, 30, -5, 5, title = ';#Delta/#sigma') sigmbook.fill( sigma, label, 60, 2.54/1000, 2.62/1000, title = ';#sigma') nlle = -3365000 nllm = -3525000 nlldelta = 30000 nllsbook.fill( (e.NLL, m.NLL), label, (30, 30), (nlle - nlldelta,nllm - nlldelta), (nlle+nlldelta,nllm+nlldelta), title = ';NLL (e);NLL (#mu)' ) diffbook.fill( e.alpha-m.alpha, label, 30, -3, 3, title=';#alpha_{e}-#alpha_{#mu}') for item in ['mean','pull','sigm','nlls','diff']: setattr(self,item+'book',eval(item+'book'))
def __init__(self, fname): self.cal = fitresult(fname) self.book = autoBook(fname.split('/')[-1]) for e in self.cal.tree: Ac_y = self.Ac_y_tt(e) Ac_y_gen = e.gen_Ac_y_ttalt Ac_y_sig = self.sigmas_Ac_y_tt(e) self.book.fill( Ac_y - Ac_y_gen, 'delta_Ac_y', 100, -0.05, 0.05) self.book.fill( Ac_y_sig, 'Ac_y_sig', 100, 0, 0.006) self.book.fill( (Ac_y - Ac_y_gen) / Ac_y_sig, 'Ac_y_pull', 100, -5, 5) print Ac_y_gen self.Draw()
def __init__(self, tree, tree2=None, datatrees=None): if datatrees: for d in datatrees.values(): d.GetEntry(0) self.datatrees = datatrees meanbook = autoBook("means") pullbook = autoBook("pulls") sigmbook = autoBook("sigma") nllsbook = autoBook("nlls") for e,m in izip(tree, tree2 if tree2 else tree): fit, sigma = lib.combined_result([(e.fit,e.sigma),(m.fit,m.sigma)]) alpha = fit / e.fit * e.alpha gen_fit = e.gen_alpha * e.fit / e.alpha label = "%d"%(100*e.lumi_factor) permil = '#circ#kern[-0.2]{#/}#kern[-0.6]{#lower[0.4]{#circ#circ}}' meanbook.fill(alpha,label, 30, e.gen_alpha - 1.5, e.gen_alpha+1.5, title=';#alpha') pullbook.fill( (fit-gen_fit)/sigma, label, 30, -5, 5, title = ';#Delta/#sigma') sigmbook.fill( sigma, label, 200, 0, 6./1000, title = ';#sigma') for item in ['mean','pull','sigm']: setattr(self,item+'book',eval(item+'book'))
def __init__(self, trees, treesA, treesC): import matplotlib.pyplot as plt from matplotlib.backends.backend_pdf import PdfPages from matplotlib.ticker import MultipleLocator xoff = 0.08 if presentation else 0 just = -0.8 + xoff fsinc = 4 if presentation else 0 fs = 14 lw = 1.3 cs = 4 ct = 0.9*lw fig = plt.figure(figsize=(6.5,6.5)) ax = fig.add_subplot(111) ax.set_ylim(-4.5,0.5 +[0,1][unfold]) ax.set_xlim(-2,2) for item in ([ax.title, ax.xaxis.label, ax.yaxis.label] + ax.get_xticklabels() + ax.get_yticklabels()): item.set_fontsize(fs+0.5*fsinc) ax.set_xlabel(r'$A_c^y$ $(\%)$', fontsize=fs+4+0.5*fsinc) #ax.set_xlabel(r'$A_c^y (\%)$ : Calculated', fontsize=fs) #ax.set_aspect('equal') ax.get_yaxis().set_visible(False) ax.xaxis.set_minor_locator(MultipleLocator(0.2)) ax.xaxis.set_major_locator(MultipleLocator(1.0)) ax.tick_params('both', length=10, width=1, which='major') ax.tick_params('both', length=5, width=1, which='minor') bookC = autoBook('C') for e,m in izip(*treesC): fit,sigma = lib.combined_result([(e.fit,e.sigma),(m.fit,m.sigma)]) label = e.label[4:6] if label in ['R.','L.','A.','ZP','A2','R2','L2','mg']: continue bookC.fill( e.gen_Ac*100, 'gen_'+label, 1000, -2, 2) bookC.fill( fit*100, "mean_"+label, 100, (e.gen_Ac-e.scale)*100, (e.gen_Ac+e.scale)*100) lw = 2 lc = (0.9,0.1,0.1) ax.text( -1.96, 0.55 + [0,1][unfold], "CMS", fontsize=19, weight='heavy') ax.text( 0.75, 0.55 + [0,1][unfold], "19.6$\,\mathsf{fb^{-1}}$ (8 TeV)", fontsize=16) if unfold: unfold_mean = 0.10 unfold_stat = 0.68 unfold_syst = 0.37 ax.errorbar( unfold_mean, 0, xerr=math.sqrt(unfold_stat**2+unfold_syst**2), marker='.', markersize=15, mfc='k', mec='k', color=lc, linewidth=lw, capsize=cs, capthick=ct ) ax.errorbar( unfold_mean, 0, xerr=unfold_stat, color=lc, marker='.', markersize=15, mfc='k', mec='k', linewidth=lw) ax.text(just, 0, r'$\mathsf{CMS,\ unfold}$', ha='right', fontsize=fs+fsinc) ax.text(just, 0 - 0.2, ('($\mathsf{%.2fpercent\pm %.2fpercent \pm %.2fpercent})ppp$'%(unfold_mean,unfold_stat,unfold_syst)).replace('percent','').replace('ppp', r'\%'), ha='right', fontsize=11+0.75*fsinc) fit,sigma = lib.combined_result([(tree.fit,tree.sigma) for tree in trees]) print fit,sigma sigmaboth = 0.0042 ax.axvspan( 100*(fit-sigmaboth), 100*(fit+sigmaboth), alpha=0.5, fc=(0.7,0.7,0.7), lw=0.1, hatch='', label=r'$68\%$',zorder=-9) ax.axvspan( 100*(fit-2*sigmaboth), 100*(fit+2*sigmaboth), alpha=1.0, fc='w', ec='k', lw=0.1, hatch='....', label=r'$95\%$', zorder=-10) ax.errorbar( 100*fit, [0,1][unfold], xerr=100*sigmaboth, color=lc, marker='.', markersize=15, mfc='k', mec='k', linewidth=lw, capsize=cs, capthick=ct) ax.errorbar( 100*fit, [0,1][unfold], xerr=100*sigma, color=lc, marker='.', markersize=15, mfc='k', mec='k', linewidth=lw) ax.text(just, [0,1][unfold], r'$\mathsf{CMS,\ template}$', ha='right',fontsize=fs+fsinc) ax.text(just, [0,1][unfold] - 0.2, r'$(\mathsf{0.33percent\pm 0.26percent \pm 0.33percent})ppp$'.replace('percent','').replace('ppp',r'\%'), ha='right', fontsize=11+0.75*fsinc) PHerr = 0.0009*100 PH = (tree.scale*100, PHerr) KR = (0.0102*100, 0.0005*100) BS = (0.0111*100, 0.0004*100) andstr = "&" if presentation else "and" predictions = zip([KR, BS, PH],[(0.75,0,0),(0.5,0,0),(0.2,0.8,0)],[r'$\mathsf{K\"{u}hn}$ $\mathsf{%s}$ $\mathsf{Rodrigo}$'%andstr,r'$\mathsf{Bernreuther}$ $\mathsf{%s}$ $\mathsf{Si}$'%andstr,r'$\mathsf{POWHEG}$']) for i,((f,s),c,L) in enumerate(predictions): ax.errorbar( f, -1-i, xerr=s, color=lc, linewidth=lw, capsize=cs, capthick=ct) ax.text(just, -1-i, L, ha='right',fontsize=fs+fsinc) names = {'mn':r'$\mathsf{MC@NLO}$'} order = [0] cgen = [] cfit = [] cerr = [] clab = [] for k,v in bookC.items(): if 'gen' in k: continue cgen.append(bookC[k.replace('mean','gen')].GetMean()) cfit.append(v.GetMean()) cerr.append(v.GetMeanError()) clab.append(k) for i,(g,f,e,l) in enumerate(sorted(zip(cgen,cfit,cerr,clab))): ax.errorbar([g], [-4-order[i]], xerr=PHerr, color=lc, linewidth=lw, capsize=cs, capthick=ct ) #ax.plot([g], [-4-order[i]], 'ob', color=(0,0,0.85), ) #ax.arrow(f, -4-order[i], g-f, 0, color=(0,0,0.85), head_length=0.1, head_width=0.2) ax.text(just, -4-order[i], names[l[-2:]], ha='right', fontsize=fs+fsinc) for k,g,f,e in sorted(zip(clab,cgen,cfit,cerr), key=lambda x: x[1]): print k, g, f, e ax.legend(loc='upper right', prop={'size':fs+0.4*fsinc}, title='Confidence').draw_frame(False) plt.subplots_adjust(top=0.95,right=0.95,left=0.05) outName = 'output/result_plot%s.pdf'%("_presentation" if presentation else "") pp = PdfPages(outName) pp.savefig(fig) pp.close() print "Wrote:", outName
r.tdrStyle.SetErrorX(r.TStyle().GetErrorX()) r.tdrStyle.SetPadTopMargin(0.065) r.TGaxis.SetMaxDigits(3) r.tdrStyle.SetEndErrorSize(6) #r.tdrStyle.SetPadRightMargin(0.06) def unqueue(h): return lib.unQueuedBins(h,5,[-1,1],[-1,1]) threeD = False comps = ['ttag','ttqg','ttqq'] colors = [r.kBlack, r.kGreen, r.kBlue, r.kRed] projections = {} book = autoBook("stuff") for extra in [True,False,'only']: for template in [None]+range(1000): print template #sys.stdout.flush() channels = dict([(lep, channel_data(lep, 'top', signal='fitTopQueuedBin5_TridiscriminantWTopQCD', threeD=threeD, extra=extra, templateID=template,getTT=True)) for lep in ['el', 'mu']]) for lep,ch in channels.items(): for comp,color in zip(comps,colors): name = '_'.join(['extra' if extra=='only' else 'total' if extra else 'orig' ,lep, comp]) if template==None: name += '_actual' tot = unqueue(ch.samples[comp].datas[0].ProjectionX()) v = (100*lib.asymmetry(tot.ProjectionX())[0], 100*lib.asymmetry(tot.ProjectionY())[0]) book.fill( v, name, (100,100), (-3,-3), (3,3))
def __init__(self, trees, treesA, treesC): import matplotlib.pyplot as plt from matplotlib.backends.backend_pdf import PdfPages fs = 14 lw = 1.3 fig = plt.figure(figsize=(6.5,6.5)) ax = fig.add_subplot(111) ax.set_ylim(-2,2) ax.set_xlim(-2,2) ax.set_ylabel(r'$A_c^y (\%)$ : Measured', fontsize=fs) ax.set_xlabel(r'$A_c^y (\%)$ : Calculated', fontsize=fs) ax.set_aspect('equal') t = np.arange(-2,2,0.01) ax.plot(t,t, lw=0.5, color='k')[0].set_dashes([1,1]) bookA = autoBook('A') for e,m in izip(*treesA): fit,sigma = lib.combined_result([(e.fit,e.sigma),(m.fit,m.sigma)]) label = e.label[1:-9] #print float(label)*e.scale, fit bookA.fill( fit*100, "mean_"+label, 100, (float(label)-1)*e.scale*100, (float(label)+1)*e.scale*100) gen = [] fit = [] err = [] for k,v in sorted(bookA.items()): gen.append(float(k[5:])*e.scale*100) fit.append(v.GetMean()) err.append(v.GetMeanError()) ax.errorbar(gen,fit,yerr=err,fmt='o', color='k', mec=(0,0.9,0), mfc='none', label='Extended POWHEG', mew=1) bookC = autoBook('C') for e,m in izip(*treesC): fit,sigma = lib.combined_result([(e.fit,e.sigma),(m.fit,m.sigma)]) label = e.label[4:6] bookC.fill( e.gen_Ac*100, 'gen_'+label, 1000, -2, 2) bookC.fill( fit*100, "mean_"+label, 100, (e.gen_Ac-e.scale)*100, (e.gen_Ac+e.scale)*100) cgen = [] cfit = [] cerr = [] clab = [] for k,v in bookC.items(): if 'gen' in k: continue cgen.append(bookC[k.replace('mean','gen')].GetMean()) cfit.append(v.GetMean()) cerr.append(v.GetMeanError()) clab.append(k) ax.errorbar(cgen,cfit,yerr=cerr,fmt='.', color=(0,0,0.85), mec='k', label=r'Alternative $\mathrm{t\bar{t}}$ models') for k,g,f,e in sorted(zip(clab,cgen,cfit,cerr), key=lambda x: x[1]): print k, g, f, e fit,sigma = lib.combined_result([(tree.fit,tree.sigma) for tree in trees]) ax.axhspan( -100, -99, alpha=0.3, fc='k', hatch='', label=r'$(e\oplus\mu)\pm\sigma_{stat}$') ax.axhspan( 100*(fit-sigma), 100*(fit+sigma), alpha=0.2, fc='k', hatch='') ax.axhspan( 100*(fit-0.0039), 100*(fit+0.0039), alpha=0.15, fc='k', hatch='', label=r'$(e\oplus\mu)\pm\sigma_{stat}\pm\sigma_{sys}$') PH = (tree.scale*100, 0.0009*100) KR = (0.0102*100, 0.0005*100) BS = (0.0111*100, 0.0004*100) predictions = zip([PH, KR, BS],[(0.2,0.8,0),(0.75,0,0),(0.5,0,0)],['POWHEG','K&R','B&S']) for (f,s),c,L in predictions: ax.axvspan( f-s, f+s, alpha=0.6, fc=c, ec=c, label=L) ax.legend(loc='upper left', prop={'size':10}).draw_frame(False) labelsfonts = {'fontsize':8} ax.text(-0.4, -0.15, 'madgraph', labelsfonts, ha='right') ax.text(0.15, 0.5, r"$Z'$", labelsfonts, ha='right') ax.annotate('right', xy=(0.479041039944,0.418250670293), xytext=(0.4,0.1), arrowprops={'fc':'k', 'width':0.05, 'shrink':0.2, 'headwidth':2}, fontsize=8) ax.text(0.55, 0.3, 'mc@nlo', labelsfonts) ax.text(0.65, 0.45, 'RIGHT', labelsfonts) ax.text(0.5, 0.7, 'left', labelsfonts, ha='right') ax.text(1.15, 0.9, 'AXIAL', labelsfonts) ax.text(1.65, 1.3, 'axial', labelsfonts) output = 'output/bias_plot.pdf' pp = PdfPages(output) print 'Wrote:', output pp.savefig(fig) pp.close()
infile = r.TFile.Open(sys.argv[1]) tree = infile.Get('fitresult') outname = sys.argv[1].replace('asymmetry_', 'ensemble').replace('.root', '') if outname in sys.argv[1]: print "Please rename input file." exit() mark = len(sys.argv) > 2 if mark: mfile = r.TFile.Open(sys.argv[2]) mtree = infile.Get('fitresult') mtree.GetEntry(0) tfile = r.TFile.Open(outname + '.root', 'RECREATE') book = autoBook(tfile) names = [ 'delta_Aqq', 'delta_Aqg', 'delta_A', 'error_Aqq', 'error_Aqg', 'error_A', 'pullqq', 'pullqg', 'pull' ] fixedLimits = [(-1.5, 1.5), (-1.5, 1.5), (-1.5, 1.5), (0.05, 1.05), (0.05, 1.05), (0.05, 1.05), (-5, 5), (-5, 5), (-5, 5)] meanNLL = sum(e.NLL for e in tree) / tree.GetEntries() limits = fixedLimits wNLL = 40000 within = 0 tot = 0 for e in tree: truth = e.gen_fitX, e.gen_fitY, 1. mean = e.fitX, e.fitY
infile = r.TFile.Open(sys.argv[1]) tree = infile.Get('fitresult') outname = sys.argv[1].replace('asymmetry_','ensemble').replace('.root', '') if outname in sys.argv[1]: print "Please rename input file." exit() mark = len(sys.argv) > 2 if mark: mfile = r.TFile.Open(sys.argv[2]) mtree = infile.Get('fitresult') mtree.GetEntry(0) tfile = r.TFile.Open(outname+'.root', 'RECREATE') book = autoBook(tfile) names = ['delta_Aqq','delta_Aqg','delta_A', 'error_Aqq','error_Aqg','error_A', 'pullqq', 'pullqg', 'pull'] fixedLimits = [(-1.5,1.5),(-1.5,1.5),(-1.5,1.5), (0.05,1.05),(0.05,1.05),(0.05,1.05), (-5,5),(-5,5),(-5,5)] meanNLL = sum(e.NLL for e in tree) / tree.GetEntries() limits = fixedLimits wNLL = 40000 within=0 tot = 0 for e in tree: truth = e.gen_fitX,e.gen_fitY,1. mean = e.fitX,e.fitY
r.TGaxis.SetMaxDigits(3) r.tdrStyle.SetEndErrorSize(6) #r.tdrStyle.SetPadRightMargin(0.06) def unqueue(h): return lib.unQueuedBins(h, 5, [-1, 1], [-1, 1]) threeD = False comps = ['ttag', 'ttqg', 'ttqq'] colors = [r.kBlack, r.kGreen, r.kBlue, r.kRed] projections = {} book = autoBook("stuff") for extra in [True, False, 'only']: for template in [None] + range(1000): print template #sys.stdout.flush() channels = dict([ (lep, channel_data(lep, 'top', signal='fitTopQueuedBin5_TridiscriminantWTopQCD', threeD=threeD, extra=extra, templateID=template, getTT=True)) for lep in ['el', 'mu'] ])
def __init__(self, trees, treesA, treesC): import matplotlib.pyplot as plt from matplotlib.backends.backend_pdf import PdfPages from matplotlib.ticker import MultipleLocator fs = 16 lw = 1.3 fig = plt.figure(figsize=(6.5,6.5)) ax = fig.add_subplot(111) for item in ([ax.title, ax.xaxis.label, ax.yaxis.label] + ax.get_xticklabels() + ax.get_yticklabels()): item.set_fontsize(fs) ylimabs = 0.8 ax.set_ylim(-ylimabs,ylimabs) ax.set_xlim(-2,2) ax.set_ylabel(r'Bias $(\%)$', fontsize=fs+2) ax.set_xlabel(r'$A_c^y$ $(\%)$', fontsize=fs+2) #ax.set_aspect('equal') ax.xaxis.set_minor_locator(MultipleLocator(0.2)) ax.xaxis.set_major_locator(MultipleLocator(1.0)) ax.yaxis.set_minor_locator(MultipleLocator(0.1)) ax.yaxis.set_major_locator(MultipleLocator(0.2)) ax.tick_params('both', length=10, width=1, which='major') ax.tick_params('both', length=5, width=1, which='minor') t = np.arange(-2,2,0.01) ax.plot(t,np.zeros(len(t)), lw=0.5, color='k')[0].set_dashes([1,1]) bookA = autoBook('A') for e,m in izip(*treesA): fit,sigma = lib.combined_result([(e.fit,e.sigma),(m.fit,m.sigma)]) label = e.label[1:-9] #print float(label)*e.scale, fit bookA.fill( fit*100, "mean_"+label, 100, (float(label)-1)*e.scale*100, (float(label)+1)*e.scale*100) gen = [] fit = [] err = [] for k,v in sorted(bookA.items()): gen.append(float(k[5:])*e.scale*100) fit.append(v.GetMean()) err.append(v.GetMeanError()) ax.errorbar(gen,fit-np.array(gen),yerr=err,fmt='o', color='k', mec=(0,0.9,0), mfc='none', label='Extended POWHEG', mew=1, capsize=0, ms=7) bookC = autoBook('C') for e,m in izip(*treesC): fit,sigma = lib.combined_result([(e.fit,e.sigma),(m.fit,m.sigma)]) label = e.label[4:6] bookC.fill( e.gen_Ac*100, 'gen_'+label, 1000, -2, 2) bookC.fill( fit*100, "mean_"+label, 100, (e.gen_Ac-2*e.scale)*100, (e.gen_Ac+2*e.scale)*100) cgen = [] cfit = [] cerr = [] clab = [] iLow = [] iHi = [] iOther = [] iSM = [] fitfile = "output/bias_plot2-fits.pdf" canvas = r.TCanvas() canvas.Print(fitfile+'[') for i, (k,v) in enumerate(x for x in bookC.items() if 'gen' not in x[0]): if 'gen' in k: continue cgen.append(bookC[k.replace('mean','gen')].GetMean()) #cfit.append(v.GetMean()) #cerr.append(v.GetMeanError()) v.Scale(1./v.Integral()) v.Fit("gaus","QEML") canvas.Print(fitfile) cfit.append(v.GetFunction("gaus").GetParameter('Mean')) cerr.append(v.GetFunction("gaus").GetParameter('Sigma')) clab.append(k) print k if '.' in k: iLow.append(i) elif '2' in k: iHi.append(i) elif k in ['mean_mg','mean_mn']: iSM.append(i) else: iOther.append(i) canvas.Print(fitfile+']') #ax.errorbar(cgen,cfit-np.array(cgen),yerr=cerr,fmt='.', color=(0,0,0.85), mec='k', label=r'Alternative $\mathsf{t\bar{t}}$ models') ax.errorbar(np.array(cgen)[iOther],(cfit-np.array(cgen))[iOther],yerr=np.array(cerr)[iOther],fmt='s', color=(0,0,0.85), mec='k', capsize=0, label=r"$\mathrm{Z}'$ model", ms=5) ax.errorbar(np.array(cgen)[iLow],(cfit-np.array(cgen))[iLow],yerr=np.array(cerr)[iLow],fmt='^', color=(0,0,0.85), mec='b', mfc='none',label=r'200$\mathsf{\,GeV}$ axigluon models', capsize=0, ms=8) ax.errorbar(np.array(cgen)[iHi],(cfit-np.array(cgen))[iHi],yerr=np.array(cerr)[iHi],fmt='v', color=(0,0,0.85), mec='k', label=r'2$\mathsf{\,TeV}$ axigluon models', capsize=0, ms=6) ax.errorbar(np.array(cgen)[iSM],(cfit-np.array(cgen))[iSM],yerr=np.array(cerr)[iSM],fmt='.', color=(0,0,0.85), mec='k', label=r'Standard model simulations ', capsize=0) for k,g,f,e in sorted(zip(clab,cgen,cfit,cerr), key=lambda x: x[1]): print k, g, f, e fit,sigma = lib.combined_result([(tree.fit,tree.sigma) for tree in trees]) #ax.axhspan( -100, -99, alpha=0.3, fc='k', hatch='', label=r'$(e\oplus\mu)\pm\sigma_{stat}$') #ax.axhspan( 100*(fit-sigma), 100*(fit+sigma), alpha=0.2, fc='k', hatch='') #ax.axhspan( 100*(fit-0.0039), 100*(fit+0.0039), alpha=0.15, fc='k', hatch='', label=r'$(e\oplus\mu)\pm\sigma_{stat}\pm\sigma_{sys}$') sys = {'mcstat':0.153, 'modeling': 0.017, 'pdf': 0.018, 'scale': 0.136} sys_th = math.sqrt(sum(s*s for s in sys.values())) ax.axhspan( -sys_th, sys_th, alpha=0.4, fc='white', hatch='//', edgecolor='k', label=r'Modeling systematic uncertainties') handles_, labels_ = [],[] handles, labels = ax.get_legend_handles_labels() for frag in ['Ext','Stand','GeV','TeV','Z','Mod']: i = next(i for i,j in enumerate(labels) if frag in j) handles_.append(handles[i]) labels_.append(labels[i]) ax.legend(handles_, labels_, loc = 'lower left', prop={'size':13}, numpoints=1).draw_frame(False) #ax.legend(loc='lower left', prop={'size':13}, numpoints=1).draw_frame(False) labelsfonts = {'fontsize':13} ax.text(-0.4, 0.15, 'MadGraph', labelsfonts, ha='right') #ax.text(0.15, 0.4, r"$Z'$", labelsfonts, ha='right') #ax.annotate('right', xy=(0.479041039944,0.418250670293), xytext=(0.4,0.1), arrowprops={'fc':'k', 'width':0.05, 'shrink':0.2, 'headwidth':2}, fontsize=8) ax.text(0.4, -0.19, 'MC@NLO', labelsfonts, ha='right') #ax.text(0.65, 0.45, 'RIGHT', labelsfonts) #ax.text(0.5, 0.7, 'left', labelsfonts, ha='right') #ax.text(1.15, 0.9, 'AXIAL', labelsfonts) #ax.text(1.65, 1.3, 'axial', labelsfonts) ax.text( -1.85, 0.7, "CMS", fontsize=20, weight='heavy') ax.text( 0.6, 0.82, "19.6$\,\mathsf{fb^{-1}}$ (8 TeV)", fontsize=16) plt.subplots_adjust(top=0.95,right=0.95,left=0.15) output = 'output/bias_plot2.pdf' pp = PdfPages(output) print 'Wrote:', output pp.savefig(fig) pp.close()