# TTree::Show with Friend Trees

**URL:** <https://root-forum.cern.ch/t/ttree-show-with-friend-trees/24273>\
**Category:** Evolution Proposals, Apps & Ideas\
**Tags:** tree\
**Created:** [March 30, 2017, 8:37pm UTC](https://root-forum.cern.ch/t/ttree-show-with-friend-trees/24273 "2017-03-30T20:37:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ksmith](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ksmith/32/12567_2.png) [@ksmith](https://root-forum.cern.ch/u/ksmith)\
**Post date:** [March 30, 2017, 8:37pm UTC](https://root-forum.cern.ch/t/ttree-show-with-friend-trees/24273/1 "2017-03-30T20:37:25Z")

</div>

Hi,

I find the `TTree::Show` method extremely valuable when trying to recall all the names of branches and leaves in a tree. I’ve come upon the situation where I have multiple trees that have all been friended to one master tree. When I execute `Show` on this master tree (or even `TTree::Print`) I’m only returned the branches and leaves from the master tree. I would have expected all the friends to show up as well as the branches are available in `TTree::Draw` and `TTree::Scan`.

Is there anyway to easily get this functionality without much overhead? I like to use this on the command line so even a few lines of code would be too much. I believe this is an oversight and should be included in the next release, but that is just my opinion.

Thanks

---

<div class="post-metadata">

**Author:** ![Axel](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/axel/32/11084_2.png) [@Axel](https://root-forum.cern.ch/u/Axel)\
**Post date:** [April 1, 2017, 7:44pm UTC](https://root-forum.cern.ch/t/ttree-show-with-friend-trees/24273/2 "2017-04-01T19:44:49Z")

</div>

Hi,

Are you looking for `tree->Print("all")`? See the doc for `TTree::Print()` [https://root.cern.ch/doc/master/classTTree.html#a063539b8071b23403a3f8f607b74f7be](https://root.cern.ch/doc/master/classTTree.html#a063539b8071b23403a3f8f607b74f7be)

Axel.

---

<div class="post-metadata">

**Author:** ![ksmith](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ksmith/32/12567_2.png) [@ksmith](https://root-forum.cern.ch/u/ksmith)\
**Post date:** [April 3, 2017, 2:43pm UTC](https://root-forum.cern.ch/t/ttree-show-with-friend-trees/24273/3 "2017-04-03T14:43:59Z")

</div>

You are correct about `TTree::Print`, I should have had a closer look at the documentation. What about `TTree::Show`? I think it would be useful to have that functionality as well. Honestly, I use show more often than print as the output is more compact and most of the times I just need a quick refresher on the names of the leaves.

---

<div class="post-metadata">

**Author:** ![Axel](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/axel/32/11084_2.png) [@Axel](https://root-forum.cern.ch/u/Axel)\
**Post date:** [April 7, 2017, 2:43pm UTC](https://root-forum.cern.ch/t/ttree-show-with-friend-trees/24273/4 "2017-04-07T14:43:07Z")

</div>

@pcanal - what do you think?

---

<div class="post-metadata">

**Author:** ![pcanal](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pcanal/32/12439_2.png) [@pcanal](https://root-forum.cern.ch/u/pcanal)\
**Post date:** [April 7, 2017, 2:54pm UTC](https://root-forum.cern.ch/t/ttree-show-with-friend-trees/24273/5 "2017-04-07T14:54:29Z")

</div>

This seems reasonable/helpful. However I did not get a chance to look at the code to remember the difficulty of this addition 🙂

---

<div class="post-metadata">

**Author:** ![ksmith](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ksmith/32/12567_2.png) [@ksmith](https://root-forum.cern.ch/u/ksmith)\
**Post date:** [April 7, 2017, 3:00pm UTC](https://root-forum.cern.ch/t/ttree-show-with-friend-trees/24273/6 "2017-04-07T15:00:34Z")

</div>

Doesn’t like too hard at first glance, modified from `TTree::Print`:

```auto
    //show friends 
   TIter nextf(fFriends);
   TFriendLock lock(const_cast<TTree*>(this),kPrint);
   TFriendElement *fr;
   while ((fr = (TFriendElement*)nextf())) {
      TTree * t = fr->GetTree();
      if (t) t->Show(entry, lenmax);
    }

```

I’m not sure about `kPrint`.
