]>
Commit | Line | Data |
---|---|---|
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 | **************************************************************************/ | |
4ae5bbc4 | 15 | |
88cb7938 | 16 | /* $Id$ */ |
b0f5e3fc | 17 | |
4ae5bbc4 | 18 | #include <Riostream.h> |
55d2c544 | 19 | #include <TMath.h> |
c9649d1e | 20 | #include <TGeoManager.h> |
21 | #include <TGeoVolume.h> | |
22 | #include <TGeoBBox.h> | |
b0f5e3fc | 23 | #include "AliITSsegmentationSSD.h" |
55d2c544 | 24 | |
25 | ////////////////////////////////////////////////////// | |
26 | // Segmentation class for // | |
27 | // silicon strips // | |
28 | // // | |
29 | ////////////////////////////////////////////////////// | |
c60e9baf | 30 | const Float_t AliITSsegmentationSSD::fgkDxDefault = 73000.; |
55d2c544 | 31 | const Float_t AliITSsegmentationSSD::fgkDzDefault = 40000.; |
32 | const Float_t AliITSsegmentationSSD::fgkDyDefault = 300.; | |
33 | const Float_t AliITSsegmentationSSD::fgkPitchDefault = 95.; | |
34 | const Int_t AliITSsegmentationSSD::fgkNstripsDefault = 768; | |
6d38396a | 35 | const Int_t AliITSsegmentationSSD::fgkNchipsPerSide = 6; |
36 | const Int_t AliITSsegmentationSSD::fgkNstripsPerChip = 128; | |
fd61217e | 37 | |
b0f5e3fc | 38 | ClassImp(AliITSsegmentationSSD) |
fa4f0f62 | 39 | |
c9649d1e | 40 | AliITSsegmentationSSD::AliITSsegmentationSSD(Option_t *opt): AliITSsegmentation(), |
e56160b8 | 41 | fNstrips(0), |
42 | fStereoP(0), | |
43 | fStereoN(0), | |
44 | fPitch(0), | |
45 | fStereoPl5(0), | |
46 | fStereoNl5(0), | |
47 | fStereoPl6(0), | |
48 | fStereoNl6(0), | |
49 | fLayer(0){ | |
179578b2 | 50 | // default constructor |
fa4f0f62 | 51 | SetDetSize(fgkDxDefault,fgkDzDefault,fgkDyDefault); |
52 | SetPadSize(fgkPitchDefault,0.); | |
53 | SetNPads(fgkNstripsDefault,0); | |
54 | SetAngles(); | |
c9649d1e | 55 | if(strstr(opt,"TGeo")){ |
56 | if(!gGeoManager){ | |
57 | AliError("Geometry is not initialized\n"); | |
58 | return; | |
59 | } | |
60 | TGeoVolume *v=NULL; | |
61 | v = gGeoManager->GetVolume("ITSssdSensitivL5"); | |
62 | if(!v){ | |
63 | AliWarning("TGeo volumeITSssdSensitivL5 not found (hint: use v11Hybrid geometry)\n Using hardwired default values"); | |
64 | } | |
65 | else { | |
66 | TGeoBBox *s=(TGeoBBox*)v->GetShape(); | |
67 | SetDetSize(s->GetDX()*20000.,s->GetDZ()*20000.,s->GetDY()*20000.); | |
68 | } | |
69 | } | |
b0f5e3fc | 70 | } |
fa4f0f62 | 71 | |
55d2c544 | 72 | //______________________________________________________________________ |
73 | void AliITSsegmentationSSD::Copy(TObject &obj) const { | |
74 | // protected method. copy this to obj | |
75 | AliITSsegmentation::Copy(obj); | |
76 | ((AliITSsegmentationSSD& ) obj).Clear(); | |
77 | ((AliITSsegmentationSSD& ) obj).fNstrips = fNstrips; | |
78 | ((AliITSsegmentationSSD& ) obj).fStereoP = fStereoP; | |
79 | ((AliITSsegmentationSSD& ) obj).fStereoN = fStereoN; | |
80 | ((AliITSsegmentationSSD& ) obj).fStereoPl5 = fStereoPl5; | |
81 | ((AliITSsegmentationSSD& ) obj).fStereoNl5 = fStereoNl5; | |
82 | ((AliITSsegmentationSSD& ) obj).fStereoPl6 = fStereoPl6; | |
83 | ((AliITSsegmentationSSD& ) obj).fStereoNl6 = fStereoNl6; | |
84 | ((AliITSsegmentationSSD& ) obj).fLayer = fLayer; | |
85 | ((AliITSsegmentationSSD& ) obj).fPitch = fPitch; | |
86 | ((AliITSsegmentationSSD& ) obj).fLayer = fLayer; | |
87 | ||
88 | } | |
89 | ||
179578b2 | 90 | //______________________________________________________________________ |
91 | AliITSsegmentationSSD& AliITSsegmentationSSD::operator=( | |
55d2c544 | 92 | const AliITSsegmentationSSD &source){ |
0315d466 | 93 | // Operator = |
55d2c544 | 94 | if(this != &source){ |
95 | source.Copy(*this); | |
96 | } | |
97 | return *this; | |
b0f5e3fc | 98 | } |
179578b2 | 99 | //______________________________________________________________________ |
55d2c544 | 100 | AliITSsegmentationSSD::AliITSsegmentationSSD(const AliITSsegmentationSSD &source): |
e56160b8 | 101 | AliITSsegmentation(source), |
102 | fNstrips(0), | |
103 | fStereoP(0), | |
104 | fStereoN(0), | |
105 | fPitch(0), | |
106 | fStereoPl5(0), | |
107 | fStereoNl5(0), | |
108 | fStereoPl6(0), | |
109 | fStereoNl6(0), | |
110 | fLayer(0){ | |
179578b2 | 111 | // copy constructor |
55d2c544 | 112 | source.Copy(*this); |
b0f5e3fc | 113 | } |
179578b2 | 114 | //---------------------------------------------------------------------- |
b0f5e3fc | 115 | void AliITSsegmentationSSD::Init(){ |
179578b2 | 116 | // standard initalizer |
b0f5e3fc | 117 | |
55d2c544 | 118 | SetPadSize(fgkPitchDefault,0.); |
119 | SetNPads(fgkNstripsDefault,0); | |
b0f5e3fc | 120 | SetAngles(); |
179578b2 | 121 | } |
122 | //---------------------------------------------------------------------- | |
55d2c544 | 123 | void AliITSsegmentationSSD::Angles(Float_t &aP,Float_t &aN) const{ |
124 | // P and N side stereo angles | |
179578b2 | 125 | if (fLayer == 5){ |
126 | aP = fStereoPl5; | |
127 | aN = fStereoNl5; | |
128 | } // end if | |
23197852 | 129 | else if (fLayer == 6){ |
179578b2 | 130 | aP = fStereoPl6; |
131 | aN = fStereoNl6; | |
132 | } // end if | |
23197852 | 133 | else { |
134 | AliWarning("SSD layer not set in segmentation. Setting angles for layer 5"); | |
135 | aP = fStereoPl5; | |
136 | aN = fStereoNl5; | |
137 | } | |
0315d466 | 138 | } |
179578b2 | 139 | //---------------------------------------------------------------------- |
140 | void AliITSsegmentationSSD::SetLayer(Int_t l){ | |
55d2c544 | 141 | //set fLayer data member (only 5 or 6 are allowed) |
179578b2 | 142 | if (l==5) fLayer =5; |
143 | if (l==6) fLayer =6; | |
f6b6d58e | 144 | if((l!=5) && (l!=6))AliError(Form("Layer can be 5 or 6, not %d",l)); |
179578b2 | 145 | } |
146 | //---------------------------------------------------------------------- | |
55d2c544 | 147 | void AliITSsegmentationSSD::GetPadTxz(Float_t &x,Float_t &z) const{ |
179578b2 | 148 | // returns P and N sided strip numbers for a given location. |
149 | // Transformation from microns detector center local coordinates | |
150 | // to detector P and N side strip numbers.. | |
151 | /* _- Z | |
152 | + angle / ^ | |
153 | fNstrips v | N-Side ...0 | |
154 | \-------/------------|-----------\--------\ | |
155 | |\\\\\\/////////////.|\\\\\\\\\\\\\\\\\\\\| | |
156 | |0\\\\/////////////..|.\\\\\\\\\\\\\\\\\\\| | |
157 | |00\\/////////////...|..\\\\\\\\\\\\\\\\\\| | |
158 | X <--|000/////////////... |...\\\\\\\\\\\\\\\\\| | |
159 | |00/////////////... | ...\\\\\\\\\\\\\\\\| | |
160 | |0/////////////... | ...\\\\\\\\\\\\\\\| | |
161 | |//////////////... | ...\\\\\\\\\\\\\\\| | |
162 | /-----\--------------|--------------------/ | |
163 | fNstrips-1 P-Side ...0 | |
164 | |0\ | |
165 | |00\ | |
166 | Dead region: |000/ | |
167 | |00/ | |
168 | |0/ | |
169 | // expects x, z in microns | |
170 | */ | |
55d2c544 | 171 | Float_t stereoP, stereoN; |
172 | Angles(stereoP,stereoN); | |
173 | Float_t tanP = TMath::Tan(stereoP); | |
174 | Float_t tanN = TMath::Tan(-stereoN); | |
179578b2 | 175 | Float_t x1 = x; |
176 | Float_t z1 = z; | |
177 | x1 += fDx/2; | |
178 | z1 += fDz/2; | |
179 | x = (x1 - z1*tanP)/fPitch; | |
180 | z = (x1 - tanN*(z1 - fDz))/fPitch; | |
181 | } | |
182 | //---------------------------------------------------------------------- | |
55d2c544 | 183 | void AliITSsegmentationSSD::GetPadIxz(Float_t x,Float_t z,Int_t &iP,Int_t &iN) const { |
0315d466 | 184 | // returns P and N sided strip numbers for a given location. |
179578b2 | 185 | /* _- Z |
186 | + angle / ^ | |
187 | fNstrips v | N-Side ...0 | |
188 | \-------/------------|-----------\--------\ | |
189 | |\\\\\\/////////////.|\\\\\\\\\\\\\\\\\\\\| | |
190 | |0\\\\/////////////..|.\\\\\\\\\\\\\\\\\\\| | |
191 | |00\\/////////////...|..\\\\\\\\\\\\\\\\\\| | |
192 | X <--|000/////////////... |...\\\\\\\\\\\\\\\\\| | |
193 | |00/////////////... | ...\\\\\\\\\\\\\\\\| | |
194 | |0/////////////... | ...\\\\\\\\\\\\\\\| | |
195 | |//////////////... | ...\\\\\\\\\\\\\\\| | |
196 | /-----\--------------|--------------------/ | |
197 | fNstrips-1 P-Side ...0 | |
198 | |0\ | |
199 | |00\ | |
200 | Dead region: |000/ | |
201 | |00/ | |
202 | |0/ | |
b0f5e3fc | 203 | |
204 | // expects x, z in microns | |
179578b2 | 205 | */ |
c1c63494 | 206 | |
55d2c544 | 207 | Float_t stereoP, stereoN; |
208 | Angles(stereoP,stereoN); | |
209 | Float_t tanP=TMath::Tan(stereoP); | |
210 | Float_t tanN=TMath::Tan(stereoN); | |
0315d466 | 211 | Float_t x1=x,z1=z; |
212 | x1 += fDx/2; | |
213 | z1 += fDz/2; | |
214 | Float_t ldX = x1 - z1*tanP; // distance from left-down edge | |
215 | iP = (Int_t)(ldX/fPitch); | |
b0f5e3fc | 216 | iP = (iP<0)? -1: iP; |
217 | iP = (iP>fNstrips)? -1: iP; | |
0315d466 | 218 | |
219 | ldX = x1 - tanN*(fDz - z1); | |
220 | iN = (Int_t)(ldX/fPitch); | |
b0f5e3fc | 221 | iN = (iN<0)? -1: iN; |
222 | iN = (iN>fNstrips)? -1: iN; | |
0315d466 | 223 | |
b0f5e3fc | 224 | } |
0315d466 | 225 | //------------------------------------------------------- |
55d2c544 | 226 | void AliITSsegmentationSSD::GetPadCxz(Int_t iP,Int_t iN,Float_t &x,Float_t &z) const { |
179578b2 | 227 | // actually this is the GetCrossing(Float_t &,Float_t &) |
0315d466 | 228 | // returns local x, z in microns ! |
b0f5e3fc | 229 | |
55d2c544 | 230 | Float_t lDx = fDx; // detector size in x direction, microns |
231 | Float_t lDz = fDz; // detector size in z direction, microns | |
179578b2 | 232 | Float_t xP; // x coordinate in the P side from the first P strip |
233 | Float_t xN; // x coordinate in the N side from the first N strip | |
55d2c544 | 234 | Float_t stereoP, stereoN; |
235 | Angles(stereoP,stereoN); | |
236 | Float_t kP=TMath::Tan(stereoP); | |
237 | Float_t kN=TMath::Tan(stereoN); | |
b0f5e3fc | 238 | |
0315d466 | 239 | xP=iP*fPitch; |
240 | xN=iN*fPitch; | |
55d2c544 | 241 | x = xP + kP*(lDz*kN-xP+xN)/(kP+kN); |
242 | z = (lDz*kN-xP+xN)/(kP+kN); | |
243 | x -= lDx/2; | |
244 | z -= lDz/2; | |
66da7685 | 245 | //if(TMath::Abs(z) > Dz/2) cout<<"Warning, wrong z local ="<<z<<endl; |
0315d466 | 246 | // Check that zL is inside the detector for the |
247 | // correspondent xP and xN coordinates | |
b0f5e3fc | 248 | |
249 | return; | |
250 | } | |
179578b2 | 251 | //______________________________________________________________________ |
aacedc3e | 252 | Bool_t AliITSsegmentationSSD::LocalToDet(Float_t x,Float_t z, |
55d2c544 | 253 | Int_t &iP,Int_t &iN) const { |
179578b2 | 254 | // Transformation from Geant cm detector center local coordinates |
255 | // to detector P and N side strip numbers.. | |
256 | /* _- Z | |
257 | + angle / ^ | |
258 | fNstrips v | N-Side ...0 | |
259 | \-------/------------|-----------\--------\ | |
260 | |\\\\\\/////////////.|\\\\\\\\\\\\\\\\\\\\| | |
261 | |0\\\\/////////////..|.\\\\\\\\\\\\\\\\\\\| | |
262 | |00\\/////////////...|..\\\\\\\\\\\\\\\\\\| | |
263 | X <--|000/////////////... |...\\\\\\\\\\\\\\\\\| | |
264 | |00/////////////... | ...\\\\\\\\\\\\\\\\| | |
265 | |0/////////////... | ...\\\\\\\\\\\\\\\| | |
266 | |//////////////... | ...\\\\\\\\\\\\\\\| | |
267 | /-----\--------------|--------------------/ | |
268 | fNstrips-1 P-Side ...0 | |
269 | |0\ | |
270 | |00\ | |
271 | Dead region: |000/ | |
272 | |00/ | |
273 | |0/ | |
274 | */ | |
6d38396a | 275 | Float_t dx,dz; |
276 | const Double_t kconst = 1.0E-04; // convert microns to cm. | |
277 | dx = 0.5*kconst*Dx(); | |
278 | dz = 0.5*kconst*Dz(); | |
23197852 | 279 | if( (x<-dx) || (x>dx) ) { |
280 | iP=-1; | |
281 | AliWarning(Form("Input argument %f out of range (%f, %f)",x,dx,-dx)); | |
282 | return kFALSE; // outside of defined volume. | |
283 | } // outside x range. | |
284 | if( (z<-dz) || (z>dz) ) { | |
285 | iN=-1; | |
286 | AliWarning(Form("Input argument %f out of range (%f, %f)",z,dz,-dz)); | |
287 | return kFALSE; // outside of defined volume. | |
288 | } | |
6d38396a | 289 | |
290 | x /= kconst; // convert to microns | |
291 | z /= kconst; // convert to microns | |
292 | this->GetPadTxz(x,z); | |
293 | ||
294 | // first for P side | |
295 | iP = (Int_t) x; | |
296 | if(iP<0 || iP>=fNstrips) iP=-1; // strip number must be in range. | |
297 | // Now for N side) | |
298 | iN = (Int_t) z; | |
299 | if(iN<0 || iN>=fNstrips) iN=-1; // strip number must be in range. | |
300 | return kTRUE; | |
179578b2 | 301 | } |
302 | //---------------------------------------------------------------------- | |
303 | void AliITSsegmentationSSD::DetToLocal(Int_t ix,Int_t iPN, | |
55d2c544 | 304 | Float_t &x,Float_t &z) const{ |
179578b2 | 305 | // Transformation from detector segmentation/cell coordiantes starting |
306 | // from 0. iPN=0 for P side and 1 for N side strip. Returned is z=0.0 | |
307 | // and the corresponding x value.. | |
308 | /* _- Z | |
309 | + angle / ^ | |
310 | fNstrips v | N-Side ...0 | |
311 | \-------/------------|-----------\--------\ | |
312 | |\\\\\\/////////////.|\\\\\\\\\\\\\\\\\\\\| | |
313 | |0\\\\/////////////..|.\\\\\\\\\\\\\\\\\\\| | |
314 | |00\\/////////////...|..\\\\\\\\\\\\\\\\\\| | |
315 | X <--|000/////////////... |...\\\\\\\\\\\\\\\\\| | |
316 | |00/////////////... | ...\\\\\\\\\\\\\\\\| | |
317 | |0/////////////... | ...\\\\\\\\\\\\\\\| | |
318 | |//////////////... | ...\\\\\\\\\\\\\\\| | |
319 | /-----\--------------|--------------------/ | |
320 | fNstrips-1 P-Side ...0 | |
321 | |0\ | |
322 | |00\ | |
323 | Dead region: |000/ | |
324 | |00/ | |
325 | |0/ | |
326 | */ | |
327 | // for strips p-side | |
328 | // x = a + b + z*tan(fStereoP); a = Dpx(iP)*(iP+0.5)-dx; b = dz*th; | |
329 | // for strips n-side | |
330 | // x = a + b + z*tan(fStereoP); a = Dpx(iN)*(iN+0.5)-dx; b = -dz*th; | |
331 | const Double_t kconst = 1.0E-04; // convert microns to cm. | |
332 | Float_t flag=kconst*Dx(); // error value | |
333 | Double_t th=0.0,dx,dz,i,a,b=0.0,xb[4],zb[4]; | |
55d2c544 | 334 | Float_t stereoP, stereoN; |
335 | Angles(stereoP,stereoN); | |
5752a110 | 336 | |
179578b2 | 337 | z = 0.0; // Strip center in z. |
338 | if(iPN<0 || iPN>1){// if error return full detector size in x. | |
339 | x = z = flag; | |
340 | return; | |
341 | } // end if | |
342 | if(ix<0 || ix>=fNstrips) { // if error return full detector size in x. | |
343 | x = z = flag; | |
344 | return; | |
345 | } // end if | |
346 | i = (Double_t) ix; // convert to double | |
347 | dx = 0.5*kconst*Dx(); // half distance in x in cm | |
348 | dz = 0.5*kconst*Dz(); // half distance in z in cm | |
349 | a = kconst*Dpx(ix)*(i+0.5)-dx; // Min x value. | |
350 | if(iPN==0){ //P-side angle defined backwards. | |
55d2c544 | 351 | th = TMath::Tan(stereoP); |
179578b2 | 352 | b = dz*th; |
353 | }else if(iPN==1){ // N-side | |
55d2c544 | 354 | th = TMath::Tan(-stereoN); |
179578b2 | 355 | b = -dz*th; |
356 | } // end if | |
357 | // compute average/center position of the strip. | |
358 | xb[0] = +dx; if(th!=0.0) zb[0] = (+dx-a-b)/th; else zb[0] = 0.0; | |
359 | xb[1] = -dx; if(th!=0.0) zb[1] = (-dx-a-b)/th; else zb[1] = 0.0; | |
360 | xb[2] = a+b+dz*th; zb[2] = +dz; | |
361 | xb[3] = a+b-dz*th; zb[3] = -dz; | |
362 | x = 0.0; z = 0.0; | |
363 | for(Int_t j=0;j<4;j++){ | |
364 | if(xb[j]>=-dx && xb[j]<=dx && zb[j]>=-dz && zb[j]<=dz){ | |
365 | x += xb[j]; | |
366 | z += zb[j]; | |
367 | } // end if | |
368 | } // end for | |
369 | x *= 0.5; | |
370 | z *= 0.5; | |
371 | return; | |
372 | } | |
373 | //---------------------------------------------------------------------- | |
374 | Bool_t AliITSsegmentationSSD::GetCrossing(Int_t iP,Int_t iN, | |
375 | Float_t &x,Float_t &z, | |
376 | Float_t c[2][2]){ | |
377 | // Given one P side strip and one N side strip, Returns kTRUE if they | |
378 | // cross each other and the location of the two crossing strips and | |
379 | // their correxlation matrix c[2][2]. | |
380 | /* _- Z | |
381 | + angle / ^ | |
382 | fNstrips v | N-Side ...0 | |
383 | \-------/------------|-----------\--------\ | |
384 | |\\\\\\/////////////.|\\\\\\\\\\\\\\\\\\\\| | |
385 | |0\\\\/////////////..|.\\\\\\\\\\\\\\\\\\\| | |
386 | |00\\/////////////...|..\\\\\\\\\\\\\\\\\\| | |
387 | X <--|000/////////////... |...\\\\\\\\\\\\\\\\\| | |
388 | |00/////////////... | ...\\\\\\\\\\\\\\\\| | |
389 | |0/////////////... | ...\\\\\\\\\\\\\\\| | |
390 | |//////////////... | ...\\\\\\\\\\\\\\\| | |
391 | /-----\--------------|--------------------/ | |
392 | fNstrips-1 P-Side ...0 | |
393 | |0\ | |
394 | |00\ | |
395 | Dead region: |000/ | |
396 | |00/ | |
397 | |0/ | |
398 | c[2][2] is defined as follows | |
399 | /c[0][0] c[0][1]\ /delta iP\ = /delta x\ | |
400 | \c[1][0] c[1][1]/ \delta iN/ = \delta z/ | |
401 | */ | |
402 | const Double_t kconst = 1.0E-04; // convert microns to cm. | |
403 | Double_t thp,thn,th,dx,dz,p,ip,in; | |
55d2c544 | 404 | Float_t stereoP, stereoN; |
405 | Angles(stereoP,stereoN); | |
179578b2 | 406 | |
55d2c544 | 407 | thp = TMath::Tan(stereoP); |
408 | thn = TMath::Tan(-stereoN); | |
179578b2 | 409 | th = thp-thn; |
410 | if(th==0.0) { // parall strips then never cross. | |
411 | x = 0.0; | |
412 | z = 0.0; | |
413 | c[0][0] = c[1][0] = c[0][1] = c[1][1] = 0.0; | |
414 | return kFALSE; | |
415 | } // end if | |
416 | // The strips must cross some place in space. | |
417 | ip = (Double_t) iP; // convert to double now for speed | |
418 | in = (Double_t) iN; // convert to double now for speed | |
419 | dx = 0.5*kconst*Dx(); // half distance in x in cm | |
420 | dz = 0.5*kconst*Dz(); // half distance in z in cm | |
421 | p = kconst*Dpx(iP); // Get strip spacing/pitch now | |
422 | x = 0.5*p+dx + (p*(in*thp-ip*thn)-2.0*dz*thp*thn)/th; | |
423 | z =(p*(in-ip)-dz*(thp+thn))/th; | |
424 | // compute correlations. | |
425 | c[0][0] = -thn*p/th; // dx/diP | |
426 | c[1][1] = p/th; // dz/diN | |
427 | c[0][1] = p*thp/th; // dx/diN | |
428 | c[1][0] = -p/th; // dz/diP | |
429 | if(x<-dx || x>dx || z<-dz || z>dz) return kFALSE; // crossing is outside | |
430 | // of the detector so | |
431 | // these strips don't | |
432 | // cross. | |
433 | return kTRUE; | |
434 | } | |
55d2c544 | 435 | |
6d38396a | 436 | //---------------------------------------------------------------------- |
437 | Int_t AliITSsegmentationSSD::GetChipFromChannel(Int_t ix, Int_t iz) const { | |
438 | // returns chip number (in range 0-11) starting from channel number | |
439 | ||
440 | if( (iz>=fgkNstripsDefault) || (iz<0) || (ix<0) || (ix>1) ) { | |
441 | AliError("Bad cell number"); | |
442 | return -1; | |
443 | } | |
444 | ||
445 | if(ix==1) iz = 1535-iz; | |
446 | Int_t theChip =iz/fgkNstripsPerChip; | |
447 | return theChip; | |
448 | ||
449 | } | |
450 | //---------------------------------------------------------------------- | |
451 | Int_t AliITSsegmentationSSD::GetChipFromLocal(Float_t xloc, Float_t zloc) const | |
452 | { | |
453 | // returns chip numbers starting from local coordinates | |
454 | // The two Nside chip number and Pside chip number are | |
455 | // coded as chip=Nchip*10+Pchip | |
456 | ||
457 | Int_t iP=0; | |
458 | Int_t iN=0; | |
459 | if (!LocalToDet(xloc,zloc,iP,iN) || | |
460 | (iP<0) || (iP>=fNstrips) || (iN<0) || (iN>=fNstrips) ) { | |
23197852 | 461 | //AliWarning("Bad local coordinate"); |
6d38396a | 462 | return -1; |
463 | } | |
464 | ||
465 | Int_t iChip = GetChipFromChannel(0,iP); | |
466 | iChip += 10*GetChipFromChannel(1,iN); // add Nside | |
467 | ||
468 | return iChip; | |
469 | ||
470 | } | |
471 | // | |
472 | ||
23197852 | 473 | Int_t AliITSsegmentationSSD::GetChipsInLocalWindow(Int_t* array, Float_t zmin, Float_t zmax, |
474 | Float_t xmin, Float_t xmax) const { | |
475 | ||
476 | Int_t nChipInW = 0; | |
477 | ||
478 | Float_t zminDet=-fDz*1.0E-04/2.; | |
479 | Float_t zmaxDet=fDz*1.0E-04/2.; | |
480 | if(zmin<zminDet) zmin=zminDet; | |
481 | if(zmax>zmaxDet) zmax=zmaxDet; | |
482 | ||
483 | Float_t xminDet=-fDx*1.0E-04/2; | |
484 | Float_t xmaxDet=fDx*1.0E-04/2; | |
485 | if(xmin<xminDet) xmin=xminDet; | |
486 | if(xmax>xmaxDet) xmax=xmaxDet; | |
487 | ||
488 | Int_t n1N=-1; | |
489 | Int_t n1P=-1; | |
490 | Int_t n1=GetChipFromLocal(xmin,zmin); | |
491 | if(n1!=-1) { // Note! Recpoint can be on the sensor but in the dead area not covered by strips! | |
492 | n1N = (Int_t) (n1/10); // N-side chip coded as 10*chip_index | |
493 | n1P = n1 - 10 * n1N; // P-side chip coded 0-5 | |
494 | array[nChipInW]=n1P; | |
495 | nChipInW++; | |
496 | array[nChipInW]=n1N; | |
497 | nChipInW++; | |
498 | } | |
499 | ||
500 | Int_t n2N=-1; | |
501 | Int_t n2P=-1; | |
502 | Int_t n2=GetChipFromLocal(xmin,zmax); | |
503 | if(n2!=-1) { // Note! Recpoint can be on the sensor but in the dead area not covered by strips! | |
504 | n2N = (Int_t) (n2/10); // N-side chip coded as 10*chip_index | |
505 | n2P = n2 - 10 * n2N; // P-side chip coded 0-5 | |
506 | if(n2P!=n1P) { array[nChipInW]=n2P; nChipInW++;} | |
507 | if(n2N!=n1N) { array[nChipInW]=n2N; nChipInW++;} | |
508 | } | |
509 | ||
510 | Int_t n3N=-1; | |
511 | Int_t n3P=-1; | |
512 | Int_t n3=GetChipFromLocal(xmax,zmin); | |
513 | if(n3!=-1) { | |
514 | n3N=(Int_t) (n3/10); // N-side chip coded as 10*chip_index | |
515 | n3P=n3 - 10 * n3N; // P-side chip coded 0-5 | |
516 | if((n3P!=n1P)&&(n3P!=n2P)) { array[nChipInW]=n3P; nChipInW++;} | |
517 | if((n3N!=n1N)&&(n3N!=n2N)) { array[nChipInW]=n3N; nChipInW++;} | |
518 | } | |
519 | ||
520 | Int_t n4N=-1; | |
521 | Int_t n4P=-1; | |
522 | Int_t n4=GetChipFromLocal(xmax,zmax); | |
523 | if(n4!=-1) { | |
524 | n4N=(Int_t) (n4/10); // N-side chip coded as 10*chip_index | |
525 | n4P=n4 - 10 * n4N; // P-side chip coded 0-5 | |
526 | if((n4P!=n1P)&&(n4P!=n2P)&&(n4P!=n3P)) { array[nChipInW]=n4P; nChipInW++;} | |
527 | if((n4N!=n1N)&&(n4N!=n2N)&&(n4N!=n3N)) { array[nChipInW]=n4N; nChipInW++;} | |
528 | } | |
529 | ||
530 | return nChipInW; | |
531 | ||
532 | } | |
533 | ||
55d2c544 | 534 | //---------------------------------------------------------------------- |
535 | void AliITSsegmentationSSD::PrintDefaultParameters() const { | |
536 | // Print default values for parameters. | |
537 | // Values specified as static const data members are shown | |
538 | ||
539 | cout<<"fgkDxDefault = "<<fgkDxDefault<<endl; | |
540 | cout<<"fgkDzDefault = "<<fgkDzDefault<<endl; | |
541 | cout<<"fgkDyDefault = "<<fgkDyDefault<<endl; | |
542 | cout<<"fgkPitchDefault = "<<fgkPitchDefault<<endl; | |
543 | cout<<"fgkNstripsDefault = "<<fgkNstripsDefault<<endl; | |
544 | } |