Skip to content

[RF] Bug in RooAbsPdf::extendedTerm when expected events is negative #8011

@lmoneta

Description

@lmoneta

When the expected number of events becomes negative, this can happen for some combinations of the parameters,
RooAbsPdf::extendedTerm prints an error message, but return also a zero value.
A zero value is WRONG bacause it is a valid value which is then used in the total likelihood computation, confusing the minimization and ending up in a good wrong result.

It should return a NaN, that is now correctly propagated and handle by RooFit.

Simple example reproducing the problem:

{
    RooWorkspace w;
    w.factory("mu[1,-1.5,10]");
   w.factory("prod::ns(1,mu)");
   w.factory("prod::nb(b[1,0,10],theta[1])");
   w.factory("sum::ntot(ns,nb)");
   w.factory("Uniform::ff(x[0,1])");
   w.factory("SUM::pdf(ntot*ff)");

   auto pdf = w.pdf("pdf");
   auto x = w.var("x");
   RooDataSet d("data","data",*x);
   d.add(*x); 
   auto nll = pdf->createNLL(d);

   auto pl = w.var("mu")->frame();
   nll->plotOn(pl);

   pl->Draw();
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions