I am facing some problems in fitting a distribution of data points which I generate according to a known analytical function.
Basically, what I want to do is:
- generate my event distribution according to the known analytical function
- convolve these event distribution with the instrument response
- fit the “new” distribution and obtain an estimation for the parameters of the fitting function.
For the sake of brevity I am attaching here the data points coming from the combination of 1. and 2. (I am not sending the full length code that I use to generate them, since it is pretty complex and long). On those points I performe the fit.
I know exactly what are the input values of the parameteres of my analytical function and my first guess was to use these input values as initial value of the fitting parameters. For the case here, that means:
plotandfit(1, 1.e-11, 1, 3, 1.5, 0.01)
(the numbers I am passing are the exact numbers I used for the simulation)
Nevertheless, if I simply do like that, I get STATUS=FAILED.
On the other hand, if I lower the normalization factor by a factor 100 (i.e. 100 times smaller than the real input value):
plotandfit(.01, 1.e-11, 1, 3, 1.5, 0.01)
then I get a reasonable result and STATUS=OK.
Moreover, the estimated value of p0 corresponds to its actual input value.
My question is: why do I need to inizialize p0 to a smaller (by a factor 100) value? Why, if I assume the input value of p0, the fit does not converge?
ps. I am working with root Version 5.34/30.
testFit_CU1Ec1.C (5.21 KB)