1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
19 #include "AliITSsegmentationSPD.h"
20 #include "AliITSgeom.h"
22 ClassImp(AliITSsegmentationSPD)
25 Float_t AliITSsegmentationSPD::ColFromZ300(Float_t z) {
26 // Get column number for each z-coordinate taking into account the
27 // extra pixels in z direction assuming 300 micron sized pixels.
29 Float_t pitchz = 300.0;
30 col = Float_t (z/pitchz);
33 //_____________________________________________________________________________
34 Float_t AliITSsegmentationSPD::ZFromCol300(Int_t col) {
35 // same comments as above
36 // Get z-coordinate for each colunm number
37 Float_t pitchz = 300.0;
42 //_____________________________________________________________________________
43 Float_t AliITSsegmentationSPD::ZpitchFromCol300(Int_t col) {
44 // returns Z pixel pitch for 300 micron pixels.
46 col = 0; // done to remove unused variable warning.
49 //_____________________________________________________________________________
50 Float_t AliITSsegmentationSPD::ColFromZ(Float_t z) {
51 // hard-wired - keep it like this till we can parametrise
52 // and get rid of AliITSgeomSPD425
53 // Get column number for each z-coordinate taking into account the
54 // extra pixels in z direction
59 Error("ColFromZ","z=%f outside of range 0.0<=z<fDz=%f",z,fDz);
61 } // end if outsize of detector
69 col = (Float_t) i + (z-s)/fCellSizeZ[i];
76 col = Float_t(z/pitchz);
77 } else if( z < 14425) {
79 col = 31 + (z - 13175)/pitchz;
80 } else if( z < 27175) {
81 col = 33 + (z - 14425)/pitchz;
82 } else if( z < 28425) {
84 col = 63 + (z - 27175)/pitchz;
85 } else if( z < 41175) {
86 col = 65 + (z - 28425)/pitchz;
87 } else if( z < 42425) {
89 col = 95 + (z - 41175)/pitchz;
90 } else if( z < 55175) {
91 col = 97 + (z - 42425)/pitchz;
92 } else if( z < 56425) {
94 col = 127 + (z - 55175)/pitchz;
95 } else if( z < 69175) {
96 col = 129 + (z - 56425)/pitchz;
97 } else if( z < 70425) {
99 col = 159 + (z - 69175)/pitchz;
100 } else if( z < 83600) {
101 col = 161 + (z - 70425)/pitchz;
103 return TMath::Abs(col);*/
106 //_____________________________________________________________________________
107 Float_t AliITSsegmentationSPD::ZFromCol(Int_t col) {
108 // same comments as above
109 // Get z-coordinate for each colunm number
113 if(col<0||col>=fNpz){
114 Error("ZFromCol","col=%d outside of range 0<=col<fNpZ=%d",col,fNpz);
116 } // end if outsize of detector
118 for(i=0;i<col;i++) z += fCellSizeZ[i];
119 z += 0.5*fCellSizeZ[col];
123 Float_t pitchz = 425;
125 if( col >=0 && col <= 30 ) {
126 z = (col + 0.5)*pitchz;
127 } else if( col >= 31 && col <= 32) {
129 z = 13175 + (col -31 + 0.5)*pitchz;
130 } else if( col >= 33 && col <= 62) {
131 z = 14425 + (col -33 + 0.5)*pitchz;
132 } else if( col >= 63 && col <= 64) {
134 z = 27175 + (col -63 + 0.5)*pitchz;
135 } else if( col >= 65 && col <= 94) {
136 z = 28425 + (col -65 + 0.5)*pitchz;
137 } else if( col >= 95 && col <= 96) {
139 z = 41175 + (col -95 + 0.5)*pitchz;
140 } else if( col >= 97 && col <= 126) {
141 z = 42425 + (col -97 + 0.5)*pitchz;
142 } else if( col >= 127 && col <= 128) {
144 z = 55175 + (col -127 + 0.5)*pitchz;
145 } else if( col >= 129 && col <= 158) {
146 z = 56425 + (col -129 + 0.5)*pitchz;
147 } else if( col >= 159 && col <= 160) {
149 z = 69175 + (col -159 + 0.5)*pitchz;
150 } else if( col >= 161 && col <= 191) {
151 z = 70425 + (col -161 + 0.5)*pitchz;
156 //______________________________________________________________________
157 Float_t AliITSsegmentationSPD::ZpitchFromCol(Int_t col) {
158 // Get pitch size in z direction for each colunm
160 Float_t pitchz = 425.;
163 } else if(col >= 31 && col <= 32) {
165 } else if(col >= 63 && col <= 64) {
167 } else if(col >= 95 && col <= 96) {
169 } else if(col >= 127 && col <= 128) {
171 } else if(col >= 159 && col <= 160) {
178 //______________________________________________________________________
179 AliITSsegmentationSPD::AliITSsegmentationSPD(){
180 // Default constructor
187 //______________________________________________________________________
188 AliITSsegmentationSPD::AliITSsegmentationSPD(AliITSgeom *gm){
197 //______________________________________________________________________
198 AliITSsegmentationSPD& AliITSsegmentationSPD::operator=(AliITSsegmentationSPD &source){
200 if(this==&source) return *this;
201 this->fNpx = source.fNpx;
202 this->fNpz = source.fNpz;
203 this->fDx = source.fDx;
204 this->fDy = source.fDy;
206 for(i=0;i<256;i++) this->fCellSizeX[i] = source.fCellSizeX[i];
207 for(i=0;i<280;i++) this->fCellSizeZ[i] = source.fCellSizeZ[i];
208 this->fCorr = new TF1(*(source.fCorr));// make a proper copy of the function
209 this->fGeom = source.fGeom; // copy only the pointers.
212 //____________________________________________________________________________
213 AliITSsegmentationSPD::AliITSsegmentationSPD(AliITSsegmentationSPD &source) :
214 AliITSsegmentation(source){
218 //----------------------------------------------------------------------
219 void AliITSsegmentationSPD::SetBinSize(Float_t *x,Float_t *z){
220 // Fills the array of pixel sizes in x, microns
221 // The input array x must have 256 elements.
224 for(i=0;i<256;i++) fCellSizeX[i] = x[i];
225 for(i=0;i<280;i++) fCellSizeZ[i] = z[i];
228 //----------------------------------------------------------------------
229 void AliITSsegmentationSPD::Init300(){
230 // Initialize infromation for 6 read out chip 300X50 micron pixel SPD
231 // detectors. This chip is 150 microns thick by 1.28 cm in x by 8.37 cm
232 // long. It has 256 50 micron pixels in x and 279 300 micron size
235 //const Float_t kconv=10000.;
237 fNpx = 256; // The number of X pixel Cell same as in fCellSizeX array size
238 fNpz = 279; // The number of Z pixel Cell same as in fCellSizeZ array size
239 for(i=0;i<fNpx;i++) fCellSizeX[i] = 50.0; // microns all the same
240 for(i=0;i<280;i++) fCellSizeZ[i] = ZpitchFromCol300(i); // microns
241 // for(i=fNpz;i<280;i++) fCellSizeZ[i] = 0.0; // zero out rest of array
243 for(i=0;i<fNpx;i++) fDx += fCellSizeX[i];
245 for(i=0;i<fNpz;i++) fDz += fCellSizeZ[i];
246 fDy = 300.0; //microns SPD sensitive layer thickness
249 //------------------------------
250 void AliITSsegmentationSPD::Init(){
251 // Initialize infromation for 6 read out chip 425X50 micron pixel SPD
252 // detectors. This chip is 150 microns thick by 1.28 cm in x by 8.375 cm
253 // long. It has 256 50 micron pixels in x and 197 mostly 425 micron size
254 // pixels in z. The two pixels between each readout chip are 625 microns long.
256 //const Float_t kconv=10000.;
258 fNpx = 256; // The number of X pixel Cell same as in fCellSizeX array size
259 fNpz = 192; // The number of Z pixel Cell same as in fCellSizeZ array size
260 for(i=0;i<fNpx;i++) fCellSizeX[i] = 50.0; // microns all the same
261 for(i=0;i<280;i++) fCellSizeZ[i] = ZpitchFromCol(i); // microns
262 // for(i=fNpz;i<280;i++) fCellSizeZ[i] = 0.0; // zero out rest of array
264 for(i=0;i<fNpx;i++) fDx += fCellSizeX[i];
266 for(i=0;i<fNpz;i++) fDz += fCellSizeZ[i];
267 fDy = 300.0; //microns SPD sensitive layer thickness
268 //printf(" AliITSsegmentationSPD - Init: fNpx fNpz fDx fDz %d %d %f %f\n",fNpx, fNpz, fDx, fDz);
271 //------------------------------
272 void AliITSsegmentationSPD::SetNPads(Int_t p1, Int_t p2){
273 // for SPD this function should be used ONLY when a beam test setup
274 // configuration is studied
280 //------------------------------
281 void AliITSsegmentationSPD::SetDetSize(Float_t p1, Float_t p2, Float_t p3){
282 // for SPD this function should be used ONLY when a beam test setup
283 // configuration is studied
290 //------------------------------
291 Float_t AliITSsegmentationSPD::Dpx(Int_t i){
292 //returs x pixel pitch for a give pixel
293 if(i<0||i>=256) return 0.0;
294 return fCellSizeX[i];
296 //------------------------------
297 Float_t AliITSsegmentationSPD::Dpz(Int_t i){
298 // returns z pixel pitch for a give pixel
299 if(i<0||i>=280) return 0.0;
300 return fCellSizeZ[i];
302 //------------------------------
303 void AliITSsegmentationSPD::GetPadIxz(Float_t x,Float_t z,Int_t &ix,Int_t &iz){
304 // Returns pixel coordinates (ix,iz) for given real local coordinates (x,z)
307 // expects x, z in microns
309 // same segmentation on x
311 ix = (Int_t)(x/dpx + 1);
312 // different segmentation on z
313 iz = (Int_t)(ColFromZ(z) + 1);
316 if (iz > fNpz) iz= fNpz;
317 if (ix > fNpx) ix= fNpx;
319 if (iz < -fNpz) iz= -fNpz;
320 if (ix < -fNpx) ix=-fNpx;
324 //------------------------------
325 void AliITSsegmentationSPD::GetPadTxz(Float_t &x,Float_t &z){
326 // local transformation of real local coordinates (x,z)
329 // expects x, z in microns
331 // same segmentation on x
338 //------------------------------
339 void AliITSsegmentationSPD::GetPadCxz(Int_t ix,Int_t iz,Float_t &x,Float_t&z){
340 // Transform from pixel to real local coordinates
342 // returns x, z in microns
346 x = (ix>0) ? Float_t(ix*dpx)-dpx/2. : Float_t(ix*dpx)+dpx/2.;
351 //------------------------------
352 void AliITSsegmentationSPD::
353 Neighbours(Int_t iX, Int_t iZ, Int_t* Nlist, Int_t Xlist[8], Int_t Zlist[8]){
354 // returns the neighbouring pixels for use in Cluster Finders and the like.
356 *Nlist=4;Xlist[0]=Xlist[1]=iX;Xlist[2]=iX-1;Xlist[3]=iX+1;
357 Zlist[0]=iZ-1;Zlist[1]=iZ+1;Zlist[2]=Zlist[3]=iZ;
362 Xlist[0]=Xlist[1]=iX;
367 Zlist[2]=Zlist[3]=iZ;
382 //______________________________________________________________________
383 void AliITSsegmentationSPD::LocalToDet(Float_t x,Float_t z,Int_t &ix,Int_t &iz){
384 // Transformation from Geant detector centered local coordinates (cm) to
385 // Pixel cell numbers ix and iz.
387 // Float_t x detector local coordinate x in cm with respect to the
388 // center of the sensitive volume.
389 // Float_t z detector local coordinate z in cm with respect to the
390 // center of the sensitive volulme.
392 // Int_t ix detector x cell coordinate. Has the range 0<=ix<fNpx.
393 // Int_t iz detector z cell coordinate. Has the range 0<=iz<fNpz.
394 // A value of -1 for ix or iz indecates that this point is outside of the
395 // detector segmentation as defined.
398 const Float_t kconv = 1.0E-04; // converts microns to cm.
400 dx = -0.5*kconv*Dx();
401 dz = -0.5*kconv*Dz();
404 if(x<dx) return; // outside x range.
405 if(z<dz) return; // outside z range.
406 for(i=0;i<Npx();i++){
407 dx += kconv*fCellSizeX[i];
410 if(i>=Npx()) return; // outside x range.
411 for(j=0;j<Npz();j++){
412 dz += kconv*fCellSizeZ[j];
415 if(j>=Npz()) return; // outside z range.
418 return; // Found ix and iz, return.
420 //______________________________________________________________________
421 void AliITSsegmentationSPD::DetToLocal(Int_t ix,Int_t iz,Float_t &x,Float_t &z)
423 // Transformation from Detector cell coordiantes to Geant detector centerd
424 // local coordinates (cm).
426 // Int_t ix detector x cell coordinate. Has the range 0<=ix<fNpx.
427 // Int_t iz detector z cell coordinate. Has the range 0<=iz<fNpz.
429 // Float_t x detector local coordinate x in cm with respect to the
430 // center of the sensitive volume.
431 // Float_t z detector local coordinate z in cm with respect to the
432 // center of the sensitive volulme.
433 // If ix and or iz is outside of the segmentation range a value of -0.5*Dx()
434 // or -0.5*Dz() is returned.
436 const Float_t kconv = 1.0E-04; // converts microns to cm.
438 x = -0.5*kconv*Dx(); // default value.
439 z = -0.5*kconv*Dz(); // default value.
440 if(ix<0 || ix>=Npx()) return; // outside of detector
441 if(iz<0 || iz>=Npz()) return; // outside of detctor
442 for(i=0;i<ix;i++) x += kconv*fCellSizeX[i]; // sum up to cell ix-1
443 x += 0.5*kconv*fCellSizeX[ix]; // add 1/2 of cell ix for center location.
444 for(j=0;j<iz;j++) z += kconv*fCellSizeZ[j]; // sum up cell iz-1
445 z += 0.5*kconv*fCellSizeZ[iz]; // add 1/2 of cell iz for center location.
446 return; // Found x and z, return.
448 //______________________________________________________________________
449 void AliITSsegmentationSPD::CellBoundries(Int_t ix,Int_t iz,
450 Double_t &xl,Double_t &xu,
451 Double_t &zl,Double_t &zu)
453 // Transformation from Detector cell coordiantes to Geant detector centerd
454 // local coordinates (cm).
456 // Int_t ix detector x cell coordinate. Has the range 0<=ix<fNpx.
457 // Int_t iz detector z cell coordinate. Has the range 0<=iz<fNpz.
459 // Double_t xl detector local coordinate cell lower bounds x in cm
460 // with respect to the center of the sensitive volume.
461 // Double_t xu detector local coordinate cell upper bounds x in cm
462 // with respect to the center of the sensitive volume.
463 // Double_t zl detector local coordinate lower bounds z in cm with
464 // respect to the center of the sensitive volulme.
465 // Double_t zu detector local coordinate upper bounds z in cm with
466 // respect to the center of the sensitive volulme.
467 // If ix and or iz is outside of the segmentation range a value of -0.5*Dx()
468 // and -0.5*Dx() or -0.5*Dz() and -0.5*Dz() are returned.
470 const Float_t kconv = 1.0E-04; // converts microns to cm.
473 xl = xu = x = -0.5*kconv*Dx(); // default value.
474 zl = zu = z = -0.5*kconv*Dz(); // default value.
475 if(ix<0 || ix>=Npx()) return; // outside of detector
476 if(iz<0 || iz>=Npz()) return; // outside of detctor
477 for(i=0;i<ix;i++) x += kconv*fCellSizeX[i]; // sum up to cell ix-1
479 x += kconv*fCellSizeX[ix];
481 for(j=0;j<iz;j++) z += kconv*fCellSizeZ[j]; // sum up cell iz-1
483 z += kconv*fCellSizeZ[iz];
485 return; // Found x and z, return.