Re: MakeClass

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Apr 19 1999 - 16:13:42 MEST


Hi Jacek,
Sorry for the long delay to answer your mails about your proposed
addition to TTree::MakeClass. I am back from the AIHENP workshop.

The purpose of SetBranchStatus is to gain time when reading the TTree.
By default, if you do nothing, Root ill read ALL branches of the Tree.
As we know, it is painful to specify the SetBranchStatus by hand.
In addition, it is easy to forget one declaration.

Your implementation is an attempt to automatize this process.
However, there are several problems with your implementation:
 - It is only valid for trivial TNtuples.
 - a branch cannot be an array (even static).
 - a branch cannot be an object.
 - reading the code is made more difficult.
 - you introduce a performance penalty.

I have in mind an automatic algorithm similar to the one we implemented
in PAW. This algorithm will generate automatically the SetBranchStatus
for all branches used in your code. The algorithm will also be nice
once the automatic macro compilation currently being implemented by
Philippe canal will be operational.
The algorithm will work for all cases of branches. It does not generate
additional code in the macro.
I hope to have time to implement/test this algorithm in the coming
weeks.

Rene Brun

Jacek M. Holeczek wrote:
> 
> Hi,
> Usually during "rapid prototyping" I modify my code a lot, switch some
> parts on, some off, ... . Unfortunately, I usually ( very often ) forget
> to SetBranchStatus, enabling/disabling appropriate ( currently used )
> ntuple branches. This leads to very difficult to find bugs ( or slows down
> the analysis, if unneeded branches are "on" ).
> I finally decided to implement a new MakeClass routine which loads
> appropriate branches on demand ( during first use of any leaf that belongs
> to the branch ).
> Please find attached the MakeClass.cxx macro, the automatically generated
> ( $ROOTSYS/test/hsimple.root related ) ntuple.hpp file, the ntuple.cxx
> file ( modified to demonstrate the way one uses it ) and the Linux EGCS
> Makefile ( to try to create the shared library ).
> For the time being the MakeClass.cxx macro is quite dumb.
> Feel free to add something to it ... .
> The only "disadvantage" that I see is that accessing a "leaf" requires to
> call "leaf()" ( instead of "leaf", as in the original MakeClass )
> The additional advantage of this macro is that one can easily build the
> shared library from it ( which is impossible if one uses the original
> TTree::MakeClass macro ).
> ( Of course, I know - calling a function is always slower then accessing
> directly a variable, but ... if I subtract the time spent to find missing
> SetBranchStatus and the time spent to load unneeded branches ... .)
> Jacek.
>



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:31 MET