Fixing NEGATIVE_RETURNS defect reported by Coverity
authorivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 28 Sep 2010 08:15:25 +0000 (08:15 +0000)
committerivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 28 Sep 2010 08:15:25 +0000 (08:15 +0000)
MUON/AliMUONCDB.cxx
MUON/AliMUONClusterSplitterMLEM.cxx
MUON/AliMUONSimpleClusterServer.cxx
MUON/AliMUONTrackHitPattern.cxx

index 910c107..a653903 100644 (file)
@@ -558,7 +558,15 @@ AliMUONCDB::MakeTriggerDCSStore(TMap& aliasMap, Bool_t defaultValues)
 
     TObjArray* valueSet = new TObjArray;
     valueSet->SetOwner(kTRUE);
+
     Int_t measureType = triggerDCSNamer.DCSvariableFromDCSAlias(aliasName.Data());
+    if ( measureType < 0 ) {
+      AliErrorGeneralStream("AliMUONCDB") 
+        << "Failed to get DCS variable from an alias (trigger): "
+        << aliasName.Data() << endl;
+      return 0;
+    }
+        
     for ( UInt_t timeStamp = 0; timeStamp < 60*15; timeStamp += 120 )
     {
       Float_t value = 
index a699eb2..853de96 100644 (file)
@@ -756,7 +756,13 @@ AliMUONClusterSplitterMLEM::Fit(const AliMUONCluster& cluster,
       
       cluster1->SetCharge(coef*fQtot,coef*fQtot);
       cluster1->SetPosition(TVector2(parOk[indx],parOk[indx+1]),TVector2(sigCand[0][0],sigCand[0][1]));
-      cluster1->SetChi2(dist[TMath::LocMin(nfit,dist)]);
+      //cluster1->SetChi2(dist[TMath::LocMin(nfit,dist)]);
+      Int_t idx = TMath::LocMin(nfit,dist);
+      if ( idx < 0 || idx > 2 ) {
+        AliErrorStream() << "Wrong index value: " << idx << endl;
+        return nfit;
+      }  
+      cluster1->SetChi2(dist[idx]);
       
       // FIXME: we miss some information in this cluster, as compared to 
       // the original AddRawCluster code.
index 553352d..de29507 100644 (file)
@@ -244,7 +244,12 @@ AliMUONSimpleClusterServer::Global2Local(Int_t detElemId, const AliMpArea& globa
   
   Double_t xl,yl,zl;
   
-  Double_t zg = AliMUONConstants::DefaultChamberZ(AliMpDEManager::GetChamberId(detElemId));
+  Int_t chamberId = AliMpDEManager::GetChamberId(detElemId);
+  if ( chamberId < 0 ) {
+    AliErrorStream() << "Cannot get chamberId from detElemId=" << detElemId << endl;
+    return;
+  }  
+  Double_t zg = AliMUONConstants::DefaultChamberZ(chamberId);
   
   fkTransformer.Global2Local(detElemId,
                              globalArea.GetPositionX(),globalArea.GetPositionY(),zg,
index ac3c015..582b7bf 100644 (file)
@@ -449,7 +449,13 @@ Int_t AliMUONTrackHitPattern::FindPadMatchingTrig(Int_t &detElemId,
        minMatchDist[cath] = fkMaxDistance/10.;
        padsInCheckArea[cath] = 0;
     }
-    Int_t iChamber = AliMpDEManager::GetChamberId(detElemId);
+    
+    Int_t iChamber = AliMpDEManager::GetChamberId(detElemId);  
+    if ( iChamber < 0 ) {
+      AliErrorStream() << "Cannot get chamberId from detElemId=" << detElemId << endl;
+      return -1;
+    }  
+
     Int_t ch = iChamber-10;
     Float_t oldDeltaZ = AliMUONConstants::DefaultChamberZ(iChamber) - AliMUONConstants::DefaultChamberZ(10);
     Float_t y = coor[1];