]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSDATreeEvent.cxx
symmetric rms error
[u/mrichter/AliRoot.git] / PHOS / AliPHOSDATreeEvent.cxx
index b0fb5c7d26a171eb6023ff8f21102891bcc0ac6a..8cd8f4cacb3c88b20892c472511a6edf4159de27 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*/
 
 // --
 // --
@@ -61,28 +61,30 @@ AliPHOSDATreeEvent::AliPHOSDATreeEvent(const AliPHOSDATreeEvent& evt)
 AliPHOSDATreeEvent& AliPHOSDATreeEvent::operator=(const AliPHOSDATreeEvent& evt){
   // Copy Operator
 
-  if( fNDigits > 0 ) delete[] fDigits;
-  fNDigits = evt.fNDigits;
-  if( fNDigits > 0 ){
-    fDigits = new AliPHOSDATreeDigit[fNDigits];
-    int ndigits = fNDigits;
-    while( ndigits-- ){
-      fDigits[ndigits] = evt.fDigits[ndigits];
+  if (this != &evt) {
+    if( fNDigits > 0 ) delete[] fDigits;
+    fNDigits = evt.fNDigits;
+    if( fNDigits > 0 ){
+      fDigits = new AliPHOSDATreeDigit[fNDigits];
+      int ndigits = fNDigits;
+      while( ndigits-- ){
+       fDigits[ndigits] = evt.fDigits[ndigits];
+      }
+    } else {
+      fDigits = 0;
     }
-  } else {
-    fDigits = 0;
-  }
-  //
-  if( fNClusters > 0 ) delete[] fClusters;
-  fNClusters = evt.fNClusters;
-  if( fNClusters > 0 ){
-    fClusters = new AliPHOSDATreeCluster[fNClusters];
-    int nclusters = fNClusters;
-    while( nclusters-- ){
-      fClusters[nclusters] = evt.fClusters[nclusters];
+    //
+    if( fNClusters > 0 ) delete[] fClusters;
+    fNClusters = evt.fNClusters;
+    if( fNClusters > 0 ){
+      fClusters = new AliPHOSDATreeCluster[fNClusters];
+      int nclusters = fNClusters;
+      while( nclusters-- ){
+       fClusters[nclusters] = evt.fClusters[nclusters];
+      }
+    } else {
+      fClusters = 0;
     }
-  } else {
-    fClusters = 0;
   }
   return *this;
 }