]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSClusterFinderV2SPD.cxx
track number corrected
[u/mrichter/AliRoot.git] / ITS / AliITSClusterFinderV2SPD.cxx
index 06d4f018475ea55eb5ed4e486f7983f055c0cbd0..fc33d7659408cd004bf0239ae63e2353db4479a0 100644 (file)
 //            Implementation of the ITS clusterer V2 class                //
 //                                                                        //
 //          Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch            //
+//          Unfolding switch from AliITSRecoParam: D. Elia, INFN Bari     //
 //                                                                        //
-///////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////
 
 
+#include "AliITSCalibrationSPD.h"
 #include "AliITSClusterFinderV2SPD.h"
 #include "AliITSRecPoint.h"
 #include "AliITSgeomTGeo.h"
 #include "AliITSDetTypeRec.h"
+#include "AliITSReconstructor.h"
 #include "AliRawReader.h"
 #include "AliITSRawStreamSPD.h"
 #include <TClonesArray.h>
@@ -31,7 +34,7 @@
 
 ClassImp(AliITSClusterFinderV2SPD)
 
-AliITSClusterFinderV2SPD::AliITSClusterFinderV2SPD(AliITSDetTypeRec* dettyp):AliITSClusterFinderV2(dettyp),
+AliITSClusterFinderV2SPD::AliITSClusterFinderV2SPD(AliITSDetTypeRec* dettyp):AliITSClusterFinder(dettyp),
 fLastSPD1(AliITSgeomTGeo::GetModuleIndex(2,1,1)-1),
 fNySPD(256),
 fNzSPD(160),
@@ -84,6 +87,26 @@ Int_t AliITSClusterFinderV2SPD::ClustersSPD(AliBin* bins, TClonesArray* digits,T
   
   //Cluster finder for SPD (from digits and from rawdata)
 
+  static AliITSRecoParam *repa = NULL;
+  if(!repa){
+    repa = (AliITSRecoParam*) AliITSReconstructor::GetRecoParam();
+    if(!repa){
+      repa = AliITSRecoParam::GetHighFluxParam();
+      AliWarning("Using default AliITSRecoParam class");
+    }
+  }
+  const TGeoHMatrix *mT2L=AliITSgeomTGeo::GetTracking2LocalMatrix(iModule);
+
+  AliITSCalibrationSPD *cal =  
+       (AliITSCalibrationSPD*) fDetTypeRec->GetCalibrationModel(iModule); 
+  // Loop on bad pixels and reset them
+  for(Int_t ipix = 0; ipix<cal->GetNrBad(); ipix++){
+    Int_t row, col;
+    cal->GetBadPixel(ipix,row,col);
+    Int_t index = (row+1) * nzbins + (col+1);
+    bins[index].SetQ(0);
+    bins[index].SetMask(0xFFFFFFFE);
+  }
   Int_t nclu=0;
   for(Int_t iBin =0; iBin < maxBins;iBin++){
     if(bins[iBin].IsUsed()) continue;
@@ -150,6 +173,13 @@ Int_t AliITSClusterFinderV2SPD::ClustersSPD(AliBin* bins, TClonesArray* digits,T
     if((iModule <= fLastSPD1) &&idy<3) idy=3;
     if((iModule > fLastSPD1) &&idy<4) idy=4;
     Int_t idz=3;
+
+    // Switch the unfolding OFF/ON
+    if(!repa->GetUseUnfoldingInClusterFinderSPD()) {
+      idy=ymax-ymin+1;
+      idz=zmax-zmin+1;
+    }
     for(Int_t iiz=zmin; iiz<=zmax;iiz+=idz){
       for(Int_t iiy=ymin;iiy<=ymax;iiy+=idy){
 
@@ -172,7 +202,7 @@ Int_t AliITSClusterFinderV2SPD::ClustersSPD(AliBin* bins, TClonesArray* digits,T
            if(TMath::Abs(iz-iiz)>0.75*idz) continue;
          }
          ndigits++;
-         Float_t qBin;
+         Float_t qBin=0.;
          if(rawdata) qBin = bins[idxBins[idx]].GetQ();
          if(!rawdata){
            AliITSdigitSPD* dig = (AliITSdigitSPD*)digits->UncheckedAt(idxBins[idx]);
@@ -187,15 +217,18 @@ Int_t AliITSClusterFinderV2SPD::ClustersSPD(AliBin* bins, TClonesArray* digits,T
        z /= q;
        y -= fHwSPD;
        z -= fHlSPD;
-       Float_t hit[5]; //y,z,sigma(y)^2, sigma(z)^2, charge
 
-       if (iModule <= fLastSPD1) hit[0] = -y+fYshift[iModule];
-        else hit[0] = y+fYshift[iModule];
-
-       hit[1] = -z+fZshift[iModule];
+       Float_t hit[5]; //y,z,sigma(y)^2, sigma(z)^2, charge
+        {
+        Double_t loc[3]={y,0.,z},trk[3]={0.,0.,0.};
+        mT2L->MasterToLocal(loc,trk);
+        hit[0]=trk[1];
+        hit[1]=trk[2];
+       }
        hit[2] = fYpitchSPD*fYpitchSPD/12.;
        hit[3] = fZ1pitchSPD*fZ1pitchSPD/12.;
        hit[4] = 1.;
+
        if(!rawdata) milab[3]=fNdet[iModule];
        Int_t info[3] = {ymax-ymin+1,zmax-zmin+1,fNlayer[iModule]};
        if(!rawdata){
@@ -218,7 +251,7 @@ Int_t AliITSClusterFinderV2SPD::ClustersSPD(AliBin* bins, TClonesArray* digits,T
 
 
 
-void AliITSClusterFinderV2SPD::FindClustersSPD(AliITSRawStream* input, 
+void AliITSClusterFinderV2SPD::FindClustersSPD(AliITSRawStreamSPD* input, 
                                        TClonesArray** clusters) 
 {
   //------------------------------------------------------------
@@ -258,9 +291,23 @@ void AliITSClusterFinderV2SPD::FindClustersSPD(AliITSRawStream* input,
     bins[index].SetQ(1);
   }
 
+  // get the FastOr bit map
+  fDetTypeRec->ResetFastOrFiredMap();
+  for(UInt_t eq=0; eq<20; eq++) {
+    for(UInt_t hs=0; hs<6; hs++) {
+      for(UInt_t chip=0; chip<10; chip++) {
+        if(input->GetFastOrSignal(eq,hs,chip)) {
+          UInt_t chipKey = input->GetOfflineChipKeyFromOnline(eq,hs,chip);
+          fDetTypeRec->SetFastOrFiredMap(chipKey);
+        }
+      }
+    }
+  }
+
   delete [] binsSPDInit;
   delete [] binsSPD;
   
+  // AliDebug(1,Form("found clusters in ITS SPD: %d", nClustersSPD));
   Info("FindClustersSPD", "found clusters in ITS SPD: %d", nClustersSPD);
 }
 
@@ -289,8 +336,8 @@ void AliITSClusterFinderV2SPD::FindClustersSPD(TClonesArray *digits) {
      bins[index].SetMask(1);
   }
    
-  ClustersSPD(bins,digits,0,kMAXBIN,kNzBins,fModule,kFALSE); 
+  Int_t nClustersSPD = ClustersSPD(bins,digits,0,kMAXBIN,kNzBins,fModule,kFALSE); 
   delete [] bins;
-}
-
 
+  AliDebug(1,Form("found clusters in ITS SPD: %d", nClustersSPD));
+}