[ROOT] TCloneArrays ADDENDUM

From: Tommaso Chiarusi (Tommaso.Chiarusi@bo.infn.it)
Date: Mon Aug 26 2002 - 18:51:29 MEST


Dear Rooters, sorry if I add the followings:

Why under CINT does work the following code
-------------------------------------------------------------------------

//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 TClonesArray *tr=new TClonesArray[2];
  tr[0]= new TClonesArray("Track",2);
  tr[1]= new TClonesArray("Track",2);
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

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

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

//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  TClonesArray *TTR = &tr[0];
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


  TIter iter(TTR);
  Track *UTr = new Track();
  while(  UTr = (Track*)iter.Next() )
    cout<<UTr->a()<<endl;

//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  TClonesArray *TTR1 = &tr[1];
///!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  TIter iter1(TTR1);
  Track *UTr1 = new Track();
  while(  UTr1 = (Track*)iter1.Next() )
    cout<<UTr1->a() <<endl;

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


instead of having the !-marked lines substituted by the  'grammatically' 
correct following lines  (

TClonesArray **tr=new TClonesArray*[2]; /// note: pointer of pointer!!!!
TClonesArray *TTR = tr[0];
TClonesArray *TTR1 = &tr[1];



Thank you.
Tommaso



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