]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSsegmentationSPD.cxx
Removing obsolete macros
[u/mrichter/AliRoot.git] / ITS / AliITSsegmentationSPD.cxx
index cd9496ae0bbca9b934d61b5100b13ede11afd802..2d2fe58724131a4299c4162edb6296b1d7c83ade 100644 (file)
@@ -22,7 +22,7 @@
 ClassImp(AliITSsegmentationSPD)
 
 
-Float_t ColFromZ300(Float_t z) {
+Float_t AliITSsegmentationSPD::ColFromZ300(Float_t z) {
 // Get column number for each z-coordinate taking into account the 
 // extra pixels in z direction assuming 300 micron sized pixels.
      Float_t col = 0.0;
@@ -31,7 +31,7 @@ Float_t ColFromZ300(Float_t z) {
      return col;
 }
 //_____________________________________________________________________________
-Float_t ZFromCol300(Int_t col) {
+Float_t AliITSsegmentationSPD::ZFromCol300(Int_t col) {
 // same comments as above
 // Get z-coordinate for each colunm number
   Float_t pitchz = 300.0;
@@ -40,17 +40,34 @@ Float_t ZFromCol300(Int_t col) {
   return z;
 }
 //_____________________________________________________________________________
-Float_t ZpitchFromCol300(Int_t col) {
+Float_t AliITSsegmentationSPD::ZpitchFromCol300(Int_t col) {
   // returns Z pixel pitch for 300 micron pixels.
   return 300.0;
 }
 //_____________________________________________________________________________
-Float_t ColFromZ(Float_t z) {
-// hard-wired - keep it like this till we can parametrise 
-// and get rid of AliITSgeomSPD425
-// Get column number for each z-coordinate taking into account the 
-// extra pixels in z direction 
-
+Float_t AliITSsegmentationSPD::ColFromZ(Float_t z) {
+    // hard-wired - keep it like this till we can parametrise 
+    // and get rid of AliITSgeomSPD425
+    // Get column number for each z-coordinate taking into account the 
+    // extra pixels in z direction 
+    Int_t i;
+    Float_t s,col;
+
+    if(z<0||z>fDz){
+       Error("ColFromZ","z=%f outside of range 0.0<=z<fDz=%f",z,fDz);
+       return 0.0; // error
+    } // end if outsize of detector
+    s = 0.0;
+    i = -1;
+    while(z>s){
+       i++;
+       s += fCellSizeZ[i];
+    } // end while
+    s -= fCellSizeZ[i];
+    col = (Float_t) i + (z-s)/fCellSizeZ[i];
+    return col;
+
+/*
   Float_t col = 0;
   Float_t pitchz = 425;
   if( z < 13175) {
@@ -81,14 +98,26 @@ Float_t ColFromZ(Float_t z) {
   } else if( z < 83600) {  
     col = 161 + (z - 70425)/pitchz;
   }   
-  return TMath::Abs(col);
+  return TMath::Abs(col);*/
 }
 
 //_____________________________________________________________________________
-Float_t ZFromCol(Int_t col) {
-// same comments as above
-// Get z-coordinate for each colunm number
-
+Float_t AliITSsegmentationSPD::ZFromCol(Int_t col) {
+    // same comments as above
+    // Get z-coordinate for each colunm number
+    Int_t i;
+    Float_t z;
+
+    if(col<0||col>=fNpz){
+       Error("ZFromCol","col=%d outside of range 0<=col<fNpZ=%d",col,fNpz);
+       return 0.0; // error
+    } // end if outsize of detector
+    z = 0.0;
+    for(i=0;i<col;i++) z += fCellSizeZ[i];
+    z += 0.5*fCellSizeZ[col];
+    return z;
+
+/* 
   Float_t pitchz = 425;
   Float_t z = 0;
   if( col >=0 && col <= 30 ) {  
@@ -120,27 +149,27 @@ Float_t ZFromCol(Int_t col) {
     z = 70425 + (col -161 + 0.5)*pitchz;    
   }
 
-  return z;
+  return z;*/
 }
 //______________________________________________________________________
-Float_t ZpitchFromCol(Int_t col) {
-// Get pitch size in z direction for each colunm
+Float_t AliITSsegmentationSPD::ZpitchFromCol(Int_t col) {
+    // Get pitch size in z direction for each colunm
 
-    Float_t pitchz = 425;
+   Float_t pitchz = 425.;
     if(col < 0){
        pitchz = 0.0;
     } else if(col >=  31 && col <=  32) {
-       pitchz = 625;
+       pitchz = 625.;
     } else if(col >=  63 && col <=  64) {
-       pitchz = 625;
+       pitchz = 625.;
     } else if(col >=  95 && col <=  96) {
-       pitchz = 625;
+       pitchz = 625.;
     } else if(col >= 127 && col <= 128) {
-       pitchz = 625;
+       pitchz = 625.;
     } else if(col >= 159 && col <= 160) {
-       pitchz = 625;
-    } else if(col>192){
-       pitchz = 0.0;
+       pitchz = 625.;
+    } else if(col>=192){
+       pitchz = 425.;
     }
     return pitchz;
 }
@@ -190,7 +219,7 @@ void AliITSsegmentationSPD::SetBinSize(Float_t *x,Float_t *z){
     Int_t i;
 
     for(i=0;i<256;i++) fCellSizeX[i] = x[i];
-    for(i=0;i<280;i++) fCellSizeX[i] = z[i];
+    for(i=0;i<280;i++) fCellSizeZ[i] = z[i];
     return;
 }
 //----------------------------------------------------------------------
@@ -205,8 +234,8 @@ 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<fNpz;i++) fCellSizeZ[i] = ZpitchFromCol300(i); // microns
-    for(i=fNpz;i<280;i++) fCellSizeZ[i] = 0.0; // zero out rest of array
+    for(i=0;i<280;i++) fCellSizeZ[i] = ZpitchFromCol300(i); // 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];
     fDz = 0;
@@ -226,8 +255,8 @@ void AliITSsegmentationSPD::Init(){
     fNpx = 256; // The number of X pixel Cell same as in fCellSizeX array size
     fNpz = 192; // 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<fNpz;i++) fCellSizeZ[i] = ZpitchFromCol(i); // microns
-    for(i=fNpz;i<280;i++) fCellSizeZ[i] = 0.0; // zero out rest of array
+    for(i=0;i<280;i++) fCellSizeZ[i] = ZpitchFromCol(i); // 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];
     fDz = 0;
@@ -257,13 +286,15 @@ void AliITSsegmentationSPD::SetDetSize(Float_t p1, Float_t p2, Float_t p3){
 }
 //------------------------------
 Float_t AliITSsegmentationSPD::Dpx(Int_t i){
-   //returs x pixel pitch for a give pixel
-   return fCellSizeX[i];
+    //returs x pixel pitch for a give pixel
+    if(i<0||i>=256) return 0.0;
+    return fCellSizeX[i];
 }
 //------------------------------
 Float_t AliITSsegmentationSPD::Dpz(Int_t i){
-  // returns z pixel pitch for a give pixel
-   return ZpitchFromCol(i);
+    // returns z pixel pitch for a give pixel
+    if(i<0||i>=280) return 0.0;
+    return fCellSizeZ[i];
 }
 //------------------------------
 void AliITSsegmentationSPD::GetPadIxz(Float_t x,Float_t z,Int_t &ix,Int_t &iz){
@@ -411,3 +442,42 @@ void AliITSsegmentationSPD::DetToLocal(Int_t ix,Int_t iz,Float_t &x,Float_t &z)
     z += 0.5*kconv*fCellSizeZ[iz]; // add 1/2 of cell iz for center location.
     return; // Found x and z, return.
 }
+//______________________________________________________________________
+void AliITSsegmentationSPD::CellBoundries(Int_t ix,Int_t iz,
+                                         Double_t &xl,Double_t &xu,
+                                         Double_t &zl,Double_t &zu)
+{
+// Transformation from Detector cell coordiantes to Geant detector centerd 
+// local coordinates (cm).
+// Input:
+// Int_t    ix        detector x cell coordinate. Has the range 0<=ix<fNpx.
+// Int_t    iz        detector z cell coordinate. Has the range 0<=iz<fNpz.
+// Output:
+// Double_t   xl       detector local coordinate cell lower bounds x in cm
+//                    with respect to the center of the sensitive volume.
+// Double_t   xu       detector local coordinate cell upper bounds x in cm 
+//                    with respect to the center of the sensitive volume.
+// Double_t   zl       detector local coordinate lower bounds z in cm with
+//                    respect to the center of the sensitive volulme.
+// Double_t   zu       detector local coordinate upper bounds z in cm with 
+//                    respect to the center of the sensitive volulme.
+// If ix and or iz is outside of the segmentation range a value of -0.5*Dx()
+// and -0.5*Dx() or -0.5*Dz() and -0.5*Dz() are returned.
+    Int_t i,j;
+    const Float_t kconv = 1.0E-04; // converts microns to cm.
+    Float_t x,z;
+
+    xl = xu = x = -0.5*kconv*Dx(); // default value.
+    zl = zu = z = -0.5*kconv*Dz(); // default value.
+    if(ix<0 || ix>=Npx()) return; // outside of detector
+    if(iz<0 || iz>=Npz()) return; // outside of detctor
+    for(i=0;i<ix;i++) x += kconv*fCellSizeX[i]; // sum up to cell ix-1
+    xl = x;
+    x += kconv*fCellSizeX[ix];
+    xu = x;
+    for(j=0;j<iz;j++) z += kconv*fCellSizeZ[j]; // sum up cell iz-1
+    zl = z;
+    z += kconv*fCellSizeZ[iz];
+    zu = z;
+    return; // Found x and z, return.
+}