[ROOT] Accessing TObjects in a TClonesArray

From: Thomas Feser (tfeser@student.physik.uni-mainz.de)
Date: Thu Aug 02 2001 - 18:41:17 MEST


Hi all,

  my problem is to store some numbers for about 500 detector components in 
a tree. My idea was to create a class derived from TObject for each set of
those numbers and to put these Objects into a TClonesArray.
  Does that sound reasonable or is it already a bad idea?

  My actual problem now is that I can't access my objects in the
TClonesArray.
  I say:

	om_values = new TClonesArray("cand", 500);
	for (Int_t i = 0; i < 500; i++) 
		new(om_values[i]) cand(0.,0.,0.,0,0.,0);

  ("cand" is the name of a class derived from TObject.)

  Then comes my actual analysis. For every event, I want to define the
members of om_values[i], so my idea was:

	for (Int_t i = 0; om_values->After(current) != 0; 
			current = om_values->After(current)) {
		i++;
		...

  where current is a pointer of type TObject, which I then want to use to
write my data into the corresponding 'cand'.

  The error message I get is:
  "fields of `TObject' are inaccessible in `cand' due to private inheritance"

  Maybe my whole idea is bullshit... any hints to some good examples or
solutions to a similiar problem would be appreciated.

  Thanks,

  _
  |om



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:54 MET