[ROOT] TClonesArray of TClonesArray

From: Tommaso Chiarusi (Tommaso.Chiarusi@bo.infn.it)
Date: Mon Aug 26 2002 - 17:45:34 MEST


Dear Rooters,

I have written this simple test code to try to use TClonesArrays of 
TCloneArrays:

{

TClonesArray tca("TClonesArray",2);// the TClonesArray of TClonesArray

TClonesArray tr("Track",2);// one TClonesArray of objects of class Track

new(tr[0]) Track(1,2,3,4,5);
new(tr[1]) Track(6,7,8,9,10);

new(tca[0]) tr;

tr.Clear();


new(tr[0]) Track(11,12,13,14,15);
new(tr[1]) Track(16,17,18,19,110);

new(tca[1]) tr;


// Now I want to retrieve the data:

TClonesArray *TCA= &tca;
TIter CIter(TCA);

TClonesArray *TR = new TClonesArray();

while(  TR = (TClonesArray*)CIter.Next() )
{

  TIter RIter(TR);

  while(  UTr = (Track*)RIter.Next() )
    {
      cout<<UTr->a()<<endl;
    }

 
}

But I get a segmentation fault corresponding to the definition of TIter 
Riter(TR)!!!
What's wrong?
Perhaps the way I fill the tca TClonesArray is not good?

Thank you. Tommaso



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:05 MET