Obtainning tree names and branch names

Hi,

I would like to access a root file and do a listing of the objects (trees in particular) that are inside.

In particular I want to open a (or more than one) tree inside the root file without having to know the tree name previously. And once I have the tree I would like to list the branch names (and types) that are inside that tree.

I would like to do this in order to access a ROOT file in a more generic way.

Any suggestion?

Thanks in advance,
Javier

Hi,

For the TTree object, you can look at the file’s list of key (GetListOfKeys), see main/src/hadd.cxx for an example.

For the top level branch, you can use TTree::GetListOfBranches.

Cheers,
Philippe.

see also $ROOTSYS/tutorials/io/loopdir.C

Rene