Problems when calculating asymptotic limits with large N_BG


I am trying to calculate upper limits on additional event yield for a single bin counting experiment.
I am using the RooStats::AsymptoticCalculator with a simple model containing only three input values:
Number of data events (N_Data), number of background events (N_BG) and
the uncertainty on the number of background events (sigma_NBG) (See macro in attachment).
I use root version 5.34.28.

In principle, this works fine but I face problems if N_Data, N_BG and/or sigma_NBG gets too large.

I get two different error messages:

  1. WARNING:Minization – RooMinimizerFcn: Minimized function has error status.
    Returning maximum FCN so far (-1e+30) to force MIGRAD to back out of this region. Error log follows
    Parameter values: BSMAnz=3603, beta_nbkg=0, glob_nbkg=0
    RooProdPdf::model[ model_core * constr_nbkg ]
    getLogVal() top-level p.d.f evaluates to zero @ !pdfs=(model_core = 0/1,constr_nbkg = 1)

  2. Error: Cannot compute CLs because CLb = 0. Returning CLs = -1

For the first case I get limit values which seems somewhat reasonable, but can I trust them?
For the second case I get no valid limits.

I have tried to avoid these problems by altering the parameter of interest (PoI) by some factors:
PoI_old = PoI_new * factor to reduce the size of the PoI.
–> this does not help.
On top of that I optimizing the upper border of the Parameter of Interest (rMax) to be large enough
but not too large (~3 times the expected limit).
I have observed that too large values of this upper border causes problem 1),
but for some values of N_Data, N_BG and sigma_NBG decreasing rMax does not help
(I have stopped decreasing rMax, if it becomes smaller than 2*expected_limit).

I have attached a plot showing for which values of N_BG and sigma_NBG which of the two problems appears (under the assumption N_BG = N_Data).

Does anybody know how to fix these problems?

Thanks a lot,
RooFit_AsymptoticLimit.C (9.37 KB)
ErrorsAndWarningsFromRooStatsvsNGB_withLegend.pdf (176 KB)


The errors are certainly given by numerical problems when fitting. It could be due to ranges not setting correctly (e.g. too large or too smalls) for the fit parameters.
I would suggest you, if increasing the background number, to renormalise it with a constant in a way that the fit parameter value stays around 1.

Best Regards


Hi Lorenzo,
Thanks for your reply.

Which parameters do you mean?
I have tried and renormalised the parameter of interest to be approx 1 but this did not helped.
Are there any other parameters I could rescale?
Sorry, I am really new to RooStats and do not know how to use it properly, yet.

Best Regards


Did you rescale also the number of background events ?
I see in your code you define for example the background yield parameter. Maybe re-define this with a scale factor to be equal to 1 at its nominal value.
If you have problem, please send me your code reproducing the problem (i.e. with large value of background defined)


I do not exactly understand what you mean with rescale the number of background events.
I do understand that one can rescale the PoI since it is possible to get to the real limit again by scaling the output by the same (inverted) factor, but if I scale the background I will get completely different limits… or do I miss something here?

I have put the macro in the attachment which reproduces the “Error: Cannot compute CLs because CLb = 0. Returning CLs = -1” problem.

RooFit_AsymptoticLimit_problem.C (7.14 KB)

Hi Simon,

Thank you for providing an example. I understand now your problem. Unfortunately there is no much one can do, in your case you have a model with large N and large N_BG and also you assign a very large systematics on N_BG. This makes the problem unconstrained, the Gaussian constraint you put in the model on the background is too loose and basically your background is unconstrained. You would need to add an extra constraint on the background which makes more sense (e.g. with k ~ 1.01 , 1% systematics, it would work) or with model like that one, you cannot infer anything on the parameter of interest.

Best Regards


Hi Lorenzo,

Thank you for your help. It is unfortunate, indeed, but at least I know now that it is a general problem and not something wrong with my code.
I think I will just discard these regions from my limit setting.

Thanks again,