Bug in conditional product pdf with a crystal ball

Dear Roofiters,

I believed to have unveiled a bug in the generation of pseudo-data when you use a product of a conditional PDF and a crystal ball with a shifting mean.

  9 // Create f(y)                                                                                                
 10 RooPolyVar fy("fy","fy",y,RooArgSet(a0,a1)) ;                                                                 
 11 // Create CB(x,f(y),s,alpha,n)                                                                                
 12 RooCBShape model("model","Crystal ball with shifting mean",x,fy,RooFit::RooConst(.1),RooFit::RooConst(1),RooFit::RooConst(1));
 13 //Create "flat" PDF in y: g(y)                                                                                
 14 RooPolynomial gy("gy","Model for y",y);                                                                       
 15 // Create plain 2D pdf model(x,sx|y) * g(y)                                                                   
 16 RooProdPdf condprod("condprod","model(x|y)*gy(y)",gy,RooFit::Conditional(model,x));

I join a little macro that reproduces the issue ProdModel.C (1.2 KB)

I think that the bug is coming from the way the pseudo-data are generated when the following method: are enabled in the pdf class definition
Int_t RooCBShape::getMaxVal(const RooArgSet& vars)
and Double_t RooCBShape::maxVal(Int_t code)

So the quick fix, I came up with, is to comment those two methods in the RooCBShape.cxx and RooCBShape.h, however this makes the generation quite slower.

If someone from the development team could take a look at this that would be very appreciated.
Kindest Regards,

Hi @LbtLoic,

I fixed a bug in the product PDF a short while ago. Do you have the opportunity to test the same workflow on lxplus using ROOT’s nightlies? It could be completely unrelated, but it’s worth a try.

Which ROOT version are you using, anyway?

OK, on second read: it’s probably not related. The version you use would nevertheless be interesting.

Dear Stephan,
Thank you for your quick reply !
I use versions ROOT 6.14/06 and ROOT 6.18/04


The problem was reported 4 years ago at: https://sft.its.cern.ch/jira/browse/ROOT-8489
I hope it will get fixed this time. It’s likely that the bug was introduced with https://github.com/root-project/root/commit/362782494f42d67c9aad01bb9d529d01cdc2dc33, but I haven’t checked that. I’m using a workaround similar to what Loïc is using.

you are right @dmytro ! The problem as in that mentioned bug is due to the wrong maximum computed by RooCBShape.
It is now fixed by this PR (https://github.com/root-project/root/pull/6604 )


1 Like

Thanks @moneta. I confirm that your fix works for our case.


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.