Re: TTree::GetEvent without creating new objects?

Rene Brun (Rene.Brun@cern.ch)
Thu, 30 Oct 1997 17:57:23 +0100


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