]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSsegmentationSPD.cxx
set reco param on an event by event basis
[u/mrichter/AliRoot.git] / ITS / AliITSsegmentationSPD.cxx
index c232fe572cb99e908b1d6c5e3e4cf3b1880a23a6..b78ce1225161bf27d8b836ae7219e9df56d2923d 100644 (file)
@@ -18,7 +18,7 @@
 #include <TGeoVolume.h>
 #include <TGeoBBox.h>
 #include "AliITSsegmentationSPD.h"
-//#include "AliITSgeom.h"
+
 //////////////////////////////////////////////////////
 // Segmentation class for                           //
 // pixels                                           //
@@ -55,16 +55,6 @@ fNpz(0){
   }
 }
 
-//______________________________________________________________________
-AliITSsegmentationSPD::AliITSsegmentationSPD(AliITSgeom *gm):
-AliITSsegmentation(gm),
-fNpx(0),
-fNpz(0){
-  // Constructor
-   fCorr=0;
-   Init(); 
-}
-
 //_____________________________________________________________________________
 Float_t AliITSsegmentationSPD::ColFromZ300(Float_t z) const {
 // Get column number for each z-coordinate taking into account the 
@@ -84,10 +74,9 @@ Float_t AliITSsegmentationSPD::ZFromCol300(Int_t col) const {
   return z;
 }
 //_____________________________________________________________________________
-Float_t AliITSsegmentationSPD::ZpitchFromCol300(Int_t col) const {
+Float_t AliITSsegmentationSPD::Zpitch300() const {
   // returns Z pixel pitch for 300 micron pixels.
 
-    col = 0; // done to remove unused variable warning.
     return 300.0;
 }
 //_____________________________________________________________________________
@@ -105,10 +94,10 @@ Float_t AliITSsegmentationSPD::ColFromZ(Float_t z) const {
     } // end if outsize of detector
     s = 0.0;
     i = -1;
-    while(z>s){
-       i++;
-       s += fCellSizeZ[i];
-    } // end while
+    do {
+      i++;
+      s += fCellSizeZ[i];
+    } while(z>s);
     s -= fCellSizeZ[i];
     col = (Float_t) i + (z-s)/fCellSizeZ[i];
     return col;
@@ -245,6 +234,8 @@ AliITSsegmentationSPD::AliITSsegmentationSPD(const AliITSsegmentationSPD &source
     AliITSsegmentation(source),
 fNpx(0),
 fNpz(0){
+  for(Int_t i=0; i<256; i++)fCellSizeX[i]=0.;
+  for(Int_t i=0; i<280; i++)fCellSizeZ[i]=0.;
   // copy constructor
   source.Copy(*this);
 }
@@ -270,7 +261,7 @@ void AliITSsegmentationSPD::Init300(){
     fNpx = 256; // The number of X pixel Cell same as in fCellSizeX array size
     fNpz = 279; // The number of Z pixel Cell same as in fCellSizeZ array size
     for(i=0;i<fNpx;i++) fCellSizeX[i] = 50.0; // microns all the same
-    for(i=0;i<280;i++) fCellSizeZ[i] = ZpitchFromCol300(i); // microns
+    for(i=0;i<280;i++) fCellSizeZ[i] = Zpitch300(); // microns
 //    for(i=fNpz;i<280;i++) fCellSizeZ[i] = 0.0; // zero out rest of array
     fDx = 0;
     for(i=0;i<fNpx;i++) fDx += fCellSizeX[i];
@@ -537,3 +528,39 @@ Int_t AliITSsegmentationSPD::GetChipFromLocal(Float_t, Float_t zloc) const {
   return GetChipFromChannel(ix0,iz);
 }
 //----------------------------------------------------------------------
+Int_t AliITSsegmentationSPD::GetChipsInLocalWindow(Int_t* array, Float_t zmin, Float_t zmax, Float_t, Float_t) const {
+  // returns the number of chips containing a road defined by given local coordinate limits
+
+  const Float_t kconv = 1.0E-04; // converts microns to cm.
+
+  if (zmin>zmax) {
+    AliWarning("Bad coordinate limits: zmin>zmax!");
+    return -1;
+  } 
+
+  Int_t nChipInW = 0;
+
+  Float_t zminDet = -0.5*kconv*Dz();
+  Float_t zmaxDet =  0.5*kconv*Dz();
+  if(zmin<zminDet) zmin=zminDet;
+  if(zmax>zmaxDet) zmax=zmaxDet;
+
+  Int_t n1 = GetChipFromLocal(0,zmin);
+  array[nChipInW] = n1;
+  nChipInW++;
+
+  Int_t n2 = GetChipFromLocal(0,zmax);
+
+  if(n2!=n1){
+    Int_t imin=TMath::Min(n1,n2);
+    Int_t imax=TMath::Max(n1,n2);
+    for(Int_t ichip=imin; ichip<=imax; ichip++){
+      if(ichip==n1) continue;
+      array[nChipInW]=ichip;
+      nChipInW++;
+    }
+  }
+
+  return nChipInW;
+}
+//----------------------------------------------------------------------