]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSsegmentationSPD.cxx
Analysis using Stavinsky mixing method
[u/mrichter/AliRoot.git] / ITS / AliITSsegmentationSPD.cxx
index a302688accf6dc4acce761d46e832948775c5167..1fcf0a47c6cbb16d44185a5253863562e82979e0 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-#include <TMath.h>
-#include <TF1.h>
-
 #include "AliITSsegmentationSPD.h"
-#include "AliITSgeom.h"
-
+//#include "AliITSgeom.h"
+//////////////////////////////////////////////////////
+// Segmentation class for                           //
+// pixels                                           //
+//                                                  //
+//////////////////////////////////////////////////////
 ClassImp(AliITSsegmentationSPD)
 
+//_____________________________________________________________________________
+  AliITSsegmentationSPD::AliITSsegmentationSPD(): AliITSsegmentation(){
+  // Default constructor
+  fNpx = 0;
+  fNpz = 0;
+  for(Int_t k=0; k<256; k++){
+    fCellSizeX[k] = 0.;
+    fCellSizeZ[k] = 0.;
+  }
+}
 
-Float_t AliITSsegmentationSPD::ColFromZ300(Float_t z) {
+//_____________________________________________________________________________
+Float_t AliITSsegmentationSPD::ColFromZ300(Float_t z) const {
 // 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 +43,7 @@ Float_t AliITSsegmentationSPD::ColFromZ300(Float_t z) {
      return col;
 }
 //_____________________________________________________________________________
-Float_t AliITSsegmentationSPD::ZFromCol300(Int_t col) {
+Float_t AliITSsegmentationSPD::ZFromCol300(Int_t col) const {
 // same comments as above
 // Get z-coordinate for each colunm number
   Float_t pitchz = 300.0;
@@ -40,12 +52,14 @@ Float_t AliITSsegmentationSPD::ZFromCol300(Int_t col) {
   return z;
 }
 //_____________________________________________________________________________
-Float_t AliITSsegmentationSPD::ZpitchFromCol300(Int_t col) {
+Float_t AliITSsegmentationSPD::ZpitchFromCol300(Int_t col) const {
   // returns Z pixel pitch for 300 micron pixels.
-  return 300.0;
+
+    col = 0; // done to remove unused variable warning.
+    return 300.0;
 }
 //_____________________________________________________________________________
-Float_t AliITSsegmentationSPD::ColFromZ(Float_t z) {
+Float_t AliITSsegmentationSPD::ColFromZ(Float_t z) const {
     // 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 
@@ -102,7 +116,7 @@ Float_t AliITSsegmentationSPD::ColFromZ(Float_t z) {
 }
 
 //_____________________________________________________________________________
-Float_t AliITSsegmentationSPD::ZFromCol(Int_t col) {
+Float_t AliITSsegmentationSPD::ZFromCol(Int_t col) const {
     // same comments as above
     // Get z-coordinate for each colunm number
     Int_t i;
@@ -152,37 +166,28 @@ Float_t AliITSsegmentationSPD::ZFromCol(Int_t col) {
   return z;*/
 }
 //______________________________________________________________________
-Float_t AliITSsegmentationSPD::ZpitchFromCol(Int_t col) {
+Float_t AliITSsegmentationSPD::ZpitchFromCol(Int_t col) const {
     // 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;
 }
 //______________________________________________________________________
-AliITSsegmentationSPD::AliITSsegmentationSPD(){
-  // Default constructor
-   fNpx = 0;
-   fNpz = 0;
-   fCorr=0;
-   fGeom = 0;
-
-}
-//______________________________________________________________________
 AliITSsegmentationSPD::AliITSsegmentationSPD(AliITSgeom *gm){
   // Constructor
    fCorr=0;
@@ -193,24 +198,30 @@ AliITSsegmentationSPD::AliITSsegmentationSPD(AliITSgeom *gm){
 
 }
 //______________________________________________________________________
-AliITSsegmentationSPD& AliITSsegmentationSPD::operator=(AliITSsegmentationSPD &source){
+void AliITSsegmentationSPD::Copy(TObject &obj) const {
+  // protected method. copy this to obj
+  AliITSsegmentation::Copy(obj);
+  ((AliITSsegmentationSPD& ) obj).fNpx  = fNpx;
+  ((AliITSsegmentationSPD& ) obj).fNpz  = fNpz;
+  Int_t i;
+  for(i=0;i<256;i++) 
+         ((AliITSsegmentationSPD& ) obj).fCellSizeX[i] = fCellSizeX[i];
+  for(i=0;i<280;i++) 
+         ((AliITSsegmentationSPD& ) obj).fCellSizeZ[i] = fCellSizeZ[i];
+}
+
+//______________________________________________________________________
+AliITSsegmentationSPD& AliITSsegmentationSPD::operator=(const AliITSsegmentationSPD &source){
    // = operator
    if(this==&source) return *this;
-   this->fNpx  = source.fNpx;
-   this->fNpz  = source.fNpz;
-   this->fDx   = source.fDx;
-   this->fDy   = source.fDy;
-   Int_t i;
-   for(i=0;i<256;i++) this->fCellSizeX[i] = source.fCellSizeX[i];
-   for(i=0;i<280;i++) this->fCellSizeZ[i] = source.fCellSizeZ[i];
-   this->fCorr = new TF1(*(source.fCorr));// make a proper copy of the function
-   this->fGeom = source.fGeom; // copy only the pointers.
+   source.Copy(*this);
    return *this;
 }
 //____________________________________________________________________________
-AliITSsegmentationSPD::AliITSsegmentationSPD(AliITSsegmentationSPD &source){
+AliITSsegmentationSPD::AliITSsegmentationSPD(const AliITSsegmentationSPD &source) :
+    AliITSsegmentation(source){
   // copy constructor
-   *this = source;
+  source.Copy(*this);
 }
 //----------------------------------------------------------------------
 void AliITSsegmentationSPD::SetBinSize(Float_t *x,Float_t *z){
@@ -274,30 +285,21 @@ void AliITSsegmentationSPD::SetNPads(Int_t p1, Int_t p2){
     fNpz=p2;
 
 }
-//------------------------------
-void AliITSsegmentationSPD::SetDetSize(Float_t p1, Float_t p2, Float_t p3){
-  // for SPD this function should be used ONLY when a beam test setup 
-  // configuration is studied
 
-    fDx=p1;
-    fDz=p2;
-    fDy=p3;
-
-}
 //------------------------------
-Float_t AliITSsegmentationSPD::Dpx(Int_t i){
+Float_t AliITSsegmentationSPD::Dpx(Int_t i) const {
     //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){
+Float_t AliITSsegmentationSPD::Dpz(Int_t i) const {
     // 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){
+void AliITSsegmentationSPD::GetPadIxz(Float_t x,Float_t z,Int_t &ix,Int_t &iz) const {
 //  Returns pixel coordinates (ix,iz) for given real local coordinates (x,z)
 //
 
@@ -319,7 +321,7 @@ void AliITSsegmentationSPD::GetPadIxz(Float_t x,Float_t z,Int_t &ix,Int_t &iz){
 }
 
 //------------------------------
-void AliITSsegmentationSPD::GetPadTxz(Float_t &x,Float_t &z){
+void AliITSsegmentationSPD::GetPadTxz(Float_t &x,Float_t &z) const{
 //  local transformation of real local coordinates (x,z)
 //
 
@@ -333,7 +335,7 @@ void AliITSsegmentationSPD::GetPadTxz(Float_t &x,Float_t &z){
 
 }
 //------------------------------
-void AliITSsegmentationSPD::GetPadCxz(Int_t ix,Int_t iz,Float_t &x,Float_t&z){
+void AliITSsegmentationSPD::GetPadCxz(Int_t ix,Int_t iz,Float_t &x,Float_t&z) const {
     // Transform from pixel to real local coordinates
 
     // returns x, z in microns
@@ -347,7 +349,7 @@ void AliITSsegmentationSPD::GetPadCxz(Int_t ix,Int_t iz,Float_t &x,Float_t&z){
 }
 //------------------------------
 void AliITSsegmentationSPD::
-Neighbours(Int_t iX, Int_t iZ, Int_t* Nlist, Int_t Xlist[8], Int_t Zlist[8]){
+Neighbours(Int_t iX, Int_t iZ, Int_t* Nlist, Int_t Xlist[8], Int_t Zlist[8]) const {
   // returns the neighbouring pixels for use in Cluster Finders and the like.
   /*
     *Nlist=4;Xlist[0]=Xlist[1]=iX;Xlist[2]=iX-1;Xlist[3]=iX+1;
@@ -377,19 +379,24 @@ Neighbours(Int_t iX, Int_t iZ, Int_t* Nlist, Int_t Xlist[8], Int_t Zlist[8]){
     Zlist[7]=iZ-1;
 }
 //______________________________________________________________________
-void AliITSsegmentationSPD::LocalToDet(Float_t x,Float_t z,Int_t &ix,Int_t &iz){
-// Transformation from Geant detector centered local coordinates (cm) to
-// Pixel cell numbers ix and iz.
-// Input:
-// Float_t   x        detector local coordinate x in cm with respect to the
-//                    center of the sensitive volume.
-// Float_t   z        detector local coordinate z in cm with respect to the
-//                    center of the sensitive volulme.
-// Output:
-// 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.
-//   A value of -1 for ix or iz indecates that this point is outside of the
-// detector segmentation as defined.
+Bool_t AliITSsegmentationSPD::LocalToDet(Float_t x,Float_t z,
+                                         Int_t &ix,Int_t &iz) const {
+    // Transformation from Geant detector centered local coordinates (cm) to
+    // Pixel cell numbers ix and iz.
+    // Input:
+    //    Float_t   x        detector local coordinate x in cm with respect to
+    //                       the center of the sensitive volume.
+    //    Float_t   z        detector local coordinate z in cm with respect to
+    //                       the center of the sensitive volulme.
+    // Output:
+    //    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.
+    // Return:
+    //   kTRUE if point x,z is inside sensitive volume, kFALSE otherwise.
+    //   A value of -1 for ix or iz indecates that this point is outside of the
+    //   detector segmentation as defined.
     Int_t i,j;
     Float_t dx,dz;
     const Float_t kconv = 1.0E-04; // converts microns to cm.
@@ -398,24 +405,24 @@ void AliITSsegmentationSPD::LocalToDet(Float_t x,Float_t z,Int_t &ix,Int_t &iz){
     dz = -0.5*kconv*Dz();
     ix = -1;
     iz = -1;
-    if(x<dx) return; // outside x range.
-    if(z<dz) return; // outside z range.
+    if(x<dx) return kFALSE; // outside x range.
+    if(z<dz) return kFALSE; // outside z range.
     for(i=0;i<Npx();i++){
        dx += kconv*fCellSizeX[i];
        if(x<dx) break;
     } // end for i
-    if(i>=Npx()) return; // outside x range.
+    if(i>=Npx()) return kFALSE; // outside x range.
     for(j=0;j<Npz();j++){
        dz += kconv*fCellSizeZ[j];
        if(z<dz) break;
     } // end for j
-    if(j>=Npz()) return; // outside z range.
+    if(j>=Npz()) return kFALSE; // outside z range.
     ix = i;
     iz = j;
-    return; // Found ix and iz, return.
+    return kTRUE; // Found ix and iz, return.
 }
 //______________________________________________________________________
-void AliITSsegmentationSPD::DetToLocal(Int_t ix,Int_t iz,Float_t &x,Float_t &z)
+void AliITSsegmentationSPD::DetToLocal(Int_t ix,Int_t iz,Float_t &x,Float_t &z) const
 {
 // Transformation from Detector cell coordiantes to Geant detector centerd 
 // local coordinates (cm).
@@ -442,3 +449,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) const
+{
+// 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.
+}