Using //! in user defined classes

Hi,

I just recently learned the “trick” of using a //! comment to prevent a data member of a user defined class from being made into a Tree Branch when using TTree::Bronch, i.e.

// Define some class that I intend to parse into a TTree
// using TTree::Bronch
class myclass
{
  public:
  double a; //  This I do want to go into the tree, and it will.
  double b; //! This I do not want to go into the tree, and it won't.
};

The reason I write about this here is that I would like to request that this “trick” be made more prominent in the ROOT documentation. For example, add it to the online TTree.html documentation. I have not seen it documented anywhere (granted I may have missed it, but something so useful as this should be very hard to miss); the only reason I now know of it is that I saw it used in someone else’s code which I was editing.

It would have been very useful for me to have this trick made more prominent in the documentation. I recently wrote a number of my own classes for a project, and thinking that it was impossible to have a class contain a data member which is not parsed into a TTree when using TTree::Bronch, I wasted a significant amount of time coming up with clumsy “workaround” solutions to a problem that does not actually exist.

Thanks,
Greg

Hi,

//! is a general feature of ROOT I/O and as such is documented in the general I/O documentation. For example see page 172 of the User’s Guide.

Also we do not recommend using ‘Bronch’ directly as it is more or so an internal routine; instead you should use ‘Branch’ with the same arguments.

Cheers,
Philippe.

OK, I am glad to see that this is documented somewhere, though I think it might still be useful to make a mention of //! in the documentation of TTree::Branch. I realize that it more generally and appropriately fits in the documentation of ROOT I/O, but for new users it is not always easy to make the connection that it can be used in TTree::Branch right away (if they have even read the I/O documentation).

Also thanks for the tip on not using Bronch directly.

Greg