# Low & up

**URL:** <https://root-forum.cern.ch/t/low-up/13583>\
**Category:** ROOT\
**Created:** [January 9, 2012, 12:33am UTC](https://root-forum.cern.ch/t/low-up/13583 "2012-01-09T00:33:38Z")\
**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:** [January 9, 2012, 12:33am UTC](https://root-forum.cern.ch/t/low-up/13583/1 "2012-01-09T00:33:38Z")

</div>

Hi there,

Could the 3 following “shortcut methods” please be added?

- TPad::GetXupNDC() (=TPad::GetXlowNDC()+TPad::GetWNDC())
- TPad::GetYupNDC() (=TPad::GetYlowNDC()+TPad::GetHNDC())
- TH1::GetBinUpEdge(ibin) (=TH1::GetBinLowEdge(ibin)+TH1::GetBinWidth(ibin))

Cheers,  
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:** [January 9, 2012, 9:47pm UTC](https://root-forum.cern.ch/t/low-up/13583/2 "2012-01-09T21:47:10Z")

</div>

Here are the corresponding diff files (against root 5.32.00).  
Cheers,  
Z  
[TH1.h.diff](https://root-forum.cern.ch/uploads/default/original/2X/d/d50c2ce58eb56d4943a0ff403c073180ffa407ea.diff) (122 Bytes)  
[TPad.h.diff](https://root-forum.cern.ch/uploads/default/original/2X/e/e25a2464a4130c76390858a230a9051fac210e98.diff) (148 Bytes)

---

<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:** [January 19, 2012, 11:02pm UTC](https://root-forum.cern.ch/t/low-up/13583/3 "2012-01-19T23:02:15Z")

</div>

Knock, knock…  
Is there anyone here?  
Cheers,  
Z

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [January 20, 2012, 7:25am UTC](https://root-forum.cern.ch/t/low-up/13583/4 "2012-01-20T07:25:45Z")

</div>

Hi,

Sorry for the late reply.  
Why do you want to have TH1::GetBinUpEdge(ibin) ? I think this functionality belongs to TAxis, so you should do h1-\>GetXaxis()-\>GetBinUpEdge(ibin). Since TH1 is the base class also for 2D histograms, what should return in case of a 2D histogram ?  
For these reasons, we will not add this method in TH1

Best Regards

Lorenzo

---

<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:** [January 20, 2012, 7:52am UTC](https://root-forum.cern.ch/t/low-up/13583/5 "2012-01-20T07:52:53Z")

</div>

Hi Lorenzo,

Just for consistency since TH1::GetBinLowEdge(ibin) already exists.

To deal with TH2, how about adding a new argument :

> TH1::GetBinLowEdge(Int\_t ibin, Option\_t\* axis = “X”)  
> TH1::GetBinUpEdge(Int\_t ibin, Option\_t\* axis = “X”)  
> as it is done in many other TH1 methods: GetAxisColor(), GetNdivisions, GetLabel\*(), GetTitle\*(), …

How about the TPad::Get{X,Y}upNDC() methods ?

Cheers,  
Z

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [January 20, 2012, 8:03am UTC](https://root-forum.cern.ch/t/low-up/13583/6 "2012-01-20T08:03:04Z")

</div>

> [@](#):
>
> Just for consistency since TH1::GetBinLowEdge(ibin) already exists.

I don’t know why this method was added,it would be nice to remove it, but we cannot do that, we will break too much code.

Adding the extra option as you propose is certainly better, but why not continuing using the TAxis interface ? I still find it a better option.

Lorenzo

---

<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:** [January 20, 2012, 9:09am UTC](https://root-forum.cern.ch/t/low-up/13583/7 "2012-01-20T09:09:28Z")

</div>

> [@](#):
>
> How about the TPad::Get{X,Y}upNDC() methods ?

The choice was made to have:

```auto
   Double_t GetXlowNDC() const {return fXlowNDC;}
   Double_t GetYlowNDC() const {return fYlowNDC;}
   Double_t GetWNDC() const {return fWNDC;}
   Double_t GetHNDC() const {return fHNDC;}
```

Would you ask for GetWNDC and GetHNDC is the choice would have been to have Get{X,Y}upNDC() methods ?

---

<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:** [January 20, 2012, 6:46pm UTC](https://root-forum.cern.ch/t/low-up/13583/8 "2012-01-20T18:46:55Z")

</div>

Lorenzo

I agree with you but many other TH1 methods also skip TAxis getters:  
GetAxisColor(), GetNdivisions(), GetLabel\*(), GetTitle\*(), …  
So whether all these methods should be removed or not.  
In the latter (necessary) case, consistency is the best choice in my opinion (see below).  
Attached are the new methods (diff files against 5.32.00).

Olivier & Lorenzo

Sorry Olivier, I don’t understand your question.  
My point is: _Low_ methods exist, why not _Up_ ones?  
It would be so much more intuitive that the complementary _Up_ methods exist.  
Instead of that, one has to go and look into Root source code to know how to proceed,  
which is time-consuming and tiresome.  
Besides it makes the code longer to write and more difficult to read.  
Please compare: `
Double_t xlow = gPad->GetXlowNDC() ;
Double_t xup = gPad->GetXlowNDC() + gPad->GetWNDC() ; `to`
Double_t xlow = gPad->GetXlowNDC() ;
Double_t xup = gPad->GetXupNDC() ; `  
This just requires one line more in TPad.h.

Have a nice week end,  
Z  
[TH1.diff.tgz](https://root-forum.cern.ch/uploads/default/original/2X/1/165d8a497b4cd1c64fc0e364eedd68de1f6a02dd.tgz) (583 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:** [January 23, 2012, 9:21am UTC](https://root-forum.cern.ch/t/low-up/13583/9 "2012-01-23T09:21:50Z")

</div>

My point was that to get the pad position in NDC you have the choice betwen to set of function

Double\_t GetXlowNDC() const {return fXlowNDC;}  
Double\_t GetYlowNDC() const {return fYlowNDC;}  
Double\_t GetWNDC() const {return fWNDC;}  
Double\_t GetHNDC() const {return fHNDC;}

or the one you suggest with Up instead of W and H

We choose the 1st one …

---

<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:** [February 24, 2012, 9:51pm UTC](https://root-forum.cern.ch/t/low-up/13583/10 "2012-02-24T21:51:48Z")

</div>

> [@](#):
>
> or the one you suggest with Up instead of W and H

Why “or”? Couldn’t all these methods coexist?  
Once again my point is just to make Root user’s life easier.  
If such coexistence issues don’t exist, adding these few extra lines to the trunk would be great.  
Kind regards,  
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:** [June 28, 2013, 7:05pm UTC](https://root-forum.cern.ch/t/low-up/13583/11 "2013-06-28T19:05:26Z")

</div>

[quote]Instead of that, one has to go and look into Root source code to know how to proceed,  
which is time-consuming and tiresome.[/quote]Still the case… 😠

Now that “redirect” methods exist (see [url][Locate like command](https://root-forum.cern.ch/t/locate-like-command/65/1) why not reconsider this point and add the 2 following insignificant lines in TPad.h

`Double_t GetXupNDC() const {return (fXlowNDC+fWNDC);}
Double_t GetYupNDC() const {return (fYlowNDC+fHNDC);}`  
I still don’t have better arguments than consistency & end user easy/intuitive experience.  
Note this was one of the statement in Fons’s last presentation ([http://indico.cern.ch/conferenceDisplay.py?confId=255905](http://indico.cern.ch/conferenceDisplay.py?confId=255905))

[quote]Improve end user graphics experience[/quote]Cheers,  
Z
