RooProdPdf: conditional option and binned data generation

Hi,

I have attached a script which gives an example of what I’m trying to do.
I am trying to fit two separate distributions where the events described by model1 are a subset of those described by model2. In the fit I want the variables from model1 to float while the variables in model2 are RooFormulas of the variables from model1 each multiplied by a constant. The fit should then maximise the likelihood of the RooProdPdf of the two models, varying the RooRealVars from model1, to get the best fit.
I have used the Conditional option to do this. Could you tell me if this is what it’s doing?
RooProdPdf model(“model”,“model”,model1,Conditional(model2,x_2));

For the fit I want to generate pseudo data for both distributions in the ProdPdf model. I would like to be able to get the expected number of events from the model and poisson smear it. However this does not work with the current example.

What happens with the 500 in the line below?
RooDataHist *data = model.generateBinned(RooArgSet(x_1,x_2),500);

If model1 originally had 10 events and model2 had 40, can it be set so that data is generated with 100 events in x_1 and 400 in x_2? Or will 500 events be generated for both x_1 and x_2?

Then in the output plots, prodPdf_eg.pdf, the numbers are consistent with 500 generated events. However a printout of nsig1->getVal() etc. gives:
nsig1: 6.5042
nsig2: 13.0084
nbkg1: 9.78657
nbkg2: 48.9329

Why don’t these numbers correspond to what we see in the plots?
Is there anyway do something like setBins() for the RooFormulaVars, so that the data has the same number of bins as the model?

Thanks for any help,
Sinéad
prodPdf_eg.pdf (39.5 KB)
prodPdf_eg.C (6.48 KB)