Placing an arrow at a bin location in a TH1


I need to place an arrow (or some kind of line vertical line) at a specific bin in a TH1 (to indicate the location of a cut). I know how to do it using a TArrow, but I need to convert the location of the bin number I’m cutting at to the x y coordinates of the pad - which is not terribly convienient, and changes if I change the size of the axis titles. My current solution is to draw a second histogram with an entry only in the bin I’m cutting at, but that seems like overkill.

Is there any way to get the location of a TH1 bin in the pads x y coordinates?


To get the X position of a bin you can use:

TH1::GetBinCenter(Int_t bin)


TH1::GetBinLowEdge(Int_t bin)

Then you can draw the TArrow using this value.