Re: A question about TClonesArray

From: Datao Gong <dtgong_at_physics.umn.edu>
Date: Thu, 10 Nov 2005 11:37:51 -0600 (CST)


Hi,Rene,
Thank you for your quick response.
>>
>> theData->Clear(); //Clear the TClonesArray, Does this mean the orignal
>> //infomation are lost after that!?
>
> Information in the existing objects is still there, but the pointers
> to the objects are gone.
> Les objects will be reused (refilled in place) by the next new with
> placement.

After Clear(), theData->GetEntriesFast() will return 0 although the objects are still there, right?
>
>>
>> for(Int_t entry = 0; entry < theSize; ++entry) theData->AddrAt(entry);
>> //AddrAt(Int_t) just return the Object* in specified slot, so it
>> //does nothing here?
>
> AddrAt simply returns the pointer to the object in the slot entry.
You mean this line actually change the TClonesArray internal struct, so that theData->GetEntries() or GetEntriesFast will return orignal value (theSize)? This confused me.

Thanks again

Datao

>
>>
>> BTW, this code works. But i just do not know why.
>>
> Yes, this should work. What is the problem ?
>
> Rene Brun
>
>
>> Thanks,
>>
>> Datao
>>
>
Received on Thu Nov 10 2005 - 18:37:58 MET

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:13 MET