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.
47 //_____________________________________________________________________________
48 Float_t AliITSsegmentationSPD::ColFromZ(Float_t z) {
49 // hard-wired - keep it like this till we can parametrise
50 // and get rid of AliITSgeomSPD425
51 // Get column number for each z-coordinate taking into account the
52 // extra pixels in z direction
57 Error("ColFromZ","z=%f outside of range 0.0<=z<fDz=%f",z,fDz);
59 } // end if outsize of detector
67 col = (Float_t) i + (z-s)/fCellSizeZ[i];
74 col = Float_t(z/pitchz);
75 } else if( z < 14425) {
77 col = 31 + (z - 13175)/pitchz;
78 } else if( z < 27175) {
79 col = 33 + (z - 14425)/pitchz;
80 } else if( z < 28425) {
82 col = 63 + (z - 27175)/pitchz;
83 } else if( z < 41175) {
84 col = 65 + (z - 28425)/pitchz;
85 } else if( z < 42425) {
87 col = 95 + (z - 41175)/pitchz;
88 } else if( z < 55175) {
89 col = 97 + (z - 42425)/pitchz;
90 } else if( z < 56425) {
92 col = 127 + (z - 55175)/pitchz;
93 } else if( z < 69175) {
94 col = 129 + (z - 56425)/pitchz;
95 } else if( z < 70425) {
97 col = 159 + (z - 69175)/pitchz;
98 } else if( z < 83600) {
99 col = 161 + (z - 70425)/pitchz;
101 return TMath::Abs(col);*/
104 //_____________________________________________________________________________
105 Float_t AliITSsegmentationSPD::ZFromCol(Int_t col) {
106 // same comments as above
107 // Get z-coordinate for each colunm number
111 if(col<0||col>=fNpz){
112 Error("ZFromCol","col=%d outside of range 0<=col<fNpZ=%d",col,fNpz);
114 } // end if outsize of detector
116 for(i=0;i<col;i++) z += fCellSizeZ[i];
117 z += 0.5*fCellSizeZ[col];
121 Float_t pitchz = 425;
123 if( col >=0 && col <= 30 ) {
124 z = (col + 0.5)*pitchz;
125 } else if( col >= 31 && col <= 32) {
127 z = 13175 + (col -31 + 0.5)*pitchz;
128 } else if( col >= 33 && col <= 62) {
129 z = 14425 + (col -33 + 0.5)*pitchz;
130 } else if( col >= 63 && col <= 64) {
132 z = 27175 + (col -63 + 0.5)*pitchz;
133 } else if( col >= 65 && col <= 94) {
134 z = 28425 + (col -65 + 0.5)*pitchz;
135 } else if( col >= 95 && col <= 96) {
137 z = 41175 + (col -95 + 0.5)*pitchz;
138 } else if( col >= 97 && col <= 126) {
139 z = 42425 + (col -97 + 0.5)*pitchz;
140 } else if( col >= 127 && col <= 128) {
142 z = 55175 + (col -127 + 0.5)*pitchz;
143 } else if( col >= 129 && col <= 158) {
144 z = 56425 + (col -129 + 0.5)*pitchz;
145 } else if( col >= 159 && col <= 160) {
147 z = 69175 + (col -159 + 0.5)*pitchz;
148 } else if( col >= 161 && col <= 191) {
149 z = 70425 + (col -161 + 0.5)*pitchz;
154 //______________________________________________________________________
155 Float_t AliITSsegmentationSPD::ZpitchFromCol(Int_t col) {
156 // Get pitch size in z direction for each colunm
158 Float_t pitchz = 425.;
161 } else if(col >= 31 && col <= 32) {
163 } else if(col >= 63 && col <= 64) {
165 } else if(col >= 95 && col <= 96) {
167 } else if(col >= 127 && col <= 128) {
169 } else if(col >= 159 && col <= 160) {
176 //______________________________________________________________________
177 AliITSsegmentationSPD::AliITSsegmentationSPD(){
178 // Default constructor
185 //______________________________________________________________________
186 AliITSsegmentationSPD::AliITSsegmentationSPD(AliITSgeom *gm){
195 //______________________________________________________________________
196 AliITSsegmentationSPD& AliITSsegmentationSPD::operator=(AliITSsegmentationSPD &source){
198 if(this==&source) return *this;
199 this->fNpx = source.fNpx;
200 this->fNpz = source.fNpz;
201 this->fDx = source.fDx;
202 this->fDy = source.fDy;
204 for(i=0;i<256;i++) this->fCellSizeX[i] = source.fCellSizeX[i];
205 for(i=0;i<280;i++) this->fCellSizeZ[i] = source.fCellSizeZ[i];
206 this->fCorr = new TF1(*(source.fCorr));// make a proper copy of the function
207 this->fGeom = source.fGeom; // copy only the pointers.
210 //____________________________________________________________________________
211 AliITSsegmentationSPD::AliITSsegmentationSPD(AliITSsegmentationSPD &source){
215 //----------------------------------------------------------------------
216 void AliITSsegmentationSPD::SetBinSize(Float_t *x,Float_t *z){
217 // Fills the array of pixel sizes in x, microns
218 // The input array x must have 256 elements.
221 for(i=0;i<256;i++) fCellSizeX[i] = x[i];
222 for(i=0;i<280;i++) fCellSizeZ[i] = z[i];
225 //----------------------------------------------------------------------
226 void AliITSsegmentationSPD::Init300(){
227 // Initialize infromation for 6 read out chip 300X50 micron pixel SPD
228 // detectors. This chip is 150 microns thick by 1.28 cm in x by 8.37 cm
229 // long. It has 256 50 micron pixels in x and 279 300 micron size
232 //const Float_t kconv=10000.;
234 fNpx = 256; // The number of X pixel Cell same as in fCellSizeX array size
235 fNpz = 279; // The number of Z pixel Cell same as in fCellSizeZ array size
236 for(i=0;i<fNpx;i++) fCellSizeX[i] = 50.0; // microns all the same
237 for(i=0;i<280;i++) fCellSizeZ[i] = ZpitchFromCol300(i); // microns
238 // for(i=fNpz;i<280;i++) fCellSizeZ[i] = 0.0; // zero out rest of array
240 for(i=0;i<fNpx;i++) fDx += fCellSizeX[i];
242 for(i=0;i<fNpz;i++) fDz += fCellSizeZ[i];
243 fDy = 300.0; //microns SPD sensitive layer thickness
246 //------------------------------
247 void AliITSsegmentationSPD::Init(){
248 // Initialize infromation for 6 read out chip 425X50 micron pixel SPD
249 // detectors. This chip is 150 microns thick by 1.28 cm in x by 8.375 cm
250 // long. It has 256 50 micron pixels in x and 197 mostly 425 micron size
251 // pixels in z. The two pixels between each readout chip are 625 microns long.
253 //const Float_t kconv=10000.;
255 fNpx = 256; // The number of X pixel Cell same as in fCellSizeX array size
256 fNpz = 192; // The number of Z pixel Cell same as in fCellSizeZ array size
257 for(i=0;i<fNpx;i++) fCellSizeX[i] = 50.0; // microns all the same
258 for(i=0;i<280;i++) fCellSizeZ[i] = ZpitchFromCol(i); // microns
259 // for(i=fNpz;i<280;i++) fCellSizeZ[i] = 0.0; // zero out rest of array
261 for(i=0;i<fNpx;i++) fDx += fCellSizeX[i];
263 for(i=0;i<fNpz;i++) fDz += fCellSizeZ[i];
264 fDy = 300.0; //microns SPD sensitive layer thickness
265 //printf(" AliITSsegmentationSPD - Init: fNpx fNpz fDx fDz %d %d %f %f\n",fNpx, fNpz, fDx, fDz);
268 //------------------------------
269 void AliITSsegmentationSPD::SetNPads(Int_t p1, Int_t p2){
270 // for SPD this function should be used ONLY when a beam test setup
271 // configuration is studied
277 //------------------------------
278 void AliITSsegmentationSPD::SetDetSize(Float_t p1, Float_t p2, Float_t p3){
279 // for SPD this function should be used ONLY when a beam test setup
280 // configuration is studied
287 //------------------------------
288 Float_t AliITSsegmentationSPD::Dpx(Int_t i){
289 //returs x pixel pitch for a give pixel
290 if(i<0||i>=256) return 0.0;
291 return fCellSizeX[i];
293 //------------------------------
294 Float_t AliITSsegmentationSPD::Dpz(Int_t i){
295 // returns z pixel pitch for a give pixel
296 if(i<0||i>=280) return 0.0;
297 return fCellSizeZ[i];
299 //------------------------------
300 void AliITSsegmentationSPD::GetPadIxz(Float_t x,Float_t z,Int_t &ix,Int_t &iz){
301 // Returns pixel coordinates (ix,iz) for given real local coordinates (x,z)
304 // expects x, z in microns
306 // same segmentation on x
308 ix = (Int_t)(x/dpx + 1);
309 // different segmentation on z
310 iz = (Int_t)(ColFromZ(z) + 1);
313 if (iz > fNpz) iz= fNpz;
314 if (ix > fNpx) ix= fNpx;
316 if (iz < -fNpz) iz= -fNpz;
317 if (ix < -fNpx) ix=-fNpx;
321 //------------------------------
322 void AliITSsegmentationSPD::GetPadTxz(Float_t &x,Float_t &z){
323 // local transformation of real local coordinates (x,z)
326 // expects x, z in microns
328 // same segmentation on x
335 //------------------------------
336 void AliITSsegmentationSPD::GetPadCxz(Int_t ix,Int_t iz,Float_t &x,Float_t&z){
337 // Transform from pixel to real local coordinates
339 // returns x, z in microns
343 x = (ix>0) ? Float_t(ix*dpx)-dpx/2. : Float_t(ix*dpx)+dpx/2.;
348 //------------------------------
349 void AliITSsegmentationSPD::
350 Neighbours(Int_t iX, Int_t iZ, Int_t* Nlist, Int_t Xlist[8], Int_t Zlist[8]){
351 // returns the neighbouring pixels for use in Cluster Finders and the like.
353 *Nlist=4;Xlist[0]=Xlist[1]=iX;Xlist[2]=iX-1;Xlist[3]=iX+1;
354 Zlist[0]=iZ-1;Zlist[1]=iZ+1;Zlist[2]=Zlist[3]=iZ;
359 Xlist[0]=Xlist[1]=iX;
364 Zlist[2]=Zlist[3]=iZ;
379 //______________________________________________________________________
380 void AliITSsegmentationSPD::LocalToDet(Float_t x,Float_t z,Int_t &ix,Int_t &iz){
381 // Transformation from Geant detector centered local coordinates (cm) to
382 // Pixel cell numbers ix and iz.
384 // Float_t x detector local coordinate x in cm with respect to the
385 // center of the sensitive volume.
386 // Float_t z detector local coordinate z in cm with respect to the
387 // center of the sensitive volulme.
389 // Int_t ix detector x cell coordinate. Has the range 0<=ix<fNpx.
390 // Int_t iz detector z cell coordinate. Has the range 0<=iz<fNpz.
391 // A value of -1 for ix or iz indecates that this point is outside of the
392 // detector segmentation as defined.
395 const Float_t kconv = 1.0E-04; // converts microns to cm.
397 dx = -0.5*kconv*Dx();
398 dz = -0.5*kconv*Dz();
401 if(x<dx) return; // outside x range.
402 if(z<dz) return; // outside z range.
403 for(i=0;i<Npx();i++){
404 dx += kconv*fCellSizeX[i];
407 if(i>=Npx()) return; // outside x range.
408 for(j=0;j<Npz();j++){
409 dz += kconv*fCellSizeZ[j];
412 if(j>=Npz()) return; // outside z range.
415 return; // Found ix and iz, return.
417 //______________________________________________________________________
418 void AliITSsegmentationSPD::DetToLocal(Int_t ix,Int_t iz,Float_t &x,Float_t &z)
420 // Transformation from Detector cell coordiantes to Geant detector centerd
421 // local coordinates (cm).
423 // Int_t ix detector x cell coordinate. Has the range 0<=ix<fNpx.
424 // Int_t iz detector z cell coordinate. Has the range 0<=iz<fNpz.
426 // Float_t x detector local coordinate x in cm with respect to the
427 // center of the sensitive volume.
428 // Float_t z detector local coordinate z in cm with respect to the
429 // center of the sensitive volulme.
430 // If ix and or iz is outside of the segmentation range a value of -0.5*Dx()
431 // or -0.5*Dz() is returned.
433 const Float_t kconv = 1.0E-04; // converts microns to cm.
435 x = -0.5*kconv*Dx(); // default value.
436 z = -0.5*kconv*Dz(); // default value.
437 if(ix<0 || ix>=Npx()) return; // outside of detector
438 if(iz<0 || iz>=Npz()) return; // outside of detctor
439 for(i=0;i<ix;i++) x += kconv*fCellSizeX[i]; // sum up to cell ix-1
440 x += 0.5*kconv*fCellSizeX[ix]; // add 1/2 of cell ix for center location.
441 for(j=0;j<iz;j++) z += kconv*fCellSizeZ[j]; // sum up cell iz-1
442 z += 0.5*kconv*fCellSizeZ[iz]; // add 1/2 of cell iz for center location.
443 return; // Found x and z, return.