# Default value of SetOptStat in TBrowser

**URL:** <https://root-forum.cern.ch/t/default-value-of-setoptstat-in-tbrowser/47889>\
**Category:** Newbie\
**Created:** [November 30, 2021, 1:12pm UTC](https://root-forum.cern.ch/t/default-value-of-setoptstat-in-tbrowser/47889 "2021-11-30T13:12:01Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mzriu](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/e56c9b/32.png) [@mzriu](https://root-forum.cern.ch/u/mzriu)\
**Post date:** [November 30, 2021, 1:12pm UTC](https://root-forum.cern.ch/t/default-value-of-setoptstat-in-tbrowser/47889/1 "2021-11-30T13:12:01Z")

</div>

ROOT Version : 6.24/06

Hi guys,

I would like to know if there is a way to change the default SetOptStat value definitively. To give a bit of context, I am looking at many histograms using TBrowser and everytime I switch from one histogram to another, the SetOptStat value gets back to 111.

So far I have tried using

```auto
gStyle->SetOptStat(111111);

```

before initializing my histograms in the code which creates them.

Thanks for reading me !

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [November 30, 2021, 1:21pm UTC](https://root-forum.cern.ch/t/default-value-of-setoptstat-in-tbrowser/47889/2 "2021-11-30T13:21:12Z")

</div>

In the command input line, type `gStyle->SetOptStat(111111)`and then `gROOT->ForceStyle()`

---

<div class="post-metadata">

**Author:** ![mzriu](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/e56c9b/32.png) [@mzriu](https://root-forum.cern.ch/u/mzriu)\
**Post date:** [November 30, 2021, 1:26pm UTC](https://root-forum.cern.ch/t/default-value-of-setoptstat-in-tbrowser/47889/3 "2021-11-30T13:26:50Z")

</div>

Hi thanks for your response ! So it works nicely in the terminal, but is there a way to do it directly in your program ?

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [November 30, 2021, 1:27pm UTC](https://root-forum.cern.ch/t/default-value-of-setoptstat-in-tbrowser/47889/4 "2021-11-30T13:27:56Z")

</div>

You mean in the source code of your application?

---

<div class="post-metadata">

**Author:** ![yus](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/y/9fc348/32.png) [@yus](https://root-forum.cern.ch/u/yus)\
**Post date:** [November 30, 2021, 1:33pm UTC](https://root-forum.cern.ch/t/default-value-of-setoptstat-in-tbrowser/47889/5 "2021-11-30T13:33:21Z")

</div>

Hi,

> [@mzriu](#):
>
> I would like to know if there is a way to change the default SetOptStat value definitively.

I think you want to add the following into your `~/.rootlogon.C` (create it if it does not exist):

```c++
{
    //... whatever you had here before (if anything)
    gStyle->SetOptStat(111111);
}

```

Then this will affect all your histograms.

---

<div class="post-metadata">

**Author:** ![mzriu](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/e56c9b/32.png) [@mzriu](https://root-forum.cern.ch/u/mzriu)\
**Post date:** [November 30, 2021, 2:33pm UTC](https://root-forum.cern.ch/t/default-value-of-setoptstat-in-tbrowser/47889/6 "2021-11-30T14:33:19Z")

</div>

Thanks both of you for your responses. Your solution works fine !

Best,  
Marius

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [November 30, 2021, 2:38pm UTC](https://root-forum.cern.ch/t/default-value-of-setoptstat-in-tbrowser/47889/7 "2021-11-30T14:38:22Z")

</div>

As @bellenot said you might los need to add `gROOT->ForceStyle()` in your `rootlogon.C` in case you want to impose the style value to histograms read from a ROOT file and having their own `OptStat`.

---

<div class="post-metadata">

**Author:** ![mzriu](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/e56c9b/32.png) [@mzriu](https://root-forum.cern.ch/u/mzriu)\
**Post date:** [November 30, 2021, 2:40pm UTC](https://root-forum.cern.ch/t/default-value-of-setoptstat-in-tbrowser/47889/8 "2021-11-30T14:40:34Z")

</div>

I just added the SetOptStat command and it worked fine. If I have any problems later I will remember to try this !

Thanks
