]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSsegmentationSPD.cxx
Added a dummy argument to FindRawClusters. Argument used for SSD version.
[u/mrichter/AliRoot.git] / ITS / AliITSsegmentationSPD.cxx
CommitLineData
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
22ClassImp(AliITSsegmentationSPD)
23
24
25Float_t 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.
28 Float_t col = 0.0;
29 Float_t pitchz = 300.0;
30 col = Float_t (z/pitchz);
31 return col;
32}
33//_____________________________________________________________________________
34Float_t ZFromCol300(Int_t col) {
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//_____________________________________________________________________________
43Float_t ZpitchFromCol300(Int_t col) {
44 // returns Z pixel pitch for 300 micron pixels.
45 return 300.0;
46}
47//_____________________________________________________________________________
5752a110 48Float_t AliITSsegmentationSPD::ColFromZ(Float_t z) {
b0f5e3fc 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
54 Float_t col = 0;
55 Float_t pitchz = 425;
56 if( z < 13175) {
57 col = Float_t(z/pitchz);
58 } else if( z < 14425) {
59 pitchz = 625;
60 col = 31 + (z - 13175)/pitchz;
61 } else if( z < 27175) {
62 col = 33 + (z - 14425)/pitchz;
63 } else if( z < 28425) {
64 pitchz = 625;
65 col = 63 + (z - 27175)/pitchz;
66 } else if( z < 41175) {
67 col = 65 + (z - 28425)/pitchz;
68 } else if( z < 42425) {
69 pitchz = 625;
70 col = 95 + (z - 41175)/pitchz;
71 } else if( z < 55175) {
72 col = 97 + (z - 42425)/pitchz;
73 } else if( z < 56425) {
74 pitchz = 625;
75 col = 127 + (z - 55175)/pitchz;
76 } else if( z < 69175) {
77 col = 129 + (z - 56425)/pitchz;
78 } else if( z < 70425) {
79 pitchz = 625;
80 col = 159 + (z - 69175)/pitchz;
81 } else if( z < 83600) {
82 col = 161 + (z - 70425)/pitchz;
83 }
e8189707 84 return TMath::Abs(col);
b0f5e3fc 85}
86
87//_____________________________________________________________________________
5752a110 88Float_t AliITSsegmentationSPD::ZFromCol(Int_t col) {
b0f5e3fc 89// same comments as above
90// Get z-coordinate for each colunm number
91
92 Float_t pitchz = 425;
93 Float_t z = 0;
94 if( col >=0 && col <= 30 ) {
95 z = (col + 0.5)*pitchz;
96 } else if( col >= 31 && col <= 32) {
97 pitchz = 625;
98 z = 13175 + (col -31 + 0.5)*pitchz;
99 } else if( col >= 33 && col <= 62) {
100 z = 14425 + (col -33 + 0.5)*pitchz;
101 } else if( col >= 63 && col <= 64) {
102 pitchz = 625;
103 z = 27175 + (col -63 + 0.5)*pitchz;
104 } else if( col >= 65 && col <= 94) {
105 z = 28425 + (col -65 + 0.5)*pitchz;
106 } else if( col >= 95 && col <= 96) {
107 pitchz = 625;
108 z = 41175 + (col -95 + 0.5)*pitchz;
109 } else if( col >= 97 && col <= 126) {
110 z = 42425 + (col -97 + 0.5)*pitchz;
111 } else if( col >= 127 && col <= 128) {
112 pitchz = 625;
113 z = 55175 + (col -127 + 0.5)*pitchz;
114 } else if( col >= 129 && col <= 158) {
115 z = 56425 + (col -129 + 0.5)*pitchz;
116 } else if( col >= 159 && col <= 160) {
117 pitchz = 625;
118 z = 69175 + (col -159 + 0.5)*pitchz;
119 } else if( col >= 161 && col <= 191) {
120 z = 70425 + (col -161 + 0.5)*pitchz;
5752a110 121 }
b0f5e3fc 122
123 return z;
124}
5752a110 125//______________________________________________________________________
126Float_t AliITSsegmentationSPD::ZpitchFromCol(Int_t col) {
b0f5e3fc 127// Get pitch size in z direction for each colunm
128
5752a110 129 Float_t pitchz = 425;
130 if(col < 0){
131 pitchz = 0.0;
132 } else if(col >= 31 && col <= 32) {
133 pitchz = 625;
134 } else if(col >= 63 && col <= 64) {
135 pitchz = 625;
136 } else if(col >= 95 && col <= 96) {
137 pitchz = 625;
138 } else if(col >= 127 && col <= 128) {
139 pitchz = 625;
140 } else if(col >= 159 && col <= 160) {
141 pitchz = 625;
142 } else if(col>=192){
143 pitchz = 0.0;
144 }
145 return pitchz;
b0f5e3fc 146}
5752a110 147//______________________________________________________________________
b0f5e3fc 148AliITSsegmentationSPD::AliITSsegmentationSPD(){
149 // Default constructor
150 fNpx = 0;
151 fNpz = 0;
152 fCorr=0;
153 fGeom = 0;
154
155}
5752a110 156//______________________________________________________________________
b0f5e3fc 157AliITSsegmentationSPD::AliITSsegmentationSPD(AliITSgeom *gm){
158 // Constructor
159 fCorr=0;
160 fNpx = 0;
161 fNpz = 0;
162 Init();
163 fGeom = gm;
164
165}
5752a110 166//______________________________________________________________________
b0f5e3fc 167AliITSsegmentationSPD& AliITSsegmentationSPD::operator=(AliITSsegmentationSPD &source){
168 // = operator
b0f5e3fc 169 if(this==&source) return *this;
170 this->fNpx = source.fNpx;
171 this->fNpz = source.fNpz;
172 this->fDx = source.fDx;
173 this->fDy = source.fDy;
e8189707 174 Int_t i;
b0f5e3fc 175 for(i=0;i<256;i++) this->fCellSizeX[i] = source.fCellSizeX[i];
176 for(i=0;i<280;i++) this->fCellSizeZ[i] = source.fCellSizeZ[i];
177 this->fCorr = new TF1(*(source.fCorr));// make a proper copy of the function
178 this->fGeom = source.fGeom; // copy only the pointers.
179 return *this;
180}
181//____________________________________________________________________________
182AliITSsegmentationSPD::AliITSsegmentationSPD(AliITSsegmentationSPD &source){
183 // copy constructor
184 *this = source;
185}
186//------------------------------
187void AliITSsegmentationSPD::Init300(){
188// Initialize infromation for 6 read out chip 300X50 micron pixel SPD
189// detectors. This chip is 150 microns thick by 1.28 cm in x by 8.37 cm
190// long. It has 256 50 micron pixels in x and 279 300 micron size
191// pixels in z.
192
b0f5e3fc 193 //const Float_t kconv=10000.;
e8189707 194 Int_t i;
b0f5e3fc 195 fNpx = 256; // The number of X pixel Cell same as in fCellSizeX array size
196 fNpz = 279; // The number of Z pixel Cell same as in fCellSizeZ array size
197 for(i=0;i<fNpx;i++) fCellSizeX[i] = 50.0; // microns all the same
198 for(i=0;i<fNpz;i++) fCellSizeZ[i] = ZpitchFromCol300(i); // microns
199 for(i=fNpz;i<280;i++) fCellSizeZ[i] = 0.0; // zero out rest of array
200 fDx = 0;
201 for(i=0;i<fNpx;i++) fDx += fCellSizeX[i];
202 fDz = 0;
203 for(i=0;i<fNpz;i++) fDz += fCellSizeZ[i];
204 fDy = 300.0; //microns SPD sensitive layer thickness
205}
206
207//------------------------------
208void AliITSsegmentationSPD::Init(){
209// Initialize infromation for 6 read out chip 425X50 micron pixel SPD
210// detectors. This chip is 150 microns thick by 1.28 cm in x by 8.375 cm
211// long. It has 256 50 micron pixels in x and 197 mostly 425 micron size
212// pixels in z. The two pixels between each readout chip are 625 microns long.
213
b0f5e3fc 214 //const Float_t kconv=10000.;
e8189707 215 Int_t i;
b0f5e3fc 216 fNpx = 256; // The number of X pixel Cell same as in fCellSizeX array size
217 fNpz = 192; // The number of Z pixel Cell same as in fCellSizeZ array size
218 for(i=0;i<fNpx;i++) fCellSizeX[i] = 50.0; // microns all the same
219 for(i=0;i<fNpz;i++) fCellSizeZ[i] = ZpitchFromCol(i); // microns
220 for(i=fNpz;i<280;i++) fCellSizeZ[i] = 0.0; // zero out rest of array
221 fDx = 0;
222 for(i=0;i<fNpx;i++) fDx += fCellSizeX[i];
223 fDz = 0;
224 for(i=0;i<fNpz;i++) fDz += fCellSizeZ[i];
225 fDy = 300.0; //microns SPD sensitive layer thickness
e8189707 226 //printf(" AliITSsegmentationSPD - Init: fNpx fNpz fDx fDz %d %d %f %f\n",fNpx, fNpz, fDx, fDz);
b0f5e3fc 227
228}
229//------------------------------
e8189707 230void AliITSsegmentationSPD::SetNPads(Int_t p1, Int_t p2){
b0f5e3fc 231 // for SPD this function should be used ONLY when a beam test setup
232 // configuration is studied
233
234 fNpx=p1;
235 fNpz=p2;
236
237}
238//------------------------------
239void AliITSsegmentationSPD::SetDetSize(Float_t p1, Float_t p2, Float_t p3){
240 // for SPD this function should be used ONLY when a beam test setup
241 // configuration is studied
242
243 fDx=p1;
244 fDz=p2;
245 fDy=p3;
246
247}
248//------------------------------
249Float_t AliITSsegmentationSPD::Dpx(Int_t i){
250 //returs x pixel pitch for a give pixel
251 return fCellSizeX[i];
252}
253//------------------------------
254Float_t AliITSsegmentationSPD::Dpz(Int_t i){
255 // returns z pixel pitch for a give pixel
256 return ZpitchFromCol(i);
257}
258//------------------------------
e8189707 259void AliITSsegmentationSPD::GetPadIxz(Float_t x,Float_t z,Int_t &ix,Int_t &iz){
b0f5e3fc 260// Returns pixel coordinates (ix,iz) for given real local coordinates (x,z)
261//
262
263 // expects x, z in microns
264
265 // same segmentation on x
266 Float_t dpx=Dpx(0);
267 ix = (Int_t)(x/dpx + 1);
268 // different segmentation on z
269 iz = (Int_t)(ColFromZ(z) + 1);
270
b0f5e3fc 271
272 if (iz > fNpz) iz= fNpz;
273 if (ix > fNpx) ix= fNpx;
b0f5e3fc 274 /*
275 if (iz < -fNpz) iz= -fNpz;
276 if (ix < -fNpx) ix=-fNpx;
277 */
278}
279
280//------------------------------
e8189707 281void AliITSsegmentationSPD::GetPadTxz(Float_t &x,Float_t &z){
282// local transformation of real local coordinates (x,z)
283//
284
285 // expects x, z in microns
286
287 // same segmentation on x
288 Float_t dpx=Dpx(0);
289
290 x /= dpx;
291 z = ColFromZ(z);
292
293}
294//------------------------------
295void AliITSsegmentationSPD::GetPadCxz(Int_t ix,Int_t iz,Float_t &x,Float_t&z){
b0f5e3fc 296 // Transform from pixel to real local coordinates
297
298 // returns x, z in microns
299
300 Float_t dpx=Dpx(0);
301
302 x = (ix>0) ? Float_t(ix*dpx)-dpx/2. : Float_t(ix*dpx)+dpx/2.;
303 z = ZFromCol(iz);
304
305
306}
307//------------------------------
308void AliITSsegmentationSPD::
309Neighbours(Int_t iX, Int_t iZ, Int_t* Nlist, Int_t Xlist[8], Int_t Zlist[8]){
310 // returns the neighbouring pixels for use in Cluster Finders and the like.
311 /*
312 *Nlist=4;Xlist[0]=Xlist[1]=iX;Xlist[2]=iX-1;Xlist[3]=iX+1;
313 Zlist[0]=iZ-1;Zlist[1]=iZ+1;Zlist[2]=Zlist[3]=iZ;
314 */
315
316
317 *Nlist=8;
318 Xlist[0]=Xlist[1]=iX;
319 Xlist[2]=iX-1;
320 Xlist[3]=iX+1;
321 Zlist[0]=iZ-1;
322 Zlist[1]=iZ+1;
323 Zlist[2]=Zlist[3]=iZ;
324
325 // Diagonal elements
326 Xlist[4]=iX+1;
327 Zlist[4]=iZ+1;
328
329 Xlist[5]=iX-1;
330 Zlist[5]=iZ-1;
331
332 Xlist[6]=iX-1;
333 Zlist[6]=iZ+1;
334
335 Xlist[7]=iX+1;
336 Zlist[7]=iZ-1;
337}
5752a110 338//______________________________________________________________________
339void AliITSsegmentationSPD::LocalToDet(Float_t x,Float_t z,Int_t &ix,Int_t &iz){
340// Transformation from Geant detector centered local coordinates (cm) to
341// Pixel cell numbers ix and iz.
342// Input:
343// Float_t x detector local coordinate x in cm with respect to the
344// center of the sensitive volume.
345// Float_t z detector local coordinate z in cm with respect to the
346// center of the sensitive volulme.
347// Output:
348// Int_t ix detector x cell coordinate. Has the range 0<=ix<fNpx.
349// Int_t iz detector z cell coordinate. Has the range 0<=iz<fNpz.
350// A value of -1 for ix or iz indecates that this point is outside of the
351// detector segmentation as defined.
352 Int_t i,j;
353 Float_t dx,dz;
354 const Float_t kconv = 1.0E-04; // converts microns to cm.
355
356 dx = -0.5*kconv*Dx();
357 dz = -0.5*kconv*Dz();
358 ix = -1;
359 iz = -1;
360 if(x<dx) return; // outside x range.
361 if(z<dz) return; // outside z range.
362 for(i=0;i<Npx();i++){
363 dx += kconv*fCellSizeX[i];
364 if(x<dx) break;
365 } // end for i
366 if(i>=Npx()) return; // outside x range.
367 for(j=0;j<Npz();j++){
368 dz += kconv*fCellSizeZ[j];
369 if(z<dz) break;
370 } // end for j
371 if(j>=Npz()) return; // outside z range.
372 ix = i;
373 iz = j;
374 return; // Found ix and iz, return.
375}
376//______________________________________________________________________
377void AliITSsegmentationSPD::DetToLocal(Int_t ix,Int_t iz,Float_t &x,Float_t &z)
378{
379// Transformation from Detector cell coordiantes to Geant detector centerd
380// local coordinates (cm).
381// Input:
382// Int_t ix detector x cell coordinate. Has the range 0<=ix<fNpx.
383// Int_t iz detector z cell coordinate. Has the range 0<=iz<fNpz.
384// Output:
385// Float_t x detector local coordinate x in cm with respect to the
386// center of the sensitive volume.
387// Float_t z detector local coordinate z in cm with respect to the
388// center of the sensitive volulme.
389// If ix and or iz is outside of the segmentation range a value of -0.5*Dx()
390// or -0.5*Dz() is returned.
391 Int_t i,j;
392 const Float_t kconv = 1.0E-04; // converts microns to cm.
393
394 x = -0.5*kconv*Dx(); // default value.
395 z = -0.5*kconv*Dz(); // default value.
396 if(ix<0 || ix>=Npx()) return; // outside of detector
397 if(iz<0 || iz>=Npz()) return; // outside of detctor
398 for(i=0;i<ix;i++) x += kconv*fCellSizeX[i]; // sum up to cell ix-1
399 x += 0.5*kconv*fCellSizeX[ix]; // add 1/2 of cell ix for center location.
400 for(j=0;j<iz;j++) z += kconv*fCellSizeZ[j]; // sum up cell iz-1
401 z += 0.5*kconv*fCellSizeZ[iz]; // add 1/2 of cell iz for center location.
402 return; // Found x and z, return.
403}