Re: TClonesArray puzzle

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Nov 19 1999 - 18:35:42 MET


Hi Yves,
An example is shown in the documentation of TClonesArray.
You must use the new with placement:
The doc at http://root.cern.ch/root/html/TClonesArray.html
gives the following example:

   TCloneArray a("TTrack", 10000);                                    
   while (TEvent *ev = (TEvent *)next()) {      // O(100000) events   
      for (int i = 0; i < ev->Ntracks; i++) {   // O(10000) tracks    
         new(a[i]) TTrack(x,y,z,...);                                 
         ...                                                          
         ...                                                          
      }                                                               
      ...                                                             
      a.Delete();                                                     
   }                                                                  

Rene Brun


Yves SCHUTZ wrote:
> 
> Hi,
> 
> I am using ROOT 2.23/08. All methods to add an
> object in TCLonesArray have been disabled!
> How do I now add an object to a TClonesArray ??
> 
> Thanks ... Yves
> --
> 
> __________________________________________________________________
> |Yves SCHUTZ  (IN2P3 - CNRS) collaboration
> TAPS/WA98/ALICE         |
> |SUBATECH
> |
> |Ecole des Mines de Nantes Telephone: (+33/0) 2 51
> 85 84 71        |
> |4, rue Alfred Kastler     Fax      : (+33/0) 2 51
> 85 84 79        |
> |F-44070 Nantes cedex 03   e-mail   :
> yves.schutz@subatech.in2p3.fr|
> |__________________________________________________________________|



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