Fit ranges Crystall Ball

Hi experts,

I am trying to fit a couple of mass points in order to extract their sigmas that I will be used for a binning optimization I am using Crystal Ball function to do that

 f = ROOT.TF1("fit","[0]*ROOT::Math::crystalball_function(x, [3], [4], [2], [1])",xmin,xmax); 
 f.SetParameters(1,massPoint,1,10,4 ) # N; alpha, n, xbar, sigma

The issue I am having was is in setting the range of the function. I wonder if there’s any way to do that automatically without having to hard code xmin and xmax of that fit range.

Thanks

Hi @yassine!

Usually, the fit functions are defined for the same range as the histograms you are fitting. So if hist is your histogram, what about using hist->GetXaxis()->GetXmin() and GetXMax() for xmin and xmax?

I hope I understood your question correctly, otherwise you have to re-explain what you mean with fit range if not the full range of the histogram.

Cheers,
Jonas

Hi Jonas,

Thanks for your prompt response, and sorry for my delayed answer. I tried your suggestion but I still dont get the result I wish here is an attached screen shoot, I am still fitting with the function as above

Thanks,

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