Exemplo n.º 1
0
def content(mHBestFit=130.0, height1SigmaLabel=10.0, color=ROOT.kBlue):
    # make mock curve
    linSpace = [100 + i * 60.0 / 300.0 for i in range(300)]
    likelihood = [(x, (x - mHBestFit) * (x - mHBestFit) / 25.0)
                  for x in linSpace]
    likelihood_statOnly = [(x, (x - mHBestFit) * (x - mHBestFit) / 20.0)
                           for x in linSpace]
    # draw curve
    g = PyROOTUtils.Graph(likelihood, lineColor=color, lineWidth=2)
    g.Draw()
    g_statOnly = PyROOTUtils.Graph(likelihood_statOnly,
                                   lineColor=color,
                                   lineWidth=2,
                                   lineStyle=ROOT.kDashed)
    g_statOnly.Draw()

    # find 68% CL interval from likelihood
    low, high = g.getFirstIntersectionsWithValue(1.0)
    vLineM1Sigma = PyROOTUtils.DrawVLine(low,
                                         lineStyle=ROOT.kDashed,
                                         lineWidth=1,
                                         lineColor=color)
    vLineP1Sigma = PyROOTUtils.DrawVLine(high,
                                         lineStyle=ROOT.kDashed,
                                         lineWidth=1,
                                         lineColor=color)
    hLine1Sigma = PyROOTUtils.DrawLine(low,
                                       height1SigmaLabel,
                                       high,
                                       height1SigmaLabel,
                                       lineWidth=5,
                                       lineColor=color)
    label1Sigma = PyROOTUtils.DrawText(
        mHBestFit,
        height1SigmaLabel, ("#lower[-0.5]{%.1f^{%+.1f}_{%+.1f} GeV}" %
                            (mHBestFit, high - mHBestFit, low - mHBestFit)),
        NDC=False,
        textSize=0.025,
        halign="center",
        valign="bottom",
        textColor=color)

    container.append(
        (g, g_statOnly, vLineM1Sigma, vLineP1Sigma, hLine1Sigma, label1Sigma))

    return (g, g_statOnly)