def doLimitError(limits, unblindedStatus):
    expRelErrors = []
    expLabels    = {}
    obsRelErrors = []
    obsLabels    = {}

    order = [0, 1, -1, 2, -2]
    expErrors = [limits.expectedErrorGraph(sigma=s) for s in order]
    if expErrors[0] != None:
        exps = [limits.expectedGraph(sigma=s) for s in order]
        expRelErrors = [(limit.divideGraph(expErrors[i], exps[i]), "ExpRelErr%d"%i) for i in xrange(len(exps))]
        expLabels = {
            "ExpRelErr0": "Expected median",
            "ExpRelErr1": "Expected +1#sigma",
            "ExpRelErr2": "Expected -1#sigma",
            "ExpRelErr3": "Expected +2#sigma",
            "ExpRelErr4": "Expected -2#sigma",
            }

    if unblindedStatus:
        obsErr = limits.observedErrorGraph()
        if obsErr != None:
            obs = limits.observedGraph()
            if obs != None:
                obsRelErrors = [(limit.divideGraph(obsErr, obs), "ObsRelErr")]
                obsLabels = {"ObsRelErr": "Observed"}

    if len(expRelErrors) == 0 and len(obsRelErrors) == 0:
        return

    # Create the plot
    plot = plots.PlotBase()
    if len(expRelErrors) > 0:
        plot.histoMgr.extendHistos([histograms.HistoGraph(x[0], x[1], drawStyle="PL", legendStyle="lp") for x in expRelErrors])
        plot.histoMgr.forEachHisto(styles.generator())
        def sty(h):
            r = h.getRootHisto()
            r.SetLineStyle(1)
            r.SetLineWidth(3)
            r.SetMarkerSize(1.4)
        plot.histoMgr.forEachHisto(sty)
        plot.histoMgr.setHistoLegendLabelMany(expLabels)
    if unblindedStatus:
        if len(obsRelErrors) > 0:
            obsRelErrors[0][0].SetMarkerSize(1.4)
            obsRelErrors[0][0].SetMarkerStyle(25)
            plot.histoMgr.insertHisto(0, histograms.HistoGraph(obsRelErrors[0][0], obsRelErrors[0][1], drawStyle="PL", legendStyle="lp"))
            plot.histoMgr.setHistoLegendLabelMany(obsLabels)

    plot.setLegend(histograms.moveLegend(histograms.createLegend(0.48, 0.75, 0.85, 0.92), dx=0.1, dy=-0.1))
 
    if len(limits.mass) == 1:
        plot.createFrame("limitsBrRelativeUncertainty", opts={"xmin": limits.mass[0]-5.0, "xmax": limits.mass[0]+5.0,  "ymin": 0, "ymaxfactor": 1.5})
    else:
        plot.createFrame("limitsBrRelativeUncertainty", opts={"ymin": 0, "ymaxfactor": 1.5})
    plot.frame.GetXaxis().SetTitle(limit.mHplus())
    plot.frame.GetYaxis().SetTitle("Uncertainty/limit")

    plot.draw()

    plot.setLuminosity(limits.getLuminosity())
    plot.addStandardTexts()

    size = 20
    x = 0.2
    histograms.addText(x, 0.88, limit.process, size=size)
    histograms.addText(x, 0.84, limits.getFinalstateText(), size=size)
    histograms.addText(x, 0.79, limit.BRassumption, size=size)

    size = 22
    x = 0.55
    histograms.addText(x, 0.88, "Toy MC relative", size=size)
    histograms.addText(x, 0.84, "statistical uncertainty", size=size)

    plot.save()
Esempio n. 2
0
def doLimitError(limits, unblindedStatus):
    expRelErrors = []
    expLabels = {}
    obsRelErrors = []
    obsLabels = {}

    order = [0, 1, -1, 2, -2]
    expErrors = [limits.expectedErrorGraph(sigma=s) for s in order]
    if expErrors[0] != None:
        exps = [limits.expectedGraph(sigma=s) for s in order]
        expRelErrors = [(limit.divideGraph(expErrors[i],
                                           exps[i]), "ExpRelErr%d" % i)
                        for i in xrange(len(exps))]
        expLabels = {
            "ExpRelErr0": "Expected median",
            "ExpRelErr1": "Expected +1#sigma",
            "ExpRelErr2": "Expected -1#sigma",
            "ExpRelErr3": "Expected +2#sigma",
            "ExpRelErr4": "Expected -2#sigma",
        }

    if unblindedStatus:
        obsErr = limits.observedErrorGraph()
        if obsErr != None:
            obs = limits.observedGraph()
            if obs != None:
                obsRelErrors = [(limit.divideGraph(obsErr, obs), "ObsRelErr")]
                obsLabels = {"ObsRelErr": "Observed"}

    if len(expRelErrors) == 0 and len(obsRelErrors) == 0:
        return

    # Create the plot
    plot = plots.PlotBase()
    if len(expRelErrors) > 0:
        plot.histoMgr.extendHistos([
            histograms.HistoGraph(x[0], x[1], drawStyle="PL", legendStyle="lp")
            for x in expRelErrors
        ])
        plot.histoMgr.forEachHisto(styles.generator())

        def sty(h):
            r = h.getRootHisto()
            r.SetLineStyle(1)
            r.SetLineWidth(3)
            r.SetMarkerSize(1.4)

        plot.histoMgr.forEachHisto(sty)
        plot.histoMgr.setHistoLegendLabelMany(expLabels)
    if unblindedStatus:
        if len(obsRelErrors) > 0:
            obsRelErrors[0][0].SetMarkerSize(1.4)
            obsRelErrors[0][0].SetMarkerStyle(25)
            plot.histoMgr.insertHisto(
                0,
                histograms.HistoGraph(obsRelErrors[0][0],
                                      obsRelErrors[0][1],
                                      drawStyle="PL",
                                      legendStyle="lp"))
            plot.histoMgr.setHistoLegendLabelMany(obsLabels)

    plot.setLegend(
        histograms.moveLegend(histograms.createLegend(0.48, 0.75, 0.85, 0.92),
                              dx=0.1,
                              dy=-0.1))

    if len(limits.mass) == 1:
        plot.createFrame("limitsBrRelativeUncertainty",
                         opts={
                             "xmin": limits.mass[0] - 5.0,
                             "xmax": limits.mass[0] + 5.0,
                             "ymin": 0,
                             "ymaxfactor": 1.5
                         })
    else:
        plot.createFrame("limitsBrRelativeUncertainty",
                         opts={
                             "ymin": 0,
                             "ymaxfactor": 1.5
                         })
    plot.frame.GetXaxis().SetTitle(limit.mHplus())
    plot.frame.GetYaxis().SetTitle("Uncertainty/limit")

    plot.draw()

    plot.setLuminosity(limits.getLuminosity())
    plot.addStandardTexts()

    size = 20
    x = 0.2
    histograms.addText(x, 0.88, limit.process, size=size)
    histograms.addText(x, 0.84, limits.getFinalstateText(), size=size)
    histograms.addText(x, 0.79, limit.BRassumption, size=size)

    size = 22
    x = 0.55
    histograms.addText(x, 0.88, "Toy MC relative", size=size)
    histograms.addText(x, 0.84, "statistical uncertainty", size=size)

    plot.save()
Esempio n. 3
0
def doCompare(name, compareList, **kwargs):
    # Define lists
    legendLabels = []
    limits = []

    # For-loop: All label-path pairs
    for label, path in compareList:
        legendLabels.append(label)
        dirs = glob.glob(path)
        dirs.sort()

        if len(dirs) == 0:
            raise Exception("No directories for pattern '%s'" % path)
        directory = dirs[-1]

        Verbose("Picked %s" % directory, True)
        limits.append(limit.BRLimits(directory, excludeMassPoints=["155"]))

    # ================================================================================================================
    # Do the sigma bands
    # ================================================================================================================
    Verbose("Creating the sigma-bands plots", True)
    _opts = copy.deepcopy(opts)
    doPlotSigmaBands(limits, legendLabels, opts.name + "_sigmaBands", _opts)

    # ================================================================================================================
    # Do expected
    # ================================================================================================================
    Verbose("Creating the expected plots", True)
    observedList = [l.observedGraph() for l in limits]
    expectedList = [l.expectedGraph() for l in limits]

    # 1) Expected: Median +/- 1,2 sigma
    doPlot(limits,
           legendLabels,
           expectedList,
           opts.name + "_median",
           limit.BRlimit,
           _opts,
           yTitle="Expected Sigma Bands")

    # 2) Expected: +/- 1 sigma
    list1 = [l.expectedGraph(sigma=+1) for l in limits]
    list2 = [l.expectedGraph(sigma=-1) for l in limits]
    exp1sigmaList = list1 + list2
    legendLabels2 = legendLabels + [None] * len(legendLabels)
    doPlot(limits,
           legendLabels2,
           exp1sigmaList,
           opts.name + "_sigma1",
           "Expected #pm1#sigma",
           _opts,
           yTitle="Expected #pm1sigma")

    # 3) Expected: +/- 2 sigma
    list1 = [l.expectedGraph(sigma=+2) for l in limits]
    list2 = [l.expectedGraph(sigma=-2) for l in limits]
    exp2sigmaList = list1 + list2
    doPlot(limits,
           legendLabels2,
           exp2sigmaList,
           opts.name + "_sigma2",
           "Expected #pm2#sigma",
           _opts,
           yTitle="Expected #pm2sigma")

    # ================================================================================================================
    # Do the observed plots
    # ================================================================================================================
    Verbose("Creating the observed plots", True)
    if opts.unblinded:
        doPlot(limits,
               legendLabels,
               observedList,
               opts.name,
               limit.BRlimit,
               _opts,
               yTitle="Observed")

    # ================================================================================================================
    # Do the relative plots
    # ================================================================================================================
    Verbose("Creating the relative plots", True)
    if not opts.relative:
        return
    # Overwrite some settings
    _opts.yMin = 0.0
    _opts.yMax = 2.5
    _opts.logY = False

    # 1) Relative: median
    relLimits = GetRelativeLimits(limits)
    expectedList = [l.expectedGraph() for l in relLimits]
    doPlot(relLimits,
           legendLabels,
           expectedList,
           opts.name + "_medianRelative",
           opts.relativeYlabel,
           _opts,
           yTitle="Expected median")

    # 2) Relative: (expected 1 sigma) / (median)
    list1 = [
        limit.divideGraph(l.expectedGraph(sigma=+1), l.expectedGraph())
        for l in limits
    ]
    list2 = [
        limit.divideGraph(l.expectedGraph(sigma=-1), l.expectedGraph())
        for l in limits
    ]
    sigma1List = list1 + list2
    doPlot(limits,
           legendLabels2,
           sigma1List,
           opts.name + "_sigma1Relative",
           "Expected #pm1#sigma / median",
           _opts,
           yTitle="Expected #pm1#sigma / median")

    # 3) Relative: (expected 2 sigma) / (median)
    list1 = [
        limit.divideGraph(l.expectedGraph(sigma=+2), l.expectedGraph())
        for l in limits
    ]
    list2 = [
        limit.divideGraph(l.expectedGraph(sigma=-2), l.expectedGraph())
        for l in limits
    ]
    sigma2List = list1 + list2
    doPlot(limits,
           legendLabels2,
           sigma2List,
           opts.name + "_sigma2Relative",
           "Expected #pm2#sigma / median",
           _opts,
           yTitle="Expected #pm2#sigma / median")
    return
Esempio n. 4
0
def doCompare(name, compareList, opts, **kwargs):
    legendLabels = []
    limits = []
    for label, path in compareList:
        legendLabels.append(label)
        dirs = glob.glob(path)
        dirs.sort()
        if len(dirs) == 0:
            raise Exception("No directories for pattern '%s'" % path)
        directory = dirs[-1]
        print "Picked %s" % directory
        limits.append(limit.BRLimits(directory, excludeMassPoints=["155"]))

    doPlot2(limits, legendLabels, name)

    limitOpts = kwargs.get(
        "limitOpts",
        {"ymax": _ifNotNone(opts.ymax, limits[0].getFinalstateYmaxBR())})
    expectedSigmaRelativeOpts = kwargs.get("expectedSigmaRelativeOpts",
                                           {"ymaxfactor": 1.2})
    moveLegend = kwargs.get("moveLegend", {})

    doPlot(limits,
           legendLabels, [l.observedGraph() for l in limits],
           name + "_observed",
           limit.BRlimit,
           opts=kwargs.get("observedOpts", limitOpts),
           moveLegend=moveLegend,
           plotLabel="Observed")

    doPlot(limits,
           legendLabels, [l.expectedGraph() for l in limits],
           name + "_expectedMedian",
           limit.BRlimit,
           opts=kwargs.get("expectedMedianOpts", limitOpts),
           moveLegend=moveLegend,
           log=kwargs.get("log", False),
           plotLabel="Expected median")

    if opts.relative:
        for i in range(1, len(limits)):
            limits[i].divideByLimit(limits[0])
        # Set reference to 1
        for j in range(0, len(limits[0].expectedMedian)):
            limits[0].expectedMedian[j] = 1.0
            limits[0].expectedMinus2[j] = 1.0
            limits[0].expectedMinus1[j] = 1.0
            limits[0].expectedPlus2[j] = 1.0
            limits[0].expectedPlus1[j] = 1.0
            limits[0].observed[j] = 1.0
        # Set y scale and require it to be linear
        kwargs["expectedMedianOptsRelative"] = {
            "ymin": 0.5,
            "ymax": _ifNotNone(opts.relativeYmax, 1.5)
        }
        kwargs["log"] = False
        doPlot(limits,
               legendLabels, [l.expectedGraph() for l in limits],
               name + "_expectedMedianRelative",
               opts.relativeYlabel,
               opts=kwargs.get("expectedMedianOptsRelative", limitOpts),
               moveLegend=moveLegend,
               log=kwargs.get("log", False),
               plotLabel="Expected median")
        print "Skipping +-1 and 2 sigma plots for --relative"
        sys.exit()

    if opts.relativePairs:
        if len(limits) % 2 != 0:
            print "Number of limits is not even!"
            sys.exit(1)
        divPoint = len(limits) / 2
        denoms = limits[:divPoint]
        numers = limits[divPoint:]
        for i in xrange(0, divPoint):
            numers[i].divideByLimit(denoms[i])
        doPlot(numers,
               legendLabels[:divPoint], [l.expectedGraph() for l in numers],
               name + "_expectedMedianRelative",
               opts.relativeYlabel,
               opts={
                   "ymin": 0.5,
                   "ymax": _ifNotNone(opts.relativeYmax, 1.5)
               },
               plotLabel="Expected median")
        print "Skipping +-1 and 2 sigma plots for --relativePairs"
        sys.exit()

    legendLabels2 = legendLabels + [None] * len(legendLabels)

    doPlot(limits,
           legendLabels2,
           [
               limit.divideGraph(l.expectedGraph(sigma=+1), l.expectedGraph())
               for l in limits
           ] + [
               limit.divideGraph(l.expectedGraph(sigma=-1), l.expectedGraph())
               for l in limits
           ],
           name + "_expectedSigma1Relative",
           "Expected #pm1#sigma / median",
           opts=kwargs.get("expectedSigma1RelativeOpts",
                           expectedSigmaRelativeOpts),
           moveLegend=moveLegend,
           plotLabel="Expected #pm1#sigma / median")

    doPlot(limits,
           legendLabels2,
           [
               limit.divideGraph(l.expectedGraph(sigma=+2), l.expectedGraph())
               for l in limits
           ] + [
               limit.divideGraph(l.expectedGraph(sigma=-2), l.expectedGraph())
               for l in limits
           ],
           name + "_expectedSigma2Relative",
           "Expected #pm2#sigma / median",
           opts=kwargs.get("expectedSigma2RelativeOpts",
                           expectedSigmaRelativeOpts),
           moveLegend=moveLegend,
           plotLabel="Expected #pm2#sigma / median")

    doPlot(limits,
           legendLabels2,
           [l.expectedGraph(sigma=+1)
            for l in limits] + [l.expectedGraph(sigma=-1) for l in limits],
           name + "_expectedSigma1",
           "Expected #pm1#sigma",
           opts=kwargs.get("expectedSigma1Opts", limitOpts),
           moveLegend=moveLegend,
           plotLabel="Expexted #pm1sigma")

    doPlot(limits,
           legendLabels2,
           [l.expectedGraph(sigma=+2)
            for l in limits] + [l.expectedGraph(sigma=-2) for l in limits],
           name + "_expectedSigma2",
           "Expected #pm2#sigma",
           opts=kwargs.get("expectedSigma2Opts", limitOpts),
           moveLegend=moveLegend,
           plotLabel="Expected #pm2sigma")
def doCompare(name, compareList, opts, **kwargs):
    legendLabels = []
    limits = []
    for label, path in compareList:
        legendLabels.append(label)
        dirs = glob.glob(path)
        dirs.sort()
        if len(dirs) == 0:
            raise Exception("No directories for pattern '%s'" % path)
        directory = dirs[-1]
        print "Picked %s" % directory
        limits.append(limit.BRLimits(directory, excludeMassPoints=["155"]))

    doPlot2(limits, legendLabels, name)

    limitOpts = kwargs.get("limitOpts", {"ymax": _ifNotNone(opts.ymax, limits[0].getFinalstateYmaxBR())})
    expectedSigmaRelativeOpts = kwargs.get("expectedSigmaRelativeOpts", {"ymaxfactor": 1.2})
    moveLegend = kwargs.get("moveLegend", {})

    doPlot(limits, legendLabels, [l.observedGraph() for l in limits],
           name+"_observed", limit.BRlimit, opts=kwargs.get("observedOpts", limitOpts), moveLegend=moveLegend,
           plotLabel="Observed")

    doPlot(limits, legendLabels, [l.expectedGraph() for l in limits],
           name+"_expectedMedian", limit.BRlimit, opts=kwargs.get("expectedMedianOpts", limitOpts), moveLegend=moveLegend, log=kwargs.get("log",False),
           plotLabel="Expected median")

    if opts.relative:
        for i in range(1, len(limits)):
            limits[i].divideByLimit(limits[0])
        # Set reference to 1
        for j in range(0, len(limits[0].expectedMedian)):
            limits[0].expectedMedian[j] = 1.0
            limits[0].expectedMinus2[j] = 1.0
            limits[0].expectedMinus1[j] = 1.0
            limits[0].expectedPlus2[j] = 1.0
            limits[0].expectedPlus1[j] = 1.0
            limits[0].observed[j] = 1.0
        # Set y scale and require it to be linear
        kwargs["expectedMedianOptsRelative"] = {"ymin": 0.5, "ymax": _ifNotNone(opts.relativeYmax, 1.5)}
        kwargs["log"] = False
        doPlot(limits, legendLabels, [l.expectedGraph() for l in limits],
              name+"_expectedMedianRelative", opts.relativeYlabel, opts=kwargs.get("expectedMedianOptsRelative", limitOpts), moveLegend=moveLegend, log=kwargs.get("log",False),
              plotLabel="Expected median")
        print "Skipping +-1 and 2 sigma plots for --relative"
        sys.exit()

    if opts.relativePairs:
        if len(limits) % 2 != 0:
            print "Number of limits is not even!"
            sys.exit(1)
        divPoint = len(limits) / 2
        denoms = limits[:divPoint]
        numers = limits[divPoint:]
        for i in xrange(0, divPoint):
            numers[i].divideByLimit(denoms[i])
        doPlot(numers, legendLabels[:divPoint], [l.expectedGraph() for l in numers],
               name+"_expectedMedianRelative", opts.relativeYlabel, opts={"ymin": 0.5, "ymax": _ifNotNone(opts.relativeYmax, 1.5)},
               plotLabel="Expected median")
        print "Skipping +-1 and 2 sigma plots for --relativePairs"
        sys.exit()

    legendLabels2 = legendLabels + [None]*len(legendLabels)

    doPlot(limits, legendLabels2,
           [limit.divideGraph(l.expectedGraph(sigma=+1), l.expectedGraph()) for l in limits] +
           [limit.divideGraph(l.expectedGraph(sigma=-1), l.expectedGraph()) for l in limits],
           name+"_expectedSigma1Relative", "Expected #pm1#sigma / median", opts=kwargs.get("expectedSigma1RelativeOpts", expectedSigmaRelativeOpts), moveLegend=moveLegend,
           plotLabel="Expected #pm1#sigma / median")

    doPlot(limits, legendLabels2,
           [limit.divideGraph(l.expectedGraph(sigma=+2), l.expectedGraph()) for l in limits] +
           [limit.divideGraph(l.expectedGraph(sigma=-2), l.expectedGraph()) for l in limits],
           name+"_expectedSigma2Relative", "Expected #pm2#sigma / median", opts=kwargs.get("expectedSigma2RelativeOpts", expectedSigmaRelativeOpts), moveLegend=moveLegend,
           plotLabel="Expected #pm2#sigma / median")

    doPlot(limits, legendLabels2,
           [l.expectedGraph(sigma=+1) for l in limits] +
           [l.expectedGraph(sigma=-1) for l in limits],
           name+"_expectedSigma1", "Expected #pm1#sigma", opts=kwargs.get("expectedSigma1Opts", limitOpts), moveLegend=moveLegend,
           plotLabel="Expexted #pm1sigma")

    doPlot(limits, legendLabels2,
           [l.expectedGraph(sigma=+2) for l in limits] +
           [l.expectedGraph(sigma=-2) for l in limits],
           name+"_expectedSigma2", "Expected #pm2#sigma", opts=kwargs.get("expectedSigma2Opts", limitOpts), moveLegend=moveLegend,
           plotLabel="Expected #pm2sigma")
Esempio n. 6
0
def doCompare(name, compareList, gOpts, **kwargs):
    # Define lists
    legendLabels = []
    limits = []

    # For-loop: All label-path pairs
    for label, path in compareList:
        legendLabels.append(label)
        dirs = glob.glob(path)
        dirs.sort()

        if len(dirs) == 0:
            raise Exception("No directories for pattern '%s'" % path)
        directory = dirs[-1]

        Print("Picked %s" % directory, True)
        limits.append(limit.BRLimits(directory, excludeMassPoints=["155"]))

    # Do the plot
    doPlotSigmaBands(limits, legendLabels, gOpts.name)

    # Define the graph lists
    observedList = [l.observedGraph() for l in limits]
    expectedList = [l.expectedGraph() for l in limits]

    doPlot(limits,
           legendLabels,
           expectedList,
           gOpts.name + "_expectedMedian",
           limit.BRlimit,
           myOpts=gOpts,
           plotLabel="Expected median")
    if gOpts.unblinded:
        doPlot(limits,
               legendLabels,
               observedList,
               gOpts.name + "_observed",
               limit.BRlimit,
               myOpts=gOpts,
               plotLabel="Observed")

    if gOpts.relative:
        nLimits = len(limits)
        # For-loop: All limits
        for i in range(1, nLimits):
            limits[i].divideByLimit(limits[0])

        # Set reference values to 1
        for j in range(0, len(limits[0].expectedMedian)):
            limits[0].expectedMedian[j] = 1.0
            limits[0].expectedMinus2[j] = 1.0
            limits[0].expectedMinus1[j] = 1.0
            limits[0].expectedPlus2[j] = 1.0
            limits[0].expectedPlus1[j] = 1.0
            limits[0].observed[j] = 1.0

        # Do the relative plot
        doPlot(limits,
               legendLabels,
               expectedList,
               gOpts.name + "_expectedMedianRelative",
               gOpts.relativeYlabel,
               myOpts=gOpts,
               plotLabel="Expected median")
        Print("Skipping +-1 and 2 sigma plots for --relative", True)
        sys.exit()

    if gOpts.relativePairs:
        if len(limits) % 2 != 0:
            Print("Number of limits is not even!", True)
            sys.exit(1)

        divPoint = len(limits) / 2
        denoms = limits[:divPoint]
        numers = limits[divPoint:]

        # For-loop: All division points
        for i in xrange(0, divPoint):
            numers[i].divideByLimit(denoms[i])

        expectedNumersList = [l.expectedGraph() for l in numers]
        doPlot(numers,
               legendLabels[:divPoint],
               gexpectedNumersList,
               gOpts.name + "_expectedMedianRelative",
               gOpts.relativeYlabel,
               plotLabel="Expected median")
        Print("Skipping +-1 and 2 sigma plots for --relativePairs", True)
        sys.exit()

    legendLabels2 = legendLabels + [None] * len(legendLabels)

    doPlot(limits,
           legendLabels2,
           [
               limit.divideGraph(l.expectedGraph(sigma=+1), l.expectedGraph())
               for l in limits
           ] + [
               limit.divideGraph(l.expectedGraph(sigma=-1), l.expectedGraph())
               for l in limits
           ],
           gOpts.name + "_expectedSigma1Relative",
           "Expected #pm1#sigma / median",
           myOpts=gOpts,
           plotLabel="Expected #pm1#sigma / median")

    doPlot(limits,
           legendLabels2,
           [
               limit.divideGraph(l.expectedGraph(sigma=+2), l.expectedGraph())
               for l in limits
           ] + [
               limit.divideGraph(l.expectedGraph(sigma=-2), l.expectedGraph())
               for l in limits
           ],
           gOpts.name + "_expectedSigma2Relative",
           "Expected #pm2#sigma / median",
           myOpts=gOpts,
           plotLabel="Expected #pm2#sigma / median")

    doPlot(limits,
           legendLabels2,
           [l.expectedGraph(sigma=+1)
            for l in limits] + [l.expectedGraph(sigma=-1) for l in limits],
           gOpts.name + "_expectedSigma1",
           "Expected #pm1#sigma",
           myOpts=gOpts,
           plotLabel="Expexted #pm1sigma")

    doPlot(limits,
           legendLabels2,
           [l.expectedGraph(sigma=+2)
            for l in limits] + [l.expectedGraph(sigma=-2) for l in limits],
           gOpts.name + "_expectedSigma2",
           "Expected #pm2#sigma",
           myOpts=gOpts,
           plotLabel="Expected #pm2sigma")
    return