]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSclustererV2.cxx
Fix for the case of non-existent calibration files
[u/mrichter/AliRoot.git] / ITS / AliITSclustererV2.cxx
index 2e9bb92dc78e8c2d0685f6d94e6016363174fa65..77c3531a210524032cff671ed71ba435846230a8 100644 (file)
@@ -2,14 +2,18 @@
 //            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
 //-------------------------------------------------------------------------
-//uncomment the line below for running with V1 cluster finder classes 
-//#define V1
 
+
+#include "AliLoader.h"
 #include "AliRun.h"
 
 #include "AliITSclustererV2.h"
 #include "AliITSclusterV2.h"
+#include "AliITSDetTypeRec.h"
 #include "AliRawReader.h"
 #include "AliITSRawStreamSPD.h"
 #include "AliITSRawStreamSDD.h"
@@ -18,7 +22,7 @@
 #include <TFile.h>
 #include <TTree.h>
 #include <TClonesArray.h>
-#include "AliITSgeom.h"
+#include "AliITSgeomTGeo.h"
 #include "AliITSdigitSPD.h"
 #include "AliITSdigitSDD.h"
 #include "AliITSdigitSSD.h"
@@ -28,39 +32,84 @@ ClassImp(AliITSclustererV2)
 
 extern AliRun *gAlice;
 
-AliITSclustererV2::AliITSclustererV2(const AliITSgeom *geom) {
+AliITSclustererV2::AliITSclustererV2():
+fNModules(0),
+fEvent(0),
+fI(0),
+fLastSPD1(0),
+fNySPD(0),
+fNzSPD(0),
+fYpitchSPD(0),
+fZ1pitchSPD(0),
+fZ2pitchSPD(0),
+fHwSPD(0),
+fHlSPD(0),
+fNySDD(0),
+fNzSDD(0),
+fYpitchSDD(0),
+fZpitchSDD(0),
+fHwSDD(0),
+fHlSDD(0),
+fYoffSDD(0),
+fLastSSD1(0),
+fYpitchSSD(0),
+fHwSSD(0),
+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),
+fI(0),
+fLastSPD1(AliITSgeomTGeo::GetModuleIndex(2,1,1)-1),
+fNySPD(256),
+fNzSPD(160),
+fYpitchSPD(0.0050),
+fZ1pitchSPD(0.0425),
+fZ2pitchSPD(0.0625),
+fHwSPD(0.64),
+fHlSPD(3.48),
+fNySDD(256),
+fNzSDD(256),
+fYpitchSDD(0.01825),
+fZpitchSDD(0.02940),
+fHwSDD(3.5085),
+fHlSDD(3.7632),
+fYoffSDD(0.0425),
+fLastSSD1(AliITSgeomTGeo::GetModuleIndex(6,1,1)-1),
+fYpitchSSD(0.0095),
+fHwSSD(3.65),
+fHlSSD(2.00),
+fTanP(0.0275),
+fTanN(0.0075) {
   //------------------------------------------------------------
   // Standard constructor
   //------------------------------------------------------------
-  AliITSgeom *g=(AliITSgeom*)geom;
-
-  fEvent=0;
-  fI=0;
-
-  Int_t mmax=geom->GetIndexMax();
-  if (mmax>2200) {
-     Fatal("AliITSclustererV2","Too many ITS subdetectors !"); 
+  if (geom) {
+    AliWarning("\"geom\" is actually a dummy argument !");
   }
   Int_t m;
-  for (m=0; m<mmax; m++) {
-     Int_t lay,lad,det; g->GetModuleId(m,lay,lad,det);
-     Float_t x,y,z;     g->GetTrans(lay,lad,det,x,y,z); 
-     Double_t rot[9];   g->GetRotMatrix(lay,lad,det,rot);
-     Double_t alpha=TMath::ATan2(rot[1],rot[0])+TMath::Pi();
-     Double_t ca=TMath::Cos(alpha), sa=TMath::Sin(alpha);
-     fYshift[m] = x*ca + y*sa;
-     fZshift[m] = (Double_t)z;
-     fNdet[m] = (lad-1)*g->GetNdetectors(lay) + (det-1);
+  for (m=0; m<fNModules; m++) {
+     Int_t lay,lad,det; AliITSgeomTGeo::GetModuleId(m,lay,lad,det);
+     const TGeoHMatrix *tm=AliITSgeomTGeo::GetTracking2LocalMatrix(m);
+     fYshift[m] = (tm->Inverse()).GetTranslation()[1];
+     fZshift[m] = (tm->Inverse()).GetTranslation()[2];
+     fNdet[m] = (lad-1)*AliITSgeomTGeo::GetNDetectors(lay) + (det-1);
      fNlayer[m] = lay-1;
   }
-  fNModules = g->GetIndexMax();
 
   //SPD geometry  
-  fLastSPD1=g->GetModuleIndex(2,1,1)-1;
-  fNySPD=256; fNzSPD=160;
-  fYpitchSPD=0.0050;
-  fZ1pitchSPD=0.0425; fZ2pitchSPD=0.0625;
-  fHwSPD=0.64; fHlSPD=3.48;
   fYSPD[0]=0.5*fYpitchSPD;
   for (m=1; m<fNySPD; m++) fYSPD[m]=fYSPD[m-1]+fYpitchSPD; 
   fZSPD[0]=fZ1pitchSPD;
@@ -77,21 +126,6 @@ AliITSclustererV2::AliITSclustererV2(const AliITSgeom *geom) {
     fZSPD[m]-=dz;
   }
 
-  //SDD geometry 
-  fNySDD=256; fNzSDD=256;
-  fYpitchSDD=0.01825;
-  fZpitchSDD=0.02940;
-  fHwSDD=3.5085; fHlSDD=3.7632;
-  fYoffSDD=0.0425;
-
-  //SSD geometry
-  fLastSSD1=g->GetModuleIndex(6,1,1)-1;
-  fYpitchSSD=0.0095;
-  fHwSSD=3.65;
-  fHlSSD=2.00;
-  fTanP=0.0275;
-  fTanN=0.0075;
-
 }
 
 
@@ -119,6 +153,10 @@ Int_t AliITSclustererV2::Digits2Clusters(TTree *dTree, TTree *cTree) {
   else branch->SetAddress(&clusters);
 
   Int_t mmax=(Int_t)dTree->GetEntries();
+  if (mmax!=fNModules) {
+    Error("Digits2Clusters","Number of entries != number of modules !");
+    return 1;
+  }
 
   for (fI=0; fI<mmax; fI++) {
     dTree->GetEvent(fI);
@@ -160,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;
@@ -198,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;
@@ -220,40 +260,52 @@ void AliITSclustererV2::Digits2Clusters(AliRawReader* rawReader) {
 //**** Fast clusters *******************************
 #include "TParticle.h"
 
-#include "AliITS.h"
+//#include "AliITS.h"
 #include "AliITSmodule.h"
 #include "AliITSRecPoint.h"
 #include "AliITSsimulationFastPoints.h"
 #include "AliITSRecPoint.h"
 
-/*
+
 static void CheckLabels(Int_t lab[3]) {
   //------------------------------------------------------------
   // Tries to find mother's labels
   //------------------------------------------------------------
+  AliRunLoader *rl = AliRunLoader::Instance();
+  TTree *trK=(TTree*)rl->TreeK();
+
+  if(trK){
     Int_t label=lab[0];
     if (label>=0) {
-       TParticle *part=(TParticle*)gAlice->GetMCApp()->Particle(label);
-       label=-3;
-       while (part->P() < 0.005) {
-          Int_t m=part->GetFirstMother();
-          if (m<0) {
-             Info("CheckLabels","Primary momentum: %f",part->P()); 
-             break;
-          }
-          if (part->GetStatusCode()>0) {
-             Info("CheckLabels","Primary momentum: %f",part->P()); 
-             break;
-          }
-          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";
+      TParticle *part=(TParticle*)gAlice->GetMCApp()->Particle(label);
+      label=-3;
+      while (part->P() < 0.005) {
+       Int_t m=part->GetFirstMother();
+       if (m<0) {
+         Info("CheckLabels","Primary momentum: %f",part->P()); 
+         break;
+       }
+       if (part->GetStatusCode()>0) {
+         Info("CheckLabels","Primary momentum: %f",part->P()); 
+         break;
+       }
+       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";
+      }
     }
+  }
 }
-*/
+
+/*
 static void CheckLabels(Int_t lab[3]) {
   //------------------------------------------------------------
   // Tries to find mother's labels
@@ -280,22 +332,26 @@ static void CheckLabels(Int_t lab[3]) {
   }
   
 }
-
+*/
 static void CheckLabels2(Int_t lab[10]) {
   //------------------------------------------------------------
   // Tries to find mother's labels
   //------------------------------------------------------------
-  Int_t nlabels =0; 
-  for (Int_t i=0;i<10;i++) if (lab[i]>=0) nlabels++;
-  if(nlabels == 0) return; // In case of no labels just exit
+  AliRunLoader *rl = AliRunLoader::Instance();
+  TTree *trK=(TTree*)rl->TreeK();
 
-  Int_t ntracks = gAlice->GetMCApp()->GetNtrack();
+  if(trK){
+    Int_t nlabels =0; 
+    for (Int_t i=0;i<10;i++) if (lab[i]>=0) nlabels++;
+    if(nlabels == 0) return; // In case of no labels just exit
 
-  for (Int_t i=0;i<10;i++){
-    Int_t label = lab[i];
-    if (label>=0 && label<ntracks) {
-      TParticle *part=(TParticle*)gAlice->GetMCApp()->Particle(label);
-      if (part->P() < 0.02) {
+    Int_t ntracks = gAlice->GetMCApp()->GetNtrack();
+
+    for (Int_t i=0;i<10;i++){
+      Int_t label = lab[i];
+      if (label>=0 && label<ntracks) {
+       TParticle *part=(TParticle*)gAlice->GetMCApp()->Particle(label);
+       if (part->P() < 0.02) {
          Int_t m=part->GetFirstMother();
          if (m<0) {    
            continue;
@@ -304,63 +360,69 @@ static void CheckLabels2(Int_t lab[10]) {
            continue;
          }
          lab[i]=m;       
+       }
+       else
+         if (part->P() < 0.12 && nlabels>3) {
+           lab[i]=-2;
+           nlabels--;
+         } 
       }
-      else
-       if (part->P() < 0.12 && nlabels>3) {
+      else{
+       if ( (label>ntracks||label <0) && nlabels>3) {
          lab[i]=-2;
          nlabels--;
        } 
-    }
-    else{
-      if ( (label>ntracks||label <0) && nlabels>3) {
-       lab[i]=-2;
-       nlabels--;
-      } 
-    }
-  }  
-  if (nlabels>3){
-    for (Int_t i=0;i<10;i++){
-      if (nlabels>3){
-       Int_t label = lab[i];
-       if (label>=0 && label<ntracks) {
-         TParticle *part=(TParticle*)gAlice->GetMCApp()->Particle(label);
-         if (part->P() < 0.1) {
-           lab[i]=-2;
-           nlabels--;
+      }
+    }  
+    if (nlabels>3){
+      for (Int_t i=0;i<10;i++){
+       if (nlabels>3){
+         Int_t label = lab[i];
+         if (label>=0 && label<ntracks) {
+           TParticle *part=(TParticle*)gAlice->GetMCApp()->Particle(label);
+           if (part->P() < 0.1) {
+             lab[i]=-2;
+             nlabels--;
+           }
          }
        }
       }
     }
-  }
 
-  //compress labels -- if multi-times the same
-  Int_t lab2[10];
-  for (Int_t i=0;i<10;i++) lab2[i]=-2;
-  for (Int_t i=0;i<10  ;i++){
-    if (lab[i]<0) continue;
-    for (Int_t j=0;j<10 &&lab2[j]!=lab[i];j++){
-      if (lab2[j]<0) {
-       lab2[j]= lab[i];
-       break;
+    //compress labels -- if multi-times the same
+    Int_t lab2[10];
+    for (Int_t i=0;i<10;i++) lab2[i]=-2;
+    for (Int_t i=0;i<10  ;i++){
+      if (lab[i]<0) continue;
+      for (Int_t j=0;j<10 &&lab2[j]!=lab[i];j++){
+       if (lab2[j]<0) {
+         lab2[j]= lab[i];
+         break;
+       }
       }
     }
+    for (Int_t j=0;j<10;j++) lab[j]=lab2[j];
   }
-  for (Int_t j=0;j<10;j++) lab[j]=lab2[j];
-  
 }
 
 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::Instance();
+  TTree *trK=(TTree*)rl->TreeK();
 
-  if(label<0) return; // In case of no label just exit
+  if(trK){
+    if(label<0) return; // In case of no label just exit
 
-  Int_t ntracks = gAlice->GetMCApp()->GetNtrack();
-  if (label>ntracks) return;
-  for (Int_t i=0;i<10;i++){
-    //    if (label<0) break;
-    if (lab[i]==label) break;
-    if (lab[i]<0) {
-      lab[i]= label;
-      break;
+    Int_t ntracks = gAlice->GetMCApp()->GetNtrack();
+    if (label>ntracks) return;
+    for (Int_t i=0;i<10;i++){
+      //    if (label<0) break;
+      if (lab[i]==label) break;
+      if (lab[i]<0) {
+       lab[i]= label;
+       break;
+      }
     }
   }
 }
@@ -376,9 +438,9 @@ void AliITSclustererV2::RecPoints2Clusters
   for (Int_t i=0; i<ncl; i++) {
     AliITSRecPoint *p = (AliITSRecPoint *)points->UncheckedAt(i);
     Float_t lp[5];
-    lp[0]=-(-p->GetX()+fYshift[idx]); if (idx<=fLastSPD1) lp[0]*=-1; //SPD1
+    lp[0]=-(-p->GetDetLocalX()+fYshift[idx]); if (idx<=fLastSPD1) lp[0]*=-1; //SPD1
     lp[1]=  -p->GetZ()+fZshift[idx];
-    lp[2]=p->GetSigmaX2();
+    lp[2]=p->GetSigmaDetLocX2();
     lp[3]=p->GetSigmaZ2();
     lp[4]=p->GetQ()*36./23333.;  //electrons -> ADC
     Int_t lab[4]; 
@@ -390,58 +452,8 @@ void AliITSclustererV2::RecPoints2Clusters
   }  
 } 
 
-Int_t AliITSclustererV2::Hits2Clusters(TTree *hTree, TTree *cTree) {
-  //------------------------------------------------------------
-  // This function creates ITS clusters
-  //------------------------------------------------------------
-  if (!gAlice) {
-     Error("Hits2Clusters","gAlice==0 !");
-     return 1;
-  }
-
-  AliITS *its  = (AliITS*)gAlice->GetModule("ITS");
-  if (!its) { 
-     Error("Hits2Clusters","Can't find the ITS !"); 
-     return 2; 
-  }
-  AliITSgeom *geom=its->GetITSgeom();
-  Int_t mmax=geom->GetIndexMax();
-
-  its->InitModules(-1,mmax);
-  its->FillModules(hTree,0);
-
-  TClonesArray *clusters=new TClonesArray("AliITSclusterV2",1000);
-  TBranch *branch=cTree->GetBranch("Clusters");
-  if (!branch) cTree->Branch("Clusters",&clusters);
-  else branch->SetAddress(&clusters);
-
-  static TClonesArray *points=its->RecPoints();
-  AliITSsimulationFastPoints sim;
-  Int_t ncl=0;
-  for (Int_t m=0; m<mmax; m++) {
-    AliITSmodule *mod=its->GetModule(m);      
-    sim.CreateFastRecPoints(mod,m,gRandom);      
-
-    RecPoints2Clusters(points, m, clusters);
-    its->ResetRecPoints();
-
-    ncl+=clusters->GetEntriesFast();
-    cTree->Fill();
-    clusters->Clear();
-  }
-
-  Info("Hits2Clusters","Number of found fast clusters : %d",ncl);
-
-  //cTree->Write();
-
-  delete clusters;
-
-  return 0;
-}
-
 //***********************************
 
-#ifndef V1
 
 void AliITSclustererV2:: 
 FindCluster(Int_t k,Int_t maxz,AliBin *bins,Int_t &n,Int_t *idx) {
@@ -530,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]);
@@ -538,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;
         
@@ -563,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++;        
        }
@@ -682,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;
@@ -868,10 +881,6 @@ FindClustersSDD(AliBin* bins[2], Int_t nMaxBin, Int_t nzBins,
            }
         */
 
-         c.SetSigmaY2(0.0030*0.0030);
-         c.SetSigmaZ2(0.0020*0.0020);
-         c.SetDetectorIndex(fNdet[fI]);
-
          Float_t y=c.GetY(),z=c.GetZ(), q=c.GetQ();
          y/=q; z/=q;
         //
@@ -890,12 +899,11 @@ FindClustersSDD(AliBin* bins[2], Int_t nMaxBin, Int_t nzBins,
 
          y=-(-y+fYshift[fI]);
          z=  -z+fZshift[fI];
-         c.SetY(y);
-         c.SetZ(z);
-        c.SetNy(maxj-minj+1);
-        c.SetNz(maxi-mini+1);
-        c.SetType(npeaks);
-         c.SetQ(q/12.7);  //to be consistent with the SSD charges
+
+         q/=12.7;  //this WAS consistent with SSD. To be reassessed 
+                   // 23-MAR-2007
+         Float_t hit[5] = {y, z, 0.0030*0.0030, 0.0020*0.0020, q};
+         Int_t  info[3] = {maxj-minj+1, maxi-mini+1, fNlayer[fI]};
 
          if (c.GetQ() < 20.) continue; //noise cluster
         
@@ -909,13 +917,13 @@ FindClustersSDD(AliBin* bins[2], Int_t nMaxBin, Int_t nzBins,
             //lab[2]=(d->GetTracks())[2];
             //CheckLabels(lab);
             CheckLabels2(milab); 
-            c.SetLabel(milab[0],0);
-            c.SetLabel(milab[1],1);
-            c.SetLabel(milab[2],2);
-            c.SetLayer(fNlayer[fI]);
           }
         }
-         new (cl[ncl]) AliITSclusterV2(c); ncl++;
+         milab[3]=fNdet[fI];
+
+         AliITSclusterV2 *cc = new (cl[ncl]) AliITSclusterV2(milab,hit,info);
+         cc->SetType(npeaks); 
+         ncl++;
       }
     }
 }
@@ -1040,6 +1048,7 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
   Int_t cused2[3000];
   for (Int_t i=0;i<3000;i++) {cnegative[i]=0; cused1[i]=0;}
   for (Int_t i=0;i<3000;i++) {cpositive[i]=0; cused2[i]=0;}
+  for (Int_t i=0;i<30000;i++){negativepair[i]=positivepair[i]=0;}
   static Short_t pairs[1000][1000];
   memset(pairs,0,sizeof(Short_t)*1000000);
 //   Short_t ** pairs = new Short_t*[1000];
@@ -1485,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};
   
@@ -1522,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;
           }
@@ -1530,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;
           }
@@ -1546,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;
           }
@@ -1556,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;
          }
@@ -1592,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;
      }
@@ -1602,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;
   }
@@ -1617,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.;
@@ -1639,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;
       }
@@ -1653,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;
        }
@@ -1676,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;
@@ -1699,79 +1708,3 @@ void AliITSclustererV2::FindClustersSSD(AliITSRawStream* input,
   Info("FindClustersSSD", "found clusters in ITS SSD: %d", nClustersSSD);
 }
 
-#else   //V1
-
-#include "AliITSDetType.h"
-
-#include "AliITSsegmentationSPD.h"
-#include "AliITSClusterFinderSPD.h"
-
-#include "AliITSresponseSDD.h"
-#include "AliITSsegmentationSDD.h"
-#include "AliITSClusterFinderSDD.h"
-
-#include "AliITSsegmentationSSD.h"
-#include "AliITSClusterFinderSSD.h"
-
-
-void AliITSclustererV2::
-FindClustersSPD(const TClonesArray *digits, TClonesArray *clusters) {
-  //------------------------------------------------------------
-  // Actual SPD cluster finding based on AliITSClusterFinderSPD
-  //------------------------------------------------------------
-  static AliITS *its=(AliITS*)gAlice->GetModule("ITS");
-  static TClonesArray *points=its->RecPoints();
-  static AliITSsegmentationSPD *seg=
-         (AliITSsegmentationSPD *)its->DetType(0)->GetSegmentationModel();
-  static AliITSClusterFinderSPD cf(seg, (TClonesArray*)digits, points);
-
-  cf.FindRawClusters(fI);
-  RecPoints2Clusters(points, fI, clusters);
-  its->ResetRecPoints();
-
-}
-
-void AliITSclustererV2::
-FindClustersSDD(const TClonesArray *digits, TClonesArray *clusters) {
-  //------------------------------------------------------------
-  // Actual SDD cluster finding based on AliITSClusterFinderSDD
-  //------------------------------------------------------------
-  static AliITS *its=(AliITS*)gAlice->GetModule("ITS");
-  static TClonesArray *points=its->RecPoints();
-  static AliITSresponseSDD *resp=
-        (AliITSresponseSDD *)its->DetType(1)->GetResponseModel();
-  static AliITSsegmentationSDD *seg=
-         (AliITSsegmentationSDD *)its->DetType(1)->GetSegmentationModel();
-  static AliITSClusterFinderSDD 
-         cf(seg,resp,(TClonesArray*)digits,its->ClustersAddress(1));
-
-  cf.FindRawClusters(fI);
-  Int_t nc=points->GetEntriesFast();
-  while (nc--) { //To be consistent with the SSD cluster charges
-     AliITSRecPoint *p=(AliITSRecPoint*)points->UncheckedAt(nc);
-     p->SetQ(p->GetQ()/12.);
-  }
-  RecPoints2Clusters(points, fI, clusters);
-  its->ResetClusters(1);
-  its->ResetRecPoints();
-
-}
-
-void AliITSclustererV2::
-FindClustersSSD(const TClonesArray *digits, TClonesArray *clusters) {
-  //------------------------------------------------------------
-  // Actual SSD cluster finding based on AliITSClusterFinderSSD
-  //------------------------------------------------------------
-  static AliITS *its=(AliITS*)gAlice->GetModule("ITS");
-  static TClonesArray *points=its->RecPoints();
-  static AliITSsegmentationSSD *seg=
-         (AliITSsegmentationSSD *)its->DetType(2)->GetSegmentationModel();
-  static AliITSClusterFinderSSD cf(seg,(TClonesArray*)digits);
-
-  cf.FindRawClusters(fI);
-  RecPoints2Clusters(points, fI, clusters);
-  its->ResetRecPoints();
-
-}
-
-#endif