an attempt to get it right

Jacek M. Holeczek (holeczek@clri6f.gsi.de)
Mon, 24 Feb 1997 17:26:23 +0100 (CET)


After painfull FindObject lesson ( life is brutal and full of ambrushes )
I decided to try as simple as possible container class.
My guess was TObjArray. I intended to :
if (RawCamac=(TObjArray*)gDirectory->GetList()->FindObject("RawCamac"))
and then :
if (RawCamac[i]) { ... }
This array would keep pointers to histograms which would reside in a
separate subdirectory, so that the gDirectory itself could keep only the
"top" level objects ( one of them would be this array ), thus finding
objects would be fast. Unfortunately I have noticed that TObjArray does
NOT inherit from TNamed, so I cannot FindObject it ( seems that none of
container classes inherits from TNamed ). Then I am looking for a simplest
built-in root class which would be able to have NAME and keep a table of
pointers to histograms ( so no "TH1F *histos[1000]" allowed, the
TObjArray would be perfect for me except that it has no name ;-( ).
Any help appreciated ( maybe TBranch ? ).
While looking at some root classes I have found some possible extentions
which should not be difficult/time-consuming to implement.
1. implement TH*I and TH*L histogram classes
2. some collection classes ( including TObjArray ) have the At(),
RemoveAt(), but NONE has DeleteAt(), so I propose to implement
DeleteAt() which should "remove" object At() and delete it if
is it on the heap
3. currently the AddAtAndExpand() doubles the size of the array,
but I think it should only increase the size by the INITIAL
aray size ( default is kInitCapacity=16 )
Jacek.