]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSClusterFinderSDD.cxx
ECS run type is PEDESTAL and not PEDESTAL_RUN
[u/mrichter/AliRoot.git] / ITS / AliITSClusterFinderSDD.cxx
index 41115ba683c95faa734a3e0a610b338a4a0708a7..5895ac976f4d7e88d4e2cd567502b5e6ca4379e7 100644 (file)
@@ -30,6 +30,7 @@
 #include "AliITSDetTypeRec.h"
 #include "AliITSCalibrationSDD.h"
 #include "AliITSsegmentationSDD.h"
+#include "AliITSgeom.h"
 #include "AliLog.h"
 
 ClassImp(AliITSClusterFinderSDD)
@@ -107,7 +108,6 @@ void AliITSClusterFinderSDD::Find1DClusters(){
     Int_t dummy          = 0;
     Double_t fTimeStep    = GetSeg()->Dpx(dummy);
     Double_t fSddLength   = GetSeg()->Dx();
-    Double_t anodePitch   = GetSeg()->Dpz(dummy);
     AliITSCalibrationSDD* cal = (AliITSCalibrationSDD*)GetResp(fModule);
     AliITSresponseSDD* res  = (AliITSresponseSDD*)((AliITSCalibrationSDD*)GetResp(fModule))->GetResponse();
     const char *option=res->ZeroSuppOption();
@@ -222,9 +222,8 @@ void AliITSClusterFinderSDD::Find1DClusters(){
                             //ns
                         } // end if
                     } // end for its
-
-                    Double_t clusteranodePath = (clusterAnode - fNofAnodes/2)*
-                                                 anodePitch;
+                   Float_t theAnode=clusterAnode+j*fNofAnodes;
+                    Double_t clusteranodePath = GetSeg()->GetLocalZFromAnode(theAnode);
                    Double_t clusterDriftPath = (Double_t)cal->GetDriftPath(clusterTime,clusteranodePath);
                     clusterDriftPath = fSddLength-clusterDriftPath;
                     if(clusterCharge <= 0.) break;
@@ -260,7 +259,6 @@ void AliITSClusterFinderSDD::Find1DClustersE(){
     Int_t dummy=0;
     Double_t fTimeStep = GetSeg()->Dpx( dummy );
     Double_t fSddLength = GetSeg()->Dx();
-    Double_t anodePitch = GetSeg()->Dpz( dummy );
     AliITSCalibrationSDD* cal = (AliITSCalibrationSDD*)GetResp(fModule);
     Map()->ClearMap();
     Map()->SetThresholdArr( fCutAmplitude );
@@ -325,9 +323,9 @@ void AliITSClusterFinderSDD::Find1DClustersE(){
                             time /= (charge/fTimeStep);   // ns
                                 // time = lmax*fTimeStep;   // ns
                             if( time > fTimeCorr ) time -= fTimeCorr;   // ns
-                            Double_t anodePath =(anode-fNofAnodes/2)*anodePitch;
-                            
-                           Double_t driftPath = (Double_t)cal->GetDriftPath(time,anodePath);
+                           Float_t theAnode=anode+j*fNofAnodes;
+                            Double_t anodePath =GetSeg()->GetLocalZFromAnode(theAnode);
+                           Double_t driftPath = (Double_t)cal->GetDriftPath(time,anode);
                             driftPath = fSddLength-driftPath;
                             AliITSRawClusterSDD clust(j+1,anode,time,charge,
                                                       fmax, peakpos,0.,0.,
@@ -837,7 +835,7 @@ void AliITSClusterFinderSDD::ResolveClusters(){
                    continue;
                 }
                 clusterI.SetPeakPos( peakpos ); 
-               Float_t dp = cal->GetDriftPath(newiTimef,anodePath);   
+               Float_t dp = cal->GetDriftPath(newiTimef,newAnodef);
                Double_t driftPath = fSddLength - (Double_t)dp;
                 Double_t sign = ( wing == 1 ) ? -1. : 1.;
                Double_t xcoord = driftPath*sign * 0.0001;
@@ -935,7 +933,7 @@ void AliITSClusterFinderSDD::SelectClusters(){
 }
 
 //______________________________________________________________________
-void AliITSClusterFinderSDD::GetRecPoints(){
+void AliITSClusterFinderSDD::GetRecPoints(AliITSCalibrationSDD* cal){
     // get rec points
   
     // get number of clusters for this module
@@ -943,8 +941,10 @@ void AliITSClusterFinderSDD::GetRecPoints(){
     nofClusters -= fNclusters;
     const Double_t kconvGeV = 1.e-6; // GeV -> KeV
     const Double_t kconv = 1.0e-4; 
+    const Double_t kcmToMicrons = 10000.;
     const Double_t kRMSx = 38.0*kconv; // microns->cm ITS TDR Table 1.3
     const Double_t kRMSz = 28.0*kconv; // microns->cm ITS TDR Table 1.3
+    Int_t nAnodes=GetSeg()->NpzHalf();
     Int_t i;
     Int_t ix, iz, idx=-1;
     AliITSdigitSDD *dig=0;
@@ -965,7 +965,14 @@ void AliITSClusterFinderSDD::GetRecPoints(){
         if(idx&&idx<= ndigits) dig =(AliITSdigitSDD*)GetDigit(idx);
         if(!dig) {
             // try cog
-            GetSeg()->GetPadIxz(clusterI->X(),clusterI->Z(),ix,iz);
+           Float_t xMicrons=clusterI->X()*kcmToMicrons;
+           Float_t zMicrons=clusterI->Z()*kcmToMicrons;
+           Float_t zAnode=zMicrons/GetSeg()->Dpz(0)+nAnodes/2;
+           Float_t driftSpeed=cal->GetDriftSpeedAtAnode(zAnode);           
+           Float_t driftPath=GetSeg()->Dx()-TMath::Abs(xMicrons);
+           ix=1+(Int_t)(driftPath/driftSpeed/GetSeg()->Dpx(0));
+           iz=1+(Int_t)zAnode;
+           if(xMicrons>0) iz+=nAnodes;
             dig = (AliITSdigitSDD*)Map()->GetHit(iz-1,ix-1);
             // if null try neighbours
             if (!dig) dig = (AliITSdigitSDD*)Map()->GetHit(iz-1,ix); 
@@ -995,17 +1002,18 @@ void AliITSClusterFinderSDD::FindRawClusters(Int_t mod){
     
     SetModule(mod);
     SetCutAmplitude(mod);
+    AliITSCalibrationSDD* cal = (AliITSCalibrationSDD*)GetResp(mod);
     Int_t nanodes=GetSeg()->Npz();
     Int_t noise=0;
     for(Int_t i=0;i<nanodes;i++){
-      noise+=(Int_t)(((AliITSCalibrationSDD*)GetResp(mod))->GetNoiseAfterElectronics(i));
+      noise+=(Int_t)cal->GetNoiseAfterElectronics(i);
     }    
     SetMinPeak((noise/nanodes)*5);
     Find1DClustersE();
     GroupClusters();
     SelectClusters();
     ResolveClusters();
-    GetRecPoints();
+    GetRecPoints(cal);
 }
 //_______________________________________________________________________
 void AliITSClusterFinderSDD::PrintStatus() const{