Dear all
The code attached sets two exponential PDFs, with slopes a and b, and a RooProdPDF of both. Naturally, the product is also an exponential with slope a+b.
I generate a dataset from the prodPdf. Then, I fix the parameter a. Finally, I fit the prodPdf to the dataset I just generated. The parameter b does not converge to the value it is supposed to - even when I setup its value to exactly the right one!
Notice that when I draw the dataset, I can fit it as a TGraph with pure ROOT, and the slope comes out correctly as a+b.
Am I missing something here?
void exponentialTest() {
RooRealVar x("x","x",2,0,5);
RooRealVar a("a","a",-0.2,-5,0,"");
RooRealVar b("b","b",-0.5,-5,0,"");
RooExponential c1("c1","c1",x,a);
RooExponential c2("c2","c2",x,b);
RooProdPdf mypdf("mypdf","mypdf",RooArgList(c1,c2));
RooDataSet* data1 = c1.generate(RooArgSet(x),1000);
RooDataSet* datap = mypdf.generate(RooArgSet(x),1000);
a.setConstant(true);
mypdf.fitTo(*datap);
a.setConstant(false);
mypdf.Print();
a.Print();
b.Print();
RooPlot* xframe = x.frame();
datap->plotOn(xframe);
xframe->Draw();
}