]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSsegmentationSPD.cxx
New ITS code for new structure and simulations.
[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>
17
18#include "AliITSsegmentationSPD.h"
19
20ClassImp(AliITSsegmentationSPD)
21
22
23Float_t ColFromZ300(Float_t z) {
24// Get column number for each z-coordinate taking into account the
25// extra pixels in z direction assuming 300 micron sized pixels.
26 Float_t col = 0.0;
27 Float_t pitchz = 300.0;
28 col = Float_t (z/pitchz);
29 return col;
30}
31//_____________________________________________________________________________
32Float_t ZFromCol300(Int_t col) {
33// same comments as above
34// Get z-coordinate for each colunm number
35 Float_t pitchz = 300.0;
36 Float_t z = 0.0;
37 z = (col+0.5)*pitchz;
38 return z;
39}
40//_____________________________________________________________________________
41Float_t ZpitchFromCol300(Int_t col) {
42 // returns Z pixel pitch for 300 micron pixels.
43 return 300.0;
44}
45//_____________________________________________________________________________
46Float_t ColFromZ(Float_t z) {
47// hard-wired - keep it like this till we can parametrise
48// and get rid of AliITSgeomSPD425
49// Get column number for each z-coordinate taking into account the
50// extra pixels in z direction
51
52 Float_t col = 0;
53 Float_t pitchz = 425;
54 if( z < 13175) {
55 col = Float_t(z/pitchz);
56 } else if( z < 14425) {
57 pitchz = 625;
58 col = 31 + (z - 13175)/pitchz;
59 } else if( z < 27175) {
60 col = 33 + (z - 14425)/pitchz;
61 } else if( z < 28425) {
62 pitchz = 625;
63 col = 63 + (z - 27175)/pitchz;
64 } else if( z < 41175) {
65 col = 65 + (z - 28425)/pitchz;
66 } else if( z < 42425) {
67 pitchz = 625;
68 col = 95 + (z - 41175)/pitchz;
69 } else if( z < 55175) {
70 col = 97 + (z - 42425)/pitchz;
71 } else if( z < 56425) {
72 pitchz = 625;
73 col = 127 + (z - 55175)/pitchz;
74 } else if( z < 69175) {
75 col = 129 + (z - 56425)/pitchz;
76 } else if( z < 70425) {
77 pitchz = 625;
78 col = 159 + (z - 69175)/pitchz;
79 } else if( z < 83600) {
80 col = 161 + (z - 70425)/pitchz;
81 }
82 return col;
83}
84
85//_____________________________________________________________________________
86Float_t ZFromCol(Int_t col) {
87// same comments as above
88// Get z-coordinate for each colunm number
89
90 Float_t pitchz = 425;
91 Float_t z = 0;
92 if( col >=0 && col <= 30 ) {
93 z = (col + 0.5)*pitchz;
94 } else if( col >= 31 && col <= 32) {
95 pitchz = 625;
96 z = 13175 + (col -31 + 0.5)*pitchz;
97 } else if( col >= 33 && col <= 62) {
98 z = 14425 + (col -33 + 0.5)*pitchz;
99 } else if( col >= 63 && col <= 64) {
100 pitchz = 625;
101 z = 27175 + (col -63 + 0.5)*pitchz;
102 } else if( col >= 65 && col <= 94) {
103 z = 28425 + (col -65 + 0.5)*pitchz;
104 } else if( col >= 95 && col <= 96) {
105 pitchz = 625;
106 z = 41175 + (col -95 + 0.5)*pitchz;
107 } else if( col >= 97 && col <= 126) {
108 z = 42425 + (col -97 + 0.5)*pitchz;
109 } else if( col >= 127 && col <= 128) {
110 pitchz = 625;
111 z = 55175 + (col -127 + 0.5)*pitchz;
112 } else if( col >= 129 && col <= 158) {
113 z = 56425 + (col -129 + 0.5)*pitchz;
114 } else if( col >= 159 && col <= 160) {
115 pitchz = 625;
116 z = 69175 + (col -159 + 0.5)*pitchz;
117 } else if( col >= 161 && col <= 191) {
118 z = 70425 + (col -161 + 0.5)*pitchz;
119 }
120
121 return z;
122}
123
124Float_t ZpitchFromCol(Int_t col) {
125// Get pitch size in z direction for each colunm
126
127 Float_t pitchz = 425;
128 if( col >=32 && col <= 33 ) {
129 pitchz = 625;
130 } else if( col >= 64 && col <= 65) {
131 pitchz = 625;
132 } else if( col >= 96 && col <= 97) {
133 pitchz = 625;
134 } else if( col >= 128 && col <= 129) {
135 pitchz = 625;
136 } else if( col >= 160 && col <= 161) {
137 pitchz = 625;
138 }
139 return pitchz;
140}
141
142AliITSsegmentationSPD::AliITSsegmentationSPD(){
143 // Default constructor
144 fNpx = 0;
145 fNpz = 0;
146 fCorr=0;
147 fGeom = 0;
148
149}
150//____________________________________________________________________________
151AliITSsegmentationSPD::AliITSsegmentationSPD(AliITSgeom *gm){
152 // Constructor
153 fCorr=0;
154 fNpx = 0;
155 fNpz = 0;
156 Init();
157 fGeom = gm;
158
159}
160//____________________________________________________________________________
161AliITSsegmentationSPD& AliITSsegmentationSPD::operator=(AliITSsegmentationSPD &source){
162 // = operator
163 Int_t i;
164 if(this==&source) return *this;
165 this->fNpx = source.fNpx;
166 this->fNpz = source.fNpz;
167 this->fDx = source.fDx;
168 this->fDy = source.fDy;
169 for(i=0;i<256;i++) this->fCellSizeX[i] = source.fCellSizeX[i];
170 for(i=0;i<280;i++) this->fCellSizeZ[i] = source.fCellSizeZ[i];
171 this->fCorr = new TF1(*(source.fCorr));// make a proper copy of the function
172 this->fGeom = source.fGeom; // copy only the pointers.
173 return *this;
174}
175//____________________________________________________________________________
176AliITSsegmentationSPD::AliITSsegmentationSPD(AliITSsegmentationSPD &source){
177 // copy constructor
178 *this = source;
179}
180//------------------------------
181void AliITSsegmentationSPD::Init300(){
182// Initialize infromation for 6 read out chip 300X50 micron pixel SPD
183// detectors. This chip is 150 microns thick by 1.28 cm in x by 8.37 cm
184// long. It has 256 50 micron pixels in x and 279 300 micron size
185// pixels in z.
186
187 Int_t i;
188 //const Float_t kconv=10000.;
189 fNpx = 256; // The number of X pixel Cell same as in fCellSizeX array size
190 fNpz = 279; // The number of Z pixel Cell same as in fCellSizeZ array size
191 for(i=0;i<fNpx;i++) fCellSizeX[i] = 50.0; // microns all the same
192 for(i=0;i<fNpz;i++) fCellSizeZ[i] = ZpitchFromCol300(i); // microns
193 for(i=fNpz;i<280;i++) fCellSizeZ[i] = 0.0; // zero out rest of array
194 fDx = 0;
195 for(i=0;i<fNpx;i++) fDx += fCellSizeX[i];
196 fDz = 0;
197 for(i=0;i<fNpz;i++) fDz += fCellSizeZ[i];
198 fDy = 300.0; //microns SPD sensitive layer thickness
199}
200
201//------------------------------
202void AliITSsegmentationSPD::Init(){
203// Initialize infromation for 6 read out chip 425X50 micron pixel SPD
204// detectors. This chip is 150 microns thick by 1.28 cm in x by 8.375 cm
205// long. It has 256 50 micron pixels in x and 197 mostly 425 micron size
206// pixels in z. The two pixels between each readout chip are 625 microns long.
207
208 Int_t i;
209 //const Float_t kconv=10000.;
210 fNpx = 256; // The number of X pixel Cell same as in fCellSizeX array size
211 fNpz = 192; // The number of Z pixel Cell same as in fCellSizeZ array size
212 for(i=0;i<fNpx;i++) fCellSizeX[i] = 50.0; // microns all the same
213 for(i=0;i<fNpz;i++) fCellSizeZ[i] = ZpitchFromCol(i); // microns
214 for(i=fNpz;i<280;i++) fCellSizeZ[i] = 0.0; // zero out rest of array
215 fDx = 0;
216 for(i=0;i<fNpx;i++) fDx += fCellSizeX[i];
217 fDz = 0;
218 for(i=0;i<fNpz;i++) fDz += fCellSizeZ[i];
219 fDy = 300.0; //microns SPD sensitive layer thickness
220 printf(" AliITSsegmentationSPD - Init: fNpx fNpz fDx fDz %d %d %f %f\n",fNpx, fNpz, fDx, fDz);
221
222}
223//------------------------------
224void AliITSsegmentationSPD::SetNCells(Int_t p1, Int_t p2){
225 // for SPD this function should be used ONLY when a beam test setup
226 // configuration is studied
227
228 fNpx=p1;
229 fNpz=p2;
230
231}
232//------------------------------
233void AliITSsegmentationSPD::SetDetSize(Float_t p1, Float_t p2, Float_t p3){
234 // for SPD this function should be used ONLY when a beam test setup
235 // configuration is studied
236
237 fDx=p1;
238 fDz=p2;
239 fDy=p3;
240
241}
242//------------------------------
243Float_t AliITSsegmentationSPD::Dpx(Int_t i){
244 //returs x pixel pitch for a give pixel
245 return fCellSizeX[i];
246}
247//------------------------------
248Float_t AliITSsegmentationSPD::Dpz(Int_t i){
249 // returns z pixel pitch for a give pixel
250 return ZpitchFromCol(i);
251}
252//------------------------------
253void AliITSsegmentationSPD::GetCellIxz(Float_t &x,Float_t &z,Int_t &ix,Int_t &iz){
254// Returns pixel coordinates (ix,iz) for given real local coordinates (x,z)
255//
256
257 // expects x, z in microns
258
259 // same segmentation on x
260 Float_t dpx=Dpx(0);
261 ix = (Int_t)(x/dpx + 1);
262 // different segmentation on z
263 iz = (Int_t)(ColFromZ(z) + 1);
264
265 x /= dpx;
266 z = ColFromZ(z);
267
268 if (iz > fNpz) iz= fNpz;
269 if (ix > fNpx) ix= fNpx;
270
271 /*
272 if (iz < -fNpz) iz= -fNpz;
273 if (ix < -fNpx) ix=-fNpx;
274 */
275}
276
277//------------------------------
278void AliITSsegmentationSPD::GetCellCxz(Int_t ix,Int_t iz,Float_t &x,Float_t&z){
279 // Transform from pixel to real local coordinates
280
281 // returns x, z in microns
282
283 Float_t dpx=Dpx(0);
284
285 x = (ix>0) ? Float_t(ix*dpx)-dpx/2. : Float_t(ix*dpx)+dpx/2.;
286 z = ZFromCol(iz);
287
288
289}
290//------------------------------
291void AliITSsegmentationSPD::
292Neighbours(Int_t iX, Int_t iZ, Int_t* Nlist, Int_t Xlist[8], Int_t Zlist[8]){
293 // returns the neighbouring pixels for use in Cluster Finders and the like.
294 /*
295 *Nlist=4;Xlist[0]=Xlist[1]=iX;Xlist[2]=iX-1;Xlist[3]=iX+1;
296 Zlist[0]=iZ-1;Zlist[1]=iZ+1;Zlist[2]=Zlist[3]=iZ;
297 */
298
299
300 *Nlist=8;
301 Xlist[0]=Xlist[1]=iX;
302 Xlist[2]=iX-1;
303 Xlist[3]=iX+1;
304 Zlist[0]=iZ-1;
305 Zlist[1]=iZ+1;
306 Zlist[2]=Zlist[3]=iZ;
307
308 // Diagonal elements
309 Xlist[4]=iX+1;
310 Zlist[4]=iZ+1;
311
312 Xlist[5]=iX-1;
313 Zlist[5]=iZ-1;
314
315 Xlist[6]=iX-1;
316 Zlist[6]=iZ+1;
317
318 Xlist[7]=iX+1;
319 Zlist[7]=iZ-1;
320}