User coordinates and pixels in 3D

Hi,

I’m implementing calorimeter clusters as TPolyMarker3D-derived objects and added a simple struct to record the info of individual hits that are grouped into the cluster. When I draw the clusters on a 3D drawing, I can get which clusters the mouse cursor is pointing to simply by using
TCanvas::ProcessEvents(Int_t x, Int_t y, Int_t z, TObject*)
but I don’t know which and what kind of hit the mouse cursor is pointing to.

My question is, would it be possible to convert the hit positions (double hx, double hy, double hz) into the pixel values (int px, int py, int pz)?

The ROOT manual seems to cover only 2D conversions. I also notice that px is constant in 3D, in my case, always 52. Or is there a better way to implement the drawing of clusters and their hits.

Thanks in advance,
Allister

[quote=“allistersanchez”] I can get which clusters the mouse cursor is pointing to simply by using
TCanvas::ProcessEvents(Int_t x, Int_t y, Int_t z, TObject*)
but I don’t know which and what kind of hit the mouse cursor is pointing to. [/quote]
The last parameter of the method
root.cern.ch/root/htmldoc/src/TC … tml#zLVCJB
returns you the pointer to “your” selected TPolyMarker3D-derived object. It should be enough to answer your question.

[quote=“allistersanchez”] My question is, would it be possible to convert the hit positions (double hx, double hy, double hz) into the pixel values (int px, int py, int pz)?

Check again the doc of the TCanvas::ProcessEvents(Int_t event, Int_t x, Int_t y, TObject*) method to see the first parameter is the “event” rather the “coordinate”. The “event” values are described by $ROOTSYS/include/Buttons.h

enum EEventType { kNoEvent = 0, kButton1Down = 1, kButton2Down = 2, kButton3Down = 3, kKeyDown = 4 , kButton1Up = 11, kButton2Up = 12, kButton3Up = 13, kKeyUp = 14 , kButton1Motion = 21, kButton2Motion = 22, kButton3Motion = 23, kKeyPress = 24 , kButton1Locate = 41, kButton2Locate = 42, kButton3Locate = 43, kMouseMotion = 51, kMouseEnter = 52, kMouseLeave = 53, kButton1Double = 61, kButton2Double = 62, kButton3Double = 63 };

Yes, the TObject pointer does give me the TPolyMarker3D-derived object that represents my calorimeter hit cluster.

[quote=“fine”]
Check again the doc of the TCanvas::ProcessEvents(Int_t event, Int_t x, Int_t y, TObject*) method to see the first parameter is the “event” rather the “coordinate”. The “event” values are described by $ROOTSYS/include/Buttons.h

enum EEventType { kNoEvent = 0, kButton1Down = 1, kButton2Down = 2, kButton3Down = 3, kKeyDown = 4 , kButton1Up = 11, kButton2Up = 12, kButton3Up = 13, kKeyUp = 14 , kButton1Motion = 21, kButton2Motion = 22, kButton3Motion = 23, kKeyPress = 24 , kButton1Locate = 41, kButton2Locate = 42, kButton3Locate = 43, kMouseMotion = 51, kMouseEnter = 52, kMouseLeave = 53, kButton1Double = 61, kButton2Double = 62, kButton3Double = 63 };[/quote]
I somehow realized later that the first integer argument is not a position value :slight_smile: and that the next two integer arguments were indeed the x and y pixels.
What I did was to convert hit positions into pixel values and compared them with x and y pixels. Thanks for your answer as it gave sense to everything :slight_smile: