]>
Commit | Line | Data |
---|---|---|
b0f5e3fc | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
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 | **************************************************************************/ | |
15 | ||
16 | #include <TMath.h> | |
1ca7869b | 17 | #include <TF1.h> |
b0f5e3fc | 18 | |
19 | #include "AliITSsegmentationSPD.h" | |
1ca7869b | 20 | #include "AliITSgeom.h" |
b0f5e3fc | 21 | |
22 | ClassImp(AliITSsegmentationSPD) | |
23 | ||
24 | ||
f1e07e4b | 25 | Float_t AliITSsegmentationSPD::ColFromZ300(Float_t z) { |
b0f5e3fc | 26 | // Get column number for each z-coordinate taking into account the |
27 | // extra pixels in z direction assuming 300 micron sized pixels. | |
28 | Float_t col = 0.0; | |
29 | Float_t pitchz = 300.0; | |
30 | col = Float_t (z/pitchz); | |
31 | return col; | |
32 | } | |
33 | //_____________________________________________________________________________ | |
f1e07e4b | 34 | Float_t AliITSsegmentationSPD::ZFromCol300(Int_t col) { |
b0f5e3fc | 35 | // same comments as above |
36 | // Get z-coordinate for each colunm number | |
37 | Float_t pitchz = 300.0; | |
38 | Float_t z = 0.0; | |
39 | z = (col+0.5)*pitchz; | |
40 | return z; | |
41 | } | |
42 | //_____________________________________________________________________________ | |
f1e07e4b | 43 | Float_t AliITSsegmentationSPD::ZpitchFromCol300(Int_t col) { |
b0f5e3fc | 44 | // returns Z pixel pitch for 300 micron pixels. |
45 | return 300.0; | |
46 | } | |
47 | //_____________________________________________________________________________ | |
f1e07e4b | 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 | |
53 | Int_t i; | |
54 | Float_t s,col; | |
5d3918d6 | 55 | |
f1e07e4b | 56 | if(z<0||z>fDz){ |
57 | Error("ColFromZ","z=%f outside of range 0.0<=z<fDz=%f",z,fDz); | |
58 | return 0.0; // error | |
59 | } // end if outsize of detector | |
60 | s = 0.0; | |
61 | i = -1; | |
62 | while(z>s){ | |
63 | i++; | |
64 | s += fCellSizeZ[i]; | |
65 | } // end while | |
66 | s -= fCellSizeZ[i]; | |
67 | col = (Float_t) i + (z-s)/fCellSizeZ[i]; | |
68 | return col; | |
69 | ||
70 | /* | |
b0f5e3fc | 71 | Float_t col = 0; |
72 | Float_t pitchz = 425; | |
73 | if( z < 13175) { | |
74 | col = Float_t(z/pitchz); | |
75 | } else if( z < 14425) { | |
76 | pitchz = 625; | |
77 | col = 31 + (z - 13175)/pitchz; | |
78 | } else if( z < 27175) { | |
79 | col = 33 + (z - 14425)/pitchz; | |
80 | } else if( z < 28425) { | |
81 | pitchz = 625; | |
82 | col = 63 + (z - 27175)/pitchz; | |
83 | } else if( z < 41175) { | |
84 | col = 65 + (z - 28425)/pitchz; | |
85 | } else if( z < 42425) { | |
86 | pitchz = 625; | |
87 | col = 95 + (z - 41175)/pitchz; | |
88 | } else if( z < 55175) { | |
89 | col = 97 + (z - 42425)/pitchz; | |
90 | } else if( z < 56425) { | |
91 | pitchz = 625; | |
92 | col = 127 + (z - 55175)/pitchz; | |
93 | } else if( z < 69175) { | |
94 | col = 129 + (z - 56425)/pitchz; | |
95 | } else if( z < 70425) { | |
96 | pitchz = 625; | |
97 | col = 159 + (z - 69175)/pitchz; | |
98 | } else if( z < 83600) { | |
99 | col = 161 + (z - 70425)/pitchz; | |
100 | } | |
f1e07e4b | 101 | return TMath::Abs(col);*/ |
b0f5e3fc | 102 | } |
103 | ||
104 | //_____________________________________________________________________________ | |
f1e07e4b | 105 | Float_t AliITSsegmentationSPD::ZFromCol(Int_t col) { |
106 | // same comments as above | |
107 | // Get z-coordinate for each colunm number | |
108 | Int_t i; | |
109 | Float_t z; | |
5d3918d6 | 110 | |
f1e07e4b | 111 | if(col<0||col>=fNpz){ |
112 | Error("ZFromCol","col=%d outside of range 0<=col<fNpZ=%d",col,fNpz); | |
113 | return 0.0; // error | |
114 | } // end if outsize of detector | |
115 | z = 0.0; | |
116 | for(i=0;i<col;i++) z += fCellSizeZ[i]; | |
117 | z += 0.5*fCellSizeZ[col]; | |
118 | return z; | |
119 | ||
120 | /* | |
b0f5e3fc | 121 | Float_t pitchz = 425; |
122 | Float_t z = 0; | |
123 | if( col >=0 && col <= 30 ) { | |
124 | z = (col + 0.5)*pitchz; | |
125 | } else if( col >= 31 && col <= 32) { | |
126 | pitchz = 625; | |
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) { | |
131 | pitchz = 625; | |
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) { | |
136 | pitchz = 625; | |
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) { | |
141 | pitchz = 625; | |
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) { | |
146 | pitchz = 625; | |
147 | z = 69175 + (col -159 + 0.5)*pitchz; | |
148 | } else if( col >= 161 && col <= 191) { | |
149 | z = 70425 + (col -161 + 0.5)*pitchz; | |
5752a110 | 150 | } |
b0f5e3fc | 151 | |
f1e07e4b | 152 | return z;*/ |
b0f5e3fc | 153 | } |
5752a110 | 154 | //______________________________________________________________________ |
f1e07e4b | 155 | Float_t AliITSsegmentationSPD::ZpitchFromCol(Int_t col) { |
156 | // Get pitch size in z direction for each colunm | |
b0f5e3fc | 157 | |
87663651 | 158 | Float_t pitchz = 425.; |
5752a110 | 159 | if(col < 0){ |
160 | pitchz = 0.0; | |
91378d45 | 161 | } else if(col >= 31 && col <= 32) { |
87663651 | 162 | pitchz = 625.; |
91378d45 | 163 | } else if(col >= 63 && col <= 64) { |
87663651 | 164 | pitchz = 625.; |
91378d45 | 165 | } else if(col >= 95 && col <= 96) { |
87663651 | 166 | pitchz = 625.; |
91378d45 | 167 | } else if(col >= 127 && col <= 128) { |
87663651 | 168 | pitchz = 625.; |
91378d45 | 169 | } else if(col >= 159 && col <= 160) { |
87663651 | 170 | pitchz = 625.; |
f1e07e4b | 171 | } else if(col>=192){ |
87663651 | 172 | pitchz = 425.; |
5752a110 | 173 | } |
174 | return pitchz; | |
b0f5e3fc | 175 | } |
5752a110 | 176 | //______________________________________________________________________ |
b0f5e3fc | 177 | AliITSsegmentationSPD::AliITSsegmentationSPD(){ |
178 | // Default constructor | |
179 | fNpx = 0; | |
180 | fNpz = 0; | |
181 | fCorr=0; | |
182 | fGeom = 0; | |
183 | ||
184 | } | |
5752a110 | 185 | //______________________________________________________________________ |
b0f5e3fc | 186 | AliITSsegmentationSPD::AliITSsegmentationSPD(AliITSgeom *gm){ |
187 | // Constructor | |
188 | fCorr=0; | |
189 | fNpx = 0; | |
190 | fNpz = 0; | |
191 | Init(); | |
192 | fGeom = gm; | |
193 | ||
194 | } | |
5752a110 | 195 | //______________________________________________________________________ |
b0f5e3fc | 196 | AliITSsegmentationSPD& AliITSsegmentationSPD::operator=(AliITSsegmentationSPD &source){ |
197 | // = operator | |
b0f5e3fc | 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; | |
e8189707 | 203 | Int_t i; |
b0f5e3fc | 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. | |
208 | return *this; | |
209 | } | |
210 | //____________________________________________________________________________ | |
211 | AliITSsegmentationSPD::AliITSsegmentationSPD(AliITSsegmentationSPD &source){ | |
212 | // copy constructor | |
213 | *this = source; | |
214 | } | |
91378d45 | 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. | |
219 | Int_t i; | |
220 | ||
221 | for(i=0;i<256;i++) fCellSizeX[i] = x[i]; | |
7775613f | 222 | for(i=0;i<280;i++) fCellSizeZ[i] = z[i]; |
91378d45 | 223 | return; |
224 | } | |
225 | //---------------------------------------------------------------------- | |
b0f5e3fc | 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 | |
230 | // pixels in z. | |
231 | ||
b0f5e3fc | 232 | //const Float_t kconv=10000.; |
e8189707 | 233 | Int_t i; |
b0f5e3fc | 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 | |
f1e07e4b | 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 | |
b0f5e3fc | 239 | fDx = 0; |
240 | for(i=0;i<fNpx;i++) fDx += fCellSizeX[i]; | |
241 | fDz = 0; | |
242 | for(i=0;i<fNpz;i++) fDz += fCellSizeZ[i]; | |
243 | fDy = 300.0; //microns SPD sensitive layer thickness | |
244 | } | |
245 | ||
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. | |
252 | ||
b0f5e3fc | 253 | //const Float_t kconv=10000.; |
e8189707 | 254 | Int_t i; |
b0f5e3fc | 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 | |
f1e07e4b | 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 | |
b0f5e3fc | 260 | fDx = 0; |
261 | for(i=0;i<fNpx;i++) fDx += fCellSizeX[i]; | |
262 | fDz = 0; | |
263 | for(i=0;i<fNpz;i++) fDz += fCellSizeZ[i]; | |
264 | fDy = 300.0; //microns SPD sensitive layer thickness | |
e8189707 | 265 | //printf(" AliITSsegmentationSPD - Init: fNpx fNpz fDx fDz %d %d %f %f\n",fNpx, fNpz, fDx, fDz); |
b0f5e3fc | 266 | |
267 | } | |
268 | //------------------------------ | |
e8189707 | 269 | void AliITSsegmentationSPD::SetNPads(Int_t p1, Int_t p2){ |
b0f5e3fc | 270 | // for SPD this function should be used ONLY when a beam test setup |
271 | // configuration is studied | |
272 | ||
273 | fNpx=p1; | |
274 | fNpz=p2; | |
275 | ||
276 | } | |
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 | |
281 | ||
282 | fDx=p1; | |
283 | fDz=p2; | |
284 | fDy=p3; | |
285 | ||
286 | } | |
287 | //------------------------------ | |
288 | Float_t AliITSsegmentationSPD::Dpx(Int_t i){ | |
f1e07e4b | 289 | //returs x pixel pitch for a give pixel |
290 | if(i<0||i>=256) return 0.0; | |
291 | return fCellSizeX[i]; | |
b0f5e3fc | 292 | } |
293 | //------------------------------ | |
294 | Float_t AliITSsegmentationSPD::Dpz(Int_t i){ | |
f1e07e4b | 295 | // returns z pixel pitch for a give pixel |
296 | if(i<0||i>=280) return 0.0; | |
297 | return fCellSizeZ[i]; | |
b0f5e3fc | 298 | } |
299 | //------------------------------ | |
e8189707 | 300 | void AliITSsegmentationSPD::GetPadIxz(Float_t x,Float_t z,Int_t &ix,Int_t &iz){ |
b0f5e3fc | 301 | // Returns pixel coordinates (ix,iz) for given real local coordinates (x,z) |
302 | // | |
303 | ||
304 | // expects x, z in microns | |
305 | ||
306 | // same segmentation on x | |
307 | Float_t dpx=Dpx(0); | |
308 | ix = (Int_t)(x/dpx + 1); | |
309 | // different segmentation on z | |
310 | iz = (Int_t)(ColFromZ(z) + 1); | |
311 | ||
b0f5e3fc | 312 | |
313 | if (iz > fNpz) iz= fNpz; | |
314 | if (ix > fNpx) ix= fNpx; | |
b0f5e3fc | 315 | /* |
316 | if (iz < -fNpz) iz= -fNpz; | |
317 | if (ix < -fNpx) ix=-fNpx; | |
318 | */ | |
319 | } | |
320 | ||
321 | //------------------------------ | |
e8189707 | 322 | void AliITSsegmentationSPD::GetPadTxz(Float_t &x,Float_t &z){ |
323 | // local transformation of real local coordinates (x,z) | |
324 | // | |
325 | ||
326 | // expects x, z in microns | |
327 | ||
328 | // same segmentation on x | |
329 | Float_t dpx=Dpx(0); | |
330 | ||
331 | x /= dpx; | |
332 | z = ColFromZ(z); | |
333 | ||
334 | } | |
335 | //------------------------------ | |
336 | void AliITSsegmentationSPD::GetPadCxz(Int_t ix,Int_t iz,Float_t &x,Float_t&z){ | |
b0f5e3fc | 337 | // Transform from pixel to real local coordinates |
338 | ||
339 | // returns x, z in microns | |
340 | ||
341 | Float_t dpx=Dpx(0); | |
342 | ||
343 | x = (ix>0) ? Float_t(ix*dpx)-dpx/2. : Float_t(ix*dpx)+dpx/2.; | |
344 | z = ZFromCol(iz); | |
345 | ||
346 | ||
347 | } | |
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. | |
352 | /* | |
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; | |
355 | */ | |
356 | ||
357 | ||
358 | *Nlist=8; | |
359 | Xlist[0]=Xlist[1]=iX; | |
360 | Xlist[2]=iX-1; | |
361 | Xlist[3]=iX+1; | |
362 | Zlist[0]=iZ-1; | |
363 | Zlist[1]=iZ+1; | |
364 | Zlist[2]=Zlist[3]=iZ; | |
365 | ||
366 | // Diagonal elements | |
367 | Xlist[4]=iX+1; | |
368 | Zlist[4]=iZ+1; | |
369 | ||
370 | Xlist[5]=iX-1; | |
371 | Zlist[5]=iZ-1; | |
372 | ||
373 | Xlist[6]=iX-1; | |
374 | Zlist[6]=iZ+1; | |
375 | ||
376 | Xlist[7]=iX+1; | |
377 | Zlist[7]=iZ-1; | |
378 | } | |
5752a110 | 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. | |
383 | // Input: | |
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. | |
388 | // Output: | |
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. | |
393 | Int_t i,j; | |
394 | Float_t dx,dz; | |
395 | const Float_t kconv = 1.0E-04; // converts microns to cm. | |
396 | ||
397 | dx = -0.5*kconv*Dx(); | |
398 | dz = -0.5*kconv*Dz(); | |
399 | ix = -1; | |
400 | iz = -1; | |
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]; | |
405 | if(x<dx) break; | |
406 | } // end for i | |
407 | if(i>=Npx()) return; // outside x range. | |
408 | for(j=0;j<Npz();j++){ | |
409 | dz += kconv*fCellSizeZ[j]; | |
410 | if(z<dz) break; | |
411 | } // end for j | |
412 | if(j>=Npz()) return; // outside z range. | |
413 | ix = i; | |
414 | iz = j; | |
415 | return; // Found ix and iz, return. | |
416 | } | |
417 | //______________________________________________________________________ | |
418 | void AliITSsegmentationSPD::DetToLocal(Int_t ix,Int_t iz,Float_t &x,Float_t &z) | |
419 | { | |
420 | // Transformation from Detector cell coordiantes to Geant detector centerd | |
421 | // local coordinates (cm). | |
422 | // Input: | |
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. | |
425 | // Output: | |
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. | |
432 | Int_t i,j; | |
433 | const Float_t kconv = 1.0E-04; // converts microns to cm. | |
434 | ||
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. | |
444 | } |