]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSsegmentationSPD.cxx
Un-hide method AliExternalTrackParam::GetC with "using" (A. Dainese)
[u/mrichter/AliRoot.git] / ITS / AliITSsegmentationSPD.cxx
index 626551ed1f6aba7442fdaee4afb3daacf5f02557..34ea73681134fc99350d1eeecac30d6eca479660 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/* $Id:$ */
+/* $Id$ */
 #include <TGeoManager.h>
 #include <TGeoVolume.h>
 #include <TGeoBBox.h>
 #include "AliITSsegmentationSPD.h"
-//#include "AliITSgeom.h"
+
 //////////////////////////////////////////////////////
 // Segmentation class for                           //
 // pixels                                           //
 //                                                  //
 //////////////////////////////////////////////////////
+const Int_t AliITSsegmentationSPD::fgkNchipsPerModule = 5;
+const Int_t AliITSsegmentationSPD::fgkNcolumnsPerChip = 32;
 ClassImp(AliITSsegmentationSPD)
 
 //_____________________________________________________________________________
@@ -53,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 
@@ -279,10 +271,13 @@ void AliITSsegmentationSPD::Init300(){
 
 //------------------------------
 void AliITSsegmentationSPD::Init(){
-  // Initialize infromation for 6 read out chip 425X50 micron pixel SPD 
-  // detectors. This chip is 150 microns thick by 1.28 cm in x by 8.375 cm
-  // long. It has 256  50 micron pixels in x and 197 mostly 425 micron size
-  // pixels in z. The two pixels between each readout chip are 625 microns long.
+// Initialize information for 5 read out chip 425X50 micron pixel SPD 
+// detectors (ladder).
+// Each readout chip is 150 micron thick.
+// The ladder sensor is 200 micron thick by 1.28 cm in x by 6.96 cm in z.
+// It has 256 50 micron pixels in x and 160 mostly 425 micron pixels in z.
+// The two pixels at boundary between two adjacent readout chips are 
+// 625 micron long.
 
   Float_t bx[256],bz[280];
   Int_t i;
@@ -511,3 +506,60 @@ void AliITSsegmentationSPD::CellBoundries(Int_t ix,Int_t iz,
     zu = z;
     return; // Found x and z, return.
 }
+//----------------------------------------------------------------------
+Int_t AliITSsegmentationSPD::GetChipFromChannel(Int_t, Int_t iz) const {
+  // returns chip number (in range 0-4) starting from channel number
+  if(iz>=fNpz  || iz<0 ){
+    AliWarning("Bad cell number");
+    return -1;
+  }
+  Int_t theChip=iz/fgkNcolumnsPerChip;
+  return theChip;
+}
+//----------------------------------------------------------------------
+Int_t AliITSsegmentationSPD::GetChipFromLocal(Float_t, Float_t zloc) const {
+  // returns chip number (in range 0-4) starting from local coordinates
+  Int_t ix0,iz;
+  if (!LocalToDet(0,zloc,ix0,iz)) {
+    AliWarning("Bad local coordinate");
+    return -1;
+  } 
+  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;
+}
+//----------------------------------------------------------------------