Re: Second time around and the object "T" isn't found...

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Oct 20 1997 - 08:40:29 MEST


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



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