]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PMD/AliPMDClusteringV1.cxx
isolated cell serach included in AliPMDClusteringV1 and kept in recpoints for offline...
[u/mrichter/AliRoot.git] / PMD / AliPMDClusteringV1.cxx
index e03a864924aec4ca0edae5f140267755e0a2c68b..b96eb60d7d184f13bef2b48eaf6cebec543520aa 100644 (file)
@@ -50,6 +50,7 @@
 
 #include "AliPMDcludata.h"
 #include "AliPMDcluster.h"
+#include "AliPMDisocell.h"
 #include "AliPMDClustering.h"
 #include "AliPMDClusteringV1.h"
 #include "AliLog.h"
@@ -95,8 +96,11 @@ AliPMDClusteringV1::~AliPMDClusteringV1()
   delete fPMDclucont;
 }
 // ------------------------------------------------------------------------ //
-void AliPMDClusteringV1::DoClust(Int_t idet, Int_t ismn, 
-                                Double_t celladc[48][96], TObjArray *pmdcont)
+void AliPMDClusteringV1::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)
 {
   // main function to call other necessary functions to do clustering
   //
@@ -108,6 +112,7 @@ void AliPMDClusteringV1::DoClust(Int_t idet, Int_t ismn,
 
   Int_t    i,  j, nmx1, incr, id, jd;
   Int_t    celldataX[kNmaxCell], celldataY[kNmaxCell];
+  Int_t    celldataTr[kNmaxCell], celldataPid[kNmaxCell];
   Float_t  clusdata[6];
   Double_t cutoff, ave;
   Double_t edepcell[kNMX];
@@ -116,6 +121,10 @@ void AliPMDClusteringV1::DoClust(Int_t idet, Int_t ismn,
   Double_t *cellenergy = new Double_t [11424];
   
 
+  // call the isolated cell search method
+
+  CalculateIsoCell(idet, ismn, celladc, pmdisocell);
+
   // ndimXr and ndimYr are different because of different module size
 
   Int_t ndimXr = 0;
@@ -137,7 +146,6 @@ void AliPMDClusteringV1::DoClust(Int_t idet, Int_t ismn,
       cellenergy[i] = 0.;
   }
 
-
   Int_t kk = 0;
   for (i = 0; i < kNDIMX; i++)
     {
@@ -231,7 +239,6 @@ void AliPMDClusteringV1::DoClust(Int_t idet, Int_t ismn,
        {
          clusdata[0] = cluX0 - (48-1) + cluY0/2.;
        }         
-      
 
       clusdata[1]     = cluY0;
       clusdata[2]     = cluADC;
@@ -258,10 +265,24 @@ void AliPMDClusteringV1::DoClust(Int_t idet, Int_t ismn,
            }
          
          celldataY[ihit] = cellcol;
-       }
+         
+         Int_t irow = celldataX[ihit];
+         Int_t icol = celldataY[ihit];
 
+         if ((irow >= 0 && irow < 48) && (icol >= 0 && icol < 96))
+           {
+             celldataTr[ihit]  = celltrack[irow][icol];
+             celldataPid[ihit] = cellpid[irow][icol];
+           }
+         else
+           {
+             celldataTr[ihit] = -1;
+             celldataPid[ihit] = -1;
+           }
+       }
 
-      pmdcl = new AliPMDcluster(idet, ismn, clusdata, celldataX, celldataY);
+      pmdcl = new AliPMDcluster(idet, ismn, clusdata, celldataX, celldataY,
+                               celldataTr, celldataPid);
       pmdcont->Add(pmdcl);
     }
   
@@ -849,13 +870,7 @@ void AliPMDClusteringV1::RefClust(Int_t incr, Double_t edepcell[])
              Int_t Ncell=1;
              for (Int_t ii = 0; ii < cellCount[kcl]; ii++)
                {
-                 Float_t xx = x[cellXY[ii][kcl]];
-                 Float_t yy = y[cellXY[ii][kcl]];
-
-                 rr=Distance(xclust[kcl],yclust[kcl],xx,yy);
-                 // Natasha
-                 // We store only the nearest and nest-nearest neighbours
-                 if(rr<2.2) 
+                 if(ii<18) 
                    {   
                      clxy[Ncell] = t[cellXY[ii][kcl]];
                      Ncell++;
@@ -902,6 +917,54 @@ Double_t AliPMDClusteringV1::Distance(Double_t x1, Double_t y1,
                                      Double_t x2, Double_t y2)
 {
   return TMath::Sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
+}
+// ------------------------------------------------------------------------ //
+void AliPMDClusteringV1::CalculateIsoCell(Int_t idet, Int_t ismn, Double_t celladc[][96], TObjArray *pmdisocell)
+{
+  // 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.
+           }
+       }
+    }
+
+
 }
 // ------------------------------------------------------------------------ //
 void AliPMDClusteringV1::SetEdepCut(Float_t decut)