import ROOT
ROOT.RooMsgService.instance().setGlobalKillBelow(5)
%jsroot on
from matplotlib import pyplot
%matplotlib inline
First we read in the signal region model from the workspace building notebook.
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")
Here we define a ProfileLikelihood calculator and ask for the 68% interval
pl = ROOT.RooStats.ProfileLikelihoodCalculator(data,mc)
pl.SetConfidenceLevel(0.683)
Find parameters at this interval
mc.LoadSnapshot()
interval = pl.GetInterval()
find the iterval on the first Parameter of Interest
firstPOI = mc.GetParametersOfInterest().first()
lowerLimit = interval.LowerLimit(firstPOI)
upperLimit = interval.UpperLimit(firstPOI)
print "68% interval on {0} is [{1},{2}]".format(firstPOI.GetName(),lowerLimit,upperLimit)
We can also plot this.
plot = ROOT.RooStats.LikelihoodIntervalPlot(interval)
plot.SetRange(200,700)
plot.SetNPoints(50)
c = ROOT.TCanvas()
ROOT.gPad.SetLogy(True)
plot.Draw()
c.Draw()