Dear root developers

I am trying to fit 10 RooDataSet’s iteratively without having to construct the PDF every time in the loop. For this reason I am updating the PDF observable with the RooRealVar from the data set, I am creating the RooAbsReal object with the createNLL method and I am fitting the data set with migrad and subsequently I call hesse. At the end of each loop I am setting the PDF variables to their initial values and their errors to 0 so that RooFit calculates the step size from the variable ranges. The fit I am performing is an unbinned extended maximum likelihood fit.

What I observe is that the iterative method works (fit converges), but there are differences in the fit logs when I am running the fit only the data set stand alone (without iterations over the other datasets). Therefore I have a few question.

- What is the counter value in the minuit output? I see that although I am deleting the minimizer in every iteration the fits somehow know that a previous call to minuit was performed.
- I see (in the fitlogs attached) that the same fit, with the same model and the same dataset, and the same starting point converges to the same point but with different fit steps. (In the iterative method the function calls are more than in the one off fitting).
- Why is the FCN value different between the two fits?
- Is there a way, so I can fit mutliple data sets without having to re-construct the PDF in every iteration?

The ROOT version I am using is: 6.20.06-x86_64-centos7-gcc8-opt

I am attaching also the macro that produces the different fit logs.

Thanks a lot in advance

–John

standaloneFit.txt (8.8 KB)

iterativeFitLog.txt (12.7 KB)

testIterativeFit.C (3.3 KB)