]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSClusterFinderSDD.cxx
- AliITSInitGeometry.cxx (updated): fgkOldSSDcone changed from kTRUE to
[u/mrichter/AliRoot.git] / ITS / AliITSClusterFinderSDD.cxx
index 41115ba683c95faa734a3e0a610b338a4a0708a7..6f24cf540df756dbabfa8126442b4ba2f3cd2d1e 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,12 +835,15 @@ void AliITSClusterFinderSDD::ResolveClusters(){
                    continue;
                 }
                 clusterI.SetPeakPos( peakpos ); 
-               Float_t dp = cal->GetDriftPath(newiTimef,anodePath);   
-               Double_t driftPath = fSddLength - (Double_t)dp;
-                Double_t sign = ( wing == 1 ) ? -1. : 1.;
-               Double_t xcoord = driftPath*sign * 0.0001;
-               Double_t zcoord = anodePath * 0.0001;
-               CorrectPosition(zcoord,xcoord);
+               Float_t dp = cal->GetDriftPath(newiTimef,newAnodef);
+               Float_t driftPath = fSddLength - (Double_t)dp;
+                Float_t sign = ( wing == 1 ) ? -1. : 1.;
+               Float_t xcoord = driftPath*sign * 0.0001;
+               Float_t zcoord = anodePath * 0.0001;
+               Float_t corrx=0, corrz=0;
+               cal->GetCorrections(zcoord,xcoord,corrz,corrx,GetSeg());
+               xcoord+=corrx;
+               zcoord+=corrz;
                 clusterI.SetX( xcoord );        
                 clusterI.SetZ( zcoord );
                 clusterI.SetAnode( newAnodef );
@@ -935,7 +936,7 @@ void AliITSClusterFinderSDD::SelectClusters(){
 }
 
 //______________________________________________________________________
-void AliITSClusterFinderSDD::GetRecPoints(){
+void AliITSClusterFinderSDD::GetRecPoints(AliITSCalibrationSDD* cal){
     // get rec points
   
     // get number of clusters for this module
@@ -943,8 +944,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 +968,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 +1005,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{
@@ -1026,27 +1037,4 @@ void AliITSClusterFinderSDD::PrintStatus() const{
     cout << "**************************************************" << endl;
 }
 
-//_________________________________________________________________________
-void AliITSClusterFinderSDD::CorrectPosition(Double_t &z, Double_t&y){
-  //correction of coordinates using the maps stored in the DB
-
-  AliITSCalibrationSDD* cal = (AliITSCalibrationSDD*)GetResp(fModule);
-  static const Int_t nbint = cal->GetMapTimeNBin();
-  static const Int_t nbina = cal->Chips()*cal->Channels();
-  Float_t stepa = (GetSeg()->Dpz(0))/10000.; //anode pitch in cm
-  Float_t stept = (GetSeg()->Dx()/cal->GetMapTimeNBin()/2.)/10.;
 
-  Int_t bint = TMath::Abs((Int_t)(y/stept));
-  if(y>=0) bint+=(Int_t)(nbint/2.);
-  if(bint>nbint) AliError("Wrong bin number!");
-
-  Int_t bina = TMath::Abs((Int_t)(z/stepa));
-  if(z>=0) bina+=(Int_t)(nbina/2.);
-  if(bina>nbina) AliError("Wrong bin number!");
-
-  Double_t devz = (Double_t)cal->GetMapACell(bina,bint)/10000.;
-  Double_t devx = (Double_t)cal->GetMapTCell(bina,bint)/10000.;
-  z+=devz;
-  y+=devx;
-
-}