Re: reading TTree from a TDirectory

From: Rene Brun <brun_at_pcroot.cern.ch>
Date: Wed, 17 Aug 2005 08:14:08 +0200 (MEST)


If mydir is a pointer to the TDirectory, do

   TTree *T = (TTree*)mydir->Get(treename);

You can access a Tree in the current directory with:

   TTree *T = (TTree*)gDirectory->Get(treename);

You can access a Tree in a file top directory with:

   TFile f("myfile.root");
   TTree *T = (TTree*)f.Get(treename);
  or
   TTree *T = (TTree*)gDirectory->Get(treename);

You can access a Tree in a file directory with:

   TFile f("myfile.root");
   TTree *T = (TTree*)f.Get(dirname/treename);

see:http://root.cern.ch/root/htmldoc//TDirectory.html#TDirectory:Get

  Rene Brun

On
Tue, 16 Aug 2005,
Tulun
Ergin wrote:

>
> Hi,
>
> Could somebody tell me the way to read a tree,
> which is saved in a TDirectory. I could not find
> any answer in the Root manual and tutorials...
>
> Thanx,
>
> Tulun Ergin
>
Received on Wed Aug 17 2005 - 08:14:15 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:11 MET