Re: [ROOT] TFolder

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Oct 09 2000 - 17:46:48 MEST


Hi Dave,
The TFolder class is like a whiteboard. It is not designed to be a store
but a naming service. If you want to use it as a store, you can look at
the class TDataSet and associates.
The TFolder class can be used as a communication service between large pieces
of code that you want to keep independent as much as possible.

It is our intention to extend the TTree::Branch functions to support TFolders.
Once your event model has been described in terms of TFolders or objects
in TFolders, the TTree could be built automatically. The argument to
the new TTree::Branch functions will be TFolder strings instead of addresses
of pointers to objects. When opening the TTree, the TFolder hierarchy could
be restored and browsed automatically. We are currently prototyping these
functions. Comments are welcome.

Rene Brun



Dave Casper wrote:
> 
>         Hi,
> 
> I have a pretty simple question about the new TFolder class, which is not
> easy to figure out from the documentation.
> 
> The documentation seems to treat the TFolder mechanism very similarly to RZ;
> you have a file and it contains folders you can retrieve things from.  What
> I would like to do is use TFolder in my MonteCarlo event class.
> Specifically, I would like to create my own class, TMyEvent which either
> derives from or contains a TFolder (or a TFolder*).  I would write these
> TMyEvent objects to a Tree on the output file.  When I read an event from
> the tree, I would like to be able to have named access to the TFolder the
> event contains or "is".
> 
> This would be very handy, because then the TFolder would be sort of an
> Object whiteboard for a given event.  It would allow adding new objects to
> the event, for instance when it is reconstructed etc, and writing the old +
> new objects contained by the event to the output file.  Thus one would not
> have to anticipate what types of information (objects) one will attach to an
> event in the future.  In more traditional terms, the TFolder would be like a
> bank directory.
> 
> I suppose there are other mechanisms for doing this, by using one of the
> other container classes, but the TFolder and its intuitive, named access is
> pretty handy.
> 
> Anyway, the documentation sort of implicitly suggests that this type of
> usage is not foreseen, so I wanted to check whether it is possible to write
> an object which contains a TFolder or derives from TFolder to a TTree on a
> root file.
> 
> Thanks for any information,
> 
> Dave
> dcasper@uci.edu



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:35 MET