createNLL problem in RooPoisson in 5.32+?

Hi

I have been trying to use createNLL to generate a specific test statistic.

I was originally using ROOT 5.30 but was noticing a lot of memory issues. I noticed on here that there were similar problems discussed and fixed in later versions. I therefore decided to source ROOT from lxplus and try using 5.32 and higher, to see if my code would run faster.

My code is loading some pdfs and using those, but I seem to have tracked the problem down, at least on the surface to the RooPoisson pdf.

I am generating data, say, with a RooPoisson* P1, with some mean. I take this to be my signal pdf. I then also have a background pdf which is also RooPoisson* P2, but has some other mean value.

I generate the data with P1 and then use createNLL on P1 and P2 with the same dataset. I then construct the likelihood ratio.

Now it seems that in version 5.30 this was working fine (although I have had issues with 2D pdfs, but not the Poissons). When I use 5.32 (and newer versions up to the 5.34 release candiate) the evaluation of the signal pdf NLL always seems to return the same value!

I then also generate data using P2 and use createNLL again with this new dataset and I observe the same behaviour - ie the pdf which was used to generate the data is evaluating to the same NLL every iteration.

Has there been a change from 5.30 to 5.32+ which could have broken the NLL evaluation in the RooPoisson class in this way, or am I doing something wrong?

For completeness, the method I am using with the NLL is to create a single instance of it and the use the setData(*data, kFALSE) on later iterations. I am also using the same technique with another group of pdfs, this time generated with RooKeysPdf and I am not observing this behaviour which again leads me to believe there may be an issue with RooPoisson?

I find it odd that the same code compiles and runs under 5.30 and gives sensible results but changing to 5.32+ means that the pdf being evaluated with the dataset it generated is giving fixed (and large) values for the NLL.
Thanks

Hi ,
Can you please post some code reproducing this problem ?

Thank you, Lorenzo

Hi Lorenzo

I have just written a quick c++ program which seems to show the same behaviour. I have followed the same syntax as I am using in my much larger/ complicated program which is why I have things like declaring a pointer in one line and initialising it in another, even though I could do the two things together in that example.

I attach a gzipped file which contains the source folder and a makefile. I work on my university server where I source ROOT 5.30 locally but I can also source 5.32+ from /afs/cern.ch/ (and the newer versions of gcc).

It seems to me that when I make this program under my local settings of ROOT 5.30 it works correctly, but when I source newer versions of ROOT 5.32+ and gcc (and then ‘make clean’, then ‘make’ again) the program exhibits the behaviour I described below.

Any help you could offer would be greatly appreciated (even if it turns out to be a problem with the way I am using the RooFit objects).

(PS - Ignore the first couple of couts which were my method of debugging which I forgot to remove.)

Ian
testmacro.gz (8.35 KB)

Thanks for the example. It looks like a bug, I will post it in Savannah,
in the mean time to fix it you need to re-create the NLL every time or using setData(data, true), which will cone the data set
Lorenzo

Thanks for the help.
I just checked and using kTRUE to clone the dataset does resolve the problem so I’ll do that for now I think.