[ROOT] TClonesArray

From: tommaso chiarusi (Tommaso.Chiarusi@bo.infn.it)
Date: Fri Dec 17 2004 - 14:41:43 MET


Dear Rooters,
Should it be stange the following?

You have a member function GetArray() which yields a pointer to 
TClonesArray.

so, in the scope of some methods:

	TClonesArray *v =  p.GettArray();
	Evento &te = *((Evento*) v->UncheckedAt(cont));


It's Ok and the Evento-memory segment does exist and it is filled with 
right things. While...

	TClonesArray *v;
	v =  p.GettArray();
	Evento &te = *((Evento*) v->UncheckedAt(cont));

It ISN'T ok, and the Evento-memory segment is completely random.



What's happening?

I need to use the second case, since the TClonesArray pointer v 
should be a private data member of a class.
In particular I should organize such stuff as the following:

	TClonesArray *v;  -> IN THE PRIVATE DATA MEMBER DECLARATION SCOPE

	v =  p.GettArray(); -> IN THE CLASS CONSTRUCTOR DEFINITION

	Evento &te = *((Evento*) v->UncheckedAt(cont)); IN A MEMBER FUNCTION
 

Maybe I'm forgetting some stupid rule.... 
Thanks a lot,

Tommaso.

P.S.

System

ROOT:  Version   4.00/08       9 July 2004
OS: Linux RH-9
gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)



-- 
-----------------------

Dr. Tommaso Chiarusi 

Dipartimento di Fisica 
Universita' di Bologna
INFN. Sez. Bologna

Tel +39.051.209.5234 
Fax +39.051.209.5269

-----------------------



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:10 MET