X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=ITS%2FAliITSsegmentationSPD.cxx;h=f1f1d2eb1ce59acac1e25569e813d78f2a975bf9;hb=69e406a75103fa07021c452da6ea770a8ed6b342;hp=69b0d4340ebf60a89182973348bb6a6d0383d2d6;hpb=b0f5e3fcf84ecedb50df35ebe629b44bafc15bc0;p=u%2Fmrichter%2FAliRoot.git diff --git a/ITS/AliITSsegmentationSPD.cxx b/ITS/AliITSsegmentationSPD.cxx index 69b0d4340eb..f1f1d2eb1ce 100644 --- a/ITS/AliITSsegmentationSPD.cxx +++ b/ITS/AliITSsegmentationSPD.cxx @@ -13,14 +13,28 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -#include - #include "AliITSsegmentationSPD.h" - +//#include "AliITSgeom.h" +////////////////////////////////////////////////////// +// Segmentation class for // +// pixels // +// // +////////////////////////////////////////////////////// ClassImp(AliITSsegmentationSPD) +//_____________________________________________________________________________ + AliITSsegmentationSPD::AliITSsegmentationSPD(): AliITSsegmentation(), +fNpx(0), +fNpz(0){ + // Default constructor + for(Int_t k=0; k<256; k++){ + fCellSizeX[k] = 0.; + fCellSizeZ[k] = 0.; + } +} -Float_t 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; @@ -29,7 +43,7 @@ Float_t ColFromZ300(Float_t z) { return col; } //_____________________________________________________________________________ -Float_t 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; @@ -38,17 +52,36 @@ Float_t ZFromCol300(Int_t col) { return z; } //_____________________________________________________________________________ -Float_t 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 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) 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 + // 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<=zs){ + 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) { @@ -79,14 +112,26 @@ Float_t ColFromZ(Float_t z) { } else if( z < 83600) { col = 161 + (z - 70425)/pitchz; } - return 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) const { + // 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=0 && col <= 30 ) { @@ -116,81 +161,94 @@ Float_t ZFromCol(Int_t col) { z = 69175 + (col -159 + 0.5)*pitchz; } else if( col >= 161 && col <= 191) { 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 pitchz = 425; - if( col >=32 && col <= 33 ) { - pitchz = 625; - } else if( col >= 64 && col <= 65) { - pitchz = 625; - } else if( col >= 96 && col <= 97) { - pitchz = 625; - } else if( col >= 128 && col <= 129) { - pitchz = 625; - } else if( col >= 160 && col <= 161) { - pitchz = 625; - } - return pitchz; +//______________________________________________________________________ +Float_t AliITSsegmentationSPD::ZpitchFromCol(Int_t col) const { + // Get pitch size in z direction for each colunm + + Float_t pitchz = 425.; + if(col < 0){ + pitchz = 0.0; + } else if(col >= 31 && col <= 32) { + pitchz = 625.; + } else if(col >= 63 && col <= 64) { + pitchz = 625.; + } else if(col >= 95 && col <= 96) { + pitchz = 625.; + } else if(col >= 127 && col <= 128) { + pitchz = 625.; + } else if(col >= 159 && col <= 160) { + pitchz = 625.; + } else if(col>=192){ + pitchz = 425.; + } + return pitchz; } - -AliITSsegmentationSPD::AliITSsegmentationSPD(){ - // Default constructor - fNpx = 0; - fNpz = 0; - fCorr=0; - fGeom = 0; - -} -//____________________________________________________________________________ -AliITSsegmentationSPD::AliITSsegmentationSPD(AliITSgeom *gm){ +//______________________________________________________________________ +AliITSsegmentationSPD::AliITSsegmentationSPD(AliITSgeom *gm): +fNpx(0), +fNpz(0){ // Constructor fCorr=0; - fNpx = 0; - fNpz = 0; Init(); fGeom = 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 - Int_t i; if(this==&source) return *this; - this->fNpx = source.fNpx; - this->fNpz = source.fNpz; - this->fDx = source.fDx; - this->fDy = source.fDy; - 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), +fNpx(0), +fNpz(0){ // copy constructor - *this = source; + source.Copy(*this); } -//------------------------------ +//---------------------------------------------------------------------- +void AliITSsegmentationSPD::SetBinSize(Float_t *x,Float_t *z){ + // Fills the array of pixel sizes in x, microns + // The input array x must have 256 elements. + Int_t i; + + for(i=0;i<256;i++) fCellSizeX[i] = x[i]; + for(i=0;i<280;i++) fCellSizeZ[i] = z[i]; + return; +} +//---------------------------------------------------------------------- void AliITSsegmentationSPD::Init300(){ // Initialize infromation for 6 read out chip 300X50 micron pixel SPD // detectors. This chip is 150 microns thick by 1.28 cm in x by 8.37 cm // long. It has 256 50 micron pixels in x and 279 300 micron size // pixels in z. - Int_t i; //const Float_t kconv=10000.; + Int_t i; 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=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); +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::GetCellIxz(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) // @@ -262,12 +313,9 @@ void AliITSsegmentationSPD::GetCellIxz(Float_t &x,Float_t &z,Int_t &ix,Int_t &iz // different segmentation on z iz = (Int_t)(ColFromZ(z) + 1); - x /= dpx; - z = ColFromZ(z); if (iz > fNpz) iz= fNpz; if (ix > fNpx) ix= fNpx; - /* if (iz < -fNpz) iz= -fNpz; if (ix < -fNpx) ix=-fNpx; @@ -275,7 +323,21 @@ void AliITSsegmentationSPD::GetCellIxz(Float_t &x,Float_t &z,Int_t &ix,Int_t &iz } //------------------------------ -void AliITSsegmentationSPD::GetCellCxz(Int_t ix,Int_t iz,Float_t &x,Float_t&z){ +void AliITSsegmentationSPD::GetPadTxz(Float_t &x,Float_t &z) const{ +// local transformation of real local coordinates (x,z) +// + + // expects x, z in microns + + // same segmentation on x + Float_t dpx=Dpx(0); + + x /= dpx; + z = ColFromZ(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 @@ -289,7 +351,7 @@ void AliITSsegmentationSPD::GetCellCxz(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; @@ -318,3 +380,113 @@ Neighbours(Int_t iX, Int_t iZ, Int_t* Nlist, Int_t Xlist[8], Int_t Zlist[8]){ Xlist[7]=iX+1; Zlist[7]=iZ-1; } +//______________________________________________________________________ +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=Npx()) return kFALSE; // outside x range. + for(j=0;j=Npz()) return kFALSE; // outside z range. + ix = i; + iz = j; + return kTRUE; // Found ix and iz, return. +} +//______________________________________________________________________ +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). +// Input: +// Int_t ix detector x cell coordinate. Has the range 0<=ix=Npx()) return; // outside of detector + if(iz<0 || iz>=Npz()) return; // outside of detctor + for(i=0;i=Npx()) return; // outside of detector + if(iz<0 || iz>=Npz()) return; // outside of detctor + for(i=0;i