I need to fit around 10^5 TGraph that are basically trigonometric functions with different amplitude and phase. I am specifically interested in the frequency. For that, I define:
TF1 *Cosine = new TF1("Cosine", "[0]*cos([1]*x*1.e6 + [2])", 0., tmax)
If I look at the plot of this particle that I am trying to fit, I can see easily that the amplitude is very close to 1, and the frequency is similar to omega_0, but for some reason, the result of the fit is not good (Chi2 is very large also).
Is there a way to improve this result, maybe forcing the minimizer to do more iterations?
Sorry, I think It would be very complicated to reproduce the graphs that I am trying to fit. I tried the verbose option, because I realized that some fits gave me the error " Invalid FitResult (status = 4 )".
The error messages are now too long, and I don’t think I need to copy the entire thing here. However, it is interesting to notice the lines:
MIGRAD FAILS TO FIND IMPROVEMENT
MIGRAD TERMINATED WITHOUT CONVERGENCE.
FCN=1503.8 FROM MIGRAD STATUS=FAILED 151 CALLS 152 TOTAL
As I suspected, for some particles, the Minimizer does not converge. I believe that my initial guess for the parameters, as well as the limits, is accurate (most of the particles have a nice fit).
How can I force TMinuit to converge, even if it needs more computing time? I have tried with
as suggested in other forum questions, but it doesn’t seem to change significantly. Please let me know if you need more information from the verbose output.