Default error level with RooAddition

Hello,

I’m having a problem when using RooAddition to combine different likelihoods.
The final error of the variables I’m fitting seem wrong.
I define a list of likelihoods from different PDFs using:

RooAbsReal *nll_1 = model_1->createNLL(*data_1,RooFit::CloneData(kFALSE),Extended(kTRUE),Constrain(*nbkgvar));
RooAbsReal *nll_2 = …

(each PDF is used to fit a different category)

Then, I add each log likelihood to a RooArgSet

RooArgSet llSet;
llSet.add(nll_1);
llSet.add(nll_2);

which I use to define the following combined likelihood

RooAbsReal *combll = new RooAddition(“combll”,“combll”,llSet);

The problem is that the variables stored in the set are not being recognized as log likelihoods
by the RooAddition class
and after the minimization procedure is done the error is evaluated at 1.0 level instead of 0.5 level.
The warning message is:

INFO:Fitting – RooAddition::defaultErrorLevel(combll) WARNING: Summation contains neither RooNLLVar nor RooChi2Var server, using default level of 1.0

I have forced the error level to be 0.5 with

RooMinuit minuit(*combll);
minuit.setErrorLevel(0.5);

and I got the correct answear for the error
but I was wondering if there is another way to do it.
Also I’m not being able to retrieve the asymmetric errors for the variable I’m fitting (I get 0 for both).
Finally I have checked that a dynamic_cast of a RooNLLVar to my nll_i variables returns a null pointer
which must be the reason why the RooAddition class is not recongnizing these as likelihoods.

Thanks for your help,
Pedro

Hi Pedro,

Thanks for reporting that. I understand what goes wrong. If you add a Constrain() term to your createNll() the returned object is not a RooNLLVar, but rather a RooAddition of a RooNLLVar and a RooConstraintSum. If you feed that again into a RooAddition the top-level one doesn’t ‘see’ the lower RooNLLVar and reverts to its default behavior.

I will modify RooAddition to look recursively which will solve this problem. In the mean time you’ll have to use the RooMinuit interface set the error level, or derived a private class from RooAddition that implements a different error level and use that for the addition.

I’ve filed this Savannah #77426

Wouter