Re: TTree::GetEvent without creating new objects?

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Oct 30 1997 - 17:57:23 MET


Robert Casties wrote:

> ...by the way:
>
> How do I get the address of the object newly created by TTree::GetEvent()?
>

We give an example in $ROOTSYS/test/Event.
TFile f("file.root");
TTree *tree = (TTree*)f.Get("T");  if your Tree was called "T"
Event *event = 0;   // fundamental to preset the pointer to 0
tree->SetBranchAddress("event",&event);
Int_t nevents = tree->GetEntries();
for (Int_t i=0;i<nevents;i++) {
   tree->GetEvent(i);  // this will create the event object
   event->Dump();     // dump contents of each event
}

Rene Brun



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:22 MET