Re: TClonesArray

From: Fons Rademakers <Fons.Rademakers_at_cern.ch>
Date: Thu, 2 Jul 2009 17:26:35 +0200


Hi Roman,

    as clonesarrays are generally large objects we don't have assignment and copy ctors for them. If you really want to copy or assign objects containing TClonesArrays, you will have to loop over these arrays yourself and copy the information. If you use a pointer to a clones array you can use the TObject::Clone() method:

TClonesArray *b = (TClonesArray*)a->Clone()

Cheers, Fons.

> Can you show me or point me to example how
> to use TClonesArray in copy constructor and
> in assignemnt operator, please?
> Thanks,
> Roman.
>
> E.g.:
>
> class item{
> };
>
>
> class myclass{
> TClonesArray array; // array of item objects
> } ;
>
> myclass::myclass(const myclass &class ){
> }
>
> myclass& myclass::operator=(const myclass &class)
> {
> if(this!=&class){
> }
> }

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers_at_cern.ch              Phone: +41 22 7679248
WWW:    http://fons.rademakers.org           Fax:   +41 22 7669640
Received on Thu Jul 02 2009 - 17:26:38 CEST

This archive was generated by hypermail 2.2.0 : Fri Jul 03 2009 - 05:50:03 CEST