User coordinates from TPad

Hi everybody,

I found a difference in ROOT when running CINT or compiled code.

What I want to do is to plot a box over a certain range of an histogram.
I need the box to be defined between x1 and x2 (fixed) and to get y1 and y2 from the histogram frame.
If I create the histogram, the canvas and the box using CINT, it works fine, as you can se from the attachment ‘testPadCoordCINT.gif’;
while if I run the code from file

$ root -l

or I try to compile it

$ root -l

I get no band (better, the box has y1=0 and y2=1) as you can see from the attachment ‘testPadCoord.gif’.

I also attached a file with a running example (‘’).

Is this a bug?


ps: I am using ROOTv5.25.04 compiled from source on linuxx8664gcc (gcc 4.4.1)
also tried on a macosx64 with gcc 4.4.1
testPadCoord.cpp (775 Bytes)





Thanks Couet,

it now works.

Can you tell me what happens to the pad when I plot an object with “same” option? And why it was OK using CINT?

You draw the box according to the Pad coordinates. But the Pad coordinates are valid only once the histogram has been painted. The line I asked you to had forces the painting. For more details see: