]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PMD/AliPMDClusteringV1.cxx
using '-release-memory' option for TPC clusterfinder
[u/mrichter/AliRoot.git] / PMD / AliPMDClusteringV1.cxx
index b2e0a076588e24e241754ed0d79e7b7f70653a34..3d5582f5767691b2dbf679f40d3328331d243c82 100644 (file)
@@ -119,7 +119,7 @@ void AliPMDClusteringV1::DoClust(Int_t idet, Int_t ismn,
   Double_t edepcell[kNMX];
   
   
-  Double_t *cellenergy = new Double_t [11424];
+  Double_t cellenergy[11424];
   
 
   // call the isolated cell search method
@@ -178,11 +178,9 @@ void AliPMDClusteringV1::DoClust(Int_t idet, Int_t ismn,
     }
   
   for (i = 0; i < kNMX; i++)
-  {
-    edepcell[i] = cellenergy[i];
-  }
-
-  delete [] cellenergy;
+    {
+      edepcell[i] = cellenergy[i];
+    }
 
   Int_t iord1[kNMX];
   TMath::Sort((Int_t)kNMX,edepcell,iord1);// order the data
@@ -784,14 +782,14 @@ void AliPMDClusteringV1::RefClust(Int_t incr, Double_t edepcell[])
                  
                  if(rr==0)
                    {
-                     ncell[kcl] = 1.;
+                     ncell[kcl]     = 1.;
                      totaladc[kcl]  = z1;
-                     totaladc2[kcl]  = pow(z1,2);
-                     ax[kcl]  x1 * z1;
-                     ay[kcl]  y1 * z1;
-                     ax2[kcl] 0.;
-                     ay2[kcl] 0.;
-                     status[j] = 1;
+                     totaladc2[kcl] = z1*z1;
+                     ax[kcl]        = x1 * z1;
+                     ay[kcl]        = y1 * z1;
+                     ax2[kcl]       = 0.;
+                     ay2[kcl]       = 0.;
+                     status[j]      = 1;
                    }
                }
            }
@@ -832,11 +830,11 @@ void AliPMDClusteringV1::RefClust(Int_t incr, Double_t edepcell[])
                  x2 = xc[maxweight];
                  y2 = yc[maxweight];
                  totaladc[maxweight]  +=  z1;
-                 ax[maxweight]        +=  x1 * z1;
-                 ay[maxweight]        +=  y1 * z1;
-                 totaladc2[maxweight] +=  pow(z1,2);
-                 ax2[maxweight]       +=  z1 * pow((x1-x2),2);
-                 ay2[maxweight]       +=  z1 * pow((y1-y2),2);
+                 ax[maxweight]        +=  x1*z1;
+                 ay[maxweight]        +=  y1*z1;
+                 totaladc2[maxweight] +=  z1*z1;
+                 ax2[maxweight]       +=  z1*(x1-x2)*(x1-x2);
+                 ay2[maxweight]       +=  z1*(y1-y2)*(y1-y2);
                  ncell[maxweight]++;
 
                }
@@ -844,23 +842,25 @@ void AliPMDClusteringV1::RefClust(Int_t incr, Double_t edepcell[])
          
          for(Int_t kcl = 0; kcl <= ig; kcl++)
            {
-
-             if(totaladc[kcl]>0){
-               if(totaladc[kcl]>0.)xclust[kcl] = (ax[kcl])/ totaladc[kcl];
-               if(totaladc[kcl]>0.)yclust[kcl] = (ay[kcl])/ totaladc[kcl];
-               
-               //natasha
-               if(totaladc2[kcl] >= pow(totaladc[kcl],2))
-                 {
-                   sigxclust[kcl] = 0.25;
-                   sigyclust[kcl] = 0.25;
-                 }
-               else
-                 {
-                   sigxclust[kcl] = (totaladc[kcl]/(pow(totaladc[kcl],2)-totaladc2[kcl]))*ax2[kcl];
-                   sigyclust[kcl] = (totaladc[kcl]/(pow(totaladc[kcl],2)-totaladc2[kcl]))*ay2[kcl];
-                 }     
-             }
+             
+             if(totaladc[kcl] > 0.)
+               {
+                 xclust[kcl] = (ax[kcl])/ totaladc[kcl];
+                 yclust[kcl] = (ay[kcl])/ totaladc[kcl];
+                 
+                 //natasha
+                 Float_t sqtotadc = totaladc[kcl]*totaladc[kcl];
+                 if(totaladc2[kcl] >= sqtotadc)
+                   {
+                     sigxclust[kcl] = 0.25;
+                     sigyclust[kcl] = 0.25;
+                   }
+                 else
+                   {
+                     sigxclust[kcl] = (totaladc[kcl]/(sqtotadc-totaladc2[kcl]))*ax2[kcl];
+                     sigyclust[kcl] = (totaladc[kcl]/(sqtotadc-totaladc2[kcl]))*ay2[kcl];
+                   }   
+               }
              
              for(j = 0; j < cellCount[kcl]; j++) clno++; 
              
@@ -873,21 +873,21 @@ void AliPMDClusteringV1::RefClust(Int_t incr, Double_t edepcell[])
              clusdata[1] = yclust[kcl];
              clusdata[2] = totaladc[kcl];
              clusdata[3] = ncell[kcl];
-
-
+             
+             
              if(sigxclust[kcl] > sigyclust[kcl]) 
                {
-                 clusdata[4] = pow(sigxclust[kcl],0.5);
-                 clusdata[5] = pow(sigyclust[kcl],0.5);
+                 clusdata[4] = TMath::Sqrt(sigxclust[kcl]);
+                 clusdata[5] = TMath::Sqrt(sigyclust[kcl]);
                }
              else
                {
-                 clusdata[4] = pow(sigyclust[kcl],0.5);
-                 clusdata[5] = pow(sigxclust[kcl],0.5);
+                 clusdata[4] = TMath::Sqrt(sigyclust[kcl]);
+                 clusdata[5] = TMath::Sqrt(sigxclust[kcl]);
                }
              
              clxy[0] = tc[kcl];
-
+             
              Int_t Ncell=1;
              for (Int_t ii = 0; ii < cellCount[kcl]; ii++)
                {
@@ -897,7 +897,7 @@ void AliPMDClusteringV1::RefClust(Int_t incr, Double_t edepcell[])
                      Ncell++;
                    }
                } 
-
+             
              pmdcludata = new AliPMDcludata(clusdata,clxy);
              fPMDclucont->Add(pmdcludata);
            }
@@ -967,8 +967,12 @@ void AliPMDClusteringV1::FindIsoCell(Int_t idet, Int_t ismn, Double_t celladc[][
                {
                  id1 = irow + neibx[ii];
                  jd1 = icol + neiby[ii];
+                 if (id1 < 0) id1 = 0;
+                 if (id1 > kMaxRow-1) id1 = kMaxRow - 1;
+                 if (jd1 < 0) jd1 = 0;
+                 if (jd1 > kMaxCol-1) jd1 = kMaxCol - 1;
                  Float_t adc = (Float_t) celladc[id1][jd1];
-                 if(adc == 0.)
+                 if(adc < 1.)
                    {
                      isocount++;
                      if(isocount == kCellNeighbour)