]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSsegmentationSPD.cxx
update info about cvs installation using cvs account
[u/mrichter/AliRoot.git] / ITS / AliITSsegmentationSPD.cxx
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
20 ClassImp(AliITSsegmentationSPD)
21
22
23 Float_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 //_____________________________________________________________________________
32 Float_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 //_____________________________________________________________________________
41 Float_t ZpitchFromCol300(Int_t col) {
42   // returns Z pixel pitch for 300 micron pixels.
43   return 300.0;
44 }
45 //_____________________________________________________________________________
46 Float_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 TMath::Abs(col);
83 }
84
85 //_____________________________________________________________________________
86 Float_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
124 Float_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
142 AliITSsegmentationSPD::AliITSsegmentationSPD(){
143   // Default constructor
144    fNpx = 0;
145    fNpz = 0;
146    fCorr=0;
147    fGeom = 0;
148
149 }
150 //____________________________________________________________________________
151 AliITSsegmentationSPD::AliITSsegmentationSPD(AliITSgeom *gm){
152   // Constructor
153    fCorr=0;
154    fNpx = 0;
155    fNpz = 0;
156    Init(); 
157    fGeom = gm;
158
159 }
160 //____________________________________________________________________________
161 AliITSsegmentationSPD& AliITSsegmentationSPD::operator=(AliITSsegmentationSPD &source){
162    // = operator
163    if(this==&source) return *this;
164    this->fNpx  = source.fNpx;
165    this->fNpz  = source.fNpz;
166    this->fDx   = source.fDx;
167    this->fDy   = source.fDy;
168    Int_t i;
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 //____________________________________________________________________________
176 AliITSsegmentationSPD::AliITSsegmentationSPD(AliITSsegmentationSPD &source){
177   // copy constructor
178    *this = source;
179 }
180 //------------------------------
181 void 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     //const Float_t kconv=10000.;
188     Int_t i;
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 //------------------------------
202 void 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     //const Float_t kconv=10000.;
209     Int_t i;
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 //------------------------------
224 void AliITSsegmentationSPD::SetNPads(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 //------------------------------
233 void 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 //------------------------------
243 Float_t AliITSsegmentationSPD::Dpx(Int_t i){
244    //returs x pixel pitch for a give pixel
245    return fCellSizeX[i];
246 }
247 //------------------------------
248 Float_t AliITSsegmentationSPD::Dpz(Int_t i){
249   // returns z pixel pitch for a give pixel
250    return ZpitchFromCol(i);
251 }
252 //------------------------------
253 void AliITSsegmentationSPD::GetPadIxz(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
266     if (iz >  fNpz) iz= fNpz;
267     if (ix >  fNpx) ix= fNpx;
268     /*
269     if (iz < -fNpz) iz= -fNpz;
270     if (ix < -fNpx) ix=-fNpx;
271     */
272 }
273
274 //------------------------------
275 void AliITSsegmentationSPD::GetPadTxz(Float_t &x,Float_t &z){
276 //  local transformation of real local coordinates (x,z)
277 //
278
279     // expects x, z in microns
280
281     // same segmentation on x
282     Float_t dpx=Dpx(0);
283
284     x /= dpx;
285     z = ColFromZ(z);
286
287 }
288 //------------------------------
289 void AliITSsegmentationSPD::GetPadCxz(Int_t ix,Int_t iz,Float_t &x,Float_t&z){
290     // Transform from pixel to real local coordinates
291
292     // returns x, z in microns
293
294     Float_t dpx=Dpx(0);
295
296     x = (ix>0) ? Float_t(ix*dpx)-dpx/2. : Float_t(ix*dpx)+dpx/2.;
297     z = ZFromCol(iz);
298
299
300 }
301 //------------------------------
302 void AliITSsegmentationSPD::
303 Neighbours(Int_t iX, Int_t iZ, Int_t* Nlist, Int_t Xlist[8], Int_t Zlist[8]){
304   // returns the neighbouring pixels for use in Cluster Finders and the like.
305   /*
306     *Nlist=4;Xlist[0]=Xlist[1]=iX;Xlist[2]=iX-1;Xlist[3]=iX+1;
307     Zlist[0]=iZ-1;Zlist[1]=iZ+1;Zlist[2]=Zlist[3]=iZ;
308   */
309
310
311     *Nlist=8;
312     Xlist[0]=Xlist[1]=iX;
313     Xlist[2]=iX-1;
314     Xlist[3]=iX+1;
315     Zlist[0]=iZ-1;
316     Zlist[1]=iZ+1;
317     Zlist[2]=Zlist[3]=iZ;
318
319    // Diagonal elements
320     Xlist[4]=iX+1;
321     Zlist[4]=iZ+1;
322
323     Xlist[5]=iX-1;
324     Zlist[5]=iZ-1;
325
326     Xlist[6]=iX-1;
327     Zlist[6]=iZ+1;
328
329     Xlist[7]=iX+1;
330     Zlist[7]=iZ-1;
331 }