Accessing member functions from a tree

Mark Boulay (mgb@phy.queensu.ca.cern.ch)
Mon, 15 Jun 1998 12:09:12 -0400 (EDT)


Hello all,

I'm trying to access a member function of a class which I've
used to generate a tree:

For example, if I have a class Event, which contains data members X,Y, and
Z, and a member function GetR(), with

{
Event *event;
TTree *tree = new TTree("T","event tree");
tree->Branch("Events","Event",&event,2000,1);
event = new Event();
for (Int_t i=0; i<100; i++)
{
event->SetX( (Float_t)i );
event->SetY( (Float_t)2*i );
event->SetZ( (Float_t)3*i );
tree->Fill();
}

I would then like to use the TTree->Draw() command with something
like:
tree->Draw("Events.GetR()");

I can do this only if GetR() does not access any of the data members
of the event class, otherwise I get a segmentation violation.

Any 'pointers'?

Thanks, Mark.

=================================================================
= =
= Mark Boulay =
= SNO Project =
= Department of Physics phone/voice mail: (613) 545-6861 =
= Queen's University fax: (613) 545-6813 =
= Kingston, Ontario email: mgb@owl.phy.queensu.ca =
= Canada, K7L 3N6 =
= =
=================================================================