Hi,

I am completely stuck with trying to use conditional PDFs in RooFit, despite the manuals’ extensive and assuring explanations. If anyone who has experience with this sees my problem, please let me know!

I have a text book example (I think) of when one can use conditional pdfs: a dataset with a set of vertex position measurements x, and a variance V(x) for each x. So, I want to fit a certain function to the distribution of x values, and I want to weigh each event with the information from V(x).

I describe the “physics” part and the “error” part with two separate PDFs, and then build a composite model using RooProdPDf("","",errorpdf, Conditional(targetpdf,x)).

My problem is that it does not seem to matter AT ALL if I include the error PDF at all, or if I treat V(x) (actually sqrt(V(x)) as a conditional PDF or not. The fit returns the same results in any case. Clearly something is wrong.

I have tried to use a RooHistPdf filled with the observed values of sqrt(V(X)) instead of a RooGenericPDF when I build my composite PDF, but it seems to make no difference.

Does anyone with experience of this know what’s wrong? I’ve included the important parts of the code here. Unfortunately it’s not executable since I can’t attach the real dataset, but maybe you can see some obvious mistake in my code?

cheers

Aras

```
//observables. vertex position and variance. Fetched from a dataset.
RooRealVar vertex_x("vertex_x","vertex_x",lowlimit_x,highlimit_x);
RooRealVar cov_x("cov_xx","Cov_x",0,2);
//fit paramaters:
RooRealVar Left_x("Left_x","X Left",leftguess_x,leftguess_x-1,leftguess_x+1);
RooRealVar sigmaLeft_x("sigmaLeft_x","X sigmaLeft",0.2,0.05,1);
RooRealVar Right_x("Right_x","X Right",rightguess_x,rightguess_x-1,rightguess_x+1);
RooRealVar sigmaRight_x("sigmaRight_x","X sigmaRight",0.2,0.05,1);
//The physics PDF:
RooGenericPdf targetpdf_x("targetpdf_x",
targetformula,
RooArgSet(vertex_x,Left_x,sigmaLeft_x,Right_x,sigmaRight_x));
//The "error part" of the PDF = sigma_x = sqrt of variance of x from vertex fit:
RooGenericPdf errorpdf_x("errorpdf_x","sqrt(@0)",RooArgSet(cov_x));
//Make composite model
RooProdPdf model_x("fullpdf_x","fullpdf",errorpdf_x,Conditional(targetpdf_x,vertex_x));
//Fit to dataset "xslice":
RooFitResult *fitresultx=model_x.fitTo(*xslice,Save(true),Minos(false),Hesse(true));
```