"htt_et_8_13TeV" : "e#tau_{h}, nobtag", "htt_et_9_13TeV" : "e#tau_{h}, btag", "htt_mt_8_13TeV" : "#mu#tau_{h}, nobtag", "htt_mt_9_13TeV" : "#mu#tau_{h}, btag", "htt_tt_8_13TeV" : "#tau_{h}#tau_{h}, nobtag", "htt_tt_9_13TeV" : "#tau_{h}#tau_{h}, btag" } with open(args.input) as jsfile: js = json.load(jsfile) for key in js[args.mass]: ## these are the channels # title = key if key not in titles else titles[key] title = titles.get(key, key) # if key not in titles: # continue toy_graph = plot.ToyTGraphFromJSON(js, [args.mass,key,'toy']) toy_hist = plot.makeHist1D("toys", 100, toy_graph) for i in range(toy_graph.GetN()): toy_hist.Fill(toy_graph.GetX()[i]) pValue = js[args.mass][key]["p"] obs = plot.ToyTGraphFromJSON(js, [args.mass,key,'obs']) arr = ROOT.TArrow(obs.GetX()[0], 0.001, obs.GetX()[0], toy_hist.GetMaximum()/8, 0.02, "<|"); arr.SetLineColor(ROOT.kBlue); arr.SetFillColor(ROOT.kBlue); arr.SetFillStyle(1001); arr.SetLineWidth(6); arr.SetLineStyle(1); arr.SetAngle(60); toy_hist.Draw() arr.Draw("<|same"); pads[0].RedrawAxis() pads[0].RedrawAxis('g')
for i in range(len(graph_list)): max_vals.append( ROOT.TMath.MaxElement(graph_list[i].GetN(), graph_list[i].GetY())) mass_list = [] for i in range(graph_list[0].GetN()): mass_list.append(float(graph_list[0].GetX()[i])) mass_list = sorted(set(mass_list)) mass_bins = len(mass_list) if int(args.verbosity) > 0: print "mass_list: ", mass_list, "Total number: ", mass_bins # Setup the canvas: we'll use a two pad split, with a small top pad to contain # the CMS logo and the legend plot.ModTDRStyle(r=0.06, l=0.12) axis = plot.makeHist1D('hist1d', mass_bins, graph_list[0]) ROOT.gStyle.SetFrameLineWidth(2) c1 = ROOT.TCanvas() pads = plot.TwoPadSplit(0.8, 0, 0) pads[1].cd() axis.GetYaxis().SetRangeUser(0, 1.2 * float(max(max_vals))) if args.mode == 'sob': axis.GetYaxis().SetTitle("S/#sqrt{B}") if args.mode == 'sosb': axis.GetYaxis().SetTitle("S/S+B") if args.custom_y_range: axis.GetYaxis().SetRangeUser(float(args.y_axis_min), float(args.y_axis_max)) axis.GetXaxis().SetTitle("m_{H} [GeV]") if args.custom_x_range:
process_label = args.process mass_list = [] for i in range(graph_exp.GetN()): mass_list.append(float(graph_exp.GetX()[i])) mass_list = sorted(set(mass_list)) mass_bins = len(mass_list) if int(args.verbosity) > 0: print "mass_list: ", mass_list, "Total number: ", mass_bins #Create canvas and TH1D plot.ModTDRStyle(width=600, l=0.12) ROOT.gStyle.SetFrameLineWidth(2) c1 = ROOT.TCanvas() axis = plot.makeHist1D('hist1d', mass_bins, graph_exp) if process_label == "gg#phi": axis.GetYaxis().SetTitle( "95% CL limit on #sigma#font[42]{(gg#phi)}#upoint#font[52]{B}#font[42]{(#phi#rightarrow#tau#tau)} [pb]" ) elif process_label == "bb#phi": axis.GetYaxis().SetTitle( "95% CL limit on #sigma#font[42]{(bb#phi)}#upoint#font[52]{B}#font[42]{(#phi#rightarrow#tau#tau)} [pb]" ) else: exit("Currently process is not supported") if args.custom_y_range: axis.GetYaxis().SetRangeUser(float(args.y_axis_min), float(args.y_axis_max)) axis.GetXaxis().SetTitle("m_{#phi} [GeV]") if args.custom_x_range:
obs_graph_list[j].SetPoint(i,xval_obs,(yval_obs)/parton_lumis[xval_obs]) process_label=args.process mass_list=[] for i in range(exp_graph_list[0].GetN()) : mass_list.append(float(exp_graph_list[0].GetX()[i])) mass_list = sorted(set(mass_list)) mass_bins=len(mass_list) if int(args.verbosity) > 0 : print "mass_list: ", mass_list, "Total number: ", mass_bins # Setup the canvas: we'll use a two pad split, with a small top pad to contain # the CMS logo and the legend plot.ModTDRStyle(r=0.06, l=0.12) axis = plot.makeHist1D('hist1d', mass_bins, exp_graph_list[0]) ROOT.gStyle.SetFrameLineWidth(2) c1=ROOT.TCanvas() pads = plot.TwoPadSplit(0.8, 0, 0) pads[1].cd() axis.GetYaxis().SetRangeUser(0,1.2*float(max(max_vals))) if args.log: axis.GetYaxis().SetRangeUser(0.001,1.2*float(max(max_vals))) if process_label == "gg#phi" : if args.relative : axis.GetYaxis().SetTitle("Relative diff in limit on #sigma#font[42]{(gg#phi)}#upoint#font[52]{B}#font[42]{(#phi#rightarrow#tau#tau)} [pb]") elif args.absolute : axis.GetYaxis().SetTitle("Absolute diff in limit on #sigma#font[42]{(gg#phi)}#upoint#font[52]{B}#font[42]{(#phi#rightarrow#tau#tau)} [pb]") else : axis.GetYaxis().SetTitle("95% CL limit on #sigma#font[42]{(gg#phi)}#upoint#font[52]{B}#font[42]{(#phi#rightarrow#tau#tau)} [pb]") elif process_label == "bb#phi" :
"htt_et_8_13TeV": "e#tau_{h}, nobtag", "htt_et_9_13TeV": "e#tau_{h}, btag", "htt_mt_8_13TeV": "#mu#tau_{h}, nobtag", "htt_mt_9_13TeV": "#mu#tau_{h}, btag", "htt_tt_8_13TeV": "#tau_{h}#tau_{h}, nobtag", "htt_tt_9_13TeV": "#tau_{h}#tau_{h}, btag" } with open(args.input) as jsfile: js = json.load(jsfile) for key in js[args.mass]: ## these are the channels # title = key if key not in titles else titles[key] title = titles.get(key, key) # if key not in titles: # continue toy_graph = plot.ToyTGraphFromJSON(js, [args.mass, key, 'toy']) toy_hist = plot.makeHist1D("toys", 100, toy_graph, 1.15) for i in range(toy_graph.GetN()): toy_hist.Fill(toy_graph.GetX()[i]) pValue = js[args.mass][key]["p"] obs = plot.ToyTGraphFromJSON(js, [args.mass, key, 'obs']) arr = ROOT.TArrow(obs.GetX()[0], 0.001, obs.GetX()[0], toy_hist.GetMaximum() / 8, 0.02, "<|") arr.SetLineColor(ROOT.kBlue) arr.SetFillColor(ROOT.kBlue) arr.SetFillStyle(1001) arr.SetLineWidth(6) arr.SetLineStyle(1) arr.SetAngle(60) toy_hist.Draw() arr.Draw("<|same")
process_label=args.process mass_list=[] for i in range(graph_exp.GetN()) : mass_list.append(float(graph_exp.GetX()[i])) mass_list = sorted(set(mass_list)) mass_bins=len(mass_list) if int(args.verbosity) > 0 : print "mass_list: ", mass_list, "Total number: ", mass_bins #Create canvas and TH1D plot.ModTDRStyle(width=600, l=0.12) ROOT.gStyle.SetFrameLineWidth(2) c1=ROOT.TCanvas() axis = plot.makeHist1D('hist1d', mass_bins, graph_exp) if process_label == "gg#phi" : axis.GetYaxis().SetTitle("95% CL limit on #sigma#font[42]{(gg#phi)}#upoint#font[52]{B}#font[42]{(#phi#rightarrow#tau#tau)} [pb]") elif process_label == "bb#phi" : axis.GetYaxis().SetTitle("95% CL limit on #sigma#font[42]{(bb#phi)}#upoint#font[52]{B}#font[42]{(#phi#rightarrow#tau#tau)} [pb]") else: exit("Currently process is not supported") if args.custom_y_range : axis.GetYaxis().SetRangeUser(float(args.y_axis_min), float(args.y_axis_max)) axis.GetXaxis().SetTitle("m_{#phi} [GeV]") if args.custom_x_range : axis.GetXaxis().SetRangeUser(float(args.x_axis_min), float(args.x_axis_max)) #Create two pads, one is just for the Legend pad_leg = ROOT.TPad("pad_leg","pad_leg",0,0.82,1,1) pad_leg.SetFillStyle(4000) pad_leg.Draw() pad_plot = ROOT.TPad("pad_plot","pad_plot",0,0,1,0.82) pad_plot.SetFillStyle(4000)