def argus(opts, args, figname): ''' ARGUS funcion: a(m; m0, xi, p) = A*m*(1- m^2/m0^2)^p * exp(xi*(1-m^2/m0^2)) ''' canvas = TCanvas("aCanvas", "Canvas", 600, 600) m0 = parse_opts_set(opts.set, 'm0') xi = parse_opts_set(opts.set, 'xi') p = parse_opts_set(opts.set, 'p') fun = 'x*TMath::Power((1-x**2/[0]**2),[2])*exp([1]*(1-x**2/[0]**2))' f1 = TF1('argus', fun, 1.83, 1.86) f1.SetParName(0, 'Resonance mass') f1.SetParName(1, 'Slope parameter') f1.SetParName(2, 'Power') f1.SetParameter(0, m0) f1.SetParameter(1, xi) f1.SetParameter(2, p) f1.Draw() canvas_output(canvas, figname, opts.test)
def momentum_pi(opts, args, figname): parsed = parse_args(args) datatype = parsed[0] tag = parsed[1] modes = parsed[2] label = parsed[3] if len(modes) > 1: raise ValueError(modes, 'Only handle one mode at this time!') mode = modes[0] modekey, sign = get_modekey_sign(mode) modename = attr.modes[modekey]['uname'] rootfile = get_rootfile(datatype, mode, label) pt = add_rootfile(rootfile, debug=opts.debug) canvas = ROOT.TCanvas("aCanvas", "Canvas", 600, 600) hist = ROOT.TH1F('pip', '#pi momentum in %s' %modename, 100, 0, 1) num = 0 for pte in pt: if opts.test and num >1000: break d =chooseD(modekey, pte, sign) if d != None: num += 1 npi = pte.ddau2[d] pipx = pte.trpipx[npi] pipy = pte.trpipy[npi] pipz = pte.trpipz[npi] pip = sqrt(pipx**2 + pipy**2 + pipz**2) hist.Fill(pip) hist.Draw() canvas_output(canvas, figname, opts.test) hist.Delete()
def deltae(opts, args, figname): parsed = parse_args(args) datatype = parsed[0] tag = parsed[1] modes = parsed[2] label = parsed[3] alt_deltae = {'decutl': -1, 'decuth': 1} canvas = ROOT.TCanvas("aCanvas", "Canvas", 1000, 1000) canvas.Divide(3,3) deltae_hist = {} hist = ROOT.TH1F('deltae', 'DeltaE', 100, -0.1, 0.1) pad = 1 for mode in modes: frametitle = tools.get_mode_root_name(mode) canvas.cd(pad) pad += 1 modekey, sign = get_modekey_sign(mode) deltae_hist[modekey] = ROOT.TH1F('deltae-%s' % modekey, frametitle, 100, -0.1, 0.1) rootfile = get_rootfile(datatype, mode, label) pt = add_rootfile(rootfile, debug=opts.debug) for pte in pt: d =chooseD(modekey, pte, sign, alt_deltae=alt_deltae) if d != None: deltae_hist[modekey].Fill(pte.ddeltae[d]) deltae_hist[modekey].Draw() canvas_output(canvas, figname, opts.test)
def mbc(opts, args, figname): parsed = parse_args(args) datatype = parsed[0] tag = parsed[1] modes = parsed[2] label = parsed[3] if len(modes) > 1: raise ValueError(modes) labels = [label] if ',' in label: labels = label.split(',') figname = shorten_figname(figname) mode = modes[0] modekey, sign = get_modekey_sign(mode) modename = attr.modes[modekey]['uname'] frametitle = modename hnames = parse_opts_set(opts.set, 'legend') if hnames: hist_names = hnames.split(',') else: hist_names = labels nBins = 100 Xmin = 1.83 Xmax = 1.89 hist_list = [] for label, hist_name in zip(labels, hist_names): hist_title = frametitle hist = ROOT.TH1D(hist_name, hist_title, nBins, Xmin, Xmax) rootfile = get_rootfile(datatype, mode, label) pt = add_rootfile(rootfile, debug=opts.debug) ntotal = 0 nselected = 0 for pte in pt: ntotal += 1 d =chooseD(modekey, pte, sign, opt=label) if d != None: hist.Fill(pte.dmbc[d]) nselected += 1 sys.stdout.write('Selected %s out of %s. \n' %(nselected, ntotal)) hist_list.append(hist) xtitle = 'mBC (GeV)' legend = ROOT.TLegend(0.66, 0.8, 0.9, 0.9) canvas = draw_hist(hist_list, xtitle, legend) Logy = parse_opts_set(opts.set, 'SetLogy') if Logy != None: canvas.SetLogy(Logy) canvas_output(canvas, figname, opts.test) hist.Delete()
def kpimass0(opts, args, figname): parsed = parse_args(args) datatype = parsed[0] tag = parsed[1] modes = parsed[2] label = parsed[3] mode = modes[0] modekey = tools.get_modekey(mode) binbase = parse_opts_set(opts.set, 'binbase') binwidth = parse_opts_set(opts.set, 'binwidth') numbins = parse_opts_set(opts.set, 'numbins') dbfile = os.path.join(attr.figpath, label, figname + '.db') fullrangedata, fullrangemc = get_fullrange_data_mc(opts, dbfile, label, 'kpimass', modekey, tag, binbase, binwidth, numbins) scaledict(fullrangedata, 1 / sumdict(fullrangedata)) scaledict(fullrangemc, 1 / sumdict(fullrangemc)) gdata = TGraph(len(fullrangedata['x']), getarray('x', fullrangedata), getarray('y', fullrangedata)) gmc = TGraph(len(fullrangemc['x']), getarray('x', fullrangemc), getarray('y', fullrangemc)) c1 = TCanvas('c', 'kpi', 600, 600) c1.SetLeftMargin(0.15) c1.SetRightMargin(0.05) c1.SetBottomMargin(0.15) c1.SetTopMargin(0.05) hr = c1.DrawFrame(0.5, 0.0, 1.5, 0.04) hr.GetYaxis().SetTitle('Yield (arbitrary units)') hr.GetXaxis().SetTitle('M(K^{-} #pi^{+}) (GeV/#font[72]{c}^{2})') hr.GetYaxis().SetTitleOffset(1.4) hr.GetYaxis().SetTitleSize(0.05) hr.GetXaxis().SetTitleOffset(1.3) hr.GetXaxis().SetTitleSize(0.05) gmc.SetMarkerStyle(21) gmc.SetMarkerColor(kRed) gmc.SetMarkerSize(0.6) gmc.SetLineColor(kRed) gmc.Draw("PL") gdata.SetMarkerStyle(20) gdata.SetMarkerColor(kBlue) gdata.SetMarkerSize(0.6) gdata.Draw("P") leg = TLegend(0.6, 0.75, 0.95, 0.95) leg.AddEntry(gdata, 'Data', 'pl') leg.AddEntry(gmc, 'MC', 'pl') leg.Draw() canvas_output(c1, figname, label, opts.test)
def kpimass0(opts, args, figname): parsed = parse_args(args) datatype = parsed[0] tag = parsed[1] modes = parsed[2] label = parsed[3] mode = modes[0] modekey = tools.get_modekey(mode) binbase = parse_opts_set(opts.set, 'binbase') binwidth = parse_opts_set(opts.set, 'binwidth') numbins = parse_opts_set(opts.set, 'numbins') dbfile = os.path.join(attr.figpath, label, figname+'.db') fullrangedata, fullrangemc = get_fullrange_data_mc( opts, dbfile, label, 'kpimass', modekey, tag, binbase, binwidth, numbins) scaledict(fullrangedata, 1/sumdict(fullrangedata)) scaledict(fullrangemc, 1/sumdict(fullrangemc)) gdata = TGraph(len(fullrangedata['x']), getarray('x', fullrangedata), getarray('y', fullrangedata)) gmc = TGraph(len(fullrangemc['x']), getarray('x', fullrangemc), getarray('y', fullrangemc)) c1 = TCanvas('c','kpi', 600, 600) c1.SetLeftMargin(0.15) c1.SetRightMargin(0.05) c1.SetBottomMargin(0.15) c1.SetTopMargin(0.05) hr = c1.DrawFrame(0.5, 0.0, 1.5, 0.04) hr.GetYaxis().SetTitle('Yield (arbitrary units)') hr.GetXaxis().SetTitle('M(K^{-} #pi^{+}) (GeV/#font[72]{c}^{2})') hr.GetYaxis().SetTitleOffset(1.4) hr.GetYaxis().SetTitleSize(0.05) hr.GetXaxis().SetTitleOffset(1.3) hr.GetXaxis().SetTitleSize(0.05) gmc.SetMarkerStyle(21) gmc.SetMarkerColor(kRed) gmc.SetMarkerSize(0.6) gmc.SetLineColor(kRed) gmc.Draw("PL") gdata.SetMarkerStyle(20) gdata.SetMarkerColor(kBlue) gdata.SetMarkerSize(0.6) gdata.Draw("P") leg = TLegend(0.6, 0.75, 0.95, 0.95) leg.AddEntry(gdata, 'Data', 'pl') leg.AddEntry(gmc, 'MC', 'pl') leg.Draw() canvas_output(c1, figname, label, opts.test)
def kpimass(opts, args, figname): var = 'kpimass' parsed = parse_args(args) datatype = parsed[0] tag = parsed[1] modes = parsed[2] label = parsed[3] if len(modes) > 1: raise ValueError(modes, 'Only handle one mode at this time!') mode = modes[0] if ',' in datatype: datatypes = datatype.split(',') else: datatypes = [datatype] hist_list = [] nBins = 100 Xmin = 0.5 Xmax = 1.5 labels = [label, label] hist_names = ['Signal MC', 'Data'] modekey, sign = get_modekey_sign(mode) modename = attr.modes[modekey]['uname'] hist_title = 'K^{-} #pi^{+} mass in %s' % modename for datatype, hist_name in zip(datatypes, hist_names): hist = ROOT.TH1D(hist_name, hist_title, nBins, Xmin, Xmax) evtfile = get_evtfile_kkmass(datatype, mode, label, var, test=opts.test) f = open(evtfile, 'r') for line in f: kpimass = float(line.split()[2]) hist.Fill(kpimass) hist_list.append(hist) xtitle = 'M(K^{+}#pi^{-}) (GeV/c^{2})' legend = ROOT.TLegend(0.1, 0.8, 0.3, 0.9) canvas = tools.draw_hist(hist_list, xtitle, legend, reverse=True) canvas_output(canvas, figname, label, opts.test, outputhtml=False) hist.Delete()
def momentum_pi0(opts, args, figname): parsed = parse_args(args) datatype = parsed[0] tag = parsed[1] modes = parsed[2] label = parsed[3] if len(modes) > 1: raise ValueError(modes, 'Only handle one mode at this time!') mode = modes[0] modekey, sign = get_modekey_sign(mode) modename = attr.modes[modekey]['uname'] rootfile = get_rootfile(datatype, mode, label) pt = add_rootfile(rootfile, debug=opts.debug) #canvas = ROOT.TCanvas("aCanvas", "Canvas", 900, 900) var = 'pi0p' title = modename unit = 'GeV' nBins = 100 Xmin = 0. Xmax = 1. xtitle = '#pi^{0} momentum (GeV)' ytitle = 'Events / (%s %s)' % ((Xmax-Xmin)/nBins, unit) hist = ROOT.TH1F(var, title, nBins, Xmin, Xmax) num = 0 for pte in pt: if opts.test and num >1000: break d =chooseD(modekey, pte, sign) if d != None: num += 1 if modekey == 1 or modekey == 203: npi0 = pte.ddau3[d] if modekey == 201: npi0 = pte.ddau4[d] pi0px = pte.pi0px[npi0] pi0py = pte.pi0py[npi0] pi0pz = pte.pi0pz[npi0] pi0p = sqrt(pi0px**2 + pi0py**2 + pi0pz**2) hist.Fill(pi0p) canvas = draw_hist(hist, xtitle, ytitle) canvas_output(canvas, figname, label, test=opts.test)
def ksmass(opts, args, figname): parsed = parse_args(args) datatype = parsed[0] tag = parsed[1] modes = parsed[2] label = parsed[3] var = 'ksmass' varname = 'K_{S} mass' unit = 'GeV' nBins = 100 Xmin = 0.45 Xmax = 0.55 if len(modes) > 1: raise ValueError(modes, 'Only handle one mode at this time!') mode = modes[0] modekey, sign = get_modekey_sign(mode) modename = attr.modes[modekey]['uname'] histname = '%s in %s' %(varname, modename) rootfile = get_rootfile(datatype, mode, label) pt = add_rootfile(rootfile, debug=opts.debug) canvas = ROOT.TCanvas("aCanvas", "Canvas", 600, 600) hist = ROOT.TH1F(var, histname, nBins, Xmin, Xmax) ntotal = 0 nselected = 0 def alt_checkVetoes(mode, pte, index, opt='', sign=None): return True if modekey not in (202, 203, 204): raise ValueError(modekey) for pte in pt: ntotal += 1 if opts.test and ntotal >1000: break d =chooseD(modekey, pte, sign, checkVetoes=alt_checkVetoes) if d != None: nselected += 1 ksmass = pte.ksmass[pte.ddau1[d]] hist.Fill(ksmass) hist.Draw() canvas_output(canvas, figname, opts.test) hist.Delete() sys.stdout.write(' selected %s out of %s.\n' % (nselected, ntotal))
def pi0mass(opts, args, figname): var = 'pi0mass' varname = '#pi^{0} mass' unit = 'GeV' nBins = 100 Xmin = 0.115 Xmax = 0.16 parsed = parse_args(args) datatype = parsed[0] tag = parsed[1] modes = parsed[2] label = parsed[3] figname = shorten_figname(figname) mode = modes[0] modekey = get_modekey(mode) modename = attr.modes[modekey]['uname'] frametitle = '#pi^{0} mass in %s' % modename labels = [label] if ',' in label: labels = label.split(',') hnames = parse_opts_set(opts.set, 'legend') if hnames: hist_names = hnames.split(',') else: hist_names = labels hist_list = [] for label, hist_name in zip(labels, hist_names): hist_title = frametitle hist = ROOT.TH1D(hist_name, hist_title, nBins, Xmin, Xmax) evtfile = get_evtfile(datatype, mode, label, var, test=False) hist = tools.fill_hist_evtfile(hist, evtfile) hist_list.append(hist) xtitle = '%s (%s)' %(varname, unit) legend = ROOT.TLegend(0.66, 0.8, 0.9, 0.9) canvas = draw_hist(hist_list, xtitle, legend) canvas_output(canvas, figname, test=opts.test)
def mass_kk(opts, args, figname): parsed = parse_args(args) datatype = parsed[0] tag = parsed[1] modes = parsed[2] label = parsed[3] if len(modes) > 1: raise ValueError(modes, 'Only handle one mode at this time!') mode = modes[0] modekey, sign = get_modekey_sign(mode) modename = attr.modes[modekey]['uname'] rootfile = get_rootfile(datatype, mode, label) pt = add_rootfile(rootfile, debug=opts.debug) canvas = ROOT.TCanvas("aCanvas", "Canvas", 600, 600) hist = ROOT.TH1F('kkmass', 'KK mass in %s' %modename, 100, 0, 2) hist.SetXTitle('M(K^{+}K^{-}) (GeV/c^{2})') num = 0 for pte in pt: if opts.test and num >10000: break d =chooseD(modekey, pte, sign) if modekey != 205: raise NameError(modekey) if d != None: num += 1 kaons = [pte.ddau1[d], pte.ddau2[d]] fourvecs = [] for index in kaons: fourvecs.append([pte.trke[index], pte.trkpy[index], pte.trkpy[index], pte.trkpz[index]]) kkmass = invmass(fourvecs[0], fourvecs[1]) hist.Fill(kkmass) hist.Draw() canvas_output(canvas, figname, label, opts.test, outputroot=True) hist.Delete()
def momentum_K(opts, args, figname): parsed = parse_args(args) datatype = parsed[0] tag = parsed[1] modes = parsed[2] label = parsed[3] if len(modes) > 1: raise ValueError(modes, 'Only handle one mode at this time!') mode = modes[0] modekey, sign = get_modekey_sign(mode) modename = attr.modes[modekey]['uname'] rootfile = get_rootfile(datatype, mode, label) pt = add_rootfile(rootfile, debug=opts.debug) canvas = ROOT.TCanvas("aCanvas", "Canvas") pmax = 1 if modekey == 0: pmax = 1.5 hist = ROOT.TH1F('K', 'K momentum in %s' %modename, 100, 0, pmax) num = 0 for pte in pt: if opts.test and num >1000: break d =chooseD(modekey, pte, sign) if d != None: num += 1 nK = pte.ddau1[d] Kpx = pte.trkpx[nK] Kpy = pte.trkpy[nK] Kpz = pte.trkpz[nK] Kp = sqrt(Kpx**2 + Kpy**2 + Kpz**2) hist.Fill(Kp) hist.Draw() canvas_output(canvas, figname, opts.test) hist.Delete()
def mass_pi0(opts, args, figname): parsed = parse_args(args) datatype = parsed[0] tag = parsed[1] modes = parsed[2] label = parsed[3] if len(modes) > 1: raise ValueError(modes, 'Only handle one mode at this time!') mode = modes[0] modekey, sign = get_modekey_sign(mode) modename = attr.modes[modekey]['uname'] rootfile = get_rootfile(datatype, mode, label) print rootfile, label sys.exit() pt = add_rootfile(rootfile, debug=opts.debug) canvas = ROOT.TCanvas("aCanvas", "Canvas") hist = ROOT.TH1F('pi0mass', '#pi^{0} mass in %s' %modename, 100, 0.1, 0.2) num = 0 for pte in pt: if opts.test and num >1000: break d =chooseD(modekey, pte, sign) if d != None: num += 1 if modekey == 1 or modekey == 203: npi0 = pte.ddau3[d] if modekey == 201: npi0 = pte.ddau4[d] pi0mass = pte.pi0mass[npi0] hist.Fill(pi0mass) hist.Draw() canvas_output(canvas, figname, opts.test) hist.Delete()
def kkmass1(opts, args, figname): parsed = parse_args(args) datatype = parsed[0] tag = parsed[1] modes = parsed[2] label = parsed[3] mode = modes[0] modekey = tools.get_modekey(mode) binbase = parse_opts_set(opts.set, 'binbase') binwidth = parse_opts_set(opts.set, 'binwidth') numbins = parse_opts_set(opts.set, 'numbins') nohtml = parse_opts_set(opts.set, 'nohtml') if nohtml == None: outputhtml = True else: outputhtml = False dbfile = os.path.join(attr.figpath, label, figname+'.db') alldata, fullrangemc = get_fullrange_data_mc( opts, dbfile, label, 'kkmass', modekey, tag, binbase, binwidth, numbins) fullrangedata = {} init_dict(fullrangedata) evtpath = os.path.join(attr.datpath, 'sel', label, 'kkmass') evtfilemc = tools.set_file('evt', 'signal', modekey, tag, prefix='', forceCombine=1, extbase=evtpath) for i in xrange(numbins): lowmass = binbase+i*binwidth highmass = binbase+(i+1)*binwidth prefix = 'dir_%s/kkmass/%s_%s' % (label, lowmass, highmass) datafile = tools.set_file('txt', 'data', modekey, tag, prefix=prefix, extbase=attr.fitpath) if os.access(datafile, os.F_OK): parsefile(datafile, lowmass, highmass, fullrangedata) else: sys.stdout.write('Skipped %s %s ...\n' % (lowmass, highmass)) scaledict(fullrangedata, 1/sumdict(fullrangedata)) scaledict(fullrangemc, 1/sumdict(fullrangemc)) gdata = TGraphAsymmErrors(len(fullrangedata['x']), getarray('x', fullrangedata), getarray('y', fullrangedata), getarray('exl', fullrangedata), getarray('exh', fullrangedata), getarray('eyl', fullrangedata), getarray('eyh', fullrangedata)) gmc = TGraph(len(fullrangemc['x']), getarray('x', fullrangemc), getarray('y', fullrangemc)) c1 = TCanvas('c','kk', 600, 600) c1.SetLeftMargin(0.15) c1.SetRightMargin(0.05) c1.SetBottomMargin(0.15) c1.SetTopMargin(0.05) #hr = c1.DrawFrame(0.5, 0.0, 1.5, 0.04) hr = c1.DrawFrame(0.9, 0.0, 1.8, 0.1) hr.GetYaxis().SetTitle('Yield (arbitrary units)') hr.GetXaxis().SetTitle('M(K^{-} #pi^{+}) (GeV/#font[72]{c}^{2})') hr.GetYaxis().SetTitleOffset(1.4) hr.GetYaxis().SetTitleSize(0.05) hr.GetXaxis().SetTitleOffset(1.3) hr.GetXaxis().SetTitleSize(0.05) gmc.SetMarkerStyle(21); gmc.SetMarkerColor(kRed); gmc.SetMarkerSize(0.6) gmc.SetLineColor(kRed) gmc.Draw("PL") gdata.SetMarkerStyle(20); gdata.SetMarkerColor(kBlue); gdata.SetMarkerSize(0.6) gdata.Draw("P") leg = TLegend(0.6, 0.75, 0.92, 0.92) leg.AddEntry(gdata, 'Data', 'pl') leg.AddEntry(gmc, 'MC', 'pl') leg.SetFillColor(0) leg.SetBorderSize(0) leg.Draw() canvas_output(c1, figname, label, opts.test, outputhtml=outputhtml)
def momentum_pim_KS(opts, args, figname): parsed = parse_args(args) datatype = parsed[0] tag = parsed[1] modes = parsed[2] label = parsed[3] if len(modes) > 1: raise ValueError(modes, 'Only handle one mode at this time!') labels = [label] if ',' in label: labels = label.split(',') figname = shorten_figname(figname) mode = modes[0] modekey, sign = get_modekey_sign(mode) modename = attr.modes[modekey]['uname'] frametitle = modename if modekey not in (202, 203, 204): raise ValueError(modekey) hnames = parse_opts_set(opts.set, 'legend') if hnames: hist_names = hnames.split(',') else: hist_names = labels nBins = 100 Xmin = 0 Xmax = 1 xtitle = '#pi^{-} (K_{S}) momentum (GeV)' legend = ROOT.TLegend(0.75, 0.8, 0.95, 0.9) hist_list = [] for label, hist_name in zip(labels, hist_names): hist_title = frametitle hist = ROOT.TH1D(hist_name, hist_title, nBins, Xmin, Xmax) rootfile = get_rootfile(datatype, mode, label) pt = add_rootfile(rootfile, debug=opts.debug) ntotal = 0 nselected = 0 for pte in pt: ntotal += 1 if opts.test and ntotal >80000: break d =chooseD(modekey, pte, sign, opt=label) if d != None: nks = pte.ddau1[d] npi = pte.ksdau2[nks] pipx = pte.trpipx[npi] pipy = pte.trpipy[npi] pipz = pte.trpipz[npi] pip = sqrt(pipx**2 + pipy**2 + pipz**2) hist.Fill(pip) nselected += 1 sys.stdout.write('%s: Selected %s out of %s. \n' %( label,nselected, ntotal)) hist_list.append(hist) canvas = draw_hist(hist_list, xtitle, legend) canvas_output(canvas, figname, opts.test) hist.Delete()
def kkmass1(opts, args, figname): parsed = parse_args(args) datatype = parsed[0] tag = parsed[1] modes = parsed[2] label = parsed[3] mode = modes[0] modekey = tools.get_modekey(mode) binbase = parse_opts_set(opts.set, 'binbase') binwidth = parse_opts_set(opts.set, 'binwidth') numbins = parse_opts_set(opts.set, 'numbins') nohtml = parse_opts_set(opts.set, 'nohtml') if nohtml == None: outputhtml = True else: outputhtml = False dbfile = os.path.join(attr.figpath, label, figname + '.db') alldata, fullrangemc = get_fullrange_data_mc(opts, dbfile, label, 'kkmass', modekey, tag, binbase, binwidth, numbins) fullrangedata = {} init_dict(fullrangedata) evtpath = os.path.join(attr.datpath, 'sel', label, 'kkmass') evtfilemc = tools.set_file('evt', 'signal', modekey, tag, prefix='', forceCombine=1, extbase=evtpath) for i in xrange(numbins): lowmass = binbase + i * binwidth highmass = binbase + (i + 1) * binwidth prefix = 'dir_%s/kkmass/%s_%s' % (label, lowmass, highmass) datafile = tools.set_file('txt', 'data', modekey, tag, prefix=prefix, extbase=attr.fitpath) if os.access(datafile, os.F_OK): parsefile(datafile, lowmass, highmass, fullrangedata) else: sys.stdout.write('Skipped %s %s ...\n' % (lowmass, highmass)) scaledict(fullrangedata, 1 / sumdict(fullrangedata)) scaledict(fullrangemc, 1 / sumdict(fullrangemc)) gdata = TGraphAsymmErrors(len(fullrangedata['x']), getarray('x', fullrangedata), getarray('y', fullrangedata), getarray('exl', fullrangedata), getarray('exh', fullrangedata), getarray('eyl', fullrangedata), getarray('eyh', fullrangedata)) gmc = TGraph(len(fullrangemc['x']), getarray('x', fullrangemc), getarray('y', fullrangemc)) c1 = TCanvas('c', 'kk', 600, 600) c1.SetLeftMargin(0.15) c1.SetRightMargin(0.05) c1.SetBottomMargin(0.15) c1.SetTopMargin(0.05) #hr = c1.DrawFrame(0.5, 0.0, 1.5, 0.04) hr = c1.DrawFrame(0.9, 0.0, 1.8, 0.1) hr.GetYaxis().SetTitle('Yield (arbitrary units)') hr.GetXaxis().SetTitle('M(K^{-} #pi^{+}) (GeV/#font[72]{c}^{2})') hr.GetYaxis().SetTitleOffset(1.4) hr.GetYaxis().SetTitleSize(0.05) hr.GetXaxis().SetTitleOffset(1.3) hr.GetXaxis().SetTitleSize(0.05) gmc.SetMarkerStyle(21) gmc.SetMarkerColor(kRed) gmc.SetMarkerSize(0.6) gmc.SetLineColor(kRed) gmc.Draw("PL") gdata.SetMarkerStyle(20) gdata.SetMarkerColor(kBlue) gdata.SetMarkerSize(0.6) gdata.Draw("P") leg = TLegend(0.6, 0.75, 0.92, 0.92) leg.AddEntry(gdata, 'Data', 'pl') leg.AddEntry(gmc, 'MC', 'pl') leg.SetFillColor(0) leg.SetBorderSize(0) leg.Draw() canvas_output(c1, figname, label, opts.test, outputhtml=outputhtml)