Low & up

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

Here are the corresponding diff files (against root 5.32.00).
Cheers,
Z
TH1.h.diff (122 Bytes)
TPad.h.diff (148 Bytes)

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

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

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

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

The choice was made to have:

   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 ?

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 (583 Bytes)

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 …

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

[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… :angry:

Now that “redirect” methods exist (see [url]Locate like command 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)

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