?: Re: ?: iterate in TClonesArray

From: Pasha Murat (murat@cdfsga.fnal.gov)
Date: Wed Mar 18 1998 - 17:54:17 MET


	Hi Dirk,

operator [] is overloaded for TClonesArray, so you should have been writing

root [7] ((*tps)[1])->Draw();

instead of yours

root [7] tps[1]->Draw();
					hope this will help, Pasha.
--------------------------------------------------------------------------------
Dirk Meier writes:
 > When I try to access the next element of 
 > the TClonesArray I still get segmentation fault:
 > 
 > root [0] TClonesArray* tps = new TClonesArray("TH1F",5);                    
 > root [1] TH1F* dummy0 = new((*tps)[0]) TH1F("bname0","btitle0",40,-20.,200);
 > root [2] TH1F* dummy1 = new((*tps)[1]) TH1F("bname1","btitle1",40,-20.,200);
 > root [3] tps[0]         // just to check whether it is there
 > (class TClonesArray)1077780400             
 > root [4] tps[1]                                                             
 > (class TClonesArray)1077780448
 > root [5] tps[2]
 > (class TClonesArray)1077780496
 > root [6] tps[0]->Draw(); // now draw the first histogramm of the array
 > Warning in <MakeDefCanvas>: creating a default canvas with name c1
 > 
 > // o.k. this works, but drawing the next element gives
 > 
 > 
 >  *** Break *** segmentation violation
 > 
 > ( 0)  0xc1667d40   StackTrace__11TUnixSystemFv + 0x28
 > [/afs/cern.ch/na49/library/local/ROOT/hpux10aCC/root/lib/libUnix.sl]
 > ( 1)  0xc16667f0   DispatchSignals__11TUnixSystemF8ESignals + 0xd0
 > [/afs/cern.ch/na49/library/local/ROOT/hpux10aCC/root/lib/libUnix.sl]
 > 
 > 
 > thanks for any hints
 > 
 > Dirk
 > 



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