#!/usr/bin/python import os,sys ## __________ check usage __________ if len(sys.argv)!=2: print 'make_most_of_fiducial_plot.py treesum.root' sys.exit(1) ## __________ ROOT __________ print 'importing ROOT...' from ROOT import * from clean_canvas import * from nice_colours import * gStyle = makegstyle(gStyle) gStyle = nice_colours(gStyle) print '...done' ## __________ read in histo __________ f = TFile(sys.argv[1]) h = f.Get('Michel/Spectrum_Selected').Clone() h.SetTitle(';momentum (MeV/c); cos#theta') h.GetXaxis().CenterTitle() h.GetYaxis().CenterTitle() h.GetXaxis().SetDecimals() h.GetYaxis().SetDecimals() h.GetYaxis().SetTitleOffset(1.4) h.SetMaximum(125000)#TMP ## __________ drawing __________ c1 = TCanvas('c1','c1',0,0,800,800) c1.SetLeftMargin(.12) c1.SetRightMargin(.15) c1.SetTopMargin(.14) c1.Range(-9.041095,-1.25,66.30137,1.25) h.Draw('colz') ## __________ add fiducial lines __________ from robs_draw_fiducial import * ls = fiducial_lines() for l in ls: l.SetLineStyle(9) l.SetLineColor(10) l.Draw('same') ## __________ Here comes the mess __________ pts = [] pts.append(TPaveText(8.090797,0.2719298,15.6629,0.5015077,"br")) pts[-1].AddText("p_{z}^{min}") pts.append(TPaveText(12.1608,1.060033,19.25965,1.306743,"br")) pts[-1].AddText("p_{t}^{min}") pts.append(TPaveText(30.10327,0.04957265,42.97762,0.2581197,"br")) pts[-1].AddText("|cos#theta|^{min}") pts.append(TPaveText(37.96041,1.14359,50.7401,1.34188,"br")) pts[-1].AddText("|cos#theta|^{max}") pts.append(TPaveText(55.56799,1.14359,64.08778,1.338462,"br")) pts[-1].AddText("p^{max}") pts.append(TPaveText(47.65506,0.1245888,55.79507,0.3473136,"br")) pts[-1].AddText("p_{t}^{max}") for pt in pts: pt.SetBorderSize(1) pt.SetFillColor(10) pt.Draw('same') ar = [] ar.append(TArrow(19.31153,1.05812,21.77281,0.9111111,0.05,">")) ar.append(TArrow(16.28227,0.4188034,21.01549,0.6068376,0.05,">")) ar.append(TArrow(36.44578,0.2888889,36.44578,0.5042735,0.05,">")) ar.append(TArrow(44.87091,1.129915,44.77625,0.982906,0.05,">")) ar.append(TArrow(57.46127,1.102564,52.3494,0.8598291,0.05,">")) ar.append(TArrow(51.34646,0.3644463,48.79087,0.5666118,0.05,">")) for a in ar: a.SetFillColor(1) a.SetFillStyle(1001) a.SetLineColor(2) a.SetLineWidth(3) a.Draw() c1.Update() au = raw_input('>')