Hi Chris,
I do not see a problem with TClonesArray::RemoveAt.
The code for reindexing fCont is there!
Could you send a running piece of code reproducing the problem?
Rene Brun
On Wed, 2
Jul 2003,
Chris Jillings wrote:
> Hi,
> I have a question concerning the use of
> TClonesArray::RemoveAt(Int_t idx)
>
> I have a TClonesArray of hits which may contain information that
> exists somewhere else. I want to remove the hit from a list if I have I
> do indeed have the information somewhere else.
> In the line below where I have indicated problem here, I keep
> finding the same thing again and again, even if it has been removed from
> the list. I went to the source and didn't see that the fCont array was
> reindexed.
> The strange thing is when I put in the Dump on the TClonesArray, th
> dump reported the proper items.
>
> I am running on RedHat with the 2.4.20-18.7 kernel i686 with Root
> Version 3.04/02 18 December 2002
>
> Thanks,
>
> Chris
>
> TClonesArray* fHit = // filled somewhere else
> int i;
> CHit* ct = // something obtained somewhere else.
> CHit* hit;
> int duplicateIndex;
> if( ct!=NULL ) {
> do {
> duplicateIndex = -1;
> for( i=0 ; i<fNhit ; i++ ) {
> hit = (CHit*)((*fHit)[i]); // PROBLEM HERE !!!!
> if( (*hit)==(*ct) ) {
> duplicateIndex = i;
> break;
> }
> }
> if( duplicateIndex>=0 ) {
> fHit->Dump();
> fHit->RemoveAt(duplicateIndex);
> fHit->Dump();
> fNhit--;
> }
> } while (duplicateIndex>=0);
> }
>
>
>
>
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:13 MET