Question w.r.t. TObjArray and TClonesArray

From: Dr. Nick van Eijndhoven (Nick@phys.uu.nl)
Date: Thu Apr 16 1998 - 15:43:42 MEST


Dear ROOTers,
In building an event structure for a physics experiment (ALICE)
I have the following situation :

- I have a class Track and in the reconstruction phase
  several Track objects are created.

- Once I have several Tracks created I want to group
  them together into a vertex.
  For this I have a class Vertex which has in its
  private area an array to store the pointers to
  the related Track objects.

  i.e.    Track** save;

  and in the Vertex constructor I do :

          save=new Track*[n];

So far this all works fine, but now I want my classes
Track and Vertex to be written onto a ROOT file, and
in making the dict for my classes it turns out that
the Streamers for my classes can't be generated 
automatically since the datamember save is an array
of pointers.

Then I got the idea of using TObjArray or TClonesArray
for this, but as far as I can see from the docs,
these facilities can only store objects and not only
pointers to objects.
Since my Track objects are already made, I don't want
to waste any memory and/or cpu time by creating copies
of them. I only need to store the pointers to my already
existing objects and when I would delete my pointer storage        
array (save in the above) I don't want my objects (i.e. Tracks)
to be deleted, but only the space reserved for save to be
freed.
Could anyone tell me how to achieve this ?
-- 

                                              Cheers,

                               _/_/      _/    _/   _/_/_/_/    _/   _/
                              _/  _/    _/    _/   _/          _/  _/
                             _/    _/  _/    _/   _/          _/_/
                            _/      _/_/    _/   _/          _/  _/
                           _/        _/    _/   _/_/_/_/    _/    _/


*----------------------------------------------------------------------*
 Dr. Nick van Eijndhoven                Department of Subatomic Physics
 email : nick@phys.uu.nl                Utrecht University / NIKHEF
 tel. +31-30-2532331 (direct)           P.O. Box 80.000
 tel. +31-30-2531492 (secr.)            NL-3508 TA Utrecht
 fax. +31-30-2518689                    The Netherlands
 WWW : http://www.phys.uu.nl/~nick      Office : Ornstein lab. 172
 ----------------------------------------------------------------------
 tel. +41-22-7679751 (direct)           CERN PPE Division / ALICE exp.
 tel. +41-22-7675857 (secr.)            CH-1211 Geneva 23
 fax. +41-22-7679480                    Switzerland
 CERN beep : 13+7294                    Office : B 160 1-012
*----------------------------------------------------------------------*



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