]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSclustererV2.cxx
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / ITS / AliITSclustererV2.cxx
index 0113a3f195ad2844b6f36f9e331ae5bae7c7d085..77c3531a210524032cff671ed71ba435846230a8 100644 (file)
@@ -2,9 +2,13 @@
 //            Implementation of the ITS clusterer V2 class
 //
 //          Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch
+// This class is no longer used for ITS recosntruction:
+// it has been replaced by the AliITSClusterFinderV2SXD classes
+// It is still used as mother class by HLT reconstruction
 //-------------------------------------------------------------------------
 
 
+#include "AliLoader.h"
 #include "AliRun.h"
 
 #include "AliITSclustererV2.h"
@@ -54,7 +58,16 @@ fHlSSD(0),
 fTanP(0),
 fTanN(0){
    //default constructor
- }
+  for(Int_t i=0;i<260;i++)fYSPD[i]=0.;
+  for(Int_t i=0;i<170;i++)fZSPD[i]=0.;
+  for(Int_t i=0;i<2200;i++){
+    fYshift[i]=0.;
+    fZshift[i]=0.;
+    fNdet[i]=0;
+    fNlayer[i]=0;
+  }
+
+}
 AliITSclustererV2::AliITSclustererV2(const Char_t *geom):
 fNModules(AliITSgeomTGeo::GetNModules()),
 fEvent(0),
@@ -185,7 +198,7 @@ void AliITSclustererV2::Digits2Clusters(AliRawReader* rawReader) {
   //------------------------------------------------------------
   // This function creates ITS clusters from raw data
   //------------------------------------------------------------
-  AliRunLoader* runLoader = AliRunLoader::GetRunLoader();
+  AliRunLoader* runLoader = AliRunLoader::Instance();
   if (!runLoader) {
     Error("Digits2Clusters", "no run loader found");
     return;
@@ -223,17 +236,19 @@ void AliITSclustererV2::Digits2Clusters(AliRawReader* rawReader) {
 
   // write all clusters to the tree
   Int_t nClusters = 0;
+  TClonesArray *emptyArray=new TClonesArray("AliITSclusterV2");
   for (Int_t iModule = 0; iModule < fNModules; iModule++) {
     array = clusters[iModule];
     if (!array) {
       Error("Digits2Clusters", "data for module %d missing!", iModule);
-      array = new TClonesArray("AliITSclusterV2");
+      array = emptyArray;
     }
     cTree->SetBranchAddress("Clusters", &array);
     cTree->Fill();
     nClusters += array->GetEntriesFast();
-    delete array;
   }
+  delete emptyArray;
+
   itsLoader->WriteRecPoints("OVERWRITE");
 
   delete[] clusters;
@@ -256,7 +271,7 @@ static void CheckLabels(Int_t lab[3]) {
   //------------------------------------------------------------
   // Tries to find mother's labels
   //------------------------------------------------------------
-  AliRunLoader *rl = AliRunLoader::GetRunLoader();
+  AliRunLoader *rl = AliRunLoader::Instance();
   TTree *trK=(TTree*)rl->TreeK();
 
   if(trK){
@@ -277,9 +292,15 @@ static void CheckLabels(Int_t lab[3]) {
        label=m;
        part=(TParticle*)gAlice->GetMCApp()->Particle(label);
       }
-      if      (lab[1]<0) lab[1]=label;
-      else if (lab[2]<0) lab[2]=label;
-      else ;//cerr<<"CheckLabels : No empty labels !\n";
+      if(lab[1]<0){
+       lab[1]=label;
+      }
+      else if (lab[2]<0) {
+       lab[2]=label;
+      }
+      else {
+       //      cerr<<"CheckLabels : No empty labels !\n";
+      }
     }
   }
 }
@@ -316,7 +337,7 @@ static void CheckLabels2(Int_t lab[10]) {
   //------------------------------------------------------------
   // Tries to find mother's labels
   //------------------------------------------------------------
-  AliRunLoader *rl = AliRunLoader::GetRunLoader();
+  AliRunLoader *rl = AliRunLoader::Instance();
   TTree *trK=(TTree*)rl->TreeK();
 
   if(trK){
@@ -387,7 +408,7 @@ static void CheckLabels2(Int_t lab[10]) {
 static void AddLabel(Int_t lab[10], Int_t label) {
 // add label of the particle in the kine tree which originates this cluster
 // (used for reconstruction of MC data only, for comparison purposes)
-  AliRunLoader *rl = AliRunLoader::GetRunLoader();
+  AliRunLoader *rl = AliRunLoader::Instance();
   TTree *trK=(TTree*)rl->TreeK();
 
   if(trK){
@@ -521,7 +542,7 @@ FindClustersSPD(const TClonesArray *digits, TClonesArray *clusters) {
      for (Int_t iz=zmin; iz<=zmax;iz+=idz)
        for (Int_t iy=ymin; iy<=ymax;iy+=idy){
         //
-        Int_t ndigits =0;
+        Int_t nodigits =0;
         Float_t y=0.,z=0.,q=0.;         
         for (Int_t l=0; l<ni; l++) {
           d=(AliITSdigitSPD*)digits->UncheckedAt(idx[l]);
@@ -529,12 +550,12 @@ FindClustersSPD(const TClonesArray *digits, TClonesArray *clusters) {
             if (TMath::Abs( d->GetCoord2()-iy)>0.75*idy) continue;
             if (TMath::Abs( d->GetCoord1()-iz)>0.75*idz) continue;
           }
-          ndigits++;
+          nodigits++;
           Float_t qq=d->GetSignal();
           y+=qq*fYSPD[d->GetCoord2()]; z+=qq*fZSPD[d->GetCoord1()]; q+=qq;   
          
         }     
-        if (ndigits==0) continue;
+        if (nodigits==0) continue;
         y/=q; z/=q;
         y-=fHwSPD; z-=fHlSPD;
         
@@ -554,7 +575,6 @@ FindClustersSPD(const TClonesArray *digits, TClonesArray *clusters) {
         lp[4]= (zmax-zmin+1)*100 + (ymax-ymin+1);
         
         milab[3]=fNdet[fI];
-        d=(AliITSdigitSPD*)digits->UncheckedAt(idx[0]);
         Int_t info[3] = {ymax-ymin+1,zmax-zmin+1,fNlayer[fI]};
         new (cl[n]) AliITSclusterV2(milab,lp,info); n++;        
        }
@@ -673,10 +693,12 @@ void AliITSclustererV2::FindClustersSPD(AliITSRawStream* input,
     }
 
     // fill the current digit into the bins array
-    Int_t index = (input->GetCoord2()+1) * kNzBins + (input->GetCoord1()+1);
-    bins[index].SetIndex(index);
-    bins[index].SetMask(1);
-    bins[index].SetQ(1);
+    if(bins){
+      Int_t index = (input->GetCoord2()+1) * kNzBins + (input->GetCoord1()+1);
+      bins[index].SetIndex(index);
+      bins[index].SetMask(1);
+      bins[index].SetQ(1);
+    }
   }
 
   delete [] binsSPDInit;
@@ -1472,9 +1494,9 @@ FindClustersSSD(const TClonesArray *alldigits, TClonesArray *clusters) {
   Int_t smax = digits->GetEntriesFast();
   if (smax==0) return;
   
-  const Int_t MAX=1000;
+  const Int_t mMAX=1000;
   Int_t np=0, nn=0; 
-  Ali1Dcluster pos[MAX], neg[MAX];
+  Ali1Dcluster pos[mMAX], neg[mMAX];
   Float_t y=0., q=0., qmax=0.; 
   Int_t lab[4]={-2,-2,-2,-2};
   
@@ -1509,7 +1531,7 @@ FindClustersSSD(const TClonesArray *alldigits, TClonesArray *clusters) {
           c[*n].SetY(y/q-0.3*nd);
           c[*n].SetQ(0.5*q);
           (*n)++;
-          if (*n==MAX) {
+          if (*n==mMAX) {
             Error("FindClustersSSD","Too many 1D clusters !");
               return;
           }
@@ -1517,7 +1539,7 @@ FindClustersSSD(const TClonesArray *alldigits, TClonesArray *clusters) {
           c[*n].SetQ(0.5*q);
           c[*n].SetNd(nd);
           (*n)++;
-          if (*n==MAX) {
+          if (*n==mMAX) {
             Error("FindClustersSSD","Too many 1D clusters !");
               return;
           }
@@ -1533,7 +1555,7 @@ FindClustersSSD(const TClonesArray *alldigits, TClonesArray *clusters) {
           c[*n].SetY(y/q-0.25*nd);
           c[*n].SetQ(0.5*q);
           (*n)++;
-          if (*n==MAX) {
+          if (*n==mMAX) {
             Error("FindClustersSSD","Too many 1D clusters !");
             return;
           }
@@ -1543,7 +1565,7 @@ FindClustersSSD(const TClonesArray *alldigits, TClonesArray *clusters) {
           c[*n].SetLabels(milab);
         }       
          (*n)++;
-         if (*n==MAX) {
+         if (*n==mMAX) {
           Error("FindClustersSSD","Too many 1D clusters !");
           return;
          }
@@ -1579,7 +1601,7 @@ FindClustersSSD(const TClonesArray *alldigits, TClonesArray *clusters) {
      c[*n].SetY(y/q-0.25*nd);
      c[*n].SetQ(0.5*q);
      (*n)++;
-     if (*n==MAX) {
+     if (*n==mMAX) {
         Error("FindClustersSSD","Too many 1D clusters !");
         return;
      }
@@ -1589,7 +1611,7 @@ FindClustersSSD(const TClonesArray *alldigits, TClonesArray *clusters) {
      c[*n].SetLabels(lab);
   }
   (*n)++;
-  if (*n==MAX) {
+  if (*n==mMAX) {
      Error("FindClustersSSD","Too many 1D clusters !");
      return;
   }
@@ -1604,8 +1626,8 @@ void AliITSclustererV2::FindClustersSSD(AliITSRawStream* input,
   // Actual SSD cluster finder for raw data
   //------------------------------------------------------------
   Int_t nClustersSSD = 0;
-  const Int_t MAX = 1000;
-  Ali1Dcluster clusters1D[2][MAX];
+  const Int_t mMAX = 1000;
+  Ali1Dcluster clusters1D[2][mMAX];
   Int_t nClusters[2] = {0, 0};
   Int_t lab[3]={-2,-2,-2};
   Float_t q = 0.;
@@ -1626,7 +1648,7 @@ void AliITSclustererV2::FindClustersSSD(AliITSRawStream* input,
     if ((!next || (input->GetModuleID() != prevModule)||
         (strip-prevStrip > 1) || (flag != prevFlag)) &&
        (nDigits > 0)) {
-      if (nClusters[prevFlag] == MAX) {
+      if (nClusters[prevFlag] == mMAX) {
        Error("FindClustersSSD", "Too many 1D clusters !");
        return;
       }
@@ -1640,7 +1662,7 @@ void AliITSclustererV2::FindClustersSSD(AliITSRawStream* input,
       if (nDigits > 4&&nDigits < 25) {
        cluster.SetY(y/q - 0.25*nDigits);
         cluster.SetQ(0.5*q);
-       if (nClusters[prevFlag] == MAX) {
+       if (nClusters[prevFlag] == mMAX) {
          Error("FindClustersSSD", "Too many 1D clusters !");
          return;
        }
@@ -1663,8 +1685,8 @@ void AliITSclustererV2::FindClustersSSD(AliITSRawStream* input,
        fI = iModule;
        FindClustersSSD(&clusters1D[0][0], nClusters[0], 
                        &clusters1D[1][0], nClusters[1], clusters[iModule]);
-       Int_t nClusters = clusters[iModule]->GetEntriesFast();
-       nClustersSSD += nClusters;
+       Int_t noClusters = clusters[iModule]->GetEntriesFast();
+       nClustersSSD += noClusters;
       }
 
       if (!next) break;