]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TOF/AliTOFClusterFinder.cxx
Better implementation of copy-constructor and operator=
[u/mrichter/AliRoot.git] / TOF / AliTOFClusterFinder.cxx
index 6b4c7eecf4a660b95ac7b2685869a3fbe8b1c03b..29506ecb942a41af3d6e0172f0ab6b69ea88763c 100644 (file)
@@ -174,35 +174,35 @@ AliTOFClusterFinder::AliTOFClusterFinder(AliRunLoader* runLoader, AliTOFcalib *c
 
 //------------------------------------------------------------------------
 AliTOFClusterFinder::AliTOFClusterFinder(const AliTOFClusterFinder &source)
-  :TObject(),
+  :TObject(source),
   fRunLoader(0),
   fTOFLoader(0),
   fTreeD(0),
   fTreeR(0),
-  fDigits(new TClonesArray("AliTOFdigit", 4000)),
-  fRecPoints(new TClonesArray("AliTOFcluster", 4000)),
+  fDigits(source.fDigits),
+  fRecPoints(source.fRecPoints),
   fNumberOfTofClusters(0),
   fVerbose(0),
-  fDecoderVersion(0),
-  fTOFcalib(0)
+  fDecoderVersion(source.fDecoderVersion),
+  fTOFcalib(source.fTOFcalib)
 {
   // copy constructor
-  this->fDigits=source.fDigits;
-  this->fRecPoints=source.fRecPoints;
-  this->fDecoderVersion=source.fDecoderVersion;
-  this->fTOFcalib=source.fTOFcalib;
-
 }
 
 //------------------------------------------------------------------------
 AliTOFClusterFinder& AliTOFClusterFinder::operator=(const AliTOFClusterFinder &source)
 {
   // ass. op.
-  this->fDigits=source.fDigits;
-  this->fRecPoints=source.fRecPoints;
-  this->fVerbose=source.fVerbose;
-  this->fDecoderVersion=source.fDecoderVersion;
-  this->fTOFcalib=source.fTOFcalib;
+
+  if (this == &source)
+    return *this;
+
+  TObject::operator=(source);  
+  fDigits=source.fDigits;
+  fRecPoints=source.fRecPoints;
+  fVerbose=source.fVerbose;
+  fDecoderVersion=source.fDecoderVersion;
+  fTOFcalib=source.fTOFcalib;
   return *this;
 
 }