Coverity fixed.
authordibari <dibari@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 21 Dec 2010 08:59:28 +0000 (08:59 +0000)
committerdibari <dibari@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 21 Dec 2010 08:59:28 +0000 (08:59 +0000)
HMPID/AliHMPIDCluster.cxx
HMPID/AliHMPIDDigitizer.cxx
HMPID/AliHMPIDPid.cxx
HMPID/AliHMPIDPreprocessor.cxx
HMPID/AliHMPIDRawStream.cxx
HMPID/AliHMPIDReconHTA.cxx

index 26a5550..6e9d6b3 100644 (file)
@@ -88,12 +88,13 @@ void AliHMPIDCluster::CoG()
 //   Returns: none
   Int_t minPadX=999,minPadY=999,maxPadX=-1,maxPadY=-1;      //for box finding  
   if(fDigs==0) return;                                      //no digits in this cluster
-  fXX=fYY=fQRaw=0;                                            //init summable parameters
+  fXX=fYY=fQRaw=0;                                          //init summable parameters
+  fCh = -1;                                                 //init chamber
   Int_t maxQpad=-1,maxQ=-1;                                 //to calculate the pad with the highest charge
   AliHMPIDDigit *pDig=0x0;
   for(Int_t iDig=0;iDig<fDigs->GetEntriesFast();iDig++){    //digits loop
     pDig=(AliHMPIDDigit*)fDigs->At(iDig);                   //get pointer to next digit
-
+    if(!pDig) continue;                                     //protection
     if(pDig->PadPcX() > maxPadX) maxPadX = pDig->PadPcX();  // find the minimum box that contain the cluster  MaxX                            
     if(pDig->PadPcY() > maxPadY) maxPadY = pDig->PadPcY();  //                                                MaxY
     if(pDig->PadPcX() < minPadX) minPadX = pDig->PadPcX();  //                                                MinX   
@@ -103,6 +104,7 @@ void AliHMPIDCluster::CoG()
     fXX += pDig->LorsX()*q;fYY +=pDig->LorsY()*q;             //add digit center weighted by QDC
     fQRaw+=q;                                               //increment total charge 
     if(q>maxQ) {maxQpad = pDig->Pad();maxQ=(Int_t)q;}       // to find pad with highest charge
+    fCh=pDig->Ch();                                         //initialize chamber number
   }//digits loop
   
   fBox=(maxPadX-minPadX+1)*100+maxPadY-minPadY+1;           // dimension of the box: format Xdim*100+Ydim
@@ -112,7 +114,6 @@ void AliHMPIDCluster::CoG()
   if(fDigs->GetEntriesFast()>1&&fgDoCorrSin)CorrSin();       //correct it by sinoid   
   
   fQ  = fQRaw;                                              // Before starting fit procedure, Q and QRaw must be equal
-  fCh=pDig->Ch();                                           //initialize chamber number
   fMaxQpad = maxQpad; fMaxQ=maxQ;                           //store max charge pad to the field
   fChi2=0;                                                  // no Chi2 to find
   fNlocMax=0;                                               // proper status from this method
index 0c5f2bc..9c81baa 100644 (file)
@@ -107,7 +107,10 @@ void AliHMPIDDigitizer::Sdi2Dig(TClonesArray *pSdiLst,TObjArray *pDigLst)
       iNdigPad++; if(iNdigPad<=3) aTids[iNdigPad-1]=pSdig->GetTrack(0);                                        //collect TID 
       continue;
     }
-    if(i!=0 && AliHMPIDParam::IsOverTh(q))  new((*pLst[iCh])[iCnt[iCh]++]) AliHMPIDDigit(iPad,(Int_t)q,aTids);   //do not create digit for the very first sdigit 
+    if(i!=0 && AliHMPIDParam::IsOverTh(q) 
+            && iCh>=AliHMPIDParam::kMinCh
+            && iCh<=AliHMPIDParam::kMaxCh)  new((*pLst[iCh])[iCnt[iCh]++]) AliHMPIDDigit(iPad,(Int_t)q,aTids);  //do not create digit for the very first sdigit 
+    
     iPad=pSdig->Pad(); iCh=AliHMPIDParam::A2C(iPad);                                                            //new sdigit comes, reset collectors
     iNdigPad=1;
     aTids[0]=pSdig->GetTrack(0);aTids[1]=aTids[2]=-1; 
@@ -116,7 +119,10 @@ void AliHMPIDDigitizer::Sdi2Dig(TClonesArray *pSdiLst,TObjArray *pDigLst)
     arrNoise[iCh][pSdig->Pc()][pSdig->PadPcX()][pSdig->PadPcY()]=0;
   }//sdigits loop (sorted)
   
-  if(AliHMPIDParam::IsOverTh(q))  new((*pLst[iCh])[iCnt[iCh]++]) AliHMPIDDigit(iPad,(Int_t)q,aTids);           //add the last one, in case of empty sdigits list q=-1
+  if(AliHMPIDParam::IsOverTh(q)
+      && iCh>=AliHMPIDParam::kMinCh
+      && iCh<=AliHMPIDParam::kMaxCh)  new((*pLst[iCh])[iCnt[iCh]++]) AliHMPIDDigit(iPad,(Int_t)q,aTids);        //add the last one, in case of empty sdigits list q=-1
+  
 // add noise pad above threshold with no signal merged...if any
   if(!fgDoNoise) return;
   aTids[0]=aTids[1]=aTids[2]=-1;
index 27f274f..aa558c0 100644 (file)
@@ -73,7 +73,7 @@ void AliHMPIDPid::FindPid(AliESDtrack *pTrk,Int_t nsp,Double_t *prob)
     
     if(sigmaRing==0) {
       for(Int_t jPart=0;jPart<nsp;jPart++) prob[jPart]=1.0/(Float_t)nsp;
-      delete pPid ; pPid=0x0; return;
+      delete pPid ; pPid=0x0; delete [] h; return;
     } 
     
     if(TMath::Abs(thetaCerExp-thetaCerTh)<4*sigmaRing) desert = kFALSE;                                                                //   
index bf2839a..90c9009 100644 (file)
@@ -128,8 +128,10 @@ Bool_t AliHMPIDPreprocessor::ProcDcs(TMap* pMap)
   
   Double_t xP,yP;
 
-  TF1 **pTin  = new TF1*[21];
-  TF1 **pTout = new TF1*[21];
+//  TF1 **pTin  = new TF1*[21];
+//  TF1 **pTout = new TF1*[21];
+  TF1  *pTin[21];
+  TF1 *pTout[21];
 
 // evaluate Environment Pressure
   
index 41cecc1..1471477 100644 (file)
@@ -206,6 +206,12 @@ Bool_t AliHMPIDRawStream::Next()
   Bool_t status=kFALSE;
   fRawDataSize=0;        
   fDDLNumber = fRawReader->GetDDLID();
+  
+  if(fDDLNumber<0) {
+    AliWarning(Form("fDDLNumber not a acceptable value %i",fDDLNumber));
+    return kFALSE;
+  }
+    
   if(fRawReader->GetType() == 7 || fRawReader->GetType() == 8 )  {           //New: Select Physics events, Old: Raw data size is not 0 and not 47148 (pedestal)
     fnDDLInStream[fDDLNumber]=1; fnDDLOutStream[fDDLNumber]=0;
     
index 0d9c001..cd53af9 100644 (file)
@@ -222,12 +222,14 @@ Bool_t AliHMPIDReconHTA::FindShape(Double_t &thTrkRec,Double_t &phiTrkRec,Double
 //              thetaCRec - estimate of ThetaCerenkov
 //              status    - TRUE if a good solution is found, FALSE if not
 
-  Double_t *phiphot = new Double_t[fNClu];  
-  Double_t *dist    = new Double_t[fNClu];  
-  Int_t    *indphi  = new    Int_t[fNClu];  
+  Double_t phiphot[1000];  
+  Double_t    dist[1000];  
+  Int_t     indphi[1000];  
 
   Bool_t status;
     
+  if(fNClu>1000) return kFALSE;  // too many clusters....
+  
 // Sort in phi angle...
   for(Int_t i=0;i<fNClu;i++) {
     if(!fClCk[i]) {
@@ -281,10 +283,6 @@ Bool_t AliHMPIDReconHTA::FindShape(Double_t &thTrkRec,Double_t &phiTrkRec,Double
     npeff++;
   }
   
-  delete [] phiphot;
-  delete [] dist;
-  delete [] indphi;
-
   if(npeff<3) {
     AliDebug(1,Form("FindShape failed: no enough photons = %i...",npeff));
     delete [] phiphotP;