Difference between TObjArray abd TClonesArray

From: Diego Casadei (casadei@bo.infn.it)
Date: Thu May 14 1998 - 22:48:04 MEST


Hello Rooters.
It's a week that I fight with TClonesArrays... and now I have a simple
question for you.
In the documentation I read that, when you plan to put in a TObjArray all
objects of the same class, you'd better to use TClonesArray instead.
Well, I have a list of objects of the same type, so I decided to use
TClonesArray.   But now, it's clear for me that my objects will have in
general different lenghts (thay contain other arrays of objects, of which
I don't know a priori the dimension).
Then the question: should I use TObjArray instead?

It's not the end.
I'd like to have ordered arrays.  In TObjArray we find the function
	virtual Bool_t    IsSortable() const { return kFALSE; }.
TClonesArray inherits from TObjArray, so I could redefine it to
	virtual Bool_t    IsSortable() const { return kTUE; }.  
In addition, TClonesArray has a Sort() function, that sorts the elements
guided by their fSize (their dimension, roughly speaking).
This is not what I need.  My classes have a data member that I would like
to use as an index for the sorting.

I guess I must write my own algorithm for this sorting, using TObjArray
instead of TClonesArray.  Do you think there is another possibility?

Best regards

        Diego Casadei
                casadei@bo.infn.it
                casadei@cern.ch



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