_ROOT Version: 6.19
_Platform: OS 10.14.3
I have some data i want to fit to a function, this function is a gausian EXCEPT its standard deviation is equal to the square root of the mean, so I did this:
def fitHist(hist,name):
print '################# MY FIT ##########################'
f = TF1('f'+name, '[0]*exp(-0.5*((x-[1])/[2])**2)', -10000, 10000)
print hist, name
cons = hist.GetFunction('gaus').GetParameter(0)
f.SetParameter(0, cons)
mean = hist.GetFunction('gaus').GetParameter(1)
f.SetParameter(1, mean)
print ''
print 'the mean is '+str(mean)
print 'sqrt(mean) is '+str(sqrt(mean))
print ''
f.SetParameter(2, sqrt(mean))
hist.Fit('f'+name)
However look at this, if I just use Fit(‘gaus’) I get a sigma of ~135, but I want to know how well would a gausian with a sigma of 139 fit that same data, however when I try to fit the funtion I did with that sigma, it changes it to 135, look:
Maybe what is happening is that my data doesn’t quite match the function I did, but that’s the point!, I want to know how closely the data fits my function, I don’t want to know what other function would fit it better.
What should I do?, how do I fix this?