Hi,
The point of the TClonesArray data member is to avoid to have to re-allocate
the
TClonesArray object for each Event object.
You can use a simple non static datamember for the TClonesArray. In
addition
you can keep the performance (i.e avoid new/delete as much possible) by
making
sure that in your code you re-use the Event objects instead of re-creating
them.
Cheers,
Philippe.
-----Original Message-----
From: owner-roottalk_at_root.cern.ch [mailto:owner-roottalk_at_root.cern.ch] On
Behalf Of Alberto Pulvirenti
Sent: Friday, February 22, 2008 12:26 PM
To: Root
Subject: [ROOT] Understanding the "Event" example
Dear all,
I have read an example named "Event.*" in the $ROOTSYS/test directory, when I was looking for a tutorial for the usage of TRefArray with TClonesArray as a data-member of an object to be stored in a TTree.
In the definition of the "Event" class, I find that there are two TClonesArray data members, one is static and another is not. I didn't understand properly whay this is done that way and what problem could occur if one defines an "Event" object which has only the non-static data member.
The idea is building something similar to create a TTree with many "Event" objects, and I would like to understand if the structure presented in that example is somehow necessary to avoid problems when building such a TTree.
Thanks
Best regards
Alberto Received on Fri Feb 22 2008 - 22:20:59 CET
This archive was generated by hypermail 2.2.0 : Tue Feb 26 2008 - 17:50:01 CET