# Printing out all trees and their elements within a root file

**URL:** <https://root-forum.cern.ch/t/printing-out-all-trees-and-their-elements-within-a-root-file/18304>\
**Category:** ROOT\
**Created:** [October 7, 2014, 10:19pm UTC](https://root-forum.cern.ch/t/printing-out-all-trees-and-their-elements-within-a-root-file/18304 "2014-10-07T22:19:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![will.flanagan](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/w/4af34b/32.png) [@will.flanagan](https://root-forum.cern.ch/u/will.flanagan)\
**Post date:** [October 7, 2014, 10:19pm UTC](https://root-forum.cern.ch/t/printing-out-all-trees-and-their-elements-within-a-root-file/18304/1 "2014-10-07T22:19:38Z")

</div>

Hi ROOT experts,

I have a large root file with a complicated structure. I want to print out all tree elements in order to search for a given quantity.

Is there any built-in functionality within ROOT to print out all trees and their elements within a root file? Otherwise, does anyone have any suggestions on how to do so?

Thanks in advance,  
Will

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [October 8, 2014, 2:08am UTC](https://root-forum.cern.ch/t/printing-out-all-trees-and-their-elements-within-a-root-file/18304/2 "2014-10-08T02:08:52Z")

</div>

See:

> [@Aux;1 aux;2 aux3;](https://root-forum.cern.ch/t/aux-1-aux-2-aux3/13345/2):
>
> Search for “cycle” and/or “namecycle”, for example in: In a Nutshell: [Input and Output](https://root.cern.ch/d/input-and-output) . ROOT User’s Guide: [Input/Output](https://root.cern.ch/root/htmldoc/guides/users-guide/ROOTUsersGuide.html#inputoutput) : [Retrieving Objects from Disk](https://root.cern.ch/root/htmldoc/guides/users-guide/ROOTUsersGuide.html#retrieving-objects-from-disk) , [Subdirectories and Navigation](https://root.cern.ch/root/htmldoc/guides/users-guide/ROOTUsersGuide.html#subdirectories-and-navigation) . Just for reference: [some additional notes about GetObject, Get, FindObjectAny, FindKeyAny, ReadObj, ReadObjAny](https://root-forum.cern.ch/t/broken-tdirectoryfile-findobjectany-and-tdirectoryfile-findkeyany/20943/16) .

[TTree::GetListOfBranches](http://root.cern.ch/root/html534/TTree.html#TTree:GetListOfBranches)  
[TTree::GetListOfLeaves](http://root.cern.ch/root/html534/TTree.html#TTree:GetListOfLeaves)

---

<div class="post-metadata">

**Author:** ![will.flanagan](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/w/4af34b/32.png) [@will.flanagan](https://root-forum.cern.ch/u/will.flanagan)\
**Post date:** [October 8, 2014, 3:25pm UTC](https://root-forum.cern.ch/t/printing-out-all-trees-and-their-elements-within-a-root-file/18304/3 "2014-10-08T15:25:11Z")

</div>

Thanks Wile E. Coyote!

FileName-\>GetListOfKeys()-\>Print() and TTreeName-\>GetListOfBranches()-\>Print() did the trick.

Cheers,  
Will
