def make_scatter_plots_pls(sig_name, bkg_name): hname = sig_name h = histograms[hname] h.SetMinimum(h.ymin) h.SetMaximum(h.ymax) h.Draw() n = len(h.data) # hname = bkg_name h = histograms[hname] g = Graph(n) # truncate data = h.data[:n] # truncate for i, (xx, yy) in enumerate(data): g.SetPoint(i, xx, yy) g.markerstyle = 4 g.markercolor = 'black' g.Draw("p") keepalive(gPad.func(), g) # hname = sig_name h = histograms[hname] g = Graph(n) data = h.data for i, (xx, yy) in enumerate(data): g.SetPoint(i, xx, yy) g.markerstyle = 4 g.markercolor = 'red' g.Draw("p") keepalive(gPad.func(), g) gPad.Print(options.outdir + hname + ".png") return
def selectLowMass(row): return row.MassDREtFSR < 110. for ana in ['full', 'z4l']: if ana == 'z4l': selector = selectLowMass else: selector = lambda *args: True g = {} for ch in plotter.channels: g[ch] = Graph(plotter.ntuples['data']['data'][ch].GetEntries(), title=titles[ch]) g[ch].color = colors[ch] g[ch].markerstyle = markers[ch] g[ch].drawstyle = 'P' g[ch].SetMarkerSize(g[ch].GetMarkerSize()*1.5) if ch == 'mmmm': g[ch].SetMarkerSize(g[ch].GetMarkerSize()*1.18) for ch in plotter.channels: #nWithFSR = 0 for i, row in enumerate(plotter.ntuples['data']['data'][ch]): if selector(row): g[ch].SetPoint(i, getMZ1[ch](row), getMZ2[ch](row)) #if row.Mass != row.MassDREtFSR: # nWithFSR += 1 #print "%s: %d / %d"%(ch, nWithFSR, int(plotter.ntuples['data']['data'][ch].GetEntries())) #for gr in g.values():
ROOT.gStyle.SetOptStat(0) fitfile = root_open('%s/MaxLikeFit.root' % basedir) fit = fitfile.fit_s pars = asrootpy(fit.floatParsFinal()) fitted = None if args.conly: fitted = ROOT.TArrow(pars['charmSF'].value, 2, pars['charmSF'].value, 1, 0.025, '|>') fitted.SetLineWidth(3) fitted.SetLineColor(ROOT.kBlue) fitted.SetFillColor(ROOT.kBlue) else: fitted = Graph(1) fitted.SetPoint(0, pars['charmSF'].value, pars['lightSF'].value) fitted.markerstyle = 20 fitted.markersize = 3 fitted.markercolor = '#009600' def addlabels(h): h.xaxis.title = 'charm SF' h.yaxis.title = 'light SF' h.xaxis.SetTitleOffset(0.9) h.yaxis.SetTitleOffset(1.2 if args.conly else 1.) addlabels(cbias) addlabels(failing) addlabels(ccover) if args.conly:
# points x = np.sort(np.random.random(10)) * 3500 y = np.random.random(10) # set style for ROOT set_style('ATLAS') # create graph graph = Graph(x.shape[0]) for i, (xx, yy) in enumerate(zip(x, y)): graph.SetPoint(i, xx, yy) # set visual attributes graph.linecolor = 'blue' graph.markercolor = 'blue' graph.markerstyle = 'diamond' graph.xaxis.SetTitle("E_{T} [GeV]") graph.yaxis.SetTitle("d#sigma_{jet}/dE_{T,jet} [fb/GeV]") graph.xaxis.SetRangeUser(0, 3500) graph.yaxis.SetRangeUser(0, 1) # plot with ROOT canvas = Canvas() graph.Draw("APL") label = ROOT.TText(0.4, 0.8, "ROOT") label.SetTextFont(43) label.SetTextSize(25) label.SetNDC() label.Draw() canvas.Modified()