In [1]:
import ROOT
ROOT.RooMsgService.instance().setGlobalKillBelow(5)
%jsroot on

from matplotlib import pyplot
%matplotlib inline
Welcome to JupyROOT 6.07/07

Reading Workspaces and Recreating Models

First we read in the signal region model from the workspace building notebook.

In [2]:
infile = ROOT.TFile.Open("output/SRselection.root")
w = infile.Get("w")
mc = w.obj("ModelConfig")
data = w.data("data")
mc.LoadSnapshot()
x = w.var("x")

Profile Likelihood Calculator

Here we define a ProfileLikelihood calculator and ask for the 68% interval

In [3]:
pl = ROOT.RooStats.ProfileLikelihoodCalculator(data,mc)
pl.SetConfidenceLevel(0.683)

Find parameters at this interval

In [4]:
mc.LoadSnapshot()
interval = pl.GetInterval()

find the iterval on the first Parameter of Interest

In [5]:
firstPOI = mc.GetParametersOfInterest().first()
lowerLimit = interval.LowerLimit(firstPOI)
upperLimit = interval.UpperLimit(firstPOI)
In [6]:
print "68% interval on {0} is [{1},{2}]".format(firstPOI.GetName(),lowerLimit,upperLimit)
68% interval on n_sig is [300.405555929,589.564440644]

We can also plot this.

In [7]:
plot = ROOT.RooStats.LikelihoodIntervalPlot(interval)
plot.SetRange(200,700)
plot.SetNPoints(50)
c = ROOT.TCanvas()
ROOT.gPad.SetLogy(True)
plot.Draw()
c.Draw()
Error in <THistPainter::PaintInit>: log scale is requested but maximum is less or equal 0 (-1.000000)