Re: [ROOT] Use of TClonesArray in Event

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Nov 06 2002 - 11:18:48 MET


Hi,

The original implementation of TClonesArray in Trees did not support
variable length elements in the class contained in the array.
We have removed most of these limitations in version 3.02 and 3.03,
also modifying the Event example to show that this is possible.
However, if you use this possibility, you must understand that you lose
one of the advantages of a TClonesArray  to eliminate most of the
calls to new/delete. You must also be careful with the way you clear
the array at the end of each event.
Look at the example very carefully.

Rene Brun

On Wed, 6 Nov 2002, GENTIT Francois-Xavier  DAPNIA wrote:

>   Dear Rooters,
>   I am now studiing the example Event provided in root/test. I thought that
> the condition for using TClonesArray instead of TObjArray in Event was that
> the objects put into the TClonesArray (here of class Track) was that they
> had to have a fixed length.
>   No I see the following into the definition of Track:
> 
>    Int_t        fNsp;          //Number of points for this track with a
> special value
>    Float_t*     fPointValue;   //[fNsp] a special quantity for some point.
> 
>   and into its implementation:
> 
>      fNsp = Int_t(3*gRandom->Rndm(1));
>    if (fNsp) {
>       fPointValue = new Float_t[fNsp];
> 
>   So the length of Track is not fixed! How can it work?
>   Thanks a lot in advance
> 
> François-Xavier Gentit
> DAPNIA/SPP CEA Saclay
> http://gentit.home.cern.ch/gentit/
> 
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:16 MET