Re: TRef between different TTree

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Fri, 9 Oct 2009 14:05:05 -0500


Hi Stefano,

The automatic loading of the branch containing the referenced object is supported only within a single tree (by calling BranchRef at the very beginning of writing the TTree).

Also note that in order for the TRef to work, the referenced object must have had at least one TRef pointing to it _before_ the referenced object is written (I.e. if you have an existing TTree whose contents had never been referenced before you will not be able to use TRef pointing to those objects).

So what is possible is to have TRef pointing from one TTree to the other TTree as long as they are written as the same time. When reading back, you will need to manually load the branch containing the referenced object (and once you do the connection between the TRef and the referenced object will be made automatically).

Cheers,
Philippe.

Stefano Dusini wrote:
> I have a file with two TTree. The first tree contain the objects
> vertex of the event, one entry for each vertex, the second tree the
> objects tracks of the event, one entry for each track. I would like to
> link the vertices to the tracks and vice versa using TRef (each track
> has two pointers two two vertices) and TRefArray (each vertex has an
> array of pointers to tracks).
>
> Is this possible in the sense that when I read one entry in the vertex
> tree the entries of the tree of tracks to which the TRef are pointing
> are automatically load in memory?
>
> Do I have to call come particular method of TTree to do this
> (TTree::BranchRef())?
>
> Thanks a lot
> Stefano
>
Received on Fri Oct 09 2009 - 21:05:11 CEST

This archive was generated by hypermail 2.2.0 : Sat Oct 10 2009 - 11:50:02 CEST