[ROOT] picking an object on a pad

From: Pasha Murat (630)840-8237@169G ((630)840-8237@169G)
Date: Thu Feb 08 2001 - 21:40:02 MET


Dear ROOTers,

having spent some time working with ROOT graphics I came across the following
issue. I'm drawing various primitives, typical for high-energy physics:
tracks, track segments, hits, detectors etc. In order to optimize certain
operations like disabling drawing all the tracks or MC particles, the 
objects included into TCanvas's list of primitives are not the hits and the
tracks themselves, but the lists of those. This way one can avoid having
very long and hard to handle lists of primitives. 

The thing I'd like to be able to do is to locate a Track with a mouse and to
popup a context menu for this Track, provided not a Track, but a list of Tracks 
is included into the current pad's list of primitives.

In principle, this is possible. One of the solutions, which comes to mind 
right away, would be to have

TObject::DistancetoPrimitive

returning not only a distance to the primitive, but also a pointer to 
WHAT IT AND NOT A TPad believes to be the object, closest to the 
cursor, because not all the information is available for TPad.
I'm wondering if a call signature like

 void TObject::DistancetoPrimitive(Int_t px, Int_t px, TObject*& closest_object);

or 

TObject* TObject::DistancetoPrimitive(Int_t px, Int_t px)

can be considered? Or is there a more elegant solution, which doesn't require
changing the interfaces?
						thanks a lot, Pasha



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:35 MET