Re: TClonesArray out of bounds and segmentation faults

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Mar 06 1998 - 19:06:20 MET


Maarten Bruinsma wrote:
> 
> Dear Fons et al.,
> 
> I have been trying for some days now to implement a TClonesArray of
> my own class. Still I keep getting error messages
> 1:
> Error in <TClonesArray::At>: index 16 out of bounds (size: 16, this:
> 0x10458db0)
> 
> 2:
> Clusters->Delete();
> 
> Fatal in <operator delete>: storage area overwritten
> aborting
> Abort (core dumped)

Maarten,
Could you identify the machine and version with which you are
having the problem?
Why do you call Clusters->Delete() and not Clusters->Clear() ?

> 
> When I make these everything seems to be fine, I create them like
>  Clusters =  new TClonesArray("EcalCluster");
>        Clusters->Expand(100);

Expansion is automatic. You better specify a start value
in teh TClonesArray constructor.

> 
>    TGammaData->Branch("BClusters",&Clusters,65536,0);
> 
> (Somewhere is written that, in my case, EcalCluster should exist of
> 'basic' types. Are these only ROOT types, or can they be normal int,
> double etc. ? )
By basic data types, we mean char,short,int,float,double,or
Char_t, Short_t, Int_t, Float_t, Double_t (+ unsigned also).
The class referenced by the TClonesArray cannot have pointers.

> 
> Somewhere else they are filled and everything seems to be fine
> (>=16 also stored) until
> I try to load them. Then I get 1: (above)
> 
>  One other thing is that
> Clusters->GetLast()

Use Clusters->GetEntries() or GetEntriesFast()

> 
> always return the maximum value, regardless if the next has less entries.
> 
> Do you have an idea about these problems?

To investigate your problem, I need to know a bit more about
your logic (class referenced by TClonesArray) and the routine
where you fill the Tree and Clear the event.
Please communicate with me directly, not to this list.

Rene Brun



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