Histogram fit minimum changes

I have a script to fit several TH1F histograms and return the minima. I’ve noticed that the minima change depending on how many histograms the script runs over. It builds each histogram one at a time based on chi^2 (y-values are chi^2 result), then fits the chi^2 curve with a third order polynomial. After the fit the histogram is deleted and the process repeated.
Is this a known issue with fitting, possibly with how MINUIT is seed, or could it be memory leak where the previous fit is not properly deleted?

Your minima may depend on the initial parameters of your fit function so, try to always (i.e. for every fit) “start” from well defined “reasonable” initial parameters.

I’m using the built in pol3
Should I define a TF1 and preset some constants instead?

Before the “Fit” line, try to add:

((TF1*)(gROOT->GetFunction("pol3")))->SetParameters(1., 1., 1., 1.);

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.