Error for mean from histogram


ROOT Version: 6.26/02
Platform: Windows
Compiler: MSVC 19.31.31104.0


Hi,

I’ve seen on https://root.cern.ch/root/htmldoc/guides/users-guide/Histograms.html` When a histogram has errors, it is visualized by default with error bars.` what does this mean? Do I have to add errors manually e.g. when writing a tree? What is the difference to use the statistics box?

Thank you!

When a 1D histogram has some errors built into its data structure and you do:

hist->Draw();

Then the error bars are drawn. If you do not want to see the errors bars for a such histogram
you need to do:

hist->Draw("HIST");

When a 1D histogram has NO errors built into its data structure and you do:

hist->Draw();

Then the error bars NOT drawn. If you want to see some errors bars automatically computed for a such histogram you need to do:

hist->Draw("E");
1 Like

Thank you! Are the errors the same in both cases?

I assume in the first case they are individually computed while the second case use kind of a standard procedure or formula?

See: ROOT: TH1 Class Reference (Sumw2)
or ROOT: TH1 Class Reference (SetErrors)

1 Like

Thank you, again!

Is it possible to display e.g the mean error as a percentage of the mean instead of a raw value? Guess it would be a relative error then(?).
Btw, I’m using gStyle->SetOptStat("eMR"); which can be found under 5.8.5 Statistics Display on Chapter: Histograms

No, there is no option for that, you will need to compute it and display it yourself.

1 Like