]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Coverity fixes
authorkharlov <kharlov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 20 Dec 2011 16:49:27 +0000 (16:49 +0000)
committerkharlov <kharlov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 20 Dec 2011 16:49:27 +0000 (16:49 +0000)
PHOS/AliPHOSCalibData.cxx
PHOS/AliPHOSDATreeCluster.cxx
PHOS/AliPHOSDATreeEvent.cxx
PHOS/AliPHOSPIDv0.cxx
PHOS/AliPHOSRawFitterv0.cxx
PHOS/AliPHOSRawFitterv2.cxx

index fc73dfdadc89af4c5a7735c575329d1fc22362ff..7a7226f5f77f91c4dc9e3aec358d4150565882d0 100644 (file)
@@ -103,19 +103,24 @@ AliPHOSCalibData::~AliPHOSCalibData()
  
 }
 
+//________________________________________________________________
 AliPHOSCalibData & AliPHOSCalibData::operator = (const AliPHOSCalibData & rhs)
 {
   //Copy-assignment. Does not delete anything (see destructor)
   //compiler generated is ok, but ... because -Weffc++ and pointer
   //members we have to define it explicitly.
   TNamed::operator=(rhs);
-  fCalibDataEmc = rhs.fCalibDataEmc;
-  fCalibDataCpv = rhs.fCalibDataCpv;
-  fEmcBadChannelsMap = rhs.fEmcBadChannelsMap;
-  fEmcDataPath  = rhs.fEmcDataPath;
-  fCpvDataPath  = rhs.fCpvDataPath;
-  fEmcBadChannelsMapPath = rhs.fEmcBadChannelsMapPath;
-  
+  if (this != &rhs) {
+    fCalibDataEmc = rhs.fCalibDataEmc;
+    fCalibDataCpv = rhs.fCalibDataCpv;
+    fEmcBadChannelsMap = rhs.fEmcBadChannelsMap;
+    fEmcDataPath  = rhs.fEmcDataPath;
+    fCpvDataPath  = rhs.fCpvDataPath;
+    fEmcBadChannelsMapPath = rhs.fEmcBadChannelsMapPath;
+  }
+  else {
+    AliFatal("Self assignment!");
+  }
   return *this;
 }
 
index 978d50730dcaa747a54edd171bdfb3a9c0fc481b..94fe94d647e1811c6926080cdd955ab4ccf83dbe 100644 (file)
@@ -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;
 }
index 99a081a3a575b6886555177692838898ed947fab..8cd8f4cacb3c88b20892c472511a6edf4159de27 100644 (file)
@@ -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;
 }
index a393a4f9988cedc9b031733dd014ad773c217abb..05a88db220d60f2c079bb72e2284a2549b89049d 100644 (file)
@@ -137,14 +137,18 @@ AliPHOSPIDv0 & AliPHOSPIDv0::operator = (const AliPHOSPIDv0 & rhs)
 {
   //Copy-assignment, emulates compiler generated, possibly wrong.
   AliPHOSPID::operator = (rhs);
-  fIDOptions = rhs.fIDOptions;
-  fClusterizer = rhs.fClusterizer;
-  fTSMaker = rhs.fTSMaker;
-  fFormula = rhs.fFormula;
-  fDispersion = rhs.fDispersion;
-  fCpvEmcDistance = rhs.fCpvEmcDistance;
-  fTimeGate = rhs.fTimeGate;
-
+  if (this != &rhs) {
+    fIDOptions = rhs.fIDOptions;
+    fClusterizer = rhs.fClusterizer;
+    fTSMaker = rhs.fTSMaker;
+    fFormula = rhs.fFormula;
+    fDispersion = rhs.fDispersion;
+    fCpvEmcDistance = rhs.fCpvEmcDistance;
+    fTimeGate = rhs.fTimeGate;
+  }
+  else {
+    AliFatal("Self assignment!");
+  }
   return *this;
 }
 
index 22533fa6f5c88b4085bc7dc694d22ffbc4e54189..e253891aac3055d049af1ecef2c61f61ec0fc46a 100644 (file)
@@ -261,6 +261,9 @@ Bool_t AliPHOSRawFitterv0::Eval(const UShort_t *signal, Int_t sigStart, Int_t si
   if(det == 0){
     return kTRUE;
   }
+  if(np == 0){
+    return kFALSE;
+  }
   Double_t c1 = (np*sxy - sx*sy)/det;  //slope
   Double_t c0 = (sy-c1*sx)/np; //offset
   if(c1 == 0){
index 643ee747ed685fbd69184fa246872da817652ff7..46effbfa80dd8c2e729a826d4600e39b75092f91 100644 (file)
@@ -376,7 +376,7 @@ Bool_t AliPHOSRawFitterv2::FindAmpT(TArrayD samples, TArrayD times){
       fddf+=phi*ddphi ;
     }
 
-    if(ff==0.||nfit==0. ){
+    if(ff<1.e-09||nfit==0 ){
       fQuality=199 ;
       return kFALSE ;
     }