]>
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> |
b0f5e3fc | 20 | #include "AliITSsegmentationSSD.h" |
55d2c544 | 21 | |
22 | ////////////////////////////////////////////////////// | |
23 | // Segmentation class for // | |
24 | // silicon strips // | |
25 | // // | |
26 | ////////////////////////////////////////////////////// | |
27 | const Float_t AliITSsegmentationSSD::fgkDxDefault = 72960.; | |
28 | const Float_t AliITSsegmentationSSD::fgkDzDefault = 40000.; | |
29 | const Float_t AliITSsegmentationSSD::fgkDyDefault = 300.; | |
30 | const Float_t AliITSsegmentationSSD::fgkPitchDefault = 95.; | |
31 | const Int_t AliITSsegmentationSSD::fgkNstripsDefault = 768; | |
fd61217e | 32 | |
b0f5e3fc | 33 | ClassImp(AliITSsegmentationSSD) |
e56160b8 | 34 | AliITSsegmentationSSD::AliITSsegmentationSSD(): AliITSsegmentation(), |
35 | fNstrips(0), | |
36 | fStereoP(0), | |
37 | fStereoN(0), | |
38 | fPitch(0), | |
39 | fStereoPl5(0), | |
40 | fStereoNl5(0), | |
41 | fStereoPl6(0), | |
42 | fStereoNl6(0), | |
43 | fLayer(0){ | |
179578b2 | 44 | // default constructor |
b0f5e3fc | 45 | } |
179578b2 | 46 | //---------------------------------------------------------------------- |
e56160b8 | 47 | AliITSsegmentationSSD::AliITSsegmentationSSD(AliITSgeom *geom): |
48 | fNstrips(0), | |
49 | fStereoP(0), | |
50 | fStereoN(0), | |
51 | fPitch(0), | |
52 | fStereoPl5(0), | |
53 | fStereoNl5(0), | |
54 | fStereoPl6(0), | |
55 | fStereoNl6(0), | |
56 | fLayer(0){ | |
179578b2 | 57 | // constuctor |
58 | fGeom = geom; | |
59 | fCorr = 0; | |
55d2c544 | 60 | SetDetSize(fgkDxDefault,fgkDzDefault,fgkDyDefault); |
61 | SetPadSize(fgkPitchDefault,0.); | |
62 | SetNPads(fgkNstripsDefault,0); | |
179578b2 | 63 | SetAngles(); |
64 | fLayer = 0; | |
b0f5e3fc | 65 | } |
55d2c544 | 66 | |
67 | //______________________________________________________________________ | |
68 | void AliITSsegmentationSSD::Copy(TObject &obj) const { | |
69 | // protected method. copy this to obj | |
70 | AliITSsegmentation::Copy(obj); | |
71 | ((AliITSsegmentationSSD& ) obj).Clear(); | |
72 | ((AliITSsegmentationSSD& ) obj).fNstrips = fNstrips; | |
73 | ((AliITSsegmentationSSD& ) obj).fStereoP = fStereoP; | |
74 | ((AliITSsegmentationSSD& ) obj).fStereoN = fStereoN; | |
75 | ((AliITSsegmentationSSD& ) obj).fStereoPl5 = fStereoPl5; | |
76 | ((AliITSsegmentationSSD& ) obj).fStereoNl5 = fStereoNl5; | |
77 | ((AliITSsegmentationSSD& ) obj).fStereoPl6 = fStereoPl6; | |
78 | ((AliITSsegmentationSSD& ) obj).fStereoNl6 = fStereoNl6; | |
79 | ((AliITSsegmentationSSD& ) obj).fLayer = fLayer; | |
80 | ((AliITSsegmentationSSD& ) obj).fPitch = fPitch; | |
81 | ((AliITSsegmentationSSD& ) obj).fLayer = fLayer; | |
82 | ||
83 | } | |
84 | ||
179578b2 | 85 | //______________________________________________________________________ |
86 | AliITSsegmentationSSD& AliITSsegmentationSSD::operator=( | |
55d2c544 | 87 | const AliITSsegmentationSSD &source){ |
0315d466 | 88 | // Operator = |
55d2c544 | 89 | if(this != &source){ |
90 | source.Copy(*this); | |
91 | } | |
92 | return *this; | |
b0f5e3fc | 93 | } |
179578b2 | 94 | //______________________________________________________________________ |
55d2c544 | 95 | AliITSsegmentationSSD::AliITSsegmentationSSD(const AliITSsegmentationSSD &source): |
e56160b8 | 96 | AliITSsegmentation(source), |
97 | fNstrips(0), | |
98 | fStereoP(0), | |
99 | fStereoN(0), | |
100 | fPitch(0), | |
101 | fStereoPl5(0), | |
102 | fStereoNl5(0), | |
103 | fStereoPl6(0), | |
104 | fStereoNl6(0), | |
105 | fLayer(0){ | |
179578b2 | 106 | // copy constructor |
55d2c544 | 107 | source.Copy(*this); |
b0f5e3fc | 108 | } |
179578b2 | 109 | //---------------------------------------------------------------------- |
b0f5e3fc | 110 | void AliITSsegmentationSSD::Init(){ |
179578b2 | 111 | // standard initalizer |
b0f5e3fc | 112 | |
55d2c544 | 113 | SetPadSize(fgkPitchDefault,0.); |
114 | SetNPads(fgkNstripsDefault,0); | |
b0f5e3fc | 115 | SetAngles(); |
179578b2 | 116 | } |
117 | //---------------------------------------------------------------------- | |
55d2c544 | 118 | void AliITSsegmentationSSD::Angles(Float_t &aP,Float_t &aN) const{ |
119 | // P and N side stereo angles | |
179578b2 | 120 | if (fLayer == 5){ |
121 | aP = fStereoPl5; | |
122 | aN = fStereoNl5; | |
123 | } // end if | |
124 | if (fLayer == 6){ | |
125 | aP = fStereoPl6; | |
126 | aN = fStereoNl6; | |
127 | } // end if | |
0315d466 | 128 | } |
179578b2 | 129 | //---------------------------------------------------------------------- |
130 | void AliITSsegmentationSSD::SetLayer(Int_t l){ | |
55d2c544 | 131 | //set fLayer data member (only 5 or 6 are allowed) |
179578b2 | 132 | if (l==5) fLayer =5; |
133 | if (l==6) fLayer =6; | |
55d2c544 | 134 | if((l!=5) && (l!=6))Error("SetLayer","Layer can be 5 or 6, not %d",l); |
179578b2 | 135 | } |
136 | //---------------------------------------------------------------------- | |
55d2c544 | 137 | void AliITSsegmentationSSD::GetPadTxz(Float_t &x,Float_t &z) const{ |
179578b2 | 138 | // returns P and N sided strip numbers for a given location. |
139 | // Transformation from microns detector center local coordinates | |
140 | // to detector P and N side strip numbers.. | |
141 | /* _- Z | |
142 | + angle / ^ | |
143 | fNstrips v | N-Side ...0 | |
144 | \-------/------------|-----------\--------\ | |
145 | |\\\\\\/////////////.|\\\\\\\\\\\\\\\\\\\\| | |
146 | |0\\\\/////////////..|.\\\\\\\\\\\\\\\\\\\| | |
147 | |00\\/////////////...|..\\\\\\\\\\\\\\\\\\| | |
148 | X <--|000/////////////... |...\\\\\\\\\\\\\\\\\| | |
149 | |00/////////////... | ...\\\\\\\\\\\\\\\\| | |
150 | |0/////////////... | ...\\\\\\\\\\\\\\\| | |
151 | |//////////////... | ...\\\\\\\\\\\\\\\| | |
152 | /-----\--------------|--------------------/ | |
153 | fNstrips-1 P-Side ...0 | |
154 | |0\ | |
155 | |00\ | |
156 | Dead region: |000/ | |
157 | |00/ | |
158 | |0/ | |
159 | // expects x, z in microns | |
160 | */ | |
55d2c544 | 161 | Float_t stereoP, stereoN; |
162 | Angles(stereoP,stereoN); | |
163 | Float_t tanP = TMath::Tan(stereoP); | |
164 | Float_t tanN = TMath::Tan(-stereoN); | |
179578b2 | 165 | Float_t x1 = x; |
166 | Float_t z1 = z; | |
167 | x1 += fDx/2; | |
168 | z1 += fDz/2; | |
169 | x = (x1 - z1*tanP)/fPitch; | |
170 | z = (x1 - tanN*(z1 - fDz))/fPitch; | |
171 | } | |
172 | //---------------------------------------------------------------------- | |
55d2c544 | 173 | void AliITSsegmentationSSD::GetPadIxz(Float_t x,Float_t z,Int_t &iP,Int_t &iN) const { |
0315d466 | 174 | // returns P and N sided strip numbers for a given location. |
179578b2 | 175 | /* _- Z |
176 | + angle / ^ | |
177 | fNstrips v | N-Side ...0 | |
178 | \-------/------------|-----------\--------\ | |
179 | |\\\\\\/////////////.|\\\\\\\\\\\\\\\\\\\\| | |
180 | |0\\\\/////////////..|.\\\\\\\\\\\\\\\\\\\| | |
181 | |00\\/////////////...|..\\\\\\\\\\\\\\\\\\| | |
182 | X <--|000/////////////... |...\\\\\\\\\\\\\\\\\| | |
183 | |00/////////////... | ...\\\\\\\\\\\\\\\\| | |
184 | |0/////////////... | ...\\\\\\\\\\\\\\\| | |
185 | |//////////////... | ...\\\\\\\\\\\\\\\| | |
186 | /-----\--------------|--------------------/ | |
187 | fNstrips-1 P-Side ...0 | |
188 | |0\ | |
189 | |00\ | |
190 | Dead region: |000/ | |
191 | |00/ | |
192 | |0/ | |
b0f5e3fc | 193 | |
194 | // expects x, z in microns | |
179578b2 | 195 | */ |
c1c63494 | 196 | |
55d2c544 | 197 | Float_t stereoP, stereoN; |
198 | Angles(stereoP,stereoN); | |
199 | Float_t tanP=TMath::Tan(stereoP); | |
200 | Float_t tanN=TMath::Tan(stereoN); | |
0315d466 | 201 | Float_t x1=x,z1=z; |
202 | x1 += fDx/2; | |
203 | z1 += fDz/2; | |
204 | Float_t ldX = x1 - z1*tanP; // distance from left-down edge | |
205 | iP = (Int_t)(ldX/fPitch); | |
b0f5e3fc | 206 | iP = (iP<0)? -1: iP; |
207 | iP = (iP>fNstrips)? -1: iP; | |
0315d466 | 208 | |
209 | ldX = x1 - tanN*(fDz - z1); | |
210 | iN = (Int_t)(ldX/fPitch); | |
b0f5e3fc | 211 | iN = (iN<0)? -1: iN; |
212 | iN = (iN>fNstrips)? -1: iN; | |
0315d466 | 213 | |
b0f5e3fc | 214 | } |
0315d466 | 215 | //------------------------------------------------------- |
55d2c544 | 216 | void AliITSsegmentationSSD::GetPadCxz(Int_t iP,Int_t iN,Float_t &x,Float_t &z) const { |
179578b2 | 217 | // actually this is the GetCrossing(Float_t &,Float_t &) |
0315d466 | 218 | // returns local x, z in microns ! |
b0f5e3fc | 219 | |
55d2c544 | 220 | Float_t lDx = fDx; // detector size in x direction, microns |
221 | Float_t lDz = fDz; // detector size in z direction, microns | |
179578b2 | 222 | Float_t xP; // x coordinate in the P side from the first P strip |
223 | Float_t xN; // x coordinate in the N side from the first N strip | |
55d2c544 | 224 | Float_t stereoP, stereoN; |
225 | Angles(stereoP,stereoN); | |
226 | Float_t kP=TMath::Tan(stereoP); | |
227 | Float_t kN=TMath::Tan(stereoN); | |
b0f5e3fc | 228 | |
0315d466 | 229 | xP=iP*fPitch; |
230 | xN=iN*fPitch; | |
55d2c544 | 231 | x = xP + kP*(lDz*kN-xP+xN)/(kP+kN); |
232 | z = (lDz*kN-xP+xN)/(kP+kN); | |
233 | x -= lDx/2; | |
234 | z -= lDz/2; | |
66da7685 | 235 | //if(TMath::Abs(z) > Dz/2) cout<<"Warning, wrong z local ="<<z<<endl; |
0315d466 | 236 | // Check that zL is inside the detector for the |
237 | // correspondent xP and xN coordinates | |
b0f5e3fc | 238 | |
239 | return; | |
240 | } | |
179578b2 | 241 | //______________________________________________________________________ |
aacedc3e | 242 | Bool_t AliITSsegmentationSSD::LocalToDet(Float_t x,Float_t z, |
55d2c544 | 243 | Int_t &iP,Int_t &iN) const { |
179578b2 | 244 | // Transformation from Geant cm detector center local coordinates |
245 | // to detector P and N side strip numbers.. | |
246 | /* _- Z | |
247 | + angle / ^ | |
248 | fNstrips v | N-Side ...0 | |
249 | \-------/------------|-----------\--------\ | |
250 | |\\\\\\/////////////.|\\\\\\\\\\\\\\\\\\\\| | |
251 | |0\\\\/////////////..|.\\\\\\\\\\\\\\\\\\\| | |
252 | |00\\/////////////...|..\\\\\\\\\\\\\\\\\\| | |
253 | X <--|000/////////////... |...\\\\\\\\\\\\\\\\\| | |
254 | |00/////////////... | ...\\\\\\\\\\\\\\\\| | |
255 | |0/////////////... | ...\\\\\\\\\\\\\\\| | |
256 | |//////////////... | ...\\\\\\\\\\\\\\\| | |
257 | /-----\--------------|--------------------/ | |
258 | fNstrips-1 P-Side ...0 | |
259 | |0\ | |
260 | |00\ | |
261 | Dead region: |000/ | |
262 | |00/ | |
263 | |0/ | |
264 | */ | |
265 | const Double_t kconst = 1.0E-04; // convert microns to cm. | |
266 | ||
267 | x /= kconst; // convert to microns | |
268 | z /= kconst; // convert to microns | |
269 | this->GetPadTxz(x,z); | |
5752a110 | 270 | |
179578b2 | 271 | // first for P side |
272 | iP = (Int_t) x; | |
273 | if(iP<0 || iP>=fNstrips) iP=-1; // strip number must be in range. | |
274 | // Now for N side) | |
275 | iN = (Int_t) z; | |
276 | if(iN<0 || iN>=fNstrips) iN=-1; // strip number must be in range. | |
aacedc3e | 277 | return kTRUE; |
179578b2 | 278 | } |
279 | //---------------------------------------------------------------------- | |
280 | void AliITSsegmentationSSD::DetToLocal(Int_t ix,Int_t iPN, | |
55d2c544 | 281 | Float_t &x,Float_t &z) const{ |
179578b2 | 282 | // Transformation from detector segmentation/cell coordiantes starting |
283 | // from 0. iPN=0 for P side and 1 for N side strip. Returned is z=0.0 | |
284 | // and the corresponding x value.. | |
285 | /* _- Z | |
286 | + angle / ^ | |
287 | fNstrips v | N-Side ...0 | |
288 | \-------/------------|-----------\--------\ | |
289 | |\\\\\\/////////////.|\\\\\\\\\\\\\\\\\\\\| | |
290 | |0\\\\/////////////..|.\\\\\\\\\\\\\\\\\\\| | |
291 | |00\\/////////////...|..\\\\\\\\\\\\\\\\\\| | |
292 | X <--|000/////////////... |...\\\\\\\\\\\\\\\\\| | |
293 | |00/////////////... | ...\\\\\\\\\\\\\\\\| | |
294 | |0/////////////... | ...\\\\\\\\\\\\\\\| | |
295 | |//////////////... | ...\\\\\\\\\\\\\\\| | |
296 | /-----\--------------|--------------------/ | |
297 | fNstrips-1 P-Side ...0 | |
298 | |0\ | |
299 | |00\ | |
300 | Dead region: |000/ | |
301 | |00/ | |
302 | |0/ | |
303 | */ | |
304 | // for strips p-side | |
305 | // x = a + b + z*tan(fStereoP); a = Dpx(iP)*(iP+0.5)-dx; b = dz*th; | |
306 | // for strips n-side | |
307 | // x = a + b + z*tan(fStereoP); a = Dpx(iN)*(iN+0.5)-dx; b = -dz*th; | |
308 | const Double_t kconst = 1.0E-04; // convert microns to cm. | |
309 | Float_t flag=kconst*Dx(); // error value | |
310 | Double_t th=0.0,dx,dz,i,a,b=0.0,xb[4],zb[4]; | |
55d2c544 | 311 | Float_t stereoP, stereoN; |
312 | Angles(stereoP,stereoN); | |
5752a110 | 313 | |
179578b2 | 314 | z = 0.0; // Strip center in z. |
315 | if(iPN<0 || iPN>1){// if error return full detector size in x. | |
316 | x = z = flag; | |
317 | return; | |
318 | } // end if | |
319 | if(ix<0 || ix>=fNstrips) { // if error return full detector size in x. | |
320 | x = z = flag; | |
321 | return; | |
322 | } // end if | |
323 | i = (Double_t) ix; // convert to double | |
324 | dx = 0.5*kconst*Dx(); // half distance in x in cm | |
325 | dz = 0.5*kconst*Dz(); // half distance in z in cm | |
326 | a = kconst*Dpx(ix)*(i+0.5)-dx; // Min x value. | |
327 | if(iPN==0){ //P-side angle defined backwards. | |
55d2c544 | 328 | th = TMath::Tan(stereoP); |
179578b2 | 329 | b = dz*th; |
330 | }else if(iPN==1){ // N-side | |
55d2c544 | 331 | th = TMath::Tan(-stereoN); |
179578b2 | 332 | b = -dz*th; |
333 | } // end if | |
334 | // compute average/center position of the strip. | |
335 | xb[0] = +dx; if(th!=0.0) zb[0] = (+dx-a-b)/th; else zb[0] = 0.0; | |
336 | xb[1] = -dx; if(th!=0.0) zb[1] = (-dx-a-b)/th; else zb[1] = 0.0; | |
337 | xb[2] = a+b+dz*th; zb[2] = +dz; | |
338 | xb[3] = a+b-dz*th; zb[3] = -dz; | |
339 | x = 0.0; z = 0.0; | |
340 | for(Int_t j=0;j<4;j++){ | |
341 | if(xb[j]>=-dx && xb[j]<=dx && zb[j]>=-dz && zb[j]<=dz){ | |
342 | x += xb[j]; | |
343 | z += zb[j]; | |
344 | } // end if | |
345 | } // end for | |
346 | x *= 0.5; | |
347 | z *= 0.5; | |
348 | return; | |
349 | } | |
350 | //---------------------------------------------------------------------- | |
351 | Bool_t AliITSsegmentationSSD::GetCrossing(Int_t iP,Int_t iN, | |
352 | Float_t &x,Float_t &z, | |
353 | Float_t c[2][2]){ | |
354 | // Given one P side strip and one N side strip, Returns kTRUE if they | |
355 | // cross each other and the location of the two crossing strips and | |
356 | // their correxlation matrix c[2][2]. | |
357 | /* _- Z | |
358 | + angle / ^ | |
359 | fNstrips v | N-Side ...0 | |
360 | \-------/------------|-----------\--------\ | |
361 | |\\\\\\/////////////.|\\\\\\\\\\\\\\\\\\\\| | |
362 | |0\\\\/////////////..|.\\\\\\\\\\\\\\\\\\\| | |
363 | |00\\/////////////...|..\\\\\\\\\\\\\\\\\\| | |
364 | X <--|000/////////////... |...\\\\\\\\\\\\\\\\\| | |
365 | |00/////////////... | ...\\\\\\\\\\\\\\\\| | |
366 | |0/////////////... | ...\\\\\\\\\\\\\\\| | |
367 | |//////////////... | ...\\\\\\\\\\\\\\\| | |
368 | /-----\--------------|--------------------/ | |
369 | fNstrips-1 P-Side ...0 | |
370 | |0\ | |
371 | |00\ | |
372 | Dead region: |000/ | |
373 | |00/ | |
374 | |0/ | |
375 | c[2][2] is defined as follows | |
376 | /c[0][0] c[0][1]\ /delta iP\ = /delta x\ | |
377 | \c[1][0] c[1][1]/ \delta iN/ = \delta z/ | |
378 | */ | |
379 | const Double_t kconst = 1.0E-04; // convert microns to cm. | |
380 | Double_t thp,thn,th,dx,dz,p,ip,in; | |
55d2c544 | 381 | Float_t stereoP, stereoN; |
382 | Angles(stereoP,stereoN); | |
179578b2 | 383 | |
55d2c544 | 384 | thp = TMath::Tan(stereoP); |
385 | thn = TMath::Tan(-stereoN); | |
179578b2 | 386 | th = thp-thn; |
387 | if(th==0.0) { // parall strips then never cross. | |
388 | x = 0.0; | |
389 | z = 0.0; | |
390 | c[0][0] = c[1][0] = c[0][1] = c[1][1] = 0.0; | |
391 | return kFALSE; | |
392 | } // end if | |
393 | // The strips must cross some place in space. | |
394 | ip = (Double_t) iP; // convert to double now for speed | |
395 | in = (Double_t) iN; // convert to double now for speed | |
396 | dx = 0.5*kconst*Dx(); // half distance in x in cm | |
397 | dz = 0.5*kconst*Dz(); // half distance in z in cm | |
398 | p = kconst*Dpx(iP); // Get strip spacing/pitch now | |
399 | x = 0.5*p+dx + (p*(in*thp-ip*thn)-2.0*dz*thp*thn)/th; | |
400 | z =(p*(in-ip)-dz*(thp+thn))/th; | |
401 | // compute correlations. | |
402 | c[0][0] = -thn*p/th; // dx/diP | |
403 | c[1][1] = p/th; // dz/diN | |
404 | c[0][1] = p*thp/th; // dx/diN | |
405 | c[1][0] = -p/th; // dz/diP | |
406 | if(x<-dx || x>dx || z<-dz || z>dz) return kFALSE; // crossing is outside | |
407 | // of the detector so | |
408 | // these strips don't | |
409 | // cross. | |
410 | return kTRUE; | |
411 | } | |
55d2c544 | 412 | |
413 | //---------------------------------------------------------------------- | |
414 | void AliITSsegmentationSSD::PrintDefaultParameters() const { | |
415 | // Print default values for parameters. | |
416 | // Values specified as static const data members are shown | |
417 | ||
418 | cout<<"fgkDxDefault = "<<fgkDxDefault<<endl; | |
419 | cout<<"fgkDzDefault = "<<fgkDzDefault<<endl; | |
420 | cout<<"fgkDyDefault = "<<fgkDyDefault<<endl; | |
421 | cout<<"fgkPitchDefault = "<<fgkPitchDefault<<endl; | |
422 | cout<<"fgkNstripsDefault = "<<fgkNstripsDefault<<endl; | |
423 | } |