]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PMD/AliPMDClusteringV1.cxx
#95494: Change AliLog message in AliAltroRawStreamV3.cxx (additional reduction of...
[u/mrichter/AliRoot.git] / PMD / AliPMDClusteringV1.cxx
index cad354ca157a6bef85bc86de8c556277e9651645..d9a4f9aacbc3a5878f2bf6b83444c5728a595ad5 100644 (file)
@@ -178,7 +178,8 @@ void AliPMDClusteringV1::DoClust(Int_t idet, Int_t ismn,
     }
 
   Bool_t jsort = true;
-  Int_t iord1[kNMX];
+  // the dimension of iord1 is increased twice
+  Int_t iord1[2*kNMX];
   TMath::Sort((Int_t)kNMX,edepcell,iord1,jsort);// order the data
   cutoff = fCutoff;                             // cutoff to discard cells
   ave  = 0.;
@@ -488,10 +489,10 @@ void AliPMDClusteringV1::RefClust(Int_t incr, Double_t edepcell[])
        {
          nsupcl++;
        }
-      if (nsupcl > ndim) 
+      if (nsupcl >= ndim) 
        {
          AliWarning("RefClust: Too many superclusters!");
-         nsupcl = ndim;
+         nsupcl = ndim - 1;
          break;
        }
       ncl[nsupcl]++;
@@ -511,6 +512,8 @@ void AliPMDClusteringV1::RefClust(Int_t incr, Double_t edepcell[])
          if (clno >= 4608) 
            {
              AliWarning("RefClust: Too many clusters! more than 4608");
+             delete [] ncl;
+             delete [] clxy;
              return;
            }
          clno++;
@@ -543,6 +546,9 @@ void AliPMDClusteringV1::RefClust(Int_t incr, Double_t edepcell[])
          if (clno >= 4608) 
            {
              AliWarning("RefClust: Too many clusters! more than 4608");
+             delete [] ncl;
+             delete [] clxy;
+
              return;
            }
          clno++;
@@ -584,14 +590,12 @@ void AliPMDClusteringV1::RefClust(Int_t incr, Double_t edepcell[])
        }
       else
        {
-         
          Int_t    *iord, *tc, *t;
          Double_t *x, *y, *z, *xc, *yc, *zc;
 
          iord = new Int_t [ncl[i]+1];
          tc   = new Int_t [ncl[i]+1];
          t    = new Int_t [ncl[i]+1];
-         
          x    = new Double_t [ncl[i]+1];
          y    = new Double_t [ncl[i]+1];
          z    = new Double_t [ncl[i]+1];
@@ -633,13 +637,11 @@ void AliPMDClusteringV1::RefClust(Int_t incr, Double_t edepcell[])
              i1      = fInfcl[1][id];
              i2      = fInfcl[2][id];
              i12     = i1 + i2*kNDIMX;
-
              iord[j] = j;
              x[j]    = fCoord[0][i1][i2];
              y[j]    = fCoord[1][i1][i2];
              z[j]    = edepcell[i12];
              t[j]    = i1*10000 + i2;
-
            }
          
          // arranging cells within supercluster in decreasing order
@@ -914,6 +916,39 @@ void AliPMDClusteringV1::RefClust(Int_t incr, Double_t edepcell[])
                  if (clno >= 4608) 
                    {
                      AliWarning("RefClust: Too many clusters! more than 4608");
+
+                     delete [] cellCount;
+                     for(Int_t jj = 0; jj < ncl[i]+1; jj++) delete [] cellXY[jj];
+                     delete [] cellXY;
+
+                     delete [] status;
+                     delete [] totaladc;
+                     delete [] totaladc2;
+                     delete [] ncell;
+                     delete [] xclust;
+                     delete [] yclust;
+                     delete [] sigxclust;
+                     delete [] sigyclust;
+                     delete [] ax;
+                     delete [] ay;
+                     delete [] ax2;
+                     delete [] ay2;
+                     delete [] weight;
+
+                     delete [] iord;
+                     delete [] tc;       
+                     delete [] t;
+                     delete [] x;
+                     delete [] y;
+                     delete [] z;
+                     delete [] xc;
+                     delete [] yc;
+                     delete [] zc;
+
+
+                     delete [] ncl;
+                     delete [] clxy;
+
                      return;
                    }
                  clusdata[0] = xclust[kcl];
@@ -949,7 +984,8 @@ void AliPMDClusteringV1::RefClust(Int_t incr, Double_t edepcell[])
                }
              delete [] cellCount;
              for(Int_t jj = 0; jj < ncl[i]+1; jj++) delete [] cellXY[jj];
-             
+             delete [] cellXY;
+
              delete [] status;
              delete [] totaladc;
              delete [] totaladc2;