Re: [ROOT] Dumping Tree Contents

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Feb 18 2003 - 19:02:55 MET


Hi Matt,

Assuming TTree *T, I suggest to loop on all leaves of the Tree and
get the pointer to the branch.

   TIter next(T.GetListOfLeaves());
   TLeaf *leaf;
   while ((leaf = (TLeaf*)next())) {
      TBranch *branch = leaf->GetBranch();
      //do something with branch
   }

Rene Brun

Matthew Wood wrote:
> 
> Hi.  I am trying to create a program that would allow me to dump the
> contents of a tree (something along the lines of TTree::Show).  Up until
> now I have been using TTree::GetBranch and then writing out the contents
> of each branch.  Unfortunately this requires me to know the name of each
> branch in advance.  Is there some mechanism for grabbing the nth branch
> or all the branches in a tree rather than grabbing each branch by name?
> 
> Matthew Wood



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:09 MET