Displaying Optional Statisics in Histograms in .root files

Dear ROOT users,

How can I force for optional statistics (e.g. underflow, overflow) to be always shown when looking at histograms in .root files using the ROOT TBrowser.

I am booking, and filling my histograms in my C++ programme. Below is an example code:

//#include “TH1D.h”
//#include "TFile.h"
TFile* file = new TFile(“myFile.root”, “recreate”);
TH1F* h = new TH1F(“h”, “myHist”, 100, 0, 10);
h -> Fill (x); //in a loop
file->Write();
file->Close();


I have tried file->SetOptStat(1111111) and h->SetOptStat(1111111)
with the same error: “no member named 'SetOptStat” in TFile or TH1F, respectively.

In your rootlogon.C file put:

gStyle->SetOptStat(1111111);
gROOT->ForceStyle();
1 Like

Thank you very much for your reply - that was exactly what I was looking for!

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