1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
19 #include "AliITSsegmentationSPD.h"
20 #include "AliITSgeom.h"
22 ClassImp(AliITSsegmentationSPD)
25 Float_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.
29 Float_t pitchz = 300.0;
30 col = Float_t (z/pitchz);
33 //_____________________________________________________________________________
34 Float_t ZFromCol300(Int_t col) {
35 // same comments as above
36 // Get z-coordinate for each colunm number
37 Float_t pitchz = 300.0;
42 //_____________________________________________________________________________
43 Float_t ZpitchFromCol300(Int_t col) {
44 // returns Z pixel pitch for 300 micron pixels.
47 //_____________________________________________________________________________
48 Float_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
57 col = Float_t(z/pitchz);
58 } else if( z < 14425) {
60 col = 31 + (z - 13175)/pitchz;
61 } else if( z < 27175) {
62 col = 33 + (z - 14425)/pitchz;
63 } else if( z < 28425) {
65 col = 63 + (z - 27175)/pitchz;
66 } else if( z < 41175) {
67 col = 65 + (z - 28425)/pitchz;
68 } else if( z < 42425) {
70 col = 95 + (z - 41175)/pitchz;
71 } else if( z < 55175) {
72 col = 97 + (z - 42425)/pitchz;
73 } else if( z < 56425) {
75 col = 127 + (z - 55175)/pitchz;
76 } else if( z < 69175) {
77 col = 129 + (z - 56425)/pitchz;
78 } else if( z < 70425) {
80 col = 159 + (z - 69175)/pitchz;
81 } else if( z < 83600) {
82 col = 161 + (z - 70425)/pitchz;
84 return TMath::Abs(col);
87 //_____________________________________________________________________________
88 Float_t ZFromCol(Int_t col) {
89 // same comments as above
90 // Get z-coordinate for each colunm number
94 if( col >=0 && col <= 30 ) {
95 z = (col + 0.5)*pitchz;
96 } else if( col >= 31 && col <= 32) {
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) {
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) {
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) {
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) {
118 z = 69175 + (col -159 + 0.5)*pitchz;
119 } else if( col >= 161 && col <= 191) {
120 z = 70425 + (col -161 + 0.5)*pitchz;
125 //______________________________________________________________________
126 Float_t ZpitchFromCol(Int_t col) {
127 // Get pitch size in z direction for each colunm
129 Float_t pitchz = 425;
132 } else if(col >= 31 && col <= 32) {
134 } else if(col >= 63 && col <= 64) {
136 } else if(col >= 95 && col <= 96) {
138 } else if(col >= 127 && col <= 128) {
140 } else if(col >= 159 && col <= 160) {
147 //______________________________________________________________________
148 AliITSsegmentationSPD::AliITSsegmentationSPD(){
149 // Default constructor
156 //______________________________________________________________________
157 AliITSsegmentationSPD::AliITSsegmentationSPD(AliITSgeom *gm){
166 //______________________________________________________________________
167 AliITSsegmentationSPD& AliITSsegmentationSPD::operator=(AliITSsegmentationSPD &source){
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;
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.
181 //____________________________________________________________________________
182 AliITSsegmentationSPD::AliITSsegmentationSPD(AliITSsegmentationSPD &source){
186 //----------------------------------------------------------------------
187 void AliITSsegmentationSPD::SetBinSize(Float_t *x,Float_t *z){
188 // Fills the array of pixel sizes in x, microns
189 // The input array x must have 256 elements.
192 for(i=0;i<256;i++) fCellSizeX[i] = x[i];
193 for(i=0;i<280;i++) fCellSizeX[i] = z[i];
196 //----------------------------------------------------------------------
197 void AliITSsegmentationSPD::Init300(){
198 // Initialize infromation for 6 read out chip 300X50 micron pixel SPD
199 // detectors. This chip is 150 microns thick by 1.28 cm in x by 8.37 cm
200 // long. It has 256 50 micron pixels in x and 279 300 micron size
203 //const Float_t kconv=10000.;
205 fNpx = 256; // The number of X pixel Cell same as in fCellSizeX array size
206 fNpz = 279; // The number of Z pixel Cell same as in fCellSizeZ array size
207 for(i=0;i<fNpx;i++) fCellSizeX[i] = 50.0; // microns all the same
208 for(i=0;i<fNpz;i++) fCellSizeZ[i] = ZpitchFromCol300(i); // microns
209 for(i=fNpz;i<280;i++) fCellSizeZ[i] = 0.0; // zero out rest of array
211 for(i=0;i<fNpx;i++) fDx += fCellSizeX[i];
213 for(i=0;i<fNpz;i++) fDz += fCellSizeZ[i];
214 fDy = 300.0; //microns SPD sensitive layer thickness
217 //------------------------------
218 void AliITSsegmentationSPD::Init(){
219 // Initialize infromation for 6 read out chip 425X50 micron pixel SPD
220 // detectors. This chip is 150 microns thick by 1.28 cm in x by 8.375 cm
221 // long. It has 256 50 micron pixels in x and 197 mostly 425 micron size
222 // pixels in z. The two pixels between each readout chip are 625 microns long.
224 //const Float_t kconv=10000.;
226 fNpx = 256; // The number of X pixel Cell same as in fCellSizeX array size
227 fNpz = 192; // The number of Z pixel Cell same as in fCellSizeZ array size
228 for(i=0;i<fNpx;i++) fCellSizeX[i] = 50.0; // microns all the same
229 for(i=0;i<fNpz;i++) fCellSizeZ[i] = ZpitchFromCol(i); // microns
230 for(i=fNpz;i<280;i++) fCellSizeZ[i] = 0.0; // zero out rest of array
232 for(i=0;i<fNpx;i++) fDx += fCellSizeX[i];
234 for(i=0;i<fNpz;i++) fDz += fCellSizeZ[i];
235 fDy = 300.0; //microns SPD sensitive layer thickness
236 //printf(" AliITSsegmentationSPD - Init: fNpx fNpz fDx fDz %d %d %f %f\n",fNpx, fNpz, fDx, fDz);
239 //------------------------------
240 void AliITSsegmentationSPD::SetNPads(Int_t p1, Int_t p2){
241 // for SPD this function should be used ONLY when a beam test setup
242 // configuration is studied
248 //------------------------------
249 void AliITSsegmentationSPD::SetDetSize(Float_t p1, Float_t p2, Float_t p3){
250 // for SPD this function should be used ONLY when a beam test setup
251 // configuration is studied
258 //------------------------------
259 Float_t AliITSsegmentationSPD::Dpx(Int_t i){
260 //returs x pixel pitch for a give pixel
261 return fCellSizeX[i];
263 //------------------------------
264 Float_t AliITSsegmentationSPD::Dpz(Int_t i){
265 // returns z pixel pitch for a give pixel
266 return ZpitchFromCol(i);
268 //------------------------------
269 void AliITSsegmentationSPD::GetPadIxz(Float_t x,Float_t z,Int_t &ix,Int_t &iz){
270 // Returns pixel coordinates (ix,iz) for given real local coordinates (x,z)
273 // expects x, z in microns
275 // same segmentation on x
277 ix = (Int_t)(x/dpx + 1);
278 // different segmentation on z
279 iz = (Int_t)(ColFromZ(z) + 1);
282 if (iz > fNpz) iz= fNpz;
283 if (ix > fNpx) ix= fNpx;
285 if (iz < -fNpz) iz= -fNpz;
286 if (ix < -fNpx) ix=-fNpx;
290 //------------------------------
291 void AliITSsegmentationSPD::GetPadTxz(Float_t &x,Float_t &z){
292 // local transformation of real local coordinates (x,z)
295 // expects x, z in microns
297 // same segmentation on x
304 //------------------------------
305 void AliITSsegmentationSPD::GetPadCxz(Int_t ix,Int_t iz,Float_t &x,Float_t&z){
306 // Transform from pixel to real local coordinates
308 // returns x, z in microns
312 x = (ix>0) ? Float_t(ix*dpx)-dpx/2. : Float_t(ix*dpx)+dpx/2.;
317 //------------------------------
318 void AliITSsegmentationSPD::
319 Neighbours(Int_t iX, Int_t iZ, Int_t* Nlist, Int_t Xlist[8], Int_t Zlist[8]){
320 // returns the neighbouring pixels for use in Cluster Finders and the like.
322 *Nlist=4;Xlist[0]=Xlist[1]=iX;Xlist[2]=iX-1;Xlist[3]=iX+1;
323 Zlist[0]=iZ-1;Zlist[1]=iZ+1;Zlist[2]=Zlist[3]=iZ;
328 Xlist[0]=Xlist[1]=iX;
333 Zlist[2]=Zlist[3]=iZ;
348 //______________________________________________________________________
349 void AliITSsegmentationSPD::LocalToDet(Float_t x,Float_t z,Int_t &ix,Int_t &iz){
350 // Transformation from Geant detector centered local coordinates (cm) to
351 // Pixel cell numbers ix and iz.
353 // Float_t x detector local coordinate x in cm with respect to the
354 // center of the sensitive volume.
355 // Float_t z detector local coordinate z in cm with respect to the
356 // center of the sensitive volulme.
358 // Int_t ix detector x cell coordinate. Has the range 0<=ix<fNpx.
359 // Int_t iz detector z cell coordinate. Has the range 0<=iz<fNpz.
360 // A value of -1 for ix or iz indecates that this point is outside of the
361 // detector segmentation as defined.
364 const Float_t kconv = 1.0E-04; // converts microns to cm.
366 dx = -0.5*kconv*Dx();
367 dz = -0.5*kconv*Dz();
370 if(x<dx) return; // outside x range.
371 if(z<dz) return; // outside z range.
372 for(i=0;i<Npx();i++){
373 dx += kconv*fCellSizeX[i];
376 if(i>=Npx()) return; // outside x range.
377 for(j=0;j<Npz();j++){
378 dz += kconv*fCellSizeZ[j];
381 if(j>=Npz()) return; // outside z range.
384 return; // Found ix and iz, return.
386 //______________________________________________________________________
387 void AliITSsegmentationSPD::DetToLocal(Int_t ix,Int_t iz,Float_t &x,Float_t &z)
389 // Transformation from Detector cell coordiantes to Geant detector centerd
390 // local coordinates (cm).
392 // Int_t ix detector x cell coordinate. Has the range 0<=ix<fNpx.
393 // Int_t iz detector z cell coordinate. Has the range 0<=iz<fNpz.
395 // Float_t x detector local coordinate x in cm with respect to the
396 // center of the sensitive volume.
397 // Float_t z detector local coordinate z in cm with respect to the
398 // center of the sensitive volulme.
399 // If ix and or iz is outside of the segmentation range a value of -0.5*Dx()
400 // or -0.5*Dz() is returned.
402 const Float_t kconv = 1.0E-04; // converts microns to cm.
404 x = -0.5*kconv*Dx(); // default value.
405 z = -0.5*kconv*Dz(); // default value.
406 if(ix<0 || ix>=Npx()) return; // outside of detector
407 if(iz<0 || iz>=Npz()) return; // outside of detctor
408 for(i=0;i<ix;i++) x += kconv*fCellSizeX[i]; // sum up to cell ix-1
409 x += 0.5*kconv*fCellSizeX[ix]; // add 1/2 of cell ix for center location.
410 for(j=0;j<iz;j++) z += kconv*fCellSizeZ[j]; // sum up cell iz-1
411 z += 0.5*kconv*fCellSizeZ[iz]; // add 1/2 of cell iz for center location.
412 return; // Found x and z, return.