]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSClusterFinderSDD.cxx
Release version of ITS code
[u/mrichter/AliRoot.git] / ITS / AliITSClusterFinderSDD.cxx
index 72dc8e16874a4d3edcdf2ffe791cd48c744add2c..fb44bc7524b83b3deee1f3f0f7f4d05707514eee 100644 (file)
@@ -15,6 +15,9 @@
 
 
 #include "AliITSClusterFinderSDD.h"
+#include "AliITSMapA2.h"
+#include "AliITSMapA1.h"
+#include "AliITS.h"
 #include "AliRun.h"
 
 
@@ -31,13 +34,12 @@ AliITSClusterFinderSDD::AliITSClusterFinderSDD
     fDigits=digits;
     fClusters=recp;
     fNclusters= fClusters->GetEntriesFast();
-    printf("SDD: fNclusters %d\n",fNclusters);
     SetCutAmplitude();
     SetDAnode();
     SetDTime();
-    SetMap();
     SetMinPeak();
     SetNCells();
+    SetMap();
 }
 
 //_____________________________________________________________________________
@@ -49,15 +51,25 @@ AliITSClusterFinderSDD::AliITSClusterFinderSDD()
     fDigits=0;
     fClusters=0;
     fNclusters=0;
+    fMap=0;
+    fMapA2=0;
     SetCutAmplitude();
     SetDAnode();
     SetDTime();
-    SetMap();
     SetMinPeak();
     SetNCells();
 
 }
 
+//_____________________________________________________________________________
+AliITSClusterFinderSDD::~AliITSClusterFinderSDD()
+{
+    // destructor
+
+    if(fMap) delete fMap;
+    if(fMapA2) delete fMapA2;
+
+}
 //__________________________________________________________________________
 AliITSClusterFinderSDD::AliITSClusterFinderSDD(const AliITSClusterFinderSDD &source){
   //     Copy Constructor 
@@ -65,6 +77,7 @@ AliITSClusterFinderSDD::AliITSClusterFinderSDD(const AliITSClusterFinderSDD &sou
   this->fClusters = source.fClusters ;
   this->fNclusters = source.fNclusters ;
   this->fMap = source.fMap ;
+  this->fMapA2 = source.fMapA2 ;
   this->fCutAmplitude = source.fCutAmplitude ;
   this->fDAnode = source.fDAnode ;
   this->fDTime = source.fDTime ;
@@ -81,6 +94,7 @@ AliITSClusterFinderSDD&
   this->fClusters = source.fClusters ;
   this->fNclusters = source.fNclusters ;
   this->fMap = source.fMap ;
+  this->fMapA2 = source.fMapA2 ;
   this->fCutAmplitude = source.fCutAmplitude ;
   this->fDAnode = source.fDAnode ;
   this->fDTime = source.fDTime ;
@@ -93,30 +107,8 @@ AliITSClusterFinderSDD&
 void AliITSClusterFinderSDD::SetMap()
 {
   // set map
-    if(!fMap) fMap=new AliITSMapA2(fSegmentation);
-
-}
-//_____________________________________________________________________________
-void AliITSClusterFinderSDD::FillMap()
-{
-  // fCoord1 = anode #
-  // fCoord2 = time sample
-
-  if (!fDigits) return; 
-  Int_t ndigits = fDigits->GetEntriesFast();
-  //printf("FillMap: ndigits %d\n",ndigits);
-  if (!ndigits) return;
-
-    AliITSdigitSDD *dig;
-    Int_t ndig;
-    for(ndig=0; ndig<ndigits; ndig++) {
-        dig = (AliITSdigitSDD*)fDigits->UncheckedAt(ndig);
-        Double_t signal=dig->fSignal;
-       //printf("FillMap: ndig fCoord1 fCoord2 signal %d %d %d %f\n",ndig,dig->fCoord1,dig->fCoord2,signal);
-        fMap->SetHit(dig->fCoord1,dig->fCoord2,signal);
-    }
-
+    if(!fMapA2) fMapA2=new AliITSMapA2(fSegmentation,fDigits,(double)fCutAmplitude);
+    if(!fMap) fMap=new AliITSMapA1(fSegmentation,fDigits);
 
 }
 //_____________________________________________________________________________
@@ -128,7 +120,6 @@ void AliITSClusterFinderSDD::Find1DClusters()
     AliITS *iTS=(AliITS*)gAlice->GetModule("ITS");
 
    // retrieve the parameters 
-   Int_t i;
    Int_t fNofMaps = fSegmentation->Npz();
    Int_t fMaxNofSamples = fSegmentation->Npx();
    Int_t fNofAnodes = fNofMaps/2;
@@ -139,7 +130,7 @@ void AliITSClusterFinderSDD::Find1DClusters()
    
    Float_t anodePitch = fSegmentation->Dpz(dummy);
    // map the signal
-   FillMap();
+   fMapA2->FillMap();
 
    // Piergiorgio's code - do not subtract baseline since we start
    // from digits and do not duplicate arrays, i.e. use fMap instead
@@ -147,11 +138,9 @@ void AliITSClusterFinderSDD::Find1DClusters()
  
 
   Int_t nofFoundClusters = 0;
-
+  Int_t i;
   Float_t **dfadc = new Float_t*[fNofMaps];
   for(i=0;i<fNofMaps;i++) dfadc[i] = new Float_t[fMaxNofSamples];
-   
-  
   Float_t fadc, fadc1, fadc2;
   Int_t j,k,idx,l,m;
   for(j=0;j<2;j++) {
@@ -159,8 +148,8 @@ void AliITSClusterFinderSDD::Find1DClusters()
       idx = j*fNofAnodes+k;
       // signal (fadc) & derivative (dfadc)
       for(l=0; l<fMaxNofSamples; l++) {
-       fadc2=(Float_t)fMap->GetSignal(idx,l);
-       fadc1=(Float_t)fMap->GetSignal(idx,l-1);
+       fadc2=(Float_t)fMapA2->GetSignal(idx,l);
+       fadc1=(Float_t)fMapA2->GetSignal(idx,l-1);
        if(l>0) dfadc[k][l-1] = fadc2-fadc1;
       } // samples
     } // anodes
@@ -192,10 +181,10 @@ void AliITSClusterFinderSDD::Find1DClusters()
        for(m=0;m<10;m++) {
          Int_t id = it+m;
          if(id>=fMaxNofSamples) break;
-          fadc=fMap->GetSignal(idx,id);
+          fadc=fMapA2->GetSignal(idx,id);
          if(fadc > fadcmax) {
            fadcmax = fadc;
-           if(fadc > fCutAmplitude) { lthra++; lthrt++; }
+           if(fadc > 0) { lthra++; lthrt++; }
            imax = id;
          }
          if(dfadc[k][id] > dfadcmax) {
@@ -205,19 +194,19 @@ void AliITSClusterFinderSDD::Find1DClusters()
        }
        it = imaxd;
        // skip if no signal over threshold
-       if(fMap->GetSignal(idx,imax) < fCutAmplitude) {it++; continue;}
+       if(fMapA2->TestHit(idx,imax) == kEmpty) {it++; continue;}
 
        if(k>0) {
-         if(fMap->GetSignal(idx-1,imax) > fCutAmplitude) lthra++;
+         if(fMapA2->TestHit(idx-1,imax) != kEmpty) lthra++;
        }
        if(k<fNofAnodes-1)
-         if(fMap->GetSignal(idx+1,imax) > fCutAmplitude) lthra++;
+         if(fMapA2->TestHit(idx+1,imax) != kEmpty) lthra++;
 
        if(imax>0) {
-         if(fMap->GetSignal(idx,imax-1) > fCutAmplitude) lthrt++;
+         if(fMapA2->TestHit(idx,imax-1) != kEmpty) lthrt++;
        }
        if(imax<fMaxNofSamples)
-         if(fMap->GetSignal(idx,imax+1) > fCutAmplitude) lthrt++;
+         if(fMapA2->TestHit(idx,imax+1) != kEmpty) lthrt++;
        
        // cluster charge
        Int_t tstart = it-1;
@@ -244,7 +233,7 @@ void AliITSClusterFinderSDD::Find1DClusters()
          Float_t clusterPeakAmplitude = 0.;
           Int_t its;
          for(its=tstart; its<=tstop; its++) {
-            fadc=fMap->GetSignal(idx,its);
+            fadc=fMapA2->GetSignal(idx,its);
            clusterCharge += fadc;
            if(fadc > clusterPeakAmplitude) clusterPeakAmplitude = fadc;
            clusterTime += fadc*its;
@@ -283,12 +272,8 @@ void AliITSClusterFinderSDD::Find1DClusters()
     } // anodes
   } // detectors (2)
 
-  Int_t nofClusters = fClusters->GetEntriesFast();
-  nofClusters -= fNclusters;
-
-  //printf("SDD- Find1Dclust: fNclusters nofClusters %d %d \n",fNclusters, nofClusters);
 
-  fMap->ClearMap();
+  fMapA2->ClearMap();
   
   for(i=0;i<fNofMaps;i++) delete[] dfadc[i];
   delete [] dfadc;
@@ -309,8 +294,6 @@ void  AliITSClusterFinderSDD::GroupClusters()
   Int_t nofClusters = fClusters->GetEntriesFast();
   nofClusters -= fNclusters;
 
-  //printf("SDD- GroupClusters: fNclusters nofClusters %d %d \n",fNclusters, nofClusters);
-
   AliITSRawClusterSDD *clusterI;
   AliITSRawClusterSDD *clusterJ;
 
@@ -328,8 +311,8 @@ void  AliITSClusterFinderSDD::GroupClusters()
       if(clusterI->T() < fTimeStep*10) fDAnode = 1.2;
       Bool_t pair = clusterI->Brother(clusterJ,fDAnode,fDTime);
       if(!pair) continue;
-      //      clusterI->Print();
-      //      clusterJ->Print();
+      //      clusterI->PrintInfo();
+      //      clusterJ->PrintInfo();
       clusterI->Add(clusterJ);
       label[j] = 1;
       fClusters->RemoveAt(j);
@@ -351,8 +334,6 @@ void AliITSClusterFinderSDD::SelectClusters()
   Int_t nofClusters = fClusters->GetEntriesFast();
   nofClusters -= fNclusters;
 
-  //printf("SDD- SelectClusters: fNclusters nofClusters %d %d \n",fNclusters, nofClusters);
-
   Int_t i;
   for(i=0; i<nofClusters; i++) { 
     AliITSRawClusterSDD *clusterI = (AliITSRawClusterSDD*) fClusters->At(i);
@@ -376,7 +357,6 @@ void AliITSClusterFinderSDD::SelectClusters()
 void AliITSClusterFinderSDD::GetRecPoints()
 {
   // get rec points
-  //static Int_t counter=0;
 
   AliITS *iTS=(AliITS*)gAlice->GetModule("ITS");
 
@@ -384,31 +364,32 @@ void AliITSClusterFinderSDD::GetRecPoints()
   Int_t nofClusters = fClusters->GetEntriesFast();
   nofClusters -= fNclusters;
 
-  //printf("SDD- GetRecPoints: fNclusters nofClusters %d %d \n",fNclusters, nofClusters);
-
-//  const Float_t kdEdXtoQ = 2.778e+2; // KeV -> number of e-hole pairs in Si
   const Float_t kconvGeV = 1.e-6; // GeV -> KeV
   const Float_t kconv = 1.0e-4; 
   const Float_t kRMSx = 38.0*kconv; // microns->cm ITS TDR Table 1.3
   const Float_t kRMSz = 28.0*kconv; // microns->cm ITS TDR Table 1.3
 
-  Int_t i;
+  fMap->FillMap();
+
+  Int_t i, ix, iz;
   for(i=0; i<nofClusters; i++) { 
     AliITSRawClusterSDD *clusterI = (AliITSRawClusterSDD*) fClusters->At(i);
+    fSegmentation->GetPadIxz(clusterI->X(),clusterI->Z(),ix,iz);
+    AliITSdigitSDD *dig = (AliITSdigitSDD*)fMap->GetHit(iz-1,ix-1);
     AliITSRecPoint rnew;
     rnew.SetX(clusterI->X());
     rnew.SetZ(clusterI->Z());
     rnew.SetQ(clusterI->Q());   // in KeV - should be ADC
-    //rnew.SetdEdX((clusterI->Q())/kdEdXtoQ);
     rnew.SetdEdX(kconvGeV*clusterI->Q());
     rnew.SetSigmaX2(kRMSx*kRMSx);
     rnew.SetSigmaZ2(kRMSz*kRMSz);
-    rnew.SetProbability(1.);
+    rnew.fTracks[0]=dig->fTracks[0];
+    rnew.fTracks[1]=dig->fTracks[1];
+    rnew.fTracks[2]=dig->fTracks[2];
     iTS->AddRecPoint(rnew);
-   //counter++;
   } // I clusters
-  //printf("counter %d\n",counter);
 
+  fMap->ClearMap();
 }
 
 //_____________________________________________________________________________