Convert pad coordinates into histogram coordinates


for my GUI I want to make certain objects “clickable”. All I need is a way to convert the canvas (pad) coordinates I get from the emitted signals into the histogram coordinates living in the same canvas. Is there a clever way to do this or do I have to create a static geometry mapping on my own? I want to make sure the user can’t destroy this mapping by e.g. moving the histogram.

Thanks in advance!


see many examples in ROOT code, eg THistPainter::GetObjectInfo in statements like

Double_t x = gPad->PadtoX(gPad->AbsPixeltoX(px)); Double_t y = gPad->PadtoY(gPad->AbsPixeltoY(py));
gPad->AbsPixeltoX(px) convert from pixel coordinates to pad coordinates. PadtoX will convert pad coordinates to user coordinates (useful in case of log scales).