Problem about fitting binned data in RooFit

Hi,

I’m now trying to use RooFit to fit a historgram, a segmentation violation error occured and I don’t know where I did wrong.

Here is a simple code to illustrate the problem.

void fit()
{
  ....

  RooRealVar x("x", "x", -1.0, 1.0);
  RooDataHist data("data", "data", RooArgList(x), sample_binned);

  //Here sample_binned is a historgram generated and filled beforehand, and the data can be correctly drawn on a frame

  RooRealVar par("par", "par", 0.5, 0., 1.0); 
  RooRealVar fsig("fsig", "fsig", 0.5, 0., 1.0);

  RooGenericPdf sigPDF("sigPDF", "Product of two regular polynomial", RooArgSet(x,par));
  RooGenericPdf bkgPDF("bkgPDF", "A 3-order polynomial with all parameters fixed", RooArgSet(x));

  RooAddPdf model("model", "model", RooArgList(sigPDF, bkgPDF), RooArgSet(fsig));

  ...

}

Now if I use “model.fitTo(data)”, the following error message appears:

However if I use “sigPDF.fitTo(data)”, though the result of fit is certainly wrong, at least the fit process can be carried out. I’m all confused about this. Is there anything I neglected or did incorrectly?

By the way, I tried on ROOT5.18 and 5.17/05, and on both version the problem happend.

Thank you all in advance.

Hi,

You did nothing wrong. This was a bug in RooFit. I will not give
you the details as it is rather technical, but it has been
fixed earlier this year, so if you pick up the latest ROOT 5.19
release it should work without problems.

Wouter