RE: Managing multiple events

From: Philippe Canal <>
Date: Thu, 22 Dec 2005 15:10:14 -0600


TTree are not designed to be stored inside another TTree. Instead you should look at using a collection (like TClonesArray or std::vector).
See $ROOTSYS/test/MainEvent.cxx for an example (or look up the User's Guide).


-----Original Message-----
From: [] On Behalf Of Alberto Pulvirenti
Sent: Monday, December 19, 2005 11:33 AM To: ROOT Mailin List
Subject: [ROOT] Managing multiple events

Dear ROOTers,

I ask for a suggestion to solve a (maybe) silly problem in an application of mine.
My problem is the following: I have a lot of files containing an event, which all reconstructed tracks.
What I have to do is selecting the tracks which are useful for my analysis and collect them into some kind of strudture, according to their PID (specifically, 4 arrays: pi+, pi-, K+ and K-). This is needed because I could repeat the successive analysis on them more than once, so this will accelerate the computing operations. What I tried to do is creating a TTree object whose branches are 4 TTrees, each one containing all interesting data (momentum, vertex, PID) of each particle (one TTree for each kind of particle). Each of these branches was a TTree with many branches of "primitive" data types (6 Double_t and 4 Int_t), which I created with a structure. Unfortunately, when I try to read these data, I often encounter some kinds of errors, or some memory leaks, and I thought that this could be due to using a TTree as a branch object.

So, I would ask if it is completely wrong to do something like that (namely, using TTrees as branches of a higher-level TTree), or if I must do something at the initialization level, in order to work properly with this kind of structure.

Thanks a lot and best regards,

    Alberto Received on Thu Dec 22 2005 - 22:12:25 MET

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:14 MET