Fitting of Histo with Logarithmic Bins

Hello ROOTers

I am trying to make a one dim histo with logarithmic bins:

short NumberofBins = 100;
float X[NumberOfBins+1];
float Xlow(1.e-1), Xhigh(1.e5);
float BinSize = (log10(Xhigh) - log10(Xlow))/NumberOfBins;
for(short i = 0; i < NumberOfBins; i++)
X[i] = Xlowpow(10, BinSizei);

TH1F *h = new TH1F(“Histname”, “Title”, NumberOfBins, X);

But when I define histo with normal bins:
TH1F *h = new TH1F(“Histname”, “Title”, 10000, 0, 10000); //with the bin size = 1. and try to fit the data set with power law function. So it gives me a slope value around -2.7.

But when I tried to fit the logarithmic bin histo with the same power law function then it gives me a slope parameter value of -1.7. I don’t know how the data slope is getting modified. Please help.

Kind Regards


In the second case you have many bins which are empty of with very small content. You cannot do in this case a chi2 fit, which is biased, but you should do a likelihood fit.
Try fitting with option “L”, to see if you get the same result.
In addition you could have another effect , in the first fit, due to the fact that you are computing the function at the bin center and some bin can be very large. If you observe still a difference try to use option “I” (integral of the function in the bin).

Best Regards


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