Reproduction of fit results

Hi everybody,

I would like to do some fits of mass spectra but I experienced, that not all fitting varieties are reproducible. This means my programm gives two different results, when I run the exact same code twice. I tried the “fitTo()” and the “chi2FitTo()” methods. Also I tried it manually by creating the NLL and the Chi2 and then calling MIGRAD and HESSE. The surprising discovery is, that only “fitTo()” gives non-reproducible results.

These two varieties should actually do the same, correct me if I’m wrong. But like I said the “fitTo()” case does not always give the same results (I’m doing these fits in a loop).

(1)
pdfSum.fitTo(M_ee, Extended(kTRUE), PrintEvalErrors(-1), PrintLevel(-1));

(2)
RooNLLVar nll("nll","nll",pdfSum,M_ee,true);
RooMinuit m(nll);
m.migrad();
m.hesse();

I’m just wondering why this is the case. If you know anything about this, please let me know! I also attached the important part of the program in case that helps to figure it out.

Thanks for your help!
Cheers,
Zyzz
fitter.cxx (26.3 KB)