Re: TBranchObject

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Nov 07 1997 - 11:38:29 MET


Christoph Borgmeier wrote:

> Hello,
>
> I'm still a bit confused about the behaviour of TBranchObject. The main
> description of it seems to be in HowtoWriteTree.html:
>
> ---------------------------------------------------------------------------
> If a data member is pointer to an object, a special branch of type
> TBranchObject is created. This is the case in our example for the data
> member fH, a pointer to an histogram. The fH branch will be filled by
> calling the class Streamer function to serialize this object into the
> branch buffer.
> ---------------------------------------------------------------------------
>
> This should set up the pointers of the objects read from a file correctly.
> What happens, if the object pointed to belongs to another branch? A small
> test showed that also these objects are read, but not the entire
> TClonesArray they belong to (judging by the speed).
>
> A part of my current test looks like this:
>
> class ReconstructedTrack:
>     some parameters
>     (not done yet:) list of pointers to detector hits
>
> class Event:
>     two pointers to trigger particles
>     pointer to TClonesArray of ReconstructedTracks
>     pointer to TClonesArray of detector hits
>
> The result looks quite promising: it is possible to access the different
> branch levels of Event (like in the famous Event example) and the reading
> of the trigger particle pointers reads the correct parts of the clones
> array.
>
> Is this observation correct? It still seems like magic. If yes, does it
> mean that all chains of pointers are restored even if only a very small
> branch is read? And: how can I avoid to read large unimportant fractions
> of an event, which are pointed to?
>
> Another question: can I find somewhere an example of pointers to
> calibration constants, which have different cycles than the events?
>

  When you do not use the split method, Root can reconstruct all
internal pointers for a given object. If you have an object Event,
and this object in turn points to list of objects, pointing to, etc,
all the network of objects is correctly written and read back
as an Event object.

When you write this Event object in split mode, however, you must
be careful. You should structure your Event class such that
the branchobjects are independent (as shown in our example test/Event).
This will work in your case if in your class Track, you replace
pointers to hits by an integer that could be the hit number
in theclonesarray of hits. It will be far more efficient in I/O time
and storage. These integers will be typically small integers that
can be nicely compressed by the ZIP algorithm.

Concerning pointers to objects with different cycles than the Event,
we are currently working on a general example more substantial
than test/Event. This example is based on our current work
with the ATLAS group on the fast simualtion program ATLFAST
converted to C++ and Root. This example illustrates several things
  - how to organize a reconstruction/simulation chain with "standardized"
     processors working in pipeline.
  - how to automatically create the Root Tree using the TClonesArray
      facility.
  - How to loop on one or more data bases in a very efficient way.
  - How to use Root for Event display.

We will make this program available as a separate tar file on our Web site
at the end of November.

Rene Brun



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