Chi square/ndf value is too small

Hi rooters.
This is probably a very stupid question. I have fitted a gaussian curve on my histogram and I don’t understand why chi square/ ndf value is so small. I know that such a small value is statistically incorrect.
acq32def.C (3.8 KB)
gaussy.txt (905 Bytes)
gaussfitdef11.pdf (17.0 KB)
I think that maybe is wrong the fit option. I have insered only the “R” option to fit in a specific range. I also tried with another options (like W or L) but I have the same value. What can I do?

When I run your macro I do not get the plot you posted as .pdf file. I get the following:

And the terminal output is:

Processing acq32def.C...
Warning in <HFit::FitObject>: A weighted likelihood fit is requested but histogram is not weighted - do a standard Likelihood fit
 FCN=0 FROM HESSE     STATUS=FAILED         11 CALLS         131 TOTAL
                     EDM=0    STRATEGY= 1  ERROR MATRIX UNCERTAINTY 100.0 per cent
  EXT PARAMETER                APPROXIMATE        STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  Constant    -2.00000e+04   1.00000e+00   0.00000e+00   0.00000e+00
   2  Mean         0.00000e+00   1.00000e+00   0.00000e+00   0.00000e+00
   3  Sigma        0.00000e+00   1.00000e+00   0.00000e+00   0.00000e+00
                               ERR DEF= 0.5

Hi. I really don’t know why. I just ran the macro to check and i get the pdf. Have you changed the directory of the txt file?
Thank you for answering.
Cheers
Alina
Update: I don’t know why but when i load the txt file here, it changes name from “gaussyy” to “gaussy”. :face_with_raised_eyebrow:

Yes the filename was not correct I get it now:

@moneta will know.

Hi,
The cause of your small chi2 is the very large error you are having in your histogram. I see in your code you are using TH1::Fill to set the bin content (calling h->Fill(i, content) ). By doing this you get a bin error equal to the content instead of the sort(content) as you probably should have.
I would suggest you to call h-SetBinContent(i, content) or if your i does not correspond to histogram bins, then set afterwards the correct histogram errors by calling h->SetBinError.

Lorenzo

1 Like

Thank you!!!

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