I have a two-dimensional fit, with two floating paramaters, nsig and nbkg. Now I try to calculate the 90% CL UL from the log-likelihood. What I am doing is (in a Python environment):
nll = RooNLLVar("nll","nll",FitPdf, Data, ROOT.RooFit.Extended(ROOT.kTRUE))
nll2 = RooFormulaVar("nll2","nll+6550.",RooArgList(nll));
llhood = RooFormulaVar("llhood","exp(-0.5*nll2)",RooArgList(nll2));
nsig.setRange("IntRange1",0,1000.)
Int1 = llhood.createIntegral(RooArgSet(nsig), ROOT.RooFit.Range('IntRange1'))
Int1Val = Int1.getVal()
i = 0
hit = False
while not(hit):
i=i+1
nsig.setRange("IntRange2",0,float(i))
Int2 = llhood.createIntegral(RooArgSet(nsig), ROOT.RooFit.Range('IntRange2'))
if Int2.getVal() >= Int1Val*0.9:
print i
hit=True
My suspicion is that the integral is done with fixed nbkg, and thus I obtain a false upper limit. Is that correct? And how can I get RooFit to integrate along the optimal nbkg values?
The two-dimensional llhood looks as follows:
Okay, I managed to get a bit further. It seems that I need the profile-likelihood which looks fine. But I am not able to convert it into the log-likelihood like with my nll2
Okay, so to complete this topic, I found a solution. Apparently the use of createProfile returns a RooProfileLL object which cannot be evaluated. To circumvent this I directly create a RooProfileLL which seems to work without any problems.