How too find out which bin was clicked in a TH2D histogram

Hi
Is there an easy way/way to find out
which bin a user has clicked in a TH2D histogram ?

In particular I have 2D XY plot of the noise of our ALICE/PHOS detector
and when the user clicks in the plot I want to display the histohram (TH1D)
used to estimate the noise for this channel.

I have made a protoype,overloading the ExecuteEvent function and evaluate
which bin is clicked vi the px, py arguments using hardcoded values for the
size of the canvas. This only works of course untll the user changes
the size of the canvas, so I need a better way.

regards
Per Thomas Hille

Hi,

You can take a look at these tutorials: graphics/triangles.C, hist/exec2.C, hist/DynamicSlice.C and graphics/mandelbrot.C

Cheers,
Bertrand.

Thanks :slight_smile: