]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Fixes for coverity warnings
authormasera <masera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 17 Dec 2010 23:55:48 +0000 (23:55 +0000)
committermasera <masera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 17 Dec 2010 23:55:48 +0000 (23:55 +0000)
ITS/AliITSQASDDDataMakerRec.cxx
ITS/AliITSQASSDDataMakerRec.cxx
ITS/AliITSRawStreamSPD.cxx
ITS/AliITSRawStreamSSD.cxx
ITS/AliITSVertexer3D.cxx
ITS/AliITSVertexerZ.cxx
ITS/AliITSsegmentationSPD.cxx

index 029d1272e33e3e9fb6b5c9d4b15133e9065e5c3a..0460bf7b540ef324870cacaba10bf40f34c49ca3 100644 (file)
@@ -833,7 +833,9 @@ Int_t AliITSQASDDDataMakerRec::MakeRecPoints(TTree * clustersTree)
          fAliITSQADataMakerRec->GetRecPointsData(i+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Reset();
        }
     }
-  Int_t firMod=AliITSgeomTGeo::GetModuleIndex(3,1,1);
+  // AliITSgeomTGeo::GetModuleIndex() issues an error in case the arguments
+  // are illegal and returns -1
+  Int_t firMod=TMath::Max(0,AliITSgeomTGeo::GetModuleIndex(3,1,1));
   Int_t lasMod=AliITSgeomTGeo::GetModuleIndex(5,1,1);
   for(Int_t module=firMod; module<lasMod;module++){
     //AliInfo(Form("Module %d\n",module));
index 83d466b52b3baa0589bef8f52c3a42d1e1ab0a85..1c283f13c173a09afed58474191d1b7e3b2007f4 100644 (file)
@@ -894,7 +894,12 @@ Int_t AliITSQASSDDataMakerRec::MakeRaws(AliRawReader* rawReader) {
        " - LDC: "<<rawReader->GetLDCId()<<
        " - Size: "<<rawReader->GetDataSize()<<
        " - Equipment size: "<<rawReader->GetEquipmentSize()<<endl;*/
-      gSizePerDDL[rawReader->GetDDLID()] = rawReader->GetDataSize();
+      Int_t ddlid = rawReader->GetDDLID();
+      if(ddlid<0){
+       AliError("GetDDLID returns a negative value");
+       continue;
+      }
+      gSizePerDDL[ddlid] = rawReader->GetDataSize();
       //gSizePerLDC[rawReader->GetLDCId()-8] = rawReader->GetDataSize();
       AliITSgeomTGeo::GetModuleId(gSSDStream.GetModuleID(),gLayer,gLadder,gModule);
       gHistPosition = (gLayer == 5) ? ((gLadder - 1)*fgkSSDMODULESPERLADDERLAYER5 + gModule - 1) : ((gLadder - 1)*fgkSSDMODULESPERLADDERLAYER6 + gModule + fgkSSDMODULESLAYER5 - 1);
@@ -1554,7 +1559,9 @@ Int_t AliITSQASSDDataMakerRec::MakeRecPoints(TTree *clustersTree)
   Int_t npoints = 0;      
   Float_t cluglo[3]={0.,0.,0.}; 
   //printf("*-*-*-*-*-*-*---*-*-*-------*-*-*-*-*-*-***************AliITSQASSDataMakerRec::MakeRecpoints STEP1 \n");
-  Int_t firMod = AliITSgeomTGeo::GetModuleIndex(5,1,1);
+  // AliITSgeomTGeo::GetModuleIndex() issues an error in case the arguments
+  // are illegal and returns -1
+  Int_t firMod = TMath::Max(0,AliITSgeomTGeo::GetModuleIndex(5,1,1));
   Int_t lasMod =  AliITSgeomTGeo::GetNModules();
   for(Int_t module = firMod; module < lasMod; module++){
     recpoints = rpcont->UncheckedGetClusters(module);
index 0f45774a5bc537225bcfa1d1de5f72109d5a9265..6c0a72d06e8b0009b9dfb7152976be902dc250c7 100644 (file)
@@ -176,6 +176,10 @@ Int_t AliITSRawStreamSPD::ReadCalibHeader() {
   if (ddlID==-1) { // we may need to read one word to get the blockAttr
     if (!ReadNextShort()) return -1;
     ddlID = fRawReader->GetDDLID();
+    if(ddlID<0){
+      AliError("fRawReader->GetDDLID() returns a negative value");
+      ddlID=0;
+    }
   }
   // reset flags and counters
   fEqPLBytesRead = 2;
index 82ba6579e181a75cbd7ce6ab46cbe1a9c6178698..ab138f56d23fed2ba5350440fccd9d8a5234e1fe 100644 (file)
@@ -537,8 +537,12 @@ Bool_t AliITSRawStreamSSD::Next()
   flag=0;
 
 
-
-  fModuleID = fgkDDLModuleMap[fRawReader->GetDDLID()][relModuleID];
+  Int_t ddlid=fRawReader->GetDDLID();
+  if(ddlid<0){
+    AliError("fRawReader->GetDDLID returns a negative value");
+    ddlid=0;
+  }
+  fModuleID = fgkDDLModuleMap[ddlid][relModuleID];
       
   fCoord2 =  (fData >> 12) & 0x000007FF; 
   fCoord1 = (fCoord2 < 768) ? 0 : 1; // strip 0 - 767 are Pside, strip 768 - 1535 are Nside
index 04da2093d09d0dd6952bd81cd33e08661aabe8dd..e9c67445d6570a2a0ddf48036b8f31599764fd19 100644 (file)
@@ -578,6 +578,7 @@ Int_t AliITSVertexer3D::FindTracklets(TTree *itsClusterTree, Int_t optCuts){
          Int_t ladmod=fLadders[ladder-1]+ladl2;
          if(ladmod>AliITSgeomTGeo::GetNLadders(2)) ladmod=ladmod-AliITSgeomTGeo::GetNLadders(2);
          Int_t modul2=AliITSgeomTGeo::GetModuleIndex(2,ladmod,k+1);
+         if(modul2<0)continue;
          if(!fUseModule[modul2]) continue;
          itsRec=rpcont->UncheckedGetClusters(modul2);
          Int_t nrecp2 = itsRec->GetEntries();
index 21c86d1a86e1141362a0a79384956831a6ba5986..7a048fe8c8322bc92aef01a4d7bfc7d295b79b67 100644 (file)
@@ -268,6 +268,7 @@ void AliITSVertexerZ::VertexZFinder(TTree *itsClusterTree){
          Int_t ladmod=fLadders[ladder-1]+ladl2;
          if(ladmod>AliITSgeomTGeo::GetNLadders(2)) ladmod=ladmod-AliITSgeomTGeo::GetNLadders(2);
          Int_t modul2=AliITSgeomTGeo::GetModuleIndex(2,ladmod,k+1);
+         if(modul2<0)continue;
          if(!fUseModule[modul2]) continue;
          itsRec=recpArr[modul2]; // rpcont->UncheckedGetClusters(modul2);
          Int_t nrecp2 = nEntriesMod[modul2]; // itsRec->GetEntries();
index 34ea73681134fc99350d1eeecac30d6eca479660..2c7cf759df9cda655a4a0a1900f4d11dc543c695 100644 (file)
@@ -95,10 +95,10 @@ Float_t AliITSsegmentationSPD::ColFromZ(Float_t z) const {
     } // end if outsize of detector
     s = 0.0;
     i = -1;
-    while(z>s){
-       i++;
-       s += fCellSizeZ[i];
-    } // end while
+    do {
+      i++;
+      s += fCellSizeZ[i];
+    } while(z>s);
     s -= fCellSizeZ[i];
     col = (Float_t) i + (z-s)/fCellSizeZ[i];
     return col;