[RooFit] How to multiply PDFs which share parameters?

Hello,

I have a problem with building PDFs in RooFit.
I have to multiply several PDFs which share parameters. I’m using conditional PDFs such that the normalization is done correctly.
I can simplify my situation as follows

PDFs P, Q and R describe the distribution of parameters x, y and z, respectively. Full PDF S is defined as
S(x, y, z) = P(x | y, z) * Q(y | z, x) * R(z | x, y)

The macro used for testing the situation is the following.

void test() 
{                                                                                                       {                                                                                                                  
  gSystem->Load("libRooFit");                                                                                      
  using namespace RooFit;                                                                                          
                                                                                                                   
  RooRealVar x("x","x",0, 1);                                                                                      
  RooRealVar y("y","y",0, 1);                                                                                      
  RooRealVar z("z","z",0, 1);                                                                                      
  RooGenericPdf P("P", "x distribution", "x * x + y + z", RooArgSet(x, y, z));                                     
  RooGenericPdf Q("Q", "y distribution", "x + y * y + z", RooArgSet(x, y, z));                                     
  RooGenericPdf R("R", "z distribution", "x + y + z * z", RooArgSet(x, y, z));                                     
  RooProdPdf S("S", "full pdf", Conditional(P, x), Conditional(Q, y), Conditional(R, z));                          
                                                                                                                   
  RooPlot* xframe = x.frame();                                                                                     
  S.plotOn(xframe);                                                                                                
  RooPlot* yframe = y.frame();                                                                                     
  S.plotOn(yframe);                                                                                                
  RooPlot* zframe = z.frame();                                                                                     
  S.plotOn(zframe);                                                                                                
                                                                                                                   
}  

If I run the macro, I got error messages from RooFit as follows.

[#0] ERROR:InputArguments – RooArgSet::checkForDup: ERROR argument with name x is already in this set
[#0] ERROR:InputArguments – RooArgSet::checkForDup: ERROR argument with name y is already in this set
[#0] ERROR:InputArguments – RooArgSet::checkForDup: ERROR argument with name z is already in this set

It seems that it’s not allowed to share conditional observables (parameters after the vertical bar) in multiplying PDFs.
Do I do something wrong? Or is there any better way to multiply PDFs which share parameters?
Since our PDFs are quite complicated, it’s not possible to define the full PDF at once using RooGenericPdf.
I’m using ROOT ver5.18/00 and RooFit v2.31.

Any suggestion would be appreciated.

Thank you,
Wataru

Hi Wataru,

What you do should be explicitly possible. I just went through the source code and I believe I made a mistake when I was migrating of the error message handling in this particular case. This message should not have been printed, it was meant to be a debug-level message. It is also harmless as no action is taken based on it internally in RooProdPdf. I will have the message suppressed in the next ROOT release.

If you have other problems please let me know.

Wouter