I have a problem with fitting my data with Cauchy distribution.
I’ve done fitting many times and have really no idea what’s wrong this time.
In fit results i get “0 +/- nan” in my parameters, a very small NCalls and no red line on graph that shows the fit.
I’ve checked if i set a good range and it’s ok.
Maybe the problem is that data is quite big(16000 datapoints) but i don’t know how to check it.
data = new TGraph(“datafile.txt”);
fc = new TF1(“fc”, “TMath::CauchyDist(x, , )”, 1.3, 1.7);
data -> Fit(fc, “R”);
data -> Draw();
In ROOT, before you try to fit your graph or histogram, you MUST set “reasonable” initial values for ALL parameters of your function (except for some “built-in” formulas, like “gaus”, for which the standard fit procedure can automatically “guess” them), otherwise the fitting procedure may easily misbehave.
from what you say, the reason why the function is not drawed because the parameters after the fit are both zero.
Moreover since your data are not normalized you should add a scaling parameter to the function,
fc = new TF1(“fc”, “*TMath::CauchyDist(x, , )”, 1.3, 1.7);
As last remark remember to use the SetParameter or SetParameters method of TF1 to give reasonable starting point to the fit algorithm.
Yes, the scalling parameter is the point. Thanks so much!