]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PMD/AliPMDClusteringV2.cxx
Charged jets (pPb): Allow arbitrary eta ranges
[u/mrichter/AliRoot.git] / PMD / AliPMDClusteringV2.cxx
index fb0835123665847b368a95445ff501f40634b212..6d0e87a8a24776926afb2dcf12968b894c41a2d4 100644 (file)
@@ -54,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++)
     {
@@ -71,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 ");
@@ -92,7 +94,10 @@ AliPMDClusteringV2::~AliPMDClusteringV2()
 // ------------------------------------------------------------------------ //
 
 void AliPMDClusteringV2::DoClust(Int_t idet, Int_t ismn, 
-                                Double_t celladc[48][96], TObjArray *pmdcont)
+                                Int_t celltrack[48][96],
+                                Int_t cellpid[48][96],
+                                Double_t celladc[48][96],
+                                TObjArray *pmdcont)
 {
   // main function to call other necessary functions to do clustering
   //
@@ -100,12 +105,15 @@ 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];
-  Float_t  clusdata[6];  
-  Double_t cutoff, ave;
+  Int_t    celldataTr[kNmaxCell], celldataPid[kNmaxCell];
+  Float_t  celldataAdc[kNmaxCell];
+  Float_t  clusdata[6] = {0.,0.,0.,0.,0.,0.};  
+  Double_t cutoff = 0., ave = 0.;
   Double_t edepcell[kNMX];
 
 
@@ -144,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.;
@@ -233,10 +242,28 @@ void AliPMDClusteringV2::DoClust(Int_t idet, Int_t ismn,
            {
              celldataX[ihit] = (Int_t) ((cellX - (48-1) + cellY/2.) + 0.5 );
            }     
-         celldataY[ihit] = (Int_t) (cellY + 0.5);
+         celldataY[ihit]   = (Int_t) (cellY + 0.5);
+
+         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];
+             celldataAdc[ihit] = (Float_t) celladc[irow][icol];
+           }
+         else
+           {
+             celldataTr[ihit]  = -1;
+             celldataPid[ihit] = -1;
+             celldataAdc[ihit] = -1;
+           }
+
        }
 
-      pmdcl = new AliPMDcluster(idet, ismn, clusdata, celldataX, celldataY);
+      pmdcl = new AliPMDcluster(idet, ismn, clusdata, celldataX, celldataY,
+                               celldataTr, celldataPid, celldataAdc);
       pmdcont->Add(pmdcl);
     }
   fPMDclucont->Delete();
@@ -250,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};
 
@@ -386,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;
 
@@ -716,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;
@@ -1044,3 +1074,8 @@ void AliPMDClusteringV2::SetEdepCut(Float_t decut)
   fCutoff = decut;
 }
 // ------------------------------------------------------------------------ //
+void AliPMDClusteringV2::SetClusteringParam(Int_t cluspar)
+{
+  fClusParam = cluspar;
+}
+// ------------------------------------------------------------------------ //