]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSsegmentationSPD.cxx
Bug fix.
[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//_____________________________________________________________________________
48Float_t 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
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//_____________________________________________________________________________
88Float_t ZFromCol(Int_t col) {
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;
121 }
122
123 return z;
124}
125
126Float_t ZpitchFromCol(Int_t col) {
127// Get pitch size in z direction for each colunm
128
129 Float_t pitchz = 425;
130 if( col >=32 && col <= 33 ) {
131 pitchz = 625;
132 } else if( col >= 64 && col <= 65) {
133 pitchz = 625;
134 } else if( col >= 96 && col <= 97) {
135 pitchz = 625;
136 } else if( col >= 128 && col <= 129) {
137 pitchz = 625;
138 } else if( col >= 160 && col <= 161) {
139 pitchz = 625;
140 }
141 return pitchz;
142}
143
144AliITSsegmentationSPD::AliITSsegmentationSPD(){
145 // Default constructor
146 fNpx = 0;
147 fNpz = 0;
148 fCorr=0;
149 fGeom = 0;
150
151}
152//____________________________________________________________________________
153AliITSsegmentationSPD::AliITSsegmentationSPD(AliITSgeom *gm){
154 // Constructor
155 fCorr=0;
156 fNpx = 0;
157 fNpz = 0;
158 Init();
159 fGeom = gm;
160
161}
162//____________________________________________________________________________
163AliITSsegmentationSPD& AliITSsegmentationSPD::operator=(AliITSsegmentationSPD &source){
164 // = operator
b0f5e3fc 165 if(this==&source) return *this;
166 this->fNpx = source.fNpx;
167 this->fNpz = source.fNpz;
168 this->fDx = source.fDx;
169 this->fDy = source.fDy;
e8189707 170 Int_t i;
b0f5e3fc 171 for(i=0;i<256;i++) this->fCellSizeX[i] = source.fCellSizeX[i];
172 for(i=0;i<280;i++) this->fCellSizeZ[i] = source.fCellSizeZ[i];
173 this->fCorr = new TF1(*(source.fCorr));// make a proper copy of the function
174 this->fGeom = source.fGeom; // copy only the pointers.
175 return *this;
176}
177//____________________________________________________________________________
178AliITSsegmentationSPD::AliITSsegmentationSPD(AliITSsegmentationSPD &source){
179 // copy constructor
180 *this = source;
181}
182//------------------------------
183void AliITSsegmentationSPD::Init300(){
184// Initialize infromation for 6 read out chip 300X50 micron pixel SPD
185// detectors. This chip is 150 microns thick by 1.28 cm in x by 8.37 cm
186// long. It has 256 50 micron pixels in x and 279 300 micron size
187// pixels in z.
188
b0f5e3fc 189 //const Float_t kconv=10000.;
e8189707 190 Int_t i;
b0f5e3fc 191 fNpx = 256; // The number of X pixel Cell same as in fCellSizeX array size
192 fNpz = 279; // The number of Z pixel Cell same as in fCellSizeZ array size
193 for(i=0;i<fNpx;i++) fCellSizeX[i] = 50.0; // microns all the same
194 for(i=0;i<fNpz;i++) fCellSizeZ[i] = ZpitchFromCol300(i); // microns
195 for(i=fNpz;i<280;i++) fCellSizeZ[i] = 0.0; // zero out rest of array
196 fDx = 0;
197 for(i=0;i<fNpx;i++) fDx += fCellSizeX[i];
198 fDz = 0;
199 for(i=0;i<fNpz;i++) fDz += fCellSizeZ[i];
200 fDy = 300.0; //microns SPD sensitive layer thickness
201}
202
203//------------------------------
204void AliITSsegmentationSPD::Init(){
205// Initialize infromation for 6 read out chip 425X50 micron pixel SPD
206// detectors. This chip is 150 microns thick by 1.28 cm in x by 8.375 cm
207// long. It has 256 50 micron pixels in x and 197 mostly 425 micron size
208// pixels in z. The two pixels between each readout chip are 625 microns long.
209
b0f5e3fc 210 //const Float_t kconv=10000.;
e8189707 211 Int_t i;
b0f5e3fc 212 fNpx = 256; // The number of X pixel Cell same as in fCellSizeX array size
213 fNpz = 192; // The number of Z pixel Cell same as in fCellSizeZ array size
214 for(i=0;i<fNpx;i++) fCellSizeX[i] = 50.0; // microns all the same
215 for(i=0;i<fNpz;i++) fCellSizeZ[i] = ZpitchFromCol(i); // microns
216 for(i=fNpz;i<280;i++) fCellSizeZ[i] = 0.0; // zero out rest of array
217 fDx = 0;
218 for(i=0;i<fNpx;i++) fDx += fCellSizeX[i];
219 fDz = 0;
220 for(i=0;i<fNpz;i++) fDz += fCellSizeZ[i];
221 fDy = 300.0; //microns SPD sensitive layer thickness
e8189707 222 //printf(" AliITSsegmentationSPD - Init: fNpx fNpz fDx fDz %d %d %f %f\n",fNpx, fNpz, fDx, fDz);
b0f5e3fc 223
224}
225//------------------------------
e8189707 226void AliITSsegmentationSPD::SetNPads(Int_t p1, Int_t p2){
b0f5e3fc 227 // for SPD this function should be used ONLY when a beam test setup
228 // configuration is studied
229
230 fNpx=p1;
231 fNpz=p2;
232
233}
234//------------------------------
235void AliITSsegmentationSPD::SetDetSize(Float_t p1, Float_t p2, Float_t p3){
236 // for SPD this function should be used ONLY when a beam test setup
237 // configuration is studied
238
239 fDx=p1;
240 fDz=p2;
241 fDy=p3;
242
243}
244//------------------------------
245Float_t AliITSsegmentationSPD::Dpx(Int_t i){
246 //returs x pixel pitch for a give pixel
247 return fCellSizeX[i];
248}
249//------------------------------
250Float_t AliITSsegmentationSPD::Dpz(Int_t i){
251 // returns z pixel pitch for a give pixel
252 return ZpitchFromCol(i);
253}
254//------------------------------
e8189707 255void AliITSsegmentationSPD::GetPadIxz(Float_t x,Float_t z,Int_t &ix,Int_t &iz){
b0f5e3fc 256// Returns pixel coordinates (ix,iz) for given real local coordinates (x,z)
257//
258
259 // expects x, z in microns
260
261 // same segmentation on x
262 Float_t dpx=Dpx(0);
263 ix = (Int_t)(x/dpx + 1);
264 // different segmentation on z
265 iz = (Int_t)(ColFromZ(z) + 1);
266
b0f5e3fc 267
268 if (iz > fNpz) iz= fNpz;
269 if (ix > fNpx) ix= fNpx;
b0f5e3fc 270 /*
271 if (iz < -fNpz) iz= -fNpz;
272 if (ix < -fNpx) ix=-fNpx;
273 */
274}
275
276//------------------------------
e8189707 277void AliITSsegmentationSPD::GetPadTxz(Float_t &x,Float_t &z){
278// local transformation of real local coordinates (x,z)
279//
280
281 // expects x, z in microns
282
283 // same segmentation on x
284 Float_t dpx=Dpx(0);
285
286 x /= dpx;
287 z = ColFromZ(z);
288
289}
290//------------------------------
291void AliITSsegmentationSPD::GetPadCxz(Int_t ix,Int_t iz,Float_t &x,Float_t&z){
b0f5e3fc 292 // Transform from pixel to real local coordinates
293
294 // returns x, z in microns
295
296 Float_t dpx=Dpx(0);
297
298 x = (ix>0) ? Float_t(ix*dpx)-dpx/2. : Float_t(ix*dpx)+dpx/2.;
299 z = ZFromCol(iz);
300
301
302}
303//------------------------------
304void AliITSsegmentationSPD::
305Neighbours(Int_t iX, Int_t iZ, Int_t* Nlist, Int_t Xlist[8], Int_t Zlist[8]){
306 // returns the neighbouring pixels for use in Cluster Finders and the like.
307 /*
308 *Nlist=4;Xlist[0]=Xlist[1]=iX;Xlist[2]=iX-1;Xlist[3]=iX+1;
309 Zlist[0]=iZ-1;Zlist[1]=iZ+1;Zlist[2]=Zlist[3]=iZ;
310 */
311
312
313 *Nlist=8;
314 Xlist[0]=Xlist[1]=iX;
315 Xlist[2]=iX-1;
316 Xlist[3]=iX+1;
317 Zlist[0]=iZ-1;
318 Zlist[1]=iZ+1;
319 Zlist[2]=Zlist[3]=iZ;
320
321 // Diagonal elements
322 Xlist[4]=iX+1;
323 Zlist[4]=iZ+1;
324
325 Xlist[5]=iX-1;
326 Zlist[5]=iZ-1;
327
328 Xlist[6]=iX-1;
329 Zlist[6]=iZ+1;
330
331 Xlist[7]=iX+1;
332 Zlist[7]=iZ-1;
333}