TTree::Show with Friend Trees


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.



Are you looking for tree->Print("all")? See the doc for TTree::Print()


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.

@pcanal - what do you think?

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

1 Like

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

    //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.