Problem with stats box

In stats box I need only name of histogram and entries. I tried with

gStyle->SetOptStat(“ne”); and gStyle->SetOptStat(110);

but it is not working. Please suggest what I am doing wrong.

I am attaching my code and plot (not coming as expected).
zeppenfeld.pdf (21.2 KB)
compare6Quantities.C (5.26 KB)

Try to add:
gROOT->ForceStyle(kTRUE);

Hi,

gStyle->SetOptStat(“ne”);
should work as expected,at least it does for me (root v 5.34.11 and above).
gStyle->SetOptStat(110);
shows as expected entries and mean
but you want:
gStyle->SetOptStat(11);
(see root.cern.ch/root/html534/TStyle … SetOptStat)

Cheers
Otto

Thanks Coyote. It worked.

@Schaile: Yes, gStyle->SetOptStat(11); is also working. Thanks.

[quote=“Wile E. Coyote”]Try to add:
gROOT->ForceStyle(kTRUE);[/quote]

It is working only when I am commenting “gROOT->SetStyle(“Plain”);”.

If it is there then even if I add gROOT->ForceStyle(kTRUE); it won’t effect anything.

Have you tried to move the “gROOT->ForceStyle(kTRUE);” line to different places in your source code?

What gives the following macro:

TH1F *h = new TH1F("aaa","BBB", 100,-2,2);
h->FillRandom("gaus");
gROOT->SetStyle("Plain");
gStyle->SetOptStat("ne");
h->Draw();

Which version of ROOT are you using?

Otto

Otto is perfectly right. The histograms are created directly in the “compare6Quantities.C” macro and none of them is read (retrieved) from any existing ROOT file.
So my initial advice to try “gROOT->ForceStyle(kTRUE);” was completely wrong here.
As Otto points out, the problems are related to the order of lines -> first comes gROOT->SetStyle(“Plain”); and then gStyle->SetOptStat(11); and to the incorrect value used in gStyle->SetOptStat(…) -> was 110, should be 11 or “ne”.

@ramkrishna: I think Otto and Wile gave you good hints. For further help we would need an example we can run.

[quote=“Otto Schaile”]What gives the following macro:

TH1F *h = new TH1F("aaa","BBB", 100,-2,2);
h->FillRandom("gaus");
gROOT->SetStyle("Plain");
gStyle->SetOptStat("ne");
h->Draw();

Which version of ROOT are you using?

Otto[/quote]
Thank you very much. When I put gROOT->SetStyle(“Plain”); above gStyle->SetOptStat(“ne”); Then my problem solved.