Re: ROOT's equivalent of PAW's "vlocate" ?

Valery Fine (fine@bnl.gov)
Wed, 22 Jul 1998 10:10:47 -0500


Dear Enterria David
On 22 Jul 98 at 1:47, you wrote:

> I am interested in storing into a vector the (x,y) values of a
> histogram point by clicking on it with the mouse. i.e. I want to
> know if there exists something in ROOT equivalent to the PAW
> instructions:
>
> vloca x y *
> aa=x(1)
> bb=y(1)
> ...
>

The "equivalent" of that PAW command us a method

http://root.cern.ch/root/html/TGXW.html#TGXW:RequestLocator

But I would not recommend this approach to do what you want.

The recommended way is expressed on

http://root.cern.ch/root/HowtoPick.html

Please read this page.

To implement your own histogram picking you may regard writing
your own derived class with only method ExecuteEvent overloaded as
follows:

MyPickedHistogram.h:

class MyPickedHistogram : public TH1 {
public:
void ExecuteEvent(Int_t event, Int_t px, Int_t py):
}

Very likely you will want to use TH1F (or some other particular "histogram" class)
instead of the base TH1.

MyPickedHistogram.cxx:

void MyPickedHistogram:: ExecuteEvent(Int_t event, Int_t px, Int_t py)
{
// Don't forget to call the "native" ExecuteEvent" to preserv the "native" functionality
TH1::ExecuteEvent(event,px,py);

// Put your own actions below
// < your own action> (see TButton.h for the event values)
}

Look "http://root.cern.ch/root/html/src/TH1.cxx.html#TH1:ExecuteEvent" up
and use it as example.
=================================================================
Dr. Valeri Faine (Fine)
------------------- Phone: +1 516 344 7806
Brookhaven National Laboratory FAX : +1 516 344 4206
Bldg. 510A /STAR mailto:fine@bnl.gov
Upton, New York, 11973-5000 http://nicewww.cern.ch/~fine
USA

Dr. Valery Fine Telex : 911621 dubna su
-----------
LCTA/Joint Inst.for Nuclear Res. Phone : +7 09621 6 40 80
141980 Dubna, Moscow region Fax : +7 09621 6 51 45
Russia mailto:fine@main1.jinr.dubna.su