]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSDATreeCluster.cxx
*** V interface for TPCCalibTasks ***
[u/mrichter/AliRoot.git] / PHOS / AliPHOSDATreeCluster.cxx
index e4e23bc5b8ee6949f56771bf98154566664de6c7..4acf8b27f3abe9c7742f1129b71294e3840df730 100644 (file)
@@ -12,7 +12,7 @@
  * about the suitability of this software for any purpose. It is          *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
-/* $Id:$*/
+/* $Id*/
 
 // --
 // --
@@ -48,22 +48,24 @@ fEnergy(cluster.fEnergy),fRow(cluster.fRow),fCol(cluster.fCol),fNDigits(cluster.
 AliPHOSDATreeCluster& AliPHOSDATreeCluster::operator=(const AliPHOSDATreeCluster& cluster){
   // Copy Operator
 
-  if( fNDigits> 0 ) delete[] fDigits;
-  fEnergy = cluster.fEnergy;
-  fNDigits = cluster.fNDigits;
-  fRow = cluster.fRow;
-  fCol = cluster.fCol;
-  //fX = cluster.fX;
-  //fY = cluster.fY;
-  //fZ = cluster.fZ;
-  if( fNDigits > 0 ){
-    fDigits = new AliPHOSDATreeDigit[fNDigits];
-    int ndigits = fNDigits;
-    while( ndigits-- ){
-      fDigits[ndigits] = cluster.fDigits[ndigits];
+  if (this != &cluster) {
+    if( fNDigits> 0 ) delete[] fDigits;
+    fEnergy = cluster.fEnergy;
+    fNDigits = cluster.fNDigits;
+    fRow = cluster.fRow;
+    fCol = cluster.fCol;
+    //fX = cluster.fX;
+    //fY = cluster.fY;
+    //fZ = cluster.fZ;
+    if( fNDigits > 0 ){
+      fDigits = new AliPHOSDATreeDigit[fNDigits];
+      int ndigits = fNDigits;
+      while( ndigits-- ){
+       fDigits[ndigits] = cluster.fDigits[ndigits];
+      }
+    } else {
+      fDigits = 0;
     }
-  } else {
-    fDigits = 0;
   }
   return *this;
 }
@@ -163,6 +165,7 @@ bool AliPHOSDATreeCluster::Append(AliPHOSDATreeCluster& cluster){
       newfDigits[ndigitsall]= cluster.fDigits[--ndigits2];
     } else {
       std::cout<<" AliPHOSDATreeCluster::Append() Something wrong.. "<<std::endl;
+      delete [] newfDigits;
       return false;
     }
   }