]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PMD/AliPMDClusteringV2.cxx
Coverity 18449,18448,18447
[u/mrichter/AliRoot.git] / PMD / AliPMDClusteringV2.cxx
index dd199783f8a3555732a487e1cb12051df68846fc..6d0e87a8a24776926afb2dcf12968b894c41a2d4 100644 (file)
@@ -44,7 +44,6 @@
 
 #include "AliPMDcludata.h"
 #include "AliPMDcluster.h"
-#include "AliPMDisocell.h"
 #include "AliPMDClustering.h"
 #include "AliPMDClusteringV2.h"
 #include "AliLog.h"
@@ -55,7 +54,8 @@ const Double_t AliPMDClusteringV2::fgkSqroot3by2=0.8660254;  // sqrt(3.)/2.
 
 AliPMDClusteringV2::AliPMDClusteringV2():
   fPMDclucont(new TObjArray()),
-  fCutoff(0.0)
+  fCutoff(0.0),
+  fClusParam(0)
 {
   for(int i = 0; i < kNDIMX; i++)
     {
@@ -72,7 +72,8 @@ AliPMDClusteringV2::AliPMDClusteringV2():
 AliPMDClusteringV2::AliPMDClusteringV2(const AliPMDClusteringV2& pmdclv2):
   AliPMDClustering(pmdclv2),
   fPMDclucont(0),
-  fCutoff(0)
+  fCutoff(0),
+  fClusParam(0)
 {
   // copy constructor
   AliError("Copy constructor not allowed ");
@@ -96,7 +97,7 @@ void AliPMDClusteringV2::DoClust(Int_t idet, Int_t ismn,
                                 Int_t celltrack[48][96],
                                 Int_t cellpid[48][96],
                                 Double_t celladc[48][96],
-                                TObjArray *pmdisocell, TObjArray *pmdcont)
+                                TObjArray *pmdcont)
 {
   // main function to call other necessary functions to do clustering
   //
@@ -104,23 +105,18 @@ void AliPMDClusteringV2::DoClust(Int_t idet, Int_t ismn,
 
   const Float_t ktwobysqrt3 = 1.1547; // 2./sqrt(3.)
   const Int_t   kNmaxCell   = 19;     // # of cells surrounding a cluster center
-  Int_t    i, j, nmx1, incr, id, jd;
+  Int_t    i = 0, j = 0, nmx1 = 0;
+  Int_t    incr = 0, id = 0, jd = 0;
   Int_t    ndimXr = 0;
   Int_t    ndimYr = 0;
   Int_t    celldataX[kNmaxCell], celldataY[kNmaxCell];
   Int_t    celldataTr[kNmaxCell], celldataPid[kNmaxCell];
   Float_t  celldataAdc[kNmaxCell];
-  Float_t  clusdata[6];  
-  Double_t cutoff, ave;
+  Float_t  clusdata[6] = {0.,0.,0.,0.,0.,0.};  
+  Double_t cutoff = 0., ave = 0.;
   Double_t edepcell[kNMX];
 
 
-  // call the isolated cell search method
-
-  FindIsoCell(idet, ismn, celladc, pmdisocell);
-
-
-
   if (ismn < 12)
     {
       ndimXr = 96;
@@ -156,7 +152,8 @@ void AliPMDClusteringV2::DoClust(Int_t idet, Int_t ismn,
        }
     }
 
-  Int_t iord1[kNMX];
+  // the dimension of iord1 is increased twice
+  Int_t iord1[2*kNMX];
   TMath::Sort((Int_t)kNMX,edepcell,iord1);// order the data
   cutoff = fCutoff; // cutoff used to discard cells having ener. dep.
   ave  = 0.;
@@ -280,8 +277,8 @@ Int_t AliPMDClusteringV2::CrClust(Double_t ave, Double_t cutoff, Int_t nmx1,
   // connected cells
   //
 
-  Int_t i,j,k,id1,id2,icl, numcell;
-  Int_t jd1,jd2, icell, cellcount;
+  Int_t i = 0, j = 0, k = 0, id1 =0, id2 = 0, icl = 0, numcell = 0;
+  Int_t jd1 = 0, jd2 = 0, icell = 0, cellcount = 0;
   Int_t clust[2][5000];
   static Int_t neibx[6] = {1,0,-1,-1,0,1}, neiby[6] = {0,1,1,0,-1,-1};
 
@@ -416,13 +413,14 @@ Int_t AliPMDClusteringV2::CrClust(Double_t ave, Double_t cutoff, Int_t nmx1,
 
   AliPMDcludata *pmdcludata = 0;
 
-  Int_t i12;
-  Int_t    i, j, k, i1, i2, id, icl, itest, ihld;
-  Int_t    ig, nsupcl, clno, clX,clY;
-  Int_t    clxy[kNmaxCell];
+  Int_t i12 = 0;
+  Int_t i = 0, j = 0, k = 0;
+  Int_t i1 = 0, i2 = 0, id = 0, icl = 0, itest = 0, ihld = 0;
+  Int_t ig = 0, nsupcl = 0, clno = 0, clX = 0, clY = 0;
+  Int_t clxy[kNmaxCell];
 
-  Float_t  clusdata[6];
-  Double_t x1, y1, z1, x2, y2, z2, rr;
+  Float_t  clusdata[6] = {0.,0.,0.,0.,0.,0.};
+  Double_t x1 = 0., y1 = 0., z1 = 0., x2 = 0., y2 = 0., z2 = 0., rr = 0.;
 
   Int_t kndim = incr + 1;
 
@@ -746,9 +744,11 @@ void AliPMDClusteringV2::ClustDetails(Int_t ncell, Int_t nclust, Double_t x[],
   Int_t kndim2 = 20;
   Int_t kndim3 = nclust + 1;//nclust
 
-  Int_t    i, j, k, i1, i2;
-  Double_t x1, y1, x2, y2, rr, b, c, r1, r2;
-  Double_t sumx, sumy, sumxy, sumxx, sum, sum1, sumyy;
+  Int_t    i = 0, j = 0, k = 0, i1 = 0, i2 = 0;
+  Double_t x1 = 0., y1 = 0., x2 = 0., y2 = 0.;
+  Double_t rr = 0., b = 0., c = 0., r1 = 0., r2 = 0.;
+  Double_t sumx = 0., sumy = 0., sumxy = 0.;
+  Double_t sumxx = 0., sum = 0., sum1 = 0., sumyy = 0.;
 
   Double_t  *str, *str1, *xcl, *ycl, *cln; 
   Int_t    **cell;
@@ -1069,56 +1069,13 @@ Double_t AliPMDClusteringV2::Distance(Double_t x1, Double_t y1,
   return TMath::Sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
 }
 // ------------------------------------------------------------------------ //
-void AliPMDClusteringV2::FindIsoCell(Int_t idet, Int_t ismn, Double_t celladc[][96], TObjArray *pmdisocell)
+void AliPMDClusteringV2::SetEdepCut(Float_t decut)
 {
-  // Does isolated cell search for offline calibration
-
-  AliPMDisocell *isocell = 0;
-
-  const Int_t kMaxRow = 48;
-  const Int_t kMaxCol = 96;
-  const Int_t kCellNeighbour = 6;
-
-  Int_t id1, jd1;
-
-  Int_t neibx[6] = {1,0,-1,-1,0,1};
-  Int_t neiby[6] = {0,1,1,0,-1,-1};
-
-
-  for(Int_t irow = 0; irow < kMaxRow; irow++)
-    {
-      for(Int_t icol = 0; icol < kMaxCol; icol++)
-       {
-         if(celladc[irow][icol] > 0)
-           {
-             Int_t isocount = 0;
-             for(Int_t ii = 0; ii < kCellNeighbour; ii++)
-               {
-                 id1 = irow + neibx[ii];
-                 jd1 = icol + neiby[ii];
-                 Float_t adc = (Float_t) celladc[id1][jd1];
-                 if(adc == 0.)
-                   {
-                     isocount++;
-                     if(isocount == kCellNeighbour)
-                       {
-                         Float_t cadc = (Float_t) celladc[irow][icol];
-
-                         isocell = new AliPMDisocell(idet,ismn,irow,icol,cadc);
-                         pmdisocell->Add(isocell);
-                         
-                       }
-                   }
-               }  // neigh cell cond.
-           }
-       }
-    }
-
-
+  fCutoff = decut;
 }
 // ------------------------------------------------------------------------ //
-void AliPMDClusteringV2::SetEdepCut(Float_t decut)
+void AliPMDClusteringV2::SetClusteringParam(Int_t cluspar)
 {
-  fCutoff = decut;
+  fClusParam = cluspar;
 }
 // ------------------------------------------------------------------------ //