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