]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSsegmentationSPD.cxx
Added function CellBoundries to return the cell boundries.
[u/mrichter/AliRoot.git] / ITS / AliITSsegmentationSPD.cxx
index f052e30f1238fa1acac2494c3c01da27a76a8ff1..2d2fe58724131a4299c4162edb6296b1d7c83ade 100644 (file)
@@ -155,21 +155,21 @@ Float_t AliITSsegmentationSPD::ZFromCol(Int_t col) {
 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;
+       pitchz = 625.;
     } else if(col>=192){
-       pitchz = 0.0;
+       pitchz = 425.;
     }
     return pitchz;
 }
@@ -219,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;
 }
 //----------------------------------------------------------------------
@@ -442,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.
+}