Re: Second time around and the object "T" isn't found...
Rene Brun (Rene.Brun@cern.ch)
Mon, 20 Oct 1997 08:40:29 +0200
Gordon Watts (Brown University) wrote:
> 
> Hi,
>   I've got a macro file I can only execute once in ROOT... that is, I need
> to exit and enter root to get it to run correctly the second time.
> Basically, I open a file and get a handle on a branch of a tree. The second
> time through it bombs on the T.GetBranch (no such symbol)...
> 
> {
>         TFile f("output.root");
>         TTree *R = (TTree *) f.Get("T");
>         TBranch *b = T.GetBranch("event");
> }
> 
>         Cheers,
>                 Gordon.
> 
Two points.
 1- You should change (typo?) the statement
     TTree *R = ...    to
     TTree *T = ...
 2- If you intend to invoke this macro several times in one session, you
    better do:
    TFile *f = new TFile(..
    TTree *T = (TTRee*) f->Get("T");
     and may be insert the statement
    gROOT->Reset()  as first statement.
Rene Brun