Dear experts,
I seem to have a problem when trying to fit a toy MC RooDataSet that has been generate from a RooProdPdf with only one random variable (using root 5.34). The problem is that the fitted parameters are completely off, while the fit seems to converge.
Minimum working example:
RooRealVar x("x", "x", 0, -5, 5);
RooRealVar y("y", "y", 0, -5, 5);
RooRealVar m("m", "m", 0 , -1, 1);
RooRealVar s("s", "s", 1, 0.7, 1.3);
// here I try to multiply two PDFs which share the same random variable x
RooGaussian g("g", "g", x, m, s);
RooGenericPdf l("l", "x^2", x);
RooProdPdf p("p", "p", RooArgSet(g,l));
// the generated event distribution looks fine
RooDataSet* d = p.generate(x, 10000);
RooPlot* frame = x.frame();
d->plotOn(frame);
// the fit delivers wrong parameters for m and s
p.fitTo(*d);
p.plotOn(frame, RooFit::LineColor(kRed));
l.plotOn(frame);
g.plotOn(frame);
frame->Draw();
I thought it would be possible to multiply two PDFs of the same random variable in this way. I want (need?) to do this because in real life one of the PDFs is a RooHistPdf, while the other one is a RooGenericPdf.
Am I doing something wrong?
Best greetings,
Christopher