Line data Source code
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 : /* $Id$ */
17 : #include <TGeoManager.h>
18 : #include <TGeoVolume.h>
19 : #include <TGeoBBox.h>
20 : #include "AliITSsegmentationSPD.h"
21 :
22 : //////////////////////////////////////////////////////
23 : // Segmentation class for //
24 : // pixels //
25 : // //
26 : //////////////////////////////////////////////////////
27 : const Int_t AliITSsegmentationSPD::fgkNchipsPerModule = 5;
28 : const Int_t AliITSsegmentationSPD::fgkNcolumnsPerChip = 32;
29 118 : ClassImp(AliITSsegmentationSPD)
30 :
31 : //_____________________________________________________________________________
32 325 : AliITSsegmentationSPD::AliITSsegmentationSPD(Option_t *opt): AliITSsegmentation(),
33 325 : fNpx(0),
34 1950 : fNpz(0){
35 : // Default constructor
36 :
37 : // Initialization to default values
38 325 : Init();
39 :
40 : // Initialization of detector dimensions from TGeo
41 650 : if(strstr(opt,"TGeo")){
42 0 : if(!gGeoManager){
43 0 : AliError("Geometry is not initialized\n Using hardwired default values");
44 : return;
45 : }
46 : TGeoVolume *v=NULL;
47 0 : v = gGeoManager->GetVolume("ITSSPDlay1-sensor");
48 0 : if(!v){
49 0 : AliWarning("TGeo volume ITSSPDlay1-sensor not found (hint: use v11Hybrid geometry)\n Using hardwired default values");
50 : }
51 : else {
52 0 : TGeoBBox *s=(TGeoBBox*)v->GetShape();
53 0 : SetDetSize(s->GetDX()*20000.,s->GetDZ()*20000.,s->GetDY()*20000.);
54 : }
55 0 : }
56 650 : }
57 :
58 : //_____________________________________________________________________________
59 : Float_t AliITSsegmentationSPD::ColFromZ300(Float_t z) const {
60 : // Get column number for each z-coordinate taking into account the
61 : // extra pixels in z direction assuming 300 micron sized pixels.
62 : Float_t col = 0.0;
63 : Float_t pitchz = 300.0;
64 0 : col = Float_t (z/pitchz);
65 0 : return col;
66 : }
67 : //_____________________________________________________________________________
68 : Float_t AliITSsegmentationSPD::ZFromCol300(Int_t col) const {
69 : // same comments as above
70 : // Get z-coordinate for each colunm number
71 : Float_t pitchz = 300.0;
72 : Float_t z = 0.0;
73 0 : z = (col+0.5)*pitchz;
74 0 : return z;
75 : }
76 : //_____________________________________________________________________________
77 : Float_t AliITSsegmentationSPD::Zpitch300() const {
78 : // returns Z pixel pitch for 300 micron pixels.
79 :
80 0 : return 300.0;
81 : }
82 : //_____________________________________________________________________________
83 : Float_t AliITSsegmentationSPD::ColFromZ(Float_t z) const {
84 : // hard-wired - keep it like this till we can parametrise
85 : // and get rid of AliITSgeomSPD425
86 : // Get column number for each z-coordinate taking into account the
87 : // extra pixels in z direction
88 : Int_t i;
89 : Float_t s,col;
90 :
91 0 : if(z<0||z>fDz){
92 0 : AliError(Form("z=%f outside of range 0.0<=z<fDz=%f",z,fDz));
93 0 : return 0.0; // error
94 : } // end if outsize of detector
95 : s = 0.0;
96 : i = -1;
97 0 : do {
98 0 : i++;
99 0 : s += fCellSizeZ[i];
100 0 : } while(z>s);
101 0 : s -= fCellSizeZ[i];
102 0 : col = (Float_t) i + (z-s)/fCellSizeZ[i];
103 0 : return col;
104 :
105 : /*
106 : Float_t col = 0;
107 : Float_t pitchz = 425;
108 : if( z < 13175) {
109 : col = Float_t(z/pitchz);
110 : } else if( z < 14425) {
111 : pitchz = 625;
112 : col = 31 + (z - 13175)/pitchz;
113 : } else if( z < 27175) {
114 : col = 33 + (z - 14425)/pitchz;
115 : } else if( z < 28425) {
116 : pitchz = 625;
117 : col = 63 + (z - 27175)/pitchz;
118 : } else if( z < 41175) {
119 : col = 65 + (z - 28425)/pitchz;
120 : } else if( z < 42425) {
121 : pitchz = 625;
122 : col = 95 + (z - 41175)/pitchz;
123 : } else if( z < 55175) {
124 : col = 97 + (z - 42425)/pitchz;
125 : } else if( z < 56425) {
126 : pitchz = 625;
127 : col = 127 + (z - 55175)/pitchz;
128 : } else if( z < 69175) {
129 : col = 129 + (z - 56425)/pitchz;
130 : } else if( z < 70425) {
131 : pitchz = 625;
132 : col = 159 + (z - 69175)/pitchz;
133 : } else if( z < 83600) {
134 : col = 161 + (z - 70425)/pitchz;
135 : }
136 : return TMath::Abs(col);*/
137 0 : }
138 :
139 : //_____________________________________________________________________________
140 : Float_t AliITSsegmentationSPD::ZFromCol(Int_t col) const {
141 : // same comments as above
142 : // Get z-coordinate for each colunm number
143 : Int_t i;
144 : Float_t z;
145 :
146 0 : if(col<0||col>=fNpz){
147 0 : AliError(Form("col=%d outside of range 0<=col<fNpZ=%d",col,fNpz));
148 0 : return 0.0; // error
149 : } // end if outsize of detector
150 : z = 0.0;
151 0 : for(i=0;i<col;i++) z += fCellSizeZ[i];
152 0 : z += 0.5*fCellSizeZ[col];
153 0 : return z;
154 :
155 : /*
156 : Float_t pitchz = 425;
157 : Float_t z = 0;
158 : if( col >=0 && col <= 30 ) {
159 : z = (col + 0.5)*pitchz;
160 : } else if( col >= 31 && col <= 32) {
161 : pitchz = 625;
162 : z = 13175 + (col -31 + 0.5)*pitchz;
163 : } else if( col >= 33 && col <= 62) {
164 : z = 14425 + (col -33 + 0.5)*pitchz;
165 : } else if( col >= 63 && col <= 64) {
166 : pitchz = 625;
167 : z = 27175 + (col -63 + 0.5)*pitchz;
168 : } else if( col >= 65 && col <= 94) {
169 : z = 28425 + (col -65 + 0.5)*pitchz;
170 : } else if( col >= 95 && col <= 96) {
171 : pitchz = 625;
172 : z = 41175 + (col -95 + 0.5)*pitchz;
173 : } else if( col >= 97 && col <= 126) {
174 : z = 42425 + (col -97 + 0.5)*pitchz;
175 : } else if( col >= 127 && col <= 128) {
176 : pitchz = 625;
177 : z = 55175 + (col -127 + 0.5)*pitchz;
178 : } else if( col >= 129 && col <= 158) {
179 : z = 56425 + (col -129 + 0.5)*pitchz;
180 : } else if( col >= 159 && col <= 160) {
181 : pitchz = 625;
182 : z = 69175 + (col -159 + 0.5)*pitchz;
183 : } else if( col >= 161 && col <= 191) {
184 : z = 70425 + (col -161 + 0.5)*pitchz;
185 : }
186 :
187 : return z;*/
188 0 : }
189 : //______________________________________________________________________
190 : Float_t AliITSsegmentationSPD::ZpitchFromCol(Int_t col) const {
191 : // Get pitch size in z direction for each colunm
192 :
193 : Float_t pitchz = 425.;
194 0 : if(col < 0){
195 : pitchz = 0.0;
196 0 : } else if(col >= 31 && col <= 32) {
197 : pitchz = 625.;
198 0 : } else if(col >= 63 && col <= 64) {
199 : pitchz = 625.;
200 0 : } else if(col >= 95 && col <= 96) {
201 : pitchz = 625.;
202 0 : } else if(col >= 127 && col <= 128) {
203 : pitchz = 625.;
204 0 : } else if(col >= 159 && col <= 160) {
205 : pitchz = 625.;
206 0 : } else if(col>=192){
207 : pitchz = 425.;
208 0 : }
209 0 : return pitchz;
210 : }
211 :
212 : //______________________________________________________________________
213 : void AliITSsegmentationSPD::Copy(TObject &obj) const {
214 : // protected method. copy this to obj
215 0 : AliITSsegmentation::Copy(obj);
216 0 : ((AliITSsegmentationSPD& ) obj).fNpx = fNpx;
217 0 : ((AliITSsegmentationSPD& ) obj).fNpz = fNpz;
218 : Int_t i;
219 0 : for(i=0;i<256;i++)
220 0 : ((AliITSsegmentationSPD& ) obj).fCellSizeX[i] = fCellSizeX[i];
221 0 : for(i=0;i<280;i++)
222 0 : ((AliITSsegmentationSPD& ) obj).fCellSizeZ[i] = fCellSizeZ[i];
223 0 : }
224 :
225 : //______________________________________________________________________
226 : AliITSsegmentationSPD& AliITSsegmentationSPD::operator=(const AliITSsegmentationSPD &source){
227 : // = operator
228 0 : if(this==&source) return *this;
229 0 : source.Copy(*this);
230 0 : return *this;
231 0 : }
232 : //____________________________________________________________________________
233 : AliITSsegmentationSPD::AliITSsegmentationSPD(const AliITSsegmentationSPD &source) :
234 0 : AliITSsegmentation(source),
235 0 : fNpx(0),
236 0 : fNpz(0){
237 0 : for(Int_t i=0; i<256; i++)fCellSizeX[i]=0.;
238 0 : for(Int_t i=0; i<280; i++)fCellSizeZ[i]=0.;
239 : // copy constructor
240 0 : source.Copy(*this);
241 0 : }
242 : //----------------------------------------------------------------------
243 : void AliITSsegmentationSPD::SetBinSize(Float_t *x,Float_t *z){
244 : // Fills the array of pixel sizes in x, microns
245 : // The input array x must have 256 elements.
246 : Int_t i;
247 :
248 167375 : for(i=0;i<256;i++) fCellSizeX[i] = x[i];
249 182650 : for(i=0;i<280;i++) fCellSizeZ[i] = z[i];
250 : return;
251 325 : }
252 : //----------------------------------------------------------------------
253 : void AliITSsegmentationSPD::Init300(){
254 : // Initialize infromation for 6 read out chip 300X50 micron pixel SPD
255 : // detectors. This chip is 150 microns thick by 1.28 cm in x by 8.37 cm
256 : // long. It has 256 50 micron pixels in x and 279 300 micron size
257 : // pixels in z.
258 :
259 : //const Float_t kconv=10000.;
260 : Int_t i;
261 0 : fNpx = 256; // The number of X pixel Cell same as in fCellSizeX array size
262 0 : fNpz = 279; // The number of Z pixel Cell same as in fCellSizeZ array size
263 0 : for(i=0;i<fNpx;i++) fCellSizeX[i] = 50.0; // microns all the same
264 0 : for(i=0;i<280;i++) fCellSizeZ[i] = Zpitch300(); // microns
265 : // for(i=fNpz;i<280;i++) fCellSizeZ[i] = 0.0; // zero out rest of array
266 0 : fDx = 0;
267 0 : for(i=0;i<fNpx;i++) fDx += fCellSizeX[i];
268 0 : fDz = 0;
269 0 : for(i=0;i<fNpz;i++) fDz += fCellSizeZ[i];
270 0 : fDy = 300.0; //microns SPD sensitive layer thickness
271 0 : }
272 :
273 : //------------------------------
274 : void AliITSsegmentationSPD::Init(){
275 : // Initialize information for 5 read out chip 425X50 micron pixel SPD
276 : // detectors (ladder).
277 : // Each readout chip is 150 micron thick.
278 : // The ladder sensor is 200 micron thick by 1.28 cm in x by 6.96 cm in z.
279 : // It has 256 50 micron pixels in x and 160 mostly 425 micron pixels in z.
280 : // The two pixels at boundary between two adjacent readout chips are
281 : // 625 micron long.
282 :
283 650 : Float_t bx[256],bz[280];
284 : Int_t i;
285 325 : SetNPads(256,160); // Number of Bins in x and z
286 167050 : for(i=000;i<256;i++) bx[i] = 50.0; // in x all are 50 microns.
287 104650 : for(i=000;i<160;i++) bz[i] = 425.0; // most are 425 microns except below
288 78650 : for(i=160;i<280;i++) bz[i] = 0.0; // Outside of detector.
289 325 : bz[ 31] = bz[ 32] = 625.0; // first chip boundary
290 325 : bz[ 63] = bz[ 64] = 625.0; // first chip boundary
291 325 : bz[ 95] = bz[ 96] = 625.0; // first chip boundary
292 325 : bz[127] = bz[128] = 625.0; // first chip boundary
293 325 : bz[160] = 425.0; // Set so that there is no zero pixel size for fNz.
294 325 : SetBinSize(bx,bz);
295 325 : SetDetSize(12800,69600,200); // full lengths (x,z,y) in microns
296 :
297 325 : }
298 : //------------------------------
299 : void AliITSsegmentationSPD::SetNPads(Int_t p1, Int_t p2){
300 : // for SPD this function should be used ONLY when a beam test setup
301 : // configuration is studied
302 :
303 650 : fNpx=p1;
304 325 : fNpz=p2;
305 :
306 325 : }
307 :
308 : //------------------------------
309 : Float_t AliITSsegmentationSPD::Dpx(Int_t i) const {
310 : //returs x pixel pitch for a give pixel
311 161200 : if(i<0||i>=256) return 0.0;
312 80600 : return fCellSizeX[i];
313 80600 : }
314 : //------------------------------
315 : Float_t AliITSsegmentationSPD::Dpz(Int_t i) const {
316 : // returns z pixel pitch for a give pixel
317 161200 : if(i<0||i>=280) return 0.0;
318 80600 : return fCellSizeZ[i];
319 80600 : }
320 : //------------------------------
321 : void AliITSsegmentationSPD::GetPadIxz(Float_t x,Float_t z,Int_t &ix,Int_t &iz) const {
322 : // Returns pixel coordinates (ix,iz) for given real local coordinates (x,z)
323 : //
324 :
325 : // expects x, z in microns
326 :
327 : // same segmentation on x
328 0 : Float_t dpx=Dpx(0);
329 0 : ix = (Int_t)(x/dpx + 1);
330 : // different segmentation on z
331 0 : iz = (Int_t)(ColFromZ(z) + 1);
332 :
333 :
334 0 : if (iz > fNpz) iz= fNpz;
335 0 : if (ix > fNpx) ix= fNpx;
336 : /*
337 : if (iz < -fNpz) iz= -fNpz;
338 : if (ix < -fNpx) ix=-fNpx;
339 : */
340 0 : }
341 :
342 : //------------------------------
343 : void AliITSsegmentationSPD::GetPadTxz(Float_t &x,Float_t &z) const{
344 : // local transformation of real local coordinates (x,z)
345 : //
346 :
347 : // expects x, z in microns
348 :
349 : // same segmentation on x
350 0 : Float_t dpx=Dpx(0);
351 :
352 0 : x /= dpx;
353 0 : z = ColFromZ(z);
354 :
355 0 : }
356 : //------------------------------
357 : void AliITSsegmentationSPD::GetPadCxz(Int_t ix,Int_t iz,Float_t &x,Float_t&z) const {
358 : // Transform from pixel to real local coordinates
359 :
360 : // returns x, z in microns
361 :
362 0 : Float_t dpx=Dpx(0);
363 :
364 0 : x = (ix>0) ? Float_t(ix*dpx)-dpx/2. : Float_t(ix*dpx)+dpx/2.;
365 0 : z = ZFromCol(iz);
366 :
367 :
368 0 : }
369 : //------------------------------
370 : void AliITSsegmentationSPD::
371 : Neighbours(Int_t iX, Int_t iZ, Int_t* Nlist, Int_t Xlist[8], Int_t Zlist[8]) const {
372 : // returns the neighbouring pixels for use in Cluster Finders and the like.
373 : /*
374 : *Nlist=4;Xlist[0]=Xlist[1]=iX;Xlist[2]=iX-1;Xlist[3]=iX+1;
375 : Zlist[0]=iZ-1;Zlist[1]=iZ+1;Zlist[2]=Zlist[3]=iZ;
376 : */
377 :
378 :
379 0 : *Nlist=8;
380 0 : Xlist[0]=Xlist[1]=iX;
381 0 : Xlist[2]=iX-1;
382 0 : Xlist[3]=iX+1;
383 0 : Zlist[0]=iZ-1;
384 0 : Zlist[1]=iZ+1;
385 0 : Zlist[2]=Zlist[3]=iZ;
386 :
387 : // Diagonal elements
388 0 : Xlist[4]=iX+1;
389 0 : Zlist[4]=iZ+1;
390 :
391 0 : Xlist[5]=iX-1;
392 0 : Zlist[5]=iZ-1;
393 :
394 0 : Xlist[6]=iX-1;
395 0 : Zlist[6]=iZ+1;
396 :
397 0 : Xlist[7]=iX+1;
398 0 : Zlist[7]=iZ-1;
399 0 : }
400 : //______________________________________________________________________
401 : Bool_t AliITSsegmentationSPD::LocalToDet(Float_t x,Float_t z,
402 : Int_t &ix,Int_t &iz) const {
403 : // Transformation from Geant detector centered local coordinates (cm) to
404 : // Pixel cell numbers ix and iz.
405 : // Input:
406 : // Float_t x detector local coordinate x in cm with respect to
407 : // the center of the sensitive volume.
408 : // Float_t z detector local coordinate z in cm with respect to
409 : // the center of the sensitive volulme.
410 : // Output:
411 : // Int_t ix detector x cell coordinate. Has the range
412 : // 0<=ix<fNpx.
413 : // Int_t iz detector z cell coordinate. Has the range
414 : // 0<=iz<fNpz.
415 : // Return:
416 : // kTRUE if point x,z is inside sensitive volume, kFALSE otherwise.
417 : // A value of -1 for ix or iz indecates that this point is outside of the
418 : // detector segmentation as defined.
419 : Int_t i,j;
420 : Float_t dx,dz;
421 : const Float_t kconv = 1.0E-04; // converts microns to cm.
422 :
423 8938 : dx = -0.5*kconv*Dx();
424 4469 : dz = -0.5*kconv*Dz();
425 4469 : ix = -1;
426 4469 : iz = -1;
427 4469 : if(x<dx) return kFALSE; // outside x range.
428 4469 : if(z<dz) return kFALSE; // outside z range.
429 1205718 : for(i=0;i<Npx();i++){
430 602859 : dx += kconv*fCellSizeX[i];
431 602859 : if(x<dx) break;
432 : } // end for i
433 4469 : if(i>=Npx()) return kFALSE; // outside x range.
434 723384 : for(j=0;j<Npz();j++){
435 361692 : dz += kconv*fCellSizeZ[j];
436 361692 : if(z<dz) break;
437 : } // end for j
438 4469 : if(j>=Npz()) return kFALSE; // outside z range.
439 4469 : ix = i;
440 4469 : iz = j;
441 4469 : return kTRUE; // Found ix and iz, return.
442 4469 : }
443 : //______________________________________________________________________
444 : void AliITSsegmentationSPD::DetToLocal(Int_t ix,Int_t iz,Float_t &x,Float_t &z) const
445 : {
446 : // Transformation from Detector cell coordiantes to Geant detector centerd
447 : // local coordinates (cm).
448 : // Input:
449 : // Int_t ix detector x cell coordinate. Has the range 0<=ix<fNpx.
450 : // Int_t iz detector z cell coordinate. Has the range 0<=iz<fNpz.
451 : // Output:
452 : // Float_t x detector local coordinate x in cm with respect to the
453 : // center of the sensitive volume.
454 : // Float_t z detector local coordinate z in cm with respect to the
455 : // center of the sensitive volulme.
456 : // If ix and or iz is outside of the segmentation range a value of -0.5*Dx()
457 : // or -0.5*Dz() is returned.
458 : Int_t i,j;
459 : const Float_t kconv = 1.0E-04; // converts microns to cm.
460 :
461 80600 : x = -0.5*kconv*Dx(); // default value.
462 40300 : z = -0.5*kconv*Dz(); // default value.
463 80600 : if(ix<0 || ix>=Npx()) return; // outside of detector
464 80600 : if(iz<0 || iz>=Npz()) return; // outside of detctor
465 10865622 : for(i=0;i<ix;i++) x += kconv*fCellSizeX[i]; // sum up to cell ix-1
466 40300 : x += 0.5*kconv*fCellSizeX[ix]; // add 1/2 of cell ix for center location.
467 7811620 : for(j=0;j<iz;j++) z += kconv*fCellSizeZ[j]; // sum up cell iz-1
468 40300 : z += 0.5*kconv*fCellSizeZ[iz]; // add 1/2 of cell iz for center location.
469 40300 : return; // Found x and z, return.
470 40300 : }
471 : //______________________________________________________________________
472 : void AliITSsegmentationSPD::CellBoundries(Int_t ix,Int_t iz,
473 : Double_t &xl,Double_t &xu,
474 : Double_t &zl,Double_t &zu) const
475 : {
476 : // Transformation from Detector cell coordiantes to Geant detector centerd
477 : // local coordinates (cm).
478 : // Input:
479 : // Int_t ix detector x cell coordinate. Has the range 0<=ix<fNpx.
480 : // Int_t iz detector z cell coordinate. Has the range 0<=iz<fNpz.
481 : // Output:
482 : // Double_t xl detector local coordinate cell lower bounds x in cm
483 : // with respect to the center of the sensitive volume.
484 : // Double_t xu detector local coordinate cell upper bounds x in cm
485 : // with respect to the center of the sensitive volume.
486 : // Double_t zl detector local coordinate lower bounds z in cm with
487 : // respect to the center of the sensitive volulme.
488 : // Double_t zu detector local coordinate upper bounds z in cm with
489 : // respect to the center of the sensitive volulme.
490 : // If ix and or iz is outside of the segmentation range a value of -0.5*Dx()
491 : // and -0.5*Dx() or -0.5*Dz() and -0.5*Dz() are returned.
492 : Int_t i,j;
493 : const Float_t kconv = 1.0E-04; // converts microns to cm.
494 : Float_t x,z;
495 :
496 0 : xl = xu = x = -0.5*kconv*Dx(); // default value.
497 0 : zl = zu = z = -0.5*kconv*Dz(); // default value.
498 0 : if(ix<0 || ix>=Npx()) return; // outside of detector
499 0 : if(iz<0 || iz>=Npz()) return; // outside of detctor
500 0 : for(i=0;i<ix;i++) x += kconv*fCellSizeX[i]; // sum up to cell ix-1
501 0 : xl = x;
502 0 : x += kconv*fCellSizeX[ix];
503 0 : xu = x;
504 0 : for(j=0;j<iz;j++) z += kconv*fCellSizeZ[j]; // sum up cell iz-1
505 0 : zl = z;
506 0 : z += kconv*fCellSizeZ[iz];
507 0 : zu = z;
508 0 : return; // Found x and z, return.
509 0 : }
510 : //----------------------------------------------------------------------
511 : Int_t AliITSsegmentationSPD::GetChipFromChannel(Int_t, Int_t iz) const {
512 : // returns chip number (in range 0-4) starting from channel number
513 4900 : if(iz>=fNpz || iz<0 ){
514 0 : AliWarning("Bad cell number");
515 0 : return -1;
516 : }
517 2450 : Int_t theChip=iz/fgkNcolumnsPerChip;
518 : return theChip;
519 2450 : }
520 : //----------------------------------------------------------------------
521 : Int_t AliITSsegmentationSPD::GetChipFromLocal(Float_t, Float_t zloc) const {
522 : // returns chip number (in range 0-4) starting from local coordinates
523 4900 : Int_t ix0,iz;
524 2450 : if (!LocalToDet(0,zloc,ix0,iz)) {
525 0 : AliWarning("Bad local coordinate");
526 0 : return -1;
527 : }
528 2450 : return GetChipFromChannel(ix0,iz);
529 2450 : }
530 : //----------------------------------------------------------------------
531 : Int_t AliITSsegmentationSPD::GetChipsInLocalWindow(Int_t* array, Float_t zmin, Float_t zmax, Float_t, Float_t) const {
532 : // returns the number of chips containing a road defined by given local coordinate limits
533 :
534 : const Float_t kconv = 1.0E-04; // converts microns to cm.
535 :
536 2304 : if (zmin>zmax) {
537 0 : AliWarning("Bad coordinate limits: zmin>zmax!");
538 0 : return -1;
539 : }
540 :
541 : Int_t nChipInW = 0;
542 :
543 1152 : Float_t zminDet = -0.5*kconv*Dz();
544 1152 : Float_t zmaxDet = 0.5*kconv*Dz();
545 1152 : if(zmin<zminDet) zmin=zminDet;
546 1152 : if(zmax>zmaxDet) zmax=zmaxDet;
547 :
548 1152 : Int_t n1 = GetChipFromLocal(0,zmin);
549 1152 : array[nChipInW] = n1;
550 : nChipInW++;
551 :
552 1152 : Int_t n2 = GetChipFromLocal(0,zmax);
553 :
554 1152 : if(n2!=n1){
555 606 : Int_t imin=TMath::Min(n1,n2);
556 606 : Int_t imax=TMath::Max(n1,n2);
557 3636 : for(Int_t ichip=imin; ichip<=imax; ichip++){
558 1212 : if(ichip==n1) continue;
559 606 : array[nChipInW]=ichip;
560 606 : nChipInW++;
561 606 : }
562 606 : }
563 :
564 : return nChipInW;
565 1152 : }
566 : //----------------------------------------------------------------------
|