Re: TTree::GetEvent() not yet automatic

Rene Brun (Rene.Brun@cern.ch)
Mon, 05 Jan 1998 12:06:58 +0100


William J. Deninger wrote:

> Hello,
>
> The ROOT header give the following description of TTree::GetEvent
>
> Int_t TTree::GetEvent(Int_t event, Int_t getall)
> {
> //*-*-*-*-*-*Read all branches of event and return total number of
> bytes*-*-*
> //*-* ===========================================================
> // If event = 0 take current event number + 1
> // If event < 0 reset event number to 0
> // getall = 0 : get only active branches// getall = 1 : get all
> branches
>
> if (event < 0 || event > fEntries) return 0;
> ...
> }
>
> However, the following if doesn't allow event to be reset to zero when
> event<0.
> Also, using the default GetEvent() (which passes in event=0) doesn't appear
> to increment the event making the following loop eternally closed.
>
> {
> tree = new TTree("tree","hi root fans");
> while(tree.GetEvent())
> ProcessEvent();
> }
>
> If this has already been pointed out, please forgive me. And thanks again
> for all your help.
>
> William Deninger
> deninger@uiuc.edu

The comments in the code are wrong. Thanks for reporting.
In GetEvent, you must specify the real event number.

Rene Brun