def doBRlimit(limits, unblindedStatus, opts, logy=False): ''' See https://twiki.cern.ch/twiki/bin/viewauth/CMS/Internal/FigGuidelines ''' graphs = [] if unblindedStatus: gr = limits.observedGraph() if gr != None: gr.SetPoint(gr.GetN()-1, gr.GetX()[gr.GetN()-1]-1e-10, gr.GetY()[gr.GetN()-1]) if opts.excludedArea: graphs.append(histograms.HistoGraph(gr, "Observed", drawStyle="PL", legendStyle=None)) excluded = gr.Clone() excluded.SetPoint(excluded.GetN(), excluded.GetX()[excluded.GetN()-1], 0.05) excluded.SetPoint(excluded.GetN(), excluded.GetX()[0], 0.05) limit.setExcludedStyle(excluded) graphs.append(histograms.HistoGraph(excluded, "Excluded", drawStyle="F", legendStyle="lpf", legendLabel="Observed")) else: graphs.append(histograms.HistoGraph(gr, "Observed", drawStyle="PL", legendStyle="lp")) # Add the expected lines graphs.extend([ histograms.HistoGraph(limits.expectedGraph(), "Expected", drawStyle="L"), histograms.HistoGraph(limits.expectedBandGraph(sigma=1), "Expected1", drawStyle="F", legendStyle="f"), #fl histograms.HistoGraph(limits.expectedBandGraph(sigma=2), "Expected2", drawStyle="F", legendStyle="f"), #fl ]) # Plot the TGraphs saveFormats = [".png", ".C", ".pdf"] if not opts.excludedArea: saveFormats.append(".eps") plot = plots.PlotBase(graphs, saveFormats=saveFormats) plot.setLuminosity(limits.getLuminosity()) plot.setLegendHeader("95% CL upper limits") # Customise legend entries plot.histoMgr.setHistoLegendLabelMany({ "Expected": "Median expected", "Expected1": "68% expected", "Expected2": "95% expected" #"Expected" : None, #"Expected1": "Expected median #pm 1#sigma", #"Expected2": "Expected median #pm 2#sigma" }) # Branching Ratio Assumption if 0: limit.BRassumption = "Assuming B(H^{+}#rightarrowt#bar{b}) = 1" # Create legend xPos = 0.53 legend = getLegend(limit, opts, xPos) plot.setLegend(legend) # Get y-min, y-max, and histogram name to be saved as ymin, ymax, saveName = getYMinMaxAndName(limits, "limitsBr", logy, opts) if opts.yMin != -1: ymin = opts.yMin if opts.yMax != -1: ymax = opts.yMax if len(limits.mass) == 1: plot.createFrame(saveName, opts={"xmin": limits.mass[0]-5.0, "xmax": limits.mass[0]+5.0, "ymin": ymin, "ymax": ymax}) else: plot.createFrame(saveName, opts={"ymin": ymin, "ymax": ymax}) # Add cut box? if opts.cutLine > 0: kwargs = {"greaterThan": True} plot.addCutBoxAndLine(cutValue=opts.cutLine, fillColor=ROOT.kRed, box=False, line=True, **kwargs) # Set x-axis title plot.frame.GetXaxis().SetTitle(limit.mHplus()) if limit.BRassumption != "": plot.frame.GetYaxis().SetTitle("95% CL limit for #sigma_{H^{+}} (pb)") else: plot.frame.GetYaxis().SetTitle(limit.sigmaBRlimit) # plot.frame.GetYaxis().SetTitle(limit.BRlimit) # Enable/Disable logscale for axes if logy: plot.getPad().SetLogy(logy) plot.getPad().SetLogx(opts.logx) # Enable grids in x and y? plot.getPad().SetGridx(opts.gridX) plot.getPad().SetGridy(opts.gridY) # Draw the plot with standard texts plot.draw() plot.addStandardTexts() # Add physics-related text on canvas addPhysicsText(histograms, limit, x=xPos) # Save the canvas plot.save() # Save the plots SavePlot(plot, saveName, os.path.join(opts.saveDir, opts.subdir) ) return
def doPlot(name, graphs, limits, xlabel, scenario, mass): higgs = "h" if "lowMH" in scenario: higgs = "H" excluded = graphs["muexcluded"] limit.setExcludedStyle(excluded) excluded.SetFillStyle(1001) excluded.SetLineWidth(0) excluded.SetLineStyle(0) excluded.SetLineColor(ROOT.kWhite) excludedCopy = excluded.Clone() if not mass in [90]: excludedCopy.SetFillColorAlpha( ROOT.kWhite, 0.0) # actual color doesn't matter, want fully transparent # else: # excluded.SetLineColor(ROOT.kBlack) # Uncomment when we have allowed for n in ["Allowed", "Allowed2"]: a = graphs[n] if a is None: continue a.SetFillStyle(3005) a.SetFillColor(ROOT.kRed) a.SetLineWidth(-302) a.SetLineColor(ROOT.kRed) a.SetLineStyle(1) legend_dh = 0 grs = [] if "observed" in graphs: grs.extend([ histograms.HistoGraph(graphs["observed"], "Observed", drawStyle="L", legendStyle="l"), histograms.HistoGraph(graphs["obs_th_plus"], "ObservedPlus", drawStyle="L", legendStyle="l"), histograms.HistoGraph(graphs["obs_th_minus"], "ObservedMinus", drawStyle="L", legendStyle=None), ]) legend_dh = 0.1 grs.extend([ histograms.HistoGraph(excluded, "Excluded", drawStyle="F"), histograms.HistoGraph(excludedCopy, "ExcludedCopy", drawStyle=None, legendStyle="f"), histograms.HistoGraph(graphs["Allowed"], "Allowed", drawStyle="L", legendStyle="lf"), ]) if graphs["Allowed2"] is not None: grs.append( histograms.HistoGraph(graphs["Allowed2"], "Allowed2", drawStyle="L", legendStyle=None)) plot = plots.PlotBase(grs, saveFormats=[".png", ".pdf", ".C"]) plot.histoMgr.setHistoLegendLabelMany({ "ExcludedCopy": "Excluded", "Allowed": "m_{" + higgs + "}^{MSSM} #neq 125#pm3 GeV", "Excluded": None, }) if "observed" in graphs: plot.histoMgr.setHistoLegendLabelMany({ "ObservedPlus": "Observed #pm1#sigma (th.)", }) textPos = "left" dx = 0 dy = -0.15 if mass in [90, 150]: textPos = "right" dx = 0.35 if mass in [155, 160]: textPos = "right" dy = -0.02 plot.setLegend( histograms.createLegend(0.19 + dx, 0.75 + dy - legend_dh, 0.57 + dx, 0.80 + dy)) histograms.moveLegend(plot.legend, dh=0.05, dy=-0.05) #plot.legend.SetFillColor(0) #plot.legend.SetFillStyle(1001) name = name.replace("-", "_") plot.createFrame(name, opts={ "ymin": 0, "ymax": tanbMax, "xmin": 200, "xmax": 3300 }) plot.frame.GetXaxis().SetTitle(xlabel) plot.frame.GetYaxis().SetTitle(limit.tanblimit) plot.draw() plot.setLuminosity(limits.getLuminosity()) plot.addStandardTexts(cmsTextPosition=textPos) size = 20 x = 0.2 + dx histograms.addText(x, 0.9 + dy, limit.process, size=size) histograms.addText(x, 0.863 + dy, limits.getFinalstateText(), size=size) histograms.addText(x, 0.815 + dy, limit.getTypesetScenarioName(scenario.replace( "_mu", "")), size=size) histograms.addText(x, 0.767 + dy, "m_{H^{+}}=%d GeV" % mass, size=size) # histograms.addText(0.2, 0.231, "Min "+limit.BR+"(t#rightarrowH^{+}b)#times"+limit.BR+"(H^{+}#rightarrow#tau#nu)", size=0.5*size) #Adding a LHC label: # ROOT.LHCHIGGS_LABEL(0.97,0.72,1) # FH_version = db.getVersion("FeynHiggs") # histograms.addText(x, 0.55, FH_version) # HD_version = db.getVersion("HDECAY") # histograms.addText(x, 0.55, FH_version+" and "+HD_version, size=size) # histograms.addText(x, 0.48, "Derived from", size=size) # histograms.addText(x, 0.43, "CMS HIG-12-052", size=size) plot.save() print "Created", name
def doBRlimit(limits, unblindedStatus, opts, log=False): leptonicFS = False graphs = [] if unblindedStatus: gr = limits.observedGraph() if gr != None: gr.SetPoint(gr.GetN() - 1, gr.GetX()[gr.GetN() - 1] - 1e-10, gr.GetY()[gr.GetN() - 1]) if opts.excludedArea: graphs.append( histograms.HistoGraph(gr, "Observed", drawStyle="PL", legendStyle=None)) excluded = gr.Clone() excluded.SetPoint(excluded.GetN(), excluded.GetX()[excluded.GetN() - 1], 0.05) excluded.SetPoint(excluded.GetN(), excluded.GetX()[0], 0.05) limit.setExcludedStyle(excluded) graphs.append( histograms.HistoGraph(excluded, "Excluded", drawStyle="F", legendStyle="lpf", legendLabel="Observed")) else: graphs.append( histograms.HistoGraph(gr, "Observed", drawStyle="PL", legendStyle="lp")) graphs.extend([ histograms.HistoGraph(limits.expectedGraph(), "Expected", drawStyle="L"), histograms.HistoGraph(limits.expectedBandGraph(sigma=1), "Expected1", drawStyle="F", legendStyle="fl"), histograms.HistoGraph(limits.expectedBandGraph(sigma=2), "Expected2", drawStyle="F", legendStyle="fl"), ]) saveFormats = [".png", ".C", ".pdf"] if not opts.excludedArea: saveFormats.append(".eps") plot = plots.PlotBase(graphs, saveFormats=saveFormats) plot.setLuminosity(limits.getLuminosity()) plot.histoMgr.setHistoLegendLabelMany({ "Expected": None, "Expected1": "Expected median #pm 1#sigma", "Expected2": "Expected median #pm 2#sigma" }) dy = -0.1 limit.BRassumption = "" #limit.BRassumption = "Assuming B(H^{+}#rightarrow#tau^{+}#nu_{#tau}) = 1" #limit.BRassumption = "Assuming B(H^{+}#rightarrowt#bar{b}) = 1" if limit.BRassumption != "": dy -= 0.05 #if len(limits.getFinalstates()) > 1: # dy -= 0.1 # Create legend x = 0.51 x = 0.45 legend = histograms.createLegend(x, 0.78 + dy, x + 0.4, 0.92 + dy) legend.SetMargin(0.17) # Make room for the final state text if opts.excludedArea: legend.SetFillStyle(1001) plot.setLegend(legend) name = "limitsBr" ymin = 0 ymax = limits.getFinalstateYmaxBR() #fixme: alexandros if opts.logx: name += "_logx" if log: name += "_log" if limits.isHeavyStatus: ymin = 1e-3 ymax = 10.0 if limit.BRassumption != "": ymax = 10.0 else: ymin = 1e-3 ymax = 4e-2 if leptonicFS: ymax = 10 if len(limits.mass) == 1: plot.createFrame(name, opts={ "xmin": limits.mass[0] - 5.0, "xmax": limits.mass[0] + 5.0, "ymin": ymin, "ymax": ymax }) else: plot.createFrame(name, opts={"ymin": ymin, "ymax": ymax}) # Set x-axis title plot.frame.GetXaxis().SetTitle(limit.mHplus()) if limits.isHeavyStatus: if limit.BRassumption != "": plot.frame.GetYaxis().SetTitle( "95% CL limit for #sigma_{H^{+}} (pb)") else: plot.frame.GetYaxis().SetTitle(limit.sigmaBRlimit) else: plot.frame.GetYaxis().SetTitle(limit.BRlimit) # Enable/Disable logscale for axes if log: plot.getPad().SetLogy(log) if opts.logx: plot.getPad().SetLogx(log) # Draw the plot with standard texts plot.draw() plot.addStandardTexts() # Add physics-process text size = 20 x = 0.51 x = 0.45 process = limit.process if limits.isHeavyStatus: process = limit.processHeavy histograms.addText(x, 0.88, process, size=size) # Add final-state text # histograms.addText(x, 0.84, limits.getFinalstateText(), size=size) #fixme: alexandros histograms.addText(x, 0.84, "fully hadronic final state", size=size) #fixme: alexandros # histograms.addText(x, 0.84, "#tau_{h}+jets and #mu#tau_{h} final states", size=size) # histograms.addText(x, 0.84, "#tau_{h}+jets final state", size=size) # histograms.addText(x, 0.84, "#tau_{h}+jets, #mu#tau_{h}, ee, e#mu, #mu#mu final states", size=size) if leptonicFS: histograms.addText(x, 0.84, "#mu#tau_{h}, ee, e#mu, #mu#mu final states", size=size) if limit.BRassumption != "": histograms.addText(x, 0.79, limit.BRassumption, size=size) plot.save() return
def doBRlimit(limits, unblindedStatus, opts, logy=False): graphs = [] if unblindedStatus: gr = limits.observedGraph() if gr != None: gr.SetPoint(gr.GetN() - 1, gr.GetX()[gr.GetN() - 1] - 1e-10, gr.GetY()[gr.GetN() - 1]) if opts.excludedArea: graphs.append( histograms.HistoGraph(gr, "Observed", drawStyle="PL", legendStyle=None)) excluded = gr.Clone() excluded.SetPoint(excluded.GetN(), excluded.GetX()[excluded.GetN() - 1], 0.05) excluded.SetPoint(excluded.GetN(), excluded.GetX()[0], 0.05) limit.setExcludedStyle(excluded) graphs.append( histograms.HistoGraph(excluded, "Excluded", drawStyle="F", legendStyle="lpf", legendLabel="Observed")) else: graphs.append( histograms.HistoGraph(gr, "Observed", drawStyle="PL", legendStyle="lp")) # Add the expected lines graphs.extend([ histograms.HistoGraph(limits.expectedGraph(), "Expected", drawStyle="L"), histograms.HistoGraph(limits.expectedBandGraph(sigma=1), "Expected1", drawStyle="F", legendStyle="fl"), histograms.HistoGraph(limits.expectedBandGraph(sigma=2), "Expected2", drawStyle="F", legendStyle="fl"), ]) # Plot the TGraphs saveFormats = [".png", ".C", ".pdf"] if not opts.excludedArea: saveFormats.append(".eps") plot = plots.PlotBase(graphs, saveFormats=saveFormats) plot.setLuminosity(limits.getLuminosity()) # Customise legend entries plot.histoMgr.setHistoLegendLabelMany({ "Expected": None, "Expected1": "Expected median #pm 1#sigma", "Expected2": "Expected median #pm 2#sigma" }) # Branching Ratio Assumption if 0: limit.BRassumption = "Assuming B(H^{+}#rightarrowt#bar{b}) = 1" # Create legend xPos = 0.53 legend = getLegend(limit, opts, xPos) plot.setLegend(legend) # Get y-min, y-max, and histogram name to be saved as ymin, ymax, saveName = getYMinMaxAndName(limits, "limitsBr", logy, opts) if opts.yMin != -1: ymin = opts.yMin if opts.yMax != -1: ymax = opts.yMax if len(limits.mass) == 1: plot.createFrame(saveName, opts={ "xmin": limits.mass[0] - 5.0, "xmax": limits.mass[0] + 5.0, "ymin": ymin, "ymax": ymax }) else: plot.createFrame(saveName, opts={"ymin": ymin, "ymax": ymax}) # Add cut box? if opts.cutLine > 0: kwargs = {"greaterThan": True} plot.addCutBoxAndLine(cutValue=opts.cutLine, fillColor=ROOT.kRed, box=False, line=True, **kwargs) # Set x-axis title plot.frame.GetXaxis().SetTitle(limit.mHplus()) if limit.BRassumption != "": plot.frame.GetYaxis().SetTitle("95% CL limit for #sigma_{H^{+}} (pb)") else: plot.frame.GetYaxis().SetTitle(limit.sigmaBRlimit) # plot.frame.GetYaxis().SetTitle(limit.BRlimit) # Enable/Disable logscale for axes if logy: plot.getPad().SetLogy(logy) plot.getPad().SetLogx(opts.logx) # Enable grids in x and y? plot.getPad().SetGridx(opts.gridX) plot.getPad().SetGridy(opts.gridY) # Draw the plot with standard texts plot.draw() plot.addStandardTexts() # Add physics-related text on canvas addPhysicsText(histograms, limit, x=xPos) # Save the canvas plot.save() # Save the plots SavePlot(plot, saveName, os.path.join(opts.saveDir, opts.settings)) return
def doPlot(name, graphs, limits, xlabel, scenario, isMA=False): blinded = True if "obs" in graphs.keys(): blinded = False higgs = "h" if scenario == "lowMH-LHCHXSWG": higgs = "H" if not blinded: obs = graphs["obs"] excluded = ROOT.TGraph(obs) excluded.SetName("ExcludedArea") if "_mA_" in name: rightX = obs.GetX()[obs.GetN()-1]+100 rightY = obs.GetY()[obs.GetN()-1] excluded.SetPoint(excluded.GetN(), rightX, rightY) excluded.SetPoint(excluded.GetN(), rightX, 1) else: excluded.SetPoint(excluded.GetN(), obs.GetX()[obs.GetN()-1], 0.5) excluded.SetPoint(excluded.GetN(), 0, 0.5) excluded.SetPoint(excluded.GetN(), 0, tanbMax) excluded.SetPoint(excluded.GetN(), obs.GetX()[0], tanbMax) excluded.SetPoint(excluded.GetN(), obs.GetX()[0], obs.GetY()[0]) limit.setExcludedStyle(excluded) excluded.SetLineWidth(0) excluded.SetLineColor(ROOT.kWhite) expected = graphs["exp"] expected.SetLineStyle(2) expected1 = graphs["exp1"] expected1.SetLineStyle(2) expected2 = graphs["exp2"] expected2.SetLineStyle(2) # allowed = graphs["Allowed"] # if not allowed == None: # allowed.SetFillStyle(3005) # allowed.SetFillColor(ROOT.kRed) # allowed.SetLineWidth(-302) # allowed.SetLineColor(ROOT.kRed) # allowed.SetLineStyle(1) if not blinded: graphs["obs_th_plus"].SetLineStyle(9) # graphs["obs_th_minus"].SetLineStyle(9) excludedCopy = excluded.Clone() # excludedCopy.SetFillColorAlpha(ROOT.kWhite, 0.0) # actual color doesn't matter, want fully transparent plot = plots.PlotBase([ histograms.HistoGraph(graphs["obs"], "Observed", drawStyle="PL", legendStyle="lp"), histograms.HistoGraph(graphs["obs_th_plus"], "ObservedPlus", drawStyle="L", legendStyle="l"), histograms.HistoGraph(graphs["obs_th_minus"], "ObservedMinus", drawStyle="L"), # histograms.HistoGraph(graphs["isomass"], "IsoMass", drawStyle="L"), # histograms.HistoGraph(graphs["isomass"], "IsoMassCopy", drawStyle="F"), histograms.HistoGraph(excluded, "Excluded", drawStyle="F", legendStyle=None), histograms.HistoGraph(excludedCopy, "ExcludedCopy", drawStyle=None, legendStyle="f"), histograms.HistoGraph(expected, "Expected", drawStyle="L"), # histograms.HistoGraph(graphs["exp"], "Expected", drawStyle="L"), # histograms.HistoGraph(graphs["Allowed"], "Allowed", drawStyle="L", legendStyle="lf"), # histograms.HistoGraph(graphs["Allowed"], "AllowedCopy", drawStyle="L", legendStyle="f"), histograms.HistoGraph(graphs["mintanb"], "MinTanb", drawStyle="L"), # histograms.HistoGraph(graphs["exp1"], "Expected1", drawStyle="F", legendStyle="fl"), # histograms.HistoGraph(graphs["exp2"], "Expected2", drawStyle="F", legendStyle="fl"), histograms.HistoGraph(expected1, "Expected1", drawStyle="F", legendStyle="fl"), histograms.HistoGraph(expected2, "Expected2", drawStyle="F", legendStyle="fl") ], saveFormats=[".png", ".pdf", ".C"] ) plot.histoMgr.setHistoLegendLabelMany({ "ObservedPlus": "Observed #pm1#sigma (th.)", "ObservedMinus": None, "Excluded": None, "ExcludedCopy": "Excluded", "Expected": None, "MinTanb": None, # "Allowed": "m_{"+higgs+"}^{MSSM} #neq 125#pm3 GeV", "Expected1": "Expected median #pm 1#sigma", "Expected2": "Expected median #pm 2#sigma", # "IsoMass": None, # "IsoMassCopy": None }) else: if not graphs["isomass"] == None: graphs["isomass"].SetFillColor(0) graphs["isomass"].SetFillStyle(1) plot = plots.PlotBase([ histograms.HistoGraph(expected, "Expected", drawStyle="L"), histograms.HistoGraph(graphs["isomass"], "IsoMass", drawStyle="L"), histograms.HistoGraph(graphs["isomass"], "IsoMassCopy", drawStyle="F"), # histograms.HistoGraph(graphs["Allowed"], "Allowed", drawStyle="L", legendStyle="lf"), # histograms.HistoGraph(graphs["Allowed"], "AllowedCopy", drawStyle="L", legendStyle="f"), histograms.HistoGraph(graphs["mintanb"], "MinTanb", drawStyle="L"), histograms.HistoGraph(expected1, "Expected1", drawStyle="F", legendStyle="fl"), histograms.HistoGraph(expected2, "Expected2", drawStyle="F", legendStyle="fl"), ], saveFormats=[".png", ".pdf", ".C"] ) plot.histoMgr.setHistoLegendLabelMany({ "Expected": None, "MinTanb": None, # "Allowed": "m_{"+higgs+"}^{MSSM} #neq 125#pm3 GeV", "Expected1": "Expected median #pm 1#sigma", "Expected2": "Expected median #pm 2#sigma", "IsoMass": None, "IsoMassCopy": None }) # Move the m_h,H allowed region to the last in the legend histoNames = [h.getName() for h in plot.histoMgr.getHistos()] plot.histoMgr.reorderLegend(filter(lambda n: "Allowed" not in n, histoNames)) size = 20 x = 0.2 # dy = -0.15 dy = -0.13 plot.setLegend(histograms.createLegend(x-0.01, 0.50+dy, x+0.45, 0.80+dy)) plot.legend.SetMargin(0.17) # plot.legend.SetFillColor(0) #plot.legend.SetFillColorAlpha(ROOT.kWhite, 50) # plot.legend.SetFillStyle(1001) if blinded: name += "_blinded" name = os.path.basename(name) name = name.replace("-","_") frameXmax = 160 if "_mA_" in name: frameXmax = 145 plot.createFrame(name, opts={"ymin": 0, "ymax": tanbMax, "xmin": 90, "xmax": frameXmax}) plot.frame.GetXaxis().SetTitle(xlabel) plot.frame.GetYaxis().SetTitle(limit.tanblimit) plot.draw() plot.setLuminosity(limits.getLuminosity()) plot.addStandardTexts() histograms.addText(x, 0.9+dy, "t #rightarrow H^{+}b, H^{+} #rightarrow c#bar{s}", size=size) # histograms.addText(x, 0.863+dy, limits.getFinalstateText(), size=size) histograms.addText(x, 0.815+dy, limit.getTypesetScenarioName(scenario), size=size) #histograms.addText(0.2, 0.231, "Min "+limit.BR+"(t#rightarrowH^{+}b)#times"+limit.BR+"(H^{+}#rightarrow#tau#nu)", size=0.5*size) # Too small to be visible # if not graphs["isomass"] == None: # histograms.addText(0.8, 0.15, "m_{H^{#pm}} = 160 GeV", size=0.5*size) #Adding a LHC label: # ROOT.LHCHIGGS_LABEL(0.97,0.72,1) #FH_version = db.getVersion("FeynHiggs") #histograms.addText(x, 0.55+dy, FH_version, size=size) # HD_version = db.getVersion("HDECAY") # histograms.addText(x, 0.55, FH_version+" and "+HD_version, size=size) # histograms.addText(x, 0.48, "Derived from", size=size) # histograms.addText(x, 0.43, "CMS HIG-12-052", size=size) plot.save() print "Created",name
def doBRlimit(limits, unblindedStatus, opts, log=False): leptonicFS = False graphs = [] if unblindedStatus: gr = limits.observedGraph() if gr != None: gr.SetPoint(gr.GetN()-1, gr.GetX()[gr.GetN()-1]-1e-10, gr.GetY()[gr.GetN()-1]) if opts.excludedArea: graphs.append(histograms.HistoGraph(gr, "Observed", drawStyle="PL", legendStyle=None)) excluded = gr.Clone() excluded.SetPoint(excluded.GetN(), excluded.GetX()[excluded.GetN()-1], 0.05) excluded.SetPoint(excluded.GetN(), excluded.GetX()[0], 0.05) limit.setExcludedStyle(excluded) graphs.append(histograms.HistoGraph(excluded, "Excluded", drawStyle="F", legendStyle="lpf", legendLabel="Observed")) else: graphs.append(histograms.HistoGraph(gr, "Observed", drawStyle="PL", legendStyle="lp")) graphs.extend([ histograms.HistoGraph(limits.expectedGraph(), "Expected", drawStyle="L"), histograms.HistoGraph(limits.expectedBandGraph(sigma=1), "Expected1", drawStyle="F", legendStyle="fl"), histograms.HistoGraph(limits.expectedBandGraph(sigma=2), "Expected2", drawStyle="F", legendStyle="fl"), ]) saveFormats = [".png", ".C"] if opts.excludedArea: saveFormats.append(".pdf") else: saveFormats.append(".eps") plot = plots.PlotBase(graphs, saveFormats=saveFormats) plot.setLuminosity(limits.getLuminosity()) plot.histoMgr.setHistoLegendLabelMany({ "Expected": None, "Expected1": "Expected median #pm 1#sigma", "Expected2": "Expected median #pm 2#sigma" }) dy = -0.1 limit.BRassumption = "Assuming B(H^{+}#rightarrow#tau^{+}#nu_{#tau}) = 1" #limit.BRassumption = "Assuming B(H^{+}#rightarrowt#bar{b}) = 1" if limit.BRassumption != "": dy -= 0.05 #if len(limits.getFinalstates()) > 1: # dy -= 0.1 x = 0.51 x = 0.4 legend = histograms.createLegend(x-0.01, 0.78+dy, 0.92, 0.92+dy) legend.SetMargin(0.17) # make room for the final state text if opts.excludedArea: legend.SetFillStyle(1001) plot.setLegend(legend) name = "limitsBr" ymin = 0 ymax = limits.getFinalstateYmaxBR() if log: name += "_log" if limits.isHeavyStatus: ymin = 1e-2 if limit.BRassumption != "": ymax = 1.5 else: ymin = 1e-3 ymax = 4e-2 if leptonicFS: ymax = 10 if len(limits.mass) == 1: plot.createFrame(name, opts={"xmin": limits.mass[0]-5.0, "xmax": limits.mass[0]+5.0, "ymin": ymin, "ymax": ymax}) else: plot.createFrame(name, opts={"ymin": ymin, "ymax": ymax}) plot.frame.GetXaxis().SetTitle(limit.mHplus()) if limits.isHeavyStatus: if limit.BRassumption != "": plot.frame.GetYaxis().SetTitle("95% CL limit for #sigma_{H^{+}} (pb)") else: plot.frame.GetYaxis().SetTitle(limit.sigmaBRlimit) else: plot.frame.GetYaxis().SetTitle(limit.BRlimit) if log: plot.getPad().SetLogy(log) plot.draw() plot.addStandardTexts() size = 20 x = 0.51 x = 0.4 process = limit.process if limits.isHeavyStatus: process = limit.processHeavy histograms.addText(x, 0.88, process, size=size) #histograms.addText(x, 0.84, limits.getFinalstateText(), size=size) #histograms.addText(x, 0.84, "#tau_{h}+jets final state", size=size) histograms.addText(x, 0.84, "#tau_{h}+jets and #mu#tau_{h} final states", size=size) #histograms.addText(x, 0.84, "#tau_{h}+jets, #mu#tau_{h}, ee, e#mu, #mu#mu final states", size=size) if leptonicFS: histograms.addText(x, 0.84, "#mu#tau_{h}, ee, e#mu, #mu#mu final states", size=size) if limit.BRassumption != "": histograms.addText(x, 0.79, limit.BRassumption, size=size) plot.save()
def doPlot(name, graphs, limits, xlabel, scenario, mass): higgs = "h" if "lowMH" in scenario: higgs = "H" excluded = graphs["muexcluded"] limit.setExcludedStyle(excluded) excluded.SetFillStyle(1001) excluded.SetLineWidth(0) excluded.SetLineStyle(0) excluded.SetLineColor(ROOT.kWhite) excludedCopy = excluded.Clone() if not mass in [90]: excludedCopy.SetFillColorAlpha(ROOT.kWhite, 0.0) # actual color doesn't matter, want fully transparent else: excluded.SetLineColor(ROOT.kBlack) # Uncomment when we have allowed for n in ["Allowed", "Allowed2"]: a = graphs[n] if a is None: continue a.SetFillStyle(3005) a.SetFillColor(ROOT.kRed) a.SetLineWidth(-302) a.SetLineColor(ROOT.kRed) a.SetLineStyle(1) legend_dh = 0 grs = [] if "observed" in graphs: grs.extend([ histograms.HistoGraph(graphs["observed"], "Observed", drawStyle="L", legendStyle="l"), histograms.HistoGraph(graphs["obs_th_plus"], "ObservedPlus", drawStyle="L", legendStyle="l"), histograms.HistoGraph(graphs["obs_th_minus"], "ObservedMinus", drawStyle="L", legendStyle=None), ]) legend_dh = 0.1 grs.extend([ histograms.HistoGraph(excluded, "Excluded", drawStyle="F"), histograms.HistoGraph(excludedCopy, "ExcludedCopy", drawStyle=None, legendStyle="f"), histograms.HistoGraph(graphs["Allowed"], "Allowed", drawStyle="L", legendStyle="lf"), # histograms.HistoGraph(graphs["IsoMass120"], "IsoMass120", drawStyle="L", legendStyle="lf"), # histograms.HistoGraph(graphs["IsoMass160"], "IsoMass160", drawStyle="L", legendStyle="lf"), # histograms.HistoGraph(graphs["IsoMass165"], "IsoMass165", drawStyle="L", legendStyle="lf"), histograms.HistoGraph(graphs["InAccessible"], "InAccessible", drawStyle="F", legendStyle="lf"), ]) if graphs["Allowed2"] is not None: grs.append(histograms.HistoGraph(graphs["Allowed2"], "Allowed2", drawStyle="L", legendStyle=None)) plot = plots.PlotBase(grs, saveFormats=[".png", ".pdf", ".C"]) plot.histoMgr.setHistoLegendLabelMany({ "ExcludedCopy": "Excluded", "Allowed": "m_{"+higgs+"}^{MSSM} #neq 125#pm3 GeV", "Excluded": None, # "IsoMass120": None, # "IsoMass160": None, # "IsoMass165": None, "InAccessible": "Inaccessible", }) if "observed" in graphs: plot.histoMgr.setHistoLegendLabelMany({ "ObservedPlus": "Observed #pm1#sigma (th.)", }) textPos = "left" dx = 0 dy = -0.15 if mass in [90, 150]: textPos = "right" dx = 0.35 if mass in [155, 160]: textPos = "right" dy = -0.02 plot.setLegend(histograms.createLegend(0.19+dx, 0.75+dy-legend_dh, 0.57+dx, 0.80+dy)) histograms.moveLegend(plot.legend, dh=0.05, dy=-0.05) #plot.legend.SetFillColor(0) #plot.legend.SetFillStyle(1001) name = name.replace("-","_") plot.createFrame(name, opts={"ymin": 0.5, "ymax": tanbMax, "xmin": 200, "xmax": 3300}) plot.frame.GetXaxis().SetTitle(xlabel) plot.frame.GetYaxis().SetTitle(limit.tanblimit) ROOT.gPad.SetLogy(True) plot.draw() plot.setLuminosity(limits.getLuminosity()) plot.addStandardTexts(cmsTextPosition=textPos) size = 20 x = 0.2+dx histograms.addText(x, 0.9+dy, limit.process, size=size) histograms.addText(x, 0.863+dy, limits.getFinalstateText(), size=size) histograms.addText(x, 0.815+dy, limit.getTypesetScenarioName(scenario.replace("_mu", "")), size=size) histograms.addText(x, 0.767+dy, "m_{A}=%d GeV" % mass, size=size) # histograms.addText(0.2, 0.231, "Min "+limit.BR+"(t#rightarrowH^{+}b)#times"+limit.BR+"(H^{+}#rightarrow#tau#nu)", size=0.5*size) #Adding a LHC label: # ROOT.LHCHIGGS_LABEL(0.97,0.72,1) # FH_version = db.getVersion("FeynHiggs") # histograms.addText(x, 0.55, FH_version) # HD_version = db.getVersion("HDECAY") # histograms.addText(x, 0.55, FH_version+" and "+HD_version, size=size) # histograms.addText(x, 0.48, "Derived from", size=size) # histograms.addText(x, 0.43, "CMS HIG-12-052", size=size) plot.save() print "Created",name
def doPlot(name, graphs, limits, xlabel, scenario, isMA=False): blinded = True if "obs" in graphs.keys(): blinded = False higgs = "h" if scenario == "lowMH-LHCHXSWG": higgs = "H" if not blinded: obs = graphs["obs"] excluded = ROOT.TGraph(obs) excluded.SetName("ExcludedArea") if "_mA_" in name: rightX = obs.GetX()[obs.GetN() - 1] + 100 rightY = obs.GetY()[obs.GetN() - 1] excluded.SetPoint(excluded.GetN(), rightX, rightY) excluded.SetPoint(excluded.GetN(), rightX, 1) else: excluded.SetPoint(excluded.GetN(), obs.GetX()[obs.GetN() - 1], 0.5) excluded.SetPoint(excluded.GetN(), 0, 0.5) excluded.SetPoint(excluded.GetN(), 0, tanbMax) excluded.SetPoint(excluded.GetN(), obs.GetX()[0], tanbMax) excluded.SetPoint(excluded.GetN(), obs.GetX()[0], obs.GetY()[0]) limit.setExcludedStyle(excluded) excluded.SetLineWidth(0) excluded.SetLineColor(ROOT.kWhite) expected = graphs["exp"] expected.SetLineStyle(2) expected1 = graphs["exp1"] expected1.SetLineStyle(2) expected2 = graphs["exp2"] expected2.SetLineStyle(2) # allowed = graphs["Allowed"] # if not allowed == None: # allowed.SetFillStyle(3005) # allowed.SetFillColor(ROOT.kRed) # allowed.SetLineWidth(-302) # allowed.SetLineColor(ROOT.kRed) # allowed.SetLineStyle(1) if not blinded: graphs["obs_th_plus"].SetLineStyle(9) # graphs["obs_th_minus"].SetLineStyle(9) excludedCopy = excluded.Clone() # excludedCopy.SetFillColorAlpha(ROOT.kWhite, 0.0) # actual color doesn't matter, want fully transparent plot = plots.PlotBase( [ histograms.HistoGraph(graphs["obs"], "Observed", drawStyle="PL", legendStyle="lp"), histograms.HistoGraph(graphs["obs_th_plus"], "ObservedPlus", drawStyle="L", legendStyle="l"), histograms.HistoGraph( graphs["obs_th_minus"], "ObservedMinus", drawStyle="L"), # histograms.HistoGraph(graphs["isomass"], "IsoMass", drawStyle="L"), # histograms.HistoGraph(graphs["isomass"], "IsoMassCopy", drawStyle="F"), histograms.HistoGraph( excluded, "Excluded", drawStyle="F", legendStyle=None), histograms.HistoGraph(excludedCopy, "ExcludedCopy", drawStyle=None, legendStyle="f"), histograms.HistoGraph(expected, "Expected", drawStyle="L"), # histograms.HistoGraph(graphs["exp"], "Expected", drawStyle="L"), # histograms.HistoGraph(graphs["Allowed"], "Allowed", drawStyle="L", legendStyle="lf"), # histograms.HistoGraph(graphs["Allowed"], "AllowedCopy", drawStyle="L", legendStyle="f"), histograms.HistoGraph( graphs["mintanb"], "MinTanb", drawStyle="L"), # histograms.HistoGraph(graphs["exp1"], "Expected1", drawStyle="F", legendStyle="fl"), # histograms.HistoGraph(graphs["exp2"], "Expected2", drawStyle="F", legendStyle="fl"), histograms.HistoGraph( expected1, "Expected1", drawStyle="F", legendStyle="fl"), histograms.HistoGraph( expected2, "Expected2", drawStyle="F", legendStyle="fl") ], saveFormats=[".png", ".pdf", ".C"]) plot.histoMgr.setHistoLegendLabelMany({ "ObservedPlus": "Observed #pm1#sigma (th.)", "ObservedMinus": None, "Excluded": None, "ExcludedCopy": "Excluded", "Expected": None, "MinTanb": None, # "Allowed": "m_{"+higgs+"}^{MSSM} #neq 125#pm3 GeV", "Expected1": "Expected median #pm 1#sigma", "Expected2": "Expected median #pm 2#sigma", # "IsoMass": None, # "IsoMassCopy": None }) else: if not graphs["isomass"] == None: graphs["isomass"].SetFillColor(0) graphs["isomass"].SetFillStyle(1) plot = plots.PlotBase( [ histograms.HistoGraph(expected, "Expected", drawStyle="L"), histograms.HistoGraph( graphs["isomass"], "IsoMass", drawStyle="L"), histograms.HistoGraph( graphs["isomass"], "IsoMassCopy", drawStyle="F"), # histograms.HistoGraph(graphs["Allowed"], "Allowed", drawStyle="L", legendStyle="lf"), # histograms.HistoGraph(graphs["Allowed"], "AllowedCopy", drawStyle="L", legendStyle="f"), histograms.HistoGraph( graphs["mintanb"], "MinTanb", drawStyle="L"), histograms.HistoGraph( expected1, "Expected1", drawStyle="F", legendStyle="fl"), histograms.HistoGraph( expected2, "Expected2", drawStyle="F", legendStyle="fl"), ], saveFormats=[".png", ".pdf", ".C"]) plot.histoMgr.setHistoLegendLabelMany({ "Expected": None, "MinTanb": None, # "Allowed": "m_{"+higgs+"}^{MSSM} #neq 125#pm3 GeV", "Expected1": "Expected median #pm 1#sigma", "Expected2": "Expected median #pm 2#sigma", "IsoMass": None, "IsoMassCopy": None }) # Move the m_h,H allowed region to the last in the legend histoNames = [h.getName() for h in plot.histoMgr.getHistos()] plot.histoMgr.reorderLegend( filter(lambda n: "Allowed" not in n, histoNames)) size = 20 x = 0.2 # dy = -0.15 dy = -0.13 plot.setLegend( histograms.createLegend(x - 0.01, 0.50 + dy, x + 0.45, 0.80 + dy)) plot.legend.SetMargin(0.17) # plot.legend.SetFillColor(0) #plot.legend.SetFillColorAlpha(ROOT.kWhite, 50) # plot.legend.SetFillStyle(1001) if blinded: name += "_blinded" name = os.path.basename(name) name = name.replace("-", "_") frameXmax = 160 if "_mA_" in name: frameXmax = 145 plot.createFrame(name, opts={ "ymin": 0, "ymax": tanbMax, "xmin": 90, "xmax": frameXmax }) plot.frame.GetXaxis().SetTitle(xlabel) plot.frame.GetYaxis().SetTitle(limit.tanblimit) plot.draw() plot.setLuminosity(limits.getLuminosity()) plot.addStandardTexts() histograms.addText(x, 0.9 + dy, "t #rightarrow H^{+}b, H^{+} #rightarrow c#bar{s}", size=size) # histograms.addText(x, 0.863+dy, limits.getFinalstateText(), size=size) histograms.addText(x, 0.815 + dy, limit.getTypesetScenarioName(scenario), size=size) #histograms.addText(0.2, 0.231, "Min "+limit.BR+"(t#rightarrowH^{+}b)#times"+limit.BR+"(H^{+}#rightarrow#tau#nu)", size=0.5*size) # Too small to be visible # if not graphs["isomass"] == None: # histograms.addText(0.8, 0.15, "m_{H^{#pm}} = 160 GeV", size=0.5*size) #Adding a LHC label: # ROOT.LHCHIGGS_LABEL(0.97,0.72,1) #FH_version = db.getVersion("FeynHiggs") #histograms.addText(x, 0.55+dy, FH_version, size=size) # HD_version = db.getVersion("HDECAY") # histograms.addText(x, 0.55, FH_version+" and "+HD_version, size=size) # histograms.addText(x, 0.48, "Derived from", size=size) # histograms.addText(x, 0.43, "CMS HIG-12-052", size=size) plot.save() print "Created", name