* provided "as is" without express or implied warranty. *
**************************************************************************/
-#include <TMath.h>
-#include <TF1.h>
-
+/* $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)
+//_____________________________________________________________________________
+ AliITSsegmentationSPD::AliITSsegmentationSPD(Option_t *opt): AliITSsegmentation(),
+fNpx(0),
+fNpz(0){
+ // Default constructor
+
+ // Initialization to default values
+ Init();
-Float_t AliITSsegmentationSPD::ColFromZ300(Float_t z) {
+ // Initialization of detector dimensions from TGeo
+ if(strstr(opt,"TGeo")){
+ if(!gGeoManager){
+ AliError("Geometry is not initialized\n Using hardwired default values");
+ return;
+ }
+ TGeoVolume *v=NULL;
+ v = gGeoManager->GetVolume("ITSSPDlay1-sensor");
+ if(!v){
+ AliWarning("TGeo volume ITSSPDlay1-sensor not found (hint: use v11Hybrid geometry)\n Using hardwired default values");
+ }
+ else {
+ TGeoBBox *s=(TGeoBBox*)v->GetShape();
+ SetDetSize(s->GetDX()*20000.,s->GetDZ()*20000.,s->GetDY()*20000.);
+ }
+ }
+}
+
+//_____________________________________________________________________________
+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;
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;
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
Float_t s,col;
if(z<0||z>fDz){
- Error("ColFromZ","z=%f outside of range 0.0<=z<fDz=%f",z,fDz);
+ AliError(Form("z=%f outside of range 0.0<=z<fDz=%f",z,fDz));
return 0.0; // error
} // end if outsize of detector
s = 0.0;
}
//_____________________________________________________________________________
-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;
Float_t z;
if(col<0||col>=fNpz){
- Error("ZFromCol","col=%d outside of range 0<=col<fNpZ=%d",col,fNpz);
+ AliError(Form("col=%d outside of range 0<=col<fNpZ=%d",col,fNpz));
return 0.0; // error
} // end if outsize of detector
z = 0.0;
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.;
}
return pitchz;
}
-//______________________________________________________________________
-AliITSsegmentationSPD::AliITSsegmentationSPD(){
- // Default constructor
- fNpx = 0;
- fNpz = 0;
- fCorr=0;
- fGeom = 0;
-}
//______________________________________________________________________
-AliITSsegmentationSPD::AliITSsegmentationSPD(AliITSgeom *gm){
- // Constructor
- fCorr=0;
- fNpx = 0;
- fNpz = 0;
- Init();
- fGeom = gm;
-
+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=(AliITSsegmentationSPD &source){
+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),
+fNpx(0),
+fNpz(0){
// copy constructor
- *this = source;
+ source.Copy(*this);
}
//----------------------------------------------------------------------
void AliITSsegmentationSPD::SetBinSize(Float_t *x,Float_t *z){
//------------------------------
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.
-
- //const Float_t kconv=10000.;
- Int_t i;
- 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<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;
- for(i=0;i<fNpz;i++) fDz += fCellSizeZ[i];
- fDy = 300.0; //microns SPD sensitive layer thickness
- //printf(" AliITSsegmentationSPD - Init: fNpx fNpz fDx fDz %d %d %f %f\n",fNpx, fNpz, fDx, fDz);
+// 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;
+ SetNPads(256,160); // Number of Bins in x and z
+ for(i=000;i<256;i++) bx[i] = 50.0; // in x all are 50 microns.
+ for(i=000;i<160;i++) bz[i] = 425.0; // most are 425 microns except below
+ for(i=160;i<280;i++) bz[i] = 0.0; // Outside of detector.
+ bz[ 31] = bz[ 32] = 625.0; // first chip boundary
+ bz[ 63] = bz[ 64] = 625.0; // first chip boundary
+ bz[ 95] = bz[ 96] = 625.0; // first chip boundary
+ bz[127] = bz[128] = 625.0; // first chip boundary
+ bz[160] = 425.0; // Set so that there is no zero pixel size for fNz.
+ SetBinSize(bx,bz);
+ SetDetSize(12800,69600,200); // full lengths (x,z,y) in microns
}
//------------------------------
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)
//
}
//------------------------------
-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)
//
}
//------------------------------
-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
}
//------------------------------
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;
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.
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).
//______________________________________________________________________
void AliITSsegmentationSPD::CellBoundries(Int_t ix,Int_t iz,
Double_t &xl,Double_t &xu,
- Double_t &zl,Double_t &zu)
+ Double_t &zl,Double_t &zu) const
{
// Transformation from Detector cell coordiantes to Geant detector centerd
// local coordinates (cm).
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;
+}
+//----------------------------------------------------------------------