X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=PHOS%2FAliPHOSDATreeEvent.cxx;h=8cd8f4cacb3c88b20892c472511a6edf4159de27;hb=7b2fb4679499eb457f89456afdcdc470ac99cb2d;hp=b0fb5c7d26a171eb6023ff8f21102891bcc0ac6a;hpb=c335b3c5e2fa78d79b2ad087d1448262e192bf0f;p=u%2Fmrichter%2FAliRoot.git diff --git a/PHOS/AliPHOSDATreeEvent.cxx b/PHOS/AliPHOSDATreeEvent.cxx index b0fb5c7d26a..8cd8f4cacb3 100644 --- a/PHOS/AliPHOSDATreeEvent.cxx +++ b/PHOS/AliPHOSDATreeEvent.cxx @@ -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; }