def get_ratios(results_7TeV, results_8TeV): ratios = {} for key in results_7TeV.keys(): ratio = None if 'Graph' in str(type(results_7TeV[key])): ratio = Graph.divide(results_7TeV[key], results_8TeV[key], False) else: ratio = results_7TeV[key].Clone('ratio_' + key) ratio.Divide(results_8TeV[key]) ratios[key] = ratio return ratios
def get_ratios(results_7TeV, results_8TeV): ratios = {} for key in results_7TeV.keys(): ratio = None if 'Graph' in str(type(results_7TeV[key])): ratio = Graph.divide(results_7TeV[key], results_8TeV[key], False) else: ratio = results_7TeV[key].Clone( 'ratio_' + key ) ratio.Divide(results_8TeV[key]) ratios[key] = ratio return ratios
def test_divide(): Graph.divide(Graph(Hist(10, 0, 1).FillRandom('gaus')), Hist(10, 0, 1).FillRandom('gaus'), 'pois')
# xerr=list(ratioplot.y()), # emptybins=False, fmt='o', lw=1, color="black") # clip_on=False) yticks(arange(0,2.0,0.2)) ylim([0,2]) axes_ratio.set_ylabel('Data/MC') if "CRDB" in histogramName: ratioplot = Graph.divide( Graph(hists['Diboson']), stack.sum , 'pois' ) ratioplot.color = "black" axes_ratio.errorbar(list(ratioplot.x()) , list(ratioplot.y()), yerr=[ x[0] for x in list(ratioplot.yerr() ) ] , # xerr=list(ratioplot.y()), fmt='o-', color="black") yticks(arange(0,2.0,0.2)) ylim([0.01,1.0]) axes_ratio.set_ylabel('Diboson Fraction')
size=10, va="top", ha="center", rotation=90) # axes_ratio.set_xlabel(histogramName.replace("_"," ").replace(">","$>$").replace("<","$<$") ) # get handles handles, labels = axes.get_legend_handles_labels() # remove the errorbars handles = [h[0] for h in handles] # use them in the legend axes.legend(handles, labels, loc='best', numpoints=1) if 'Data' in hists: ratioplot = Graph.divide(Graph(hists['Data']), stack.sum, 'pois') ratioplot.color = "black" axes_ratio.errorbar( list(ratioplot.x()), list(ratioplot.y()), yerr=[x[0] for x in list(ratioplot.yerr())], # xerr=list(ratioplot.y()), fmt='o', color="black") yticks(arange(0, 2.0, 0.2)) ylim([0, 2]) axes_ratio.set_ylabel('Data/MC') if "CRDB" in histogramName:
def test_static_divide(): Graph.divide(Graph(Hist(10, 0, 1).FillRandom('gaus')), Hist(10, 0, 1).FillRandom('gaus'), 'pois')
# leg = plt.legend(loc="best") axes.annotate(r'\textbf{\textit{ATLAS}} Internal',xy=(0.05,0.9),xycoords='axes fraction') axes.annotate(r'$\int{L}\sim$ %d pb$^{-1}$, $\sqrt{s}$=13 TeV'%(3.5*lumiscale),xy=(0.3,0.82),xycoords='axes fraction') # get handles handles, labels = axes.get_legend_handles_labels() # remove the errorbars handles = [h[0] for h in handles] # use them in the legend axes.legend(handles, labels, loc='best',numpoints=1) if 'Data' in hists: ratioplot = Graph.divide( Graph(hists['Data']), stack.sum , 'pois' ) ratioplot.color = "black" axes_ratio.errorbar(list(ratioplot.x()) , list(ratioplot.y()), yerr=[ x[0] for x in list(ratioplot.yerr() ) ] , # xerr=list(ratioplot.y()), fmt='o', color="black") yticks(arange(0,2.0,0.2)) ylim([0,2]) axes.set_ylabel('Events') axes_ratio.set_xlabel(histogramName.replace("_"," ") ) axes_ratio.set_ylabel('Data/MC')