I think your problem is that for the predefined function gaus
root looks for reasonable start values for the fitparameters.
It sets the mean of the gaussian to the mean of your histogram.
After that it fixes this parameter. So I suppose 3.83943e+00
is the mean of your histogram.
An easy workaround is not to use the root supplied gaussian but to
define it by yourself:
TF1 mygaus("mygaus","[0]*exp(-0.5*(x-[1])*(x-[1])/([2]*[2]))",0,20);
mygaus.SetParameters(1000,0.0,4); // set parameter [0],[1] and[2]
mygaus.SetParLimits(1,1,1); // fix parameter 1 to 0.0 (set above)
hist.Fit("mygaus","V") // fit mygauss to hist
mygaus.SetParLimits(1,0,0); // frees parameter [1]
Peter Malzacher
FNAL and GSI
P.Malzacher@gsi.de