# TH1::Integral("width") in TPaveStats (statbox)

**URL:** <https://root-forum.cern.ch/t/th1-integral-width-in-tpavestats-statbox/16238>\
**Category:** ROOT\
**Created:** [June 13, 2013, 8:21pm UTC](https://root-forum.cern.ch/t/th1-integral-width-in-tpavestats-statbox/16238 "2013-06-13T20:21:23Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zesp](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/z/b5ac83/32.png) [@Zesp](https://root-forum.cern.ch/u/Zesp)\
**Post date:** [June 13, 2013, 8:21pm UTC](https://root-forum.cern.ch/t/th1-integral-width-in-tpavestats-statbox/16238/1 "2013-06-13T20:21:23Z")

</div>

Hi there,

Attached’s a patch to display TH1::Integral(“width”) instead of TH1::Integral() in TPaveStats (git diff against trunk rev f9e6c8dcedff7cfd4ab3531b4a960128ea1e41c2).  
It introduces the option “I”=2 (the default one remains “i”=1):

`{
TH1D * histo1D = new TH1D ("histo1D","",2,0.,4.) ; 
histo1D->SetBinContent( 1,1.) ;
histo1D->SetBinContent( 2,2.) ;
TCanvas * canvas = new TCanvas () ;
canvas->Divide(2,1) ;
canvas->cd(1) ; gStyle->SetOptStat("nemruoi") ; histo1D->DrawClone() ;
canvas->cd(2) ; gStyle->SetOptStat("nemruoI") ; histo1D->DrawClone() ;
}`  
Could this (or any better version) please be committed to the trunk?

Cheers,  
Z  
[TStyle.cxx.diff](https://root-forum.cern.ch/uploads/default/original/2X/b/babfb0511444d5fd50080f195d9ebb5e15996295.diff) (514 Bytes)  
[THistPainter.cxx.diff](https://root-forum.cern.ch/uploads/default/original/2X/f/f5247f4d35254d40ff7fac03fb87c51eb8854f24.diff) (901 Bytes)

---

<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:** [June 14, 2013, 7:54am UTC](https://root-forum.cern.ch/t/th1-integral-width-in-tpavestats-statbox/16238/2 "2013-06-14T07:54:09Z")

</div>

I’ll check with Lorenzo and apply it if he agrees.

---

<div class="post-metadata">

**Author:** ![Zesp](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/z/b5ac83/32.png) [@Zesp](https://root-forum.cern.ch/u/Zesp)\
**Post date:** [June 14, 2013, 8:01am UTC](https://root-forum.cern.ch/t/th1-integral-width-in-tpavestats-statbox/16238/3 "2013-06-14T08:01:38Z")

</div>

Ok, thanks.  
Have a nice meeting 😉  
Z

---

<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:** [June 14, 2013, 8:09am UTC](https://root-forum.cern.ch/t/th1-integral-width-in-tpavestats-statbox/16238/4 "2013-06-14T08:09:02Z")

</div>

One thing which is missing is your diff files is the documentation update in TStyle::SetOptStat headers.

---

<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:** [June 14, 2013, 8:35am UTC](https://root-forum.cern.ch/t/th1-integral-width-in-tpavestats-statbox/16238/5 "2013-06-14T08:35:11Z")

</div>

Hi Mathieu,

just spoke with Lorenzo. Your patch is fine. Only is missing the doc.  
Can you provide it in your diff ?

Olivier

---

<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:** [June 14, 2013, 9:30am UTC](https://root-forum.cern.ch/t/th1-integral-width-in-tpavestats-statbox/16238/6 "2013-06-14T09:30:58Z")

</div>

One more thing. When you use “I” instead of “i” there no changes on the Stats display showing that you have used one or the other. I am not sure that’s a good thing.

---

<div class="post-metadata">

**Author:** ![Zesp](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/z/b5ac83/32.png) [@Zesp](https://root-forum.cern.ch/u/Zesp)\
**Post date:** [June 15, 2013, 5:15pm UTC](https://root-forum.cern.ch/t/th1-integral-width-in-tpavestats-statbox/16238/7 "2013-06-15T17:15:29Z")

</div>

[quote]When you use “I” instead of “i” there no changes on the Stats display showing that you have used one or the other.[/quote]So let’s introduce it. Among first ideas coming`Integral*
Integral*x
Integral_BW
Integral(BW)
Integral_W
Integral(W)
Integral_w
Integral(w)
Integral("width")
Integral\times#DeltaX`I propose “Integral(w)” as a default.  
As usual the best is to let the end user choose.  
Hence a new entry in [$ROOTSYS/etc/system.rootrc (.rootrc)](http://root.cern.ch/download/doc/primer/ROOTPrimer.html#configure-root-at-start-up): `Hist.Stats.IntegralBinWidth: Integral(w)`

[quote]Only is missing the doc. Can you provide it in your diff ?[/quote]See the diff files below (same trunk rev as above, TStyle.cxx.2.diff = TStyle.cxx.diff provided not to forget it). Feature above documented.

Cheers,  
Z  
[THistPainter.cxx.2.diff](https://root-forum.cern.ch/uploads/default/original/2X/e/e0342e69e640273f7add3f7388fbac354fefba1c.diff) (5.99 KB)  
[TStyle.cxx.2.diff](https://root-forum.cern.ch/uploads/default/original/2X/b/babfb0511444d5fd50080f195d9ebb5e15996295.diff) (514 Bytes)

---

<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:** [June 17, 2013, 9:30am UTC](https://root-forum.cern.ch/t/th1-integral-width-in-tpavestats-statbox/16238/8 "2013-06-17T09:30:28Z")

</div>

Now in place. Thanks !

---

<div class="post-metadata">

**Author:** ![Zesp](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/z/b5ac83/32.png) [@Zesp](https://root-forum.cern.ch/u/Zesp)\
**Post date:** [June 17, 2013, 9:38am UTC](https://root-forum.cern.ch/t/th1-integral-width-in-tpavestats-statbox/16238/9 "2013-06-17T09:38:54Z")

</div>

Thx Olivier.  
CU around,  
Z

---

<div class="post-metadata">

**Author:** ![Zesp](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/z/b5ac83/32.png) [@Zesp](https://root-forum.cern.ch/u/Zesp)\
**Post date:** [July 2, 2013, 7:47am UTC](https://root-forum.cern.ch/t/th1-integral-width-in-tpavestats-statbox/16238/10 "2013-07-02T07:47:39Z")

</div>

Hi Olivier,  
Some comments were missing.  
Git diff against master branch 06ba34699dfd5a8f7c898f9371984837a52f334d.  
See ya,  
Z  
[TStyle.cxx.3.diff](https://root-forum.cern.ch/uploads/default/original/2X/a/aa3da63df46e9b82d526caed3419a0bef575a7a6.diff) (892 Bytes)

---

<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:** [July 2, 2013, 7:56am UTC](https://root-forum.cern.ch/t/th1-integral-width-in-tpavestats-statbox/16238/11 "2013-07-02T07:56:17Z")

</div>

Thanks.  
Now in place
