def main(): from optparse import OptionParser parser = OptionParser() parser.add_option("-i", "--inputfile", dest="inputfile") parser.add_option("-m", "--model", dest="model", type="string") (options, args) = parser.parse_args() from ROOT import TFile, TMultiGraph, TCanvas, TLegend from Styles import formatXsecCL import configurations as config from ROOT import gStyle gStyle.SetPadTopMargin(0.05) gStyle.SetPadRightMargin(0.05) infile = TFile(options.inputfile, "READ") infile_xsec = TFile(config.bh_xsec, "READ") store = [] for n in config.extraDim_list: c = TCanvas("%s-n%d" % (options.model,n),\ "%s-n%d" % (options.model,n),\ 500, 500) store.append(c) graphs = TMultiGraph() store.append(graphs) legend = TLegend(0.5266129,0.5360169,0.9476613,0.9364407) legend.SetTextSize(0.02966102); legend.SetFillColor(0) legend.SetLineColor(0) legend.SetHeader("n = %d" % n) store.append(legend) for i,MD in enumerate(config.MD_list): gCL95 = infile.Get("%s-MD%.1f_n%d-CL95" % (options.model, MD, n)) gXsec = infile_xsec.Get("%s-MD%.1f_n%d" % (options.model, MD, n)) if gCL95 and gXsec: legend.AddEntry(gCL95, "M_{D} = %.1f TeV Observed" % MD, "l") formatXsecCL(gCL95, i, 1) graphs.Add(gCL95, "l") legend.AddEntry(gXsec, "M_{D} = %.1f TeV Theoretical" % MD, "l") formatXsecCL(gXsec, i, 2) graphs.Add(gXsec, "c") graphs.Draw("a") graphs.GetXaxis().SetTitle("M_{BH}^{ min} (TeV)") graphs.GetYaxis().SetTitle("#sigma (pb)") graphs.GetYaxis().SetTitleOffset(1.2) graphs.GetXaxis().SetRangeUser(3.5,6.5) graphs.SetMinimum(1e-3) graphs.SetMaximum(1e2) c.SetLogy() legend.Draw("plain") c.Print("MassLimit_%s_n%d.pdf" % (options.model,n)) c.Update() raw_input("Press Enter to continue...")
def main(): from optparse import OptionParser parser = OptionParser() parser.add_option("-i", "--inputfile", dest="inputfile") parser.add_option("-m", "--model", dest="model", type="string") (options, args) = parser.parse_args() from ROOT import TFile, TMultiGraph, TCanvas, TLegend from Styles import formatXsecCL import configurations as config from ROOT import gStyle gStyle.SetPadTopMargin(0.05) gStyle.SetPadRightMargin(0.05) infile = TFile(options.inputfile, "READ") infile_xsec = TFile(config.bh_xsec, "READ") store = [] for n in config.extraDim_list: c = TCanvas("%s-n%d" % (options.model,n),\ "%s-n%d" % (options.model,n),\ 500, 500) store.append(c) graphs = TMultiGraph() store.append(graphs) legend = TLegend(0.5266129, 0.5360169, 0.9476613, 0.9364407) legend.SetTextSize(0.02966102) legend.SetFillColor(0) legend.SetLineColor(0) legend.SetHeader("n = %d" % n) store.append(legend) for i, MD in enumerate(config.MD_list): gCL95 = infile.Get("%s-MD%.1f_n%d-CL95" % (options.model, MD, n)) gXsec = infile_xsec.Get("%s-MD%.1f_n%d" % (options.model, MD, n)) if gCL95 and gXsec: legend.AddEntry(gCL95, "M_{D} = %.1f TeV Observed" % MD, "l") formatXsecCL(gCL95, i, 1) graphs.Add(gCL95, "l") legend.AddEntry(gXsec, "M_{D} = %.1f TeV Theoretical" % MD, "l") formatXsecCL(gXsec, i, 2) graphs.Add(gXsec, "c") graphs.Draw("a") graphs.GetXaxis().SetTitle("M_{BH}^{ min} (TeV)") graphs.GetYaxis().SetTitle("#sigma (pb)") graphs.GetYaxis().SetTitleOffset(1.2) graphs.GetXaxis().SetRangeUser(4.5, 7.5) graphs.SetMinimum(1e-4) graphs.SetMaximum(1) c.SetLogy() legend.Draw("plain") c.Print("MassLimit_%s_n%d.pdf" % (options.model, n)) c.Print("MassLimit_%s_n%d.png" % (options.model, n)) c.Update() raw_input("Press Enter to continue...")
def main(): import configurations as config import csv from ModelParser import ModelKey, GroupXsecLimit from ROOT import gStyle from Styles import marker gStyle.SetPadTopMargin(0.05) gStyle.SetPadRightMargin(0.05) from optparse import OptionParser parser = OptionParser() parser.add_option("-i", "--inputfile", dest="inputfile") (options, args) = parser.parse_args() models = [] with open(config.bh_list, 'rb') as f: reader = csv.reader(f) for r in reader: models.append(ModelKey(r[0])) from ROOT import TFile, TMultiGraph, TGraph, TLegend, TCanvas infile_xsec = TFile(config.bh_xsec, "READ") infile_CL = TFile(options.inputfile, "READ") from OptimizationTools import Bisection from Styles import formatXsecCL, formatExcludedMass store = [] mg = TMultiGraph() legend1 = TLegend(0.3241611,0.49,0.746644,0.69) legend1.SetHeader("Observed Cross Section Limits") legend1.SetTextSize(0.037) legend1.SetTextFont(42) legend1.SetFillColor(0) legend1.SetLineColor(0) legend2 = TLegend(0.3241611,0.68,0.746644,0.88) legend2.SetHeader("Theoretical Cross Section") legend2.SetTextSize(0.037) legend2.SetTextFont(42) legend2.SetFillColor(0) legend2.SetLineColor(0) legend3 = TLegend(0.3241611,0.8806993,0.886644,0.9273427) legend3.SetHeader("String Ball (BlackMax)") legend3.SetTextSize(0.037) legend3.SetTextFont(42) legend3.SetFillColor(0) legend3.SetLineColor(0) iColor = 0 iStyle = 2 #for key, group in ModelLimitGroup(models).items(): for key, group in GroupXsecLimit(models).items(): if not "SB" in key: continue name = ModelKey(key).name gXsec = infile_xsec.Get(key) formatXsecCL(gXsec, iColor, iStyle) mg.Add(gXsec, "c") legend2.AddEntry(gXsec, config.model_description[name], "l") gCL95 = infile_CL.Get("%s-CL95" % key) formatXsecCL(gCL95, iColor, 1) mg.Add(gCL95, "pl") legend1.AddEntry(gCL95, config.model_description[name], "pl") iColor += 1 iStyle += 2 c = TCanvas("SB_BM", "SB_BM", 500, 500) c.SetLogy() mg.Draw("A") mg.GetXaxis().SetTitle("M^{ min} (TeV)") mg.GetXaxis().SetRangeUser(3.9,7.1) mg.GetYaxis().SetRangeUser(1e-4,50) mg.GetYaxis().SetTitle("#sigma (pb)") mg.GetYaxis().SetTitleOffset(1.05) mg.GetYaxis().SetTitleSize(0.045) mg.GetYaxis().SetLabelSize(0.045) mg.GetXaxis().SetTitleSize(0.045) mg.GetXaxis().SetLabelSize(0.045) legend1.Draw("plain") legend2.Draw("plain") legend3.Draw("plain") c.Update() from ROOT import TPaveText cmslabel = TPaveText(0.45,0.96,0.60,0.99,"brNDC") cmslabel.AddText(config.cmsTitle) cmslabel.SetTextSize(0.041) #cmslabel.AddText(config.cmsSubtitle) cmslabel.SetFillColor(0) cmslabel.Draw("plain") raw_input("Press Enter to continue...")
m.Nbkg) else: bkg_str = "$%.2f \pm %.2f$" % (m.Nbkg, m.NbkgErr) texfile.write("%.1f & %.1f & %d & %.2f & %d & %.1f & %.1f & %.2f & %d & %s & %.3f & %.3f\\\\\n"\ % (m.MD, m.M, m.n, m.xsec, m.Nmin, m.STmin/1000.0, m.A*100.0, m.Nsig,\ m.Ndata, bkg_str, m.cl95, m.cla)) #gxsec = TGraph(vx, vxsec) #gxsec.SetName("%s-MD%s_n%d-xsec" % (generator, MD, n)) #formatXsecCL(gxsec, icolor) #store.book(gxsec) gcl95 = TGraph(vx, vcl95) gcl95.SetName("%s-MD%.1f_n%d-CL95" % (generator, MD, n)) formatXsecCL(gcl95, icolor, 2) store.book(gcl95) gcla = TGraph(vx, vcla) gcla.SetName("%s-MD%.1f_n%d-CLA" % (generator, MD, n)) formatXsecCL(gcla, icolor, 3) store.book(gcla) #spline # n_interpolation = 10 # vx_spline = TVectorD((vsize-1) * n_interpolation) # vxsec_spline = TVectorD((vsize-1) * n_interpolation) # for i in range(vsize-1): # step = (vx[i+1] - vx[i]) / n_interpolation # for j in range(n_interpolation): # index = i*n_interpolation + j
bkg_str = "$%.2f ^{+%.2f}_{-%.2f}$" % (m.Nbkg, m.NbkgErr, m.Nbkg) else: bkg_str = "$%.2f \pm %.2f$" % (m.Nbkg, m.NbkgErr) texfile.write("%.1f & %.1f & %d & %.2f & %d & %.1f & %.1f & %.2f & %d & %s & %.3f & %.3f\\\\\n"\ % (m.MD, m.M, m.n, m.xsec, m.Nmin, m.STmin/1000.0, m.A*100.0, m.Nsig,\ m.Ndata, bkg_str, m.cl95, m.cla)) #gxsec = TGraph(vx, vxsec) #gxsec.SetName("%s-MD%s_n%d-xsec" % (generator, MD, n)) #formatXsecCL(gxsec, icolor) #store.book(gxsec) gcl95 = TGraph(vx, vcl95) gcl95.SetName("%s-MD%.1f_n%d-CL95" % (generator, MD, n)) formatXsecCL(gcl95, icolor, 2) store.book(gcl95) gcla = TGraph(vx, vcla) gcla.SetName("%s-MD%.1f_n%d-CLA" % (generator, MD, n)) formatXsecCL(gcla, icolor, 3) store.book(gcla) #spline # n_interpolation = 10 # vx_spline = TVectorD((vsize-1) * n_interpolation) # vxsec_spline = TVectorD((vsize-1) * n_interpolation) # for i in range(vsize-1): # step = (vx[i+1] - vx[i]) / n_interpolation # for j in range(n_interpolation): # index = i*n_interpolation + j