]>
Commit | Line | Data |
---|---|---|
172b0d90 | 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 | ||
166d14ba | 16 | /* |
17 | $Id$ | |
18 | */ | |
19 | ||
20 | ||
21 | //////////////////////////////////////////////////////////////////////// | |
22 | // This class is a base class for the ITS geometry version 11. It | |
23 | // contains common/standard functions used in many places in defining | |
24 | // the ITS geometry, version 11. Large posions of the ITS geometry, | |
25 | // version 11, should be derived from this class so as to make maximum | |
26 | // use of these common functions. This class also defines the proper | |
27 | // conversion valuse such, to cm and degrees, such that the most usefull | |
28 | // units, those used in the Engineering drawings, can be used. | |
29 | //////////////////////////////////////////////////////////////////////// | |
30 | ||
31 | ||
172b0d90 | 32 | #include <Riostream.h> |
33 | #include <TMath.h> | |
172b0d90 | 34 | #include <TGeoPcon.h> |
35 | #include <TGeoCone.h> | |
36 | #include <TGeoTube.h> // contaings TGeoTubeSeg | |
37 | #include <TGeoArb8.h> | |
166d14ba | 38 | #include <TPolyMarker.h> |
39 | #include <TPolyLine.h> | |
172b0d90 | 40 | #include "AliITSv11Geometry.h" |
41 | ||
42 | ClassImp(AliITSv11Geometry) | |
43 | //______________________________________________________________________ | |
166d14ba | 44 | Double_t AliITSv11Geometry::Yfrom2Points(Double_t x0,Double_t y0, |
45 | Double_t x1,Double_t y1, | |
cee918ed | 46 | Double_t x)const{ |
166d14ba | 47 | // Given the two points (x0,y0) and (x1,y1) and the location x, returns |
48 | // the value y corresponding to that point x on the line defined by the | |
49 | // two points. | |
50 | // Inputs: | |
51 | // Double_t x0 The first x value defining the line | |
52 | // Double_t y0 The first y value defining the line | |
53 | // Double_t x1 The second x value defining the line | |
54 | // Double_t y1 The second y value defining the line | |
55 | // Double_t x The x value for which the y value is wanted. | |
56 | // Outputs: | |
57 | // none. | |
58 | // Return: | |
59 | // The value y corresponding to the point x on the line defined by | |
60 | // the two points (x0,y0) and (x1,y1). | |
61 | ||
62 | if(x0==x1 && y0==y1) { | |
63 | printf("Error: AliITSv11Geometry::Yfrom2Ponts The two points are " | |
64 | "the same (%e,%e) and (%e,%e)",x0,y0,x1,y1); | |
65 | return 0.0; | |
66 | } // end if | |
67 | if(x0==x1){ | |
68 | printf("Warning: AliITSv11Geometry::Yfrom2Points x0=%e == x1=%e. " | |
69 | "line vertical ""returning mean y",x0,x1); | |
70 | return 0.5*(y0+y1); | |
71 | }// end if x0==x1 | |
72 | Double_t m = (y0-y1)/(x0-x1); | |
73 | return m*(x-x0)+y0; | |
74 | } | |
75 | //______________________________________________________________________ | |
76 | Double_t AliITSv11Geometry::Xfrom2Points(Double_t x0,Double_t y0, | |
77 | Double_t x1,Double_t y1, | |
cee918ed | 78 | Double_t y)const{ |
166d14ba | 79 | // Given the two points (x0,y0) and (x1,y1) and the location y, returns |
80 | // the value x corresponding to that point y on the line defined by the | |
81 | // two points. | |
82 | // Inputs: | |
83 | // Double_t x0 The first x value defining the line | |
84 | // Double_t y0 The first y value defining the line | |
85 | // Double_t x1 The second x value defining the line | |
86 | // Double_t y1 The second y value defining the line | |
87 | // Double_t y The y value for which the x value is wanted. | |
88 | // Outputs: | |
89 | // none. | |
90 | // Return: | |
91 | // The value x corresponding to the point y on the line defined by | |
92 | // the two points (x0,y0) and (x1,y1). | |
93 | ||
94 | if(x0==x1 && y0==y1) { | |
95 | printf("Error: AliITSv11Geometry::Yfrom2Ponts The two points are " | |
96 | "the same (%e,%e) and (%e,%e)",x0,y0,x1,y1); | |
97 | return 0.0; | |
98 | } // end if | |
99 | if(y0==y1){ | |
100 | printf("Warrning: AliITSv11Geometry::Yfrom2Points y0=%e == y1=%e. " | |
101 | "line horizontal returning mean x",y0,y1); | |
102 | return 0.5*(x0+x1); | |
103 | }// end if y0==y1 | |
104 | Double_t m = (x0-x1)/(y0-y1); | |
105 | return m*(y-y0)+x0; | |
106 | } | |
107 | //______________________________________________________________________ | |
108 | Double_t AliITSv11Geometry::RmaxFrom2Points(const TGeoPcon *p,Int_t i1, | |
cee918ed | 109 | Int_t i2,Double_t z)const{ |
172b0d90 | 110 | // functions Require at parts of Volume A to be already defined. |
111 | // Retruns the value of Rmax corresponding to point z alone the line | |
112 | // defined by the two points p.Rmax(i1),p-GetZ(i1) and p->GetRmax(i2), | |
113 | // p->GetZ(i2). | |
166d14ba | 114 | // Inputs: |
115 | // TGeoPcon *p The Polycone where the two points come from | |
116 | // Int_t i1 Point 1 | |
117 | // Int_t i2 Point 2 | |
118 | // Double_t z The value of z for which Rmax is to be found | |
119 | // Outputs: | |
120 | // none. | |
121 | // Return: | |
122 | // Double_t Rmax the value corresponding to z | |
172b0d90 | 123 | Double_t d0,d1,d2,r; |
124 | ||
125 | d0 = p->GetRmax(i1)-p->GetRmax(i2);// cout <<"L263: d0="<<d0<<endl; | |
126 | d1 = z-p->GetZ(i2);// cout <<"L264: d1="<<d1<<endl; | |
127 | d2 = p->GetZ(i1)-p->GetZ(i2);// cout <<"L265: d2="<<d2<<endl; | |
128 | r = p->GetRmax(i2) + d1*d0/d2;// cout <<"L266: r="<<r<<endl; | |
129 | return r; | |
130 | } | |
131 | //______________________________________________________________________ | |
166d14ba | 132 | Double_t AliITSv11Geometry::RminFrom2Points(const TGeoPcon *p,Int_t i1, |
cee918ed | 133 | Int_t i2,Double_t z)const{ |
172b0d90 | 134 | // Retruns the value of Rmin corresponding to point z alone the line |
135 | // defined by the two points p->GetRmin(i1),p->GetZ(i1) and | |
136 | // p->GetRmin(i2), p->GetZ(i2). | |
166d14ba | 137 | // Inputs: |
138 | // TGeoPcon *p The Polycone where the two points come from | |
139 | // Int_t i1 Point 1 | |
140 | // Int_t i2 Point 2 | |
141 | // Double_t z The value of z for which Rmax is to be found | |
142 | // Outputs: | |
143 | // none. | |
144 | // Return: | |
145 | // Double_t Rmax the value corresponding to z | |
172b0d90 | 146 | |
147 | return p->GetRmin(i2)+(p->GetRmin(i1)-p->GetRmin(i2))*(z-p->GetZ(i2))/ | |
148 | (p->GetZ(i1)-p->GetZ(i2)); | |
149 | } | |
150 | //______________________________________________________________________ | |
166d14ba | 151 | Double_t AliITSv11Geometry::RFrom2Points(const Double_t *p,const Double_t *az, |
cee918ed | 152 | Int_t i1,Int_t i2,Double_t z)const{ |
172b0d90 | 153 | // Retruns the value of Rmin corresponding to point z alone the line |
154 | // defined by the two points p->GetRmin(i1),p->GetZ(i1) and | |
155 | // p->GetRmin(i2), p->GetZ(i2). | |
166d14ba | 156 | // Inputs: |
157 | // Double_t az Array of z values | |
158 | // Double_t r Array of r values | |
159 | // Int_t i1 First Point in arrays | |
160 | // Int_t i2 Second Point in arrays | |
161 | // Double_t z Value z at which r is to be found | |
162 | // Outputs: | |
163 | // none. | |
164 | // Return: | |
165 | // The value r corresponding to z and the line defined by the two points | |
172b0d90 | 166 | |
166d14ba | 167 | return p[i2]+(p[i1]-p[i2])*(z-az[i2])/(az[i1]-az[i2]); |
172b0d90 | 168 | } |
169 | //______________________________________________________________________ | |
166d14ba | 170 | Double_t AliITSv11Geometry::Zfrom2MinPoints(const TGeoPcon *p,Int_t i1, |
cee918ed | 171 | Int_t i2,Double_t r)const{ |
172b0d90 | 172 | // Retruns the value of Z corresponding to point R alone the line |
173 | // defined by the two points p->GetRmin(i1),p->GetZ(i1) and | |
174 | // p->GetRmin(i2),p->GetZ(i2) | |
166d14ba | 175 | // Inputs: |
176 | // TGeoPcon *p The Poly cone where the two points come from. | |
177 | // Int_t i1 First Point in arrays | |
178 | // Int_t i2 Second Point in arrays | |
179 | // Double_t r Value r min at which z is to be found | |
180 | // Outputs: | |
181 | // none. | |
182 | // Return: | |
183 | // The value z corresponding to r min and the line defined by | |
184 | // the two points | |
172b0d90 | 185 | |
186 | return p->GetZ(i2)+(p->GetZ(i1)-p->GetZ(i2))*(r-p->GetRmin(i2))/ | |
187 | (p->GetRmin(i1)-p->GetRmin(i2)); | |
188 | } | |
189 | //______________________________________________________________________ | |
166d14ba | 190 | Double_t AliITSv11Geometry::Zfrom2MaxPoints(const TGeoPcon *p,Int_t i1, |
cee918ed | 191 | Int_t i2,Double_t r)const{ |
172b0d90 | 192 | // Retruns the value of Z corresponding to point R alone the line |
193 | // defined by the two points p->GetRmax(i1),p->GetZ(i1) and | |
194 | // p->GetRmax(i2),p->GetZ(i2) | |
166d14ba | 195 | // Inputs: |
196 | // TGeoPcon *p The Poly cone where the two points come from. | |
197 | // Int_t i1 First Point in arrays | |
198 | // Int_t i2 Second Point in arrays | |
199 | // Double_t r Value r max at which z is to be found | |
200 | // Outputs: | |
201 | // none. | |
202 | // Return: | |
203 | // The value z corresponding to r max and the line defined by | |
204 | // the two points | |
172b0d90 | 205 | |
206 | return p->GetZ(i2)+(p->GetZ(i1)-p->GetZ(i2))*(r-p->GetRmax(i2))/ | |
207 | (p->GetRmax(i1)-p->GetRmax(i2)); | |
208 | } | |
209 | //______________________________________________________________________ | |
166d14ba | 210 | Double_t AliITSv11Geometry::Zfrom2Points(const Double_t *z,const Double_t *ar, |
cee918ed | 211 | Int_t i1,Int_t i2,Double_t r)const{ |
166d14ba | 212 | // Retruns the value of z corresponding to point R alone the line |
172b0d90 | 213 | // defined by the two points p->GetRmax(i1),p->GetZ(i1) and |
214 | // p->GetRmax(i2),p->GetZ(i2) | |
166d14ba | 215 | // Inputs: |
216 | // Double_t z Array of z values | |
217 | // Double_t ar Array of r values | |
218 | // Int_t i1 First Point in arrays | |
219 | // Int_t i2 Second Point in arrays | |
220 | // Double_t r Value r at which z is to be found | |
221 | // Outputs: | |
222 | // none. | |
223 | // Return: | |
224 | // The value z corresponding to r and the line defined by the two points | |
172b0d90 | 225 | |
166d14ba | 226 | return z[i2]+(z[i1]-z[i2])*(r-ar[i2])/(ar[i1]-ar[i2]); |
172b0d90 | 227 | } |
228 | //______________________________________________________________________ | |
166d14ba | 229 | Double_t AliITSv11Geometry::RmaxFromZpCone(const TGeoPcon *p,int ip, |
230 | Double_t tc,Double_t z, | |
cee918ed | 231 | Double_t th)const{ |
166d14ba | 232 | // General Outer Cone surface equation Rmax. |
233 | // Intputs: | |
234 | // TGeoPcon *p The poly cone where the initial point comes from | |
235 | // Int_t ip The index in p to get the point location | |
236 | // Double_t tc The angle of that part of the cone is at | |
237 | // Double_t z The value of z to compute Rmax from | |
238 | // Double_t th The perpendicular distance the parralell line is | |
239 | // from the point ip. | |
240 | // Outputs: | |
241 | // none. | |
242 | // Return: | |
243 | // The value Rmax correstponding to the line at angle th, offeset by | |
244 | // th, and the point p->GetZ/Rmin[ip] at the location z. | |
cee918ed | 245 | Double_t tantc = TMath::Tan(tc*TMath::DegToRad()); |
246 | Double_t costc = TMath::Cos(tc*TMath::DegToRad()); | |
172b0d90 | 247 | |
248 | return -tantc*(z-p->GetZ(ip))+p->GetRmax(ip)+th/costc; | |
249 | } | |
250 | //______________________________________________________________________ | |
166d14ba | 251 | Double_t AliITSv11Geometry::RFromZpCone(const Double_t *ar, |
252 | const Double_t *az,int ip, | |
253 | Double_t tc,Double_t z, | |
cee918ed | 254 | Double_t th)const{ |
166d14ba | 255 | // General Cone surface equation R(z). |
256 | // Intputs: | |
257 | // Double_t ar The array of R values | |
258 | // Double_t az The array of Z values | |
259 | // Int_t ip The index in p to get the point location | |
260 | // Double_t tc The angle of that part of the cone is at | |
261 | // Double_t z The value of z to compute R from | |
262 | // Double_t th The perpendicular distance the parralell line is | |
263 | // from the point ip. | |
264 | // Outputs: | |
265 | // none. | |
266 | // Return: | |
267 | // The value R correstponding to the line at angle th, offeset by | |
268 | // th, and the point p->GetZ/Rmax[ip] at the locatin z. | |
cee918ed | 269 | Double_t tantc = TMath::Tan(tc*TMath::DegToRad()); |
270 | Double_t costc = TMath::Cos(tc*TMath::DegToRad()); | |
172b0d90 | 271 | |
166d14ba | 272 | return -tantc*(z-az[ip])+ar[ip]+th/costc; |
172b0d90 | 273 | } |
274 | //______________________________________________________________________ | |
166d14ba | 275 | Double_t AliITSv11Geometry::RminFromZpCone(const TGeoPcon *p,Int_t ip, |
276 | Double_t tc,Double_t z, | |
cee918ed | 277 | Double_t th)const{ |
166d14ba | 278 | // General Inner Cone surface equation Rmin. |
279 | // Intputs: | |
280 | // TGeoPcon *p The poly cone where the initial point comes from | |
281 | // Int_t ip The index in p to get the point location | |
282 | // Double_t tc The angle of that part of the cone is at | |
283 | // Double_t z The value of z to compute Rmin from | |
284 | // Double_t th The perpendicular distance the parralell line is | |
285 | // from the point ip. | |
286 | // Outputs: | |
287 | // none. | |
288 | // Return: | |
289 | // The value Rmin correstponding to the line at angle th, offeset by | |
290 | // th, and the point p->GetZ/Rmin[ip] at the location z. | |
cee918ed | 291 | Double_t tantc = TMath::Tan(tc*TMath::DegToRad()); |
292 | Double_t costc = TMath::Cos(tc*TMath::DegToRad()); | |
172b0d90 | 293 | |
294 | return -tantc*(z-p->GetZ(ip))+p->GetRmin(ip)+th/costc; | |
295 | } | |
296 | //______________________________________________________________________ | |
166d14ba | 297 | Double_t AliITSv11Geometry::ZFromRmaxpCone(const TGeoPcon *p,int ip, |
298 | Double_t tc,Double_t r, | |
cee918ed | 299 | Double_t th)const{ |
166d14ba | 300 | // General Outer cone Surface equation for z. |
301 | // Intputs: | |
302 | // TGeoPcon *p The poly cone where the initial point comes from | |
303 | // Int_t ip The index in p to get the point location | |
304 | // Double_t tc The angle of that part of the cone is at | |
305 | // Double_t r The value of Rmax to compute z from | |
306 | // Double_t th The perpendicular distance the parralell line is | |
307 | // from the point ip. | |
308 | // Outputs: | |
309 | // none. | |
310 | // Return: | |
311 | // The value Z correstponding to the line at angle th, offeset by | |
312 | // th, and the point p->GetZ/Rmax[ip] at the location r. | |
cee918ed | 313 | Double_t tantc = TMath::Tan(tc*TMath::DegToRad()); |
314 | Double_t costc = TMath::Cos(tc*TMath::DegToRad()); | |
172b0d90 | 315 | |
316 | return p->GetZ(ip)+(p->GetRmax(ip)+th/costc-r)/tantc; | |
317 | } | |
318 | //______________________________________________________________________ | |
166d14ba | 319 | Double_t AliITSv11Geometry::ZFromRmaxpCone(const Double_t *ar, |
320 | const Double_t *az,int ip, | |
321 | Double_t tc,Double_t r, | |
cee918ed | 322 | Double_t th)const{ |
166d14ba | 323 | // General Outer cone Surface equation for z. |
324 | // Intputs: | |
325 | // Double_t ar The array of R values | |
326 | // Double_t az The array of Z values | |
327 | // Int_t ip The index in p to get the point location | |
328 | // Double_t tc The angle of that part of the cone is at | |
329 | // Double_t r The value of Rmax to compute z from | |
330 | // Double_t th The perpendicular distance the parralell line is | |
331 | // from the point ip. | |
332 | // Outputs: | |
333 | // none. | |
334 | // Return: | |
335 | // The value Z correstponding to the line at angle th, offeset by | |
336 | // th, and the point p->GetZ/Rmax[ip] at the locatin r. | |
cee918ed | 337 | Double_t tantc = TMath::Tan(tc*TMath::DegToRad()); |
338 | Double_t costc = TMath::Cos(tc*TMath::DegToRad()); | |
172b0d90 | 339 | |
166d14ba | 340 | return az[ip]+(ar[ip]+th/costc-r)/tantc; |
172b0d90 | 341 | } |
342 | //______________________________________________________________________ | |
166d14ba | 343 | Double_t AliITSv11Geometry::ZFromRminpCone(const TGeoPcon *p,int ip, |
344 | Double_t tc,Double_t r, | |
cee918ed | 345 | Double_t th)const{ |
166d14ba | 346 | // General Inner cone Surface equation for z. |
347 | // Intputs: | |
348 | // TGeoPcon *p The poly cone where the initial point comes from | |
349 | // Int_t ip The index in p to get the point location | |
350 | // Double_t tc The angle of that part of the cone is at | |
351 | // Double_t r The value of Rmin to compute z from | |
352 | // Double_t th The perpendicular distance the parralell line is | |
353 | // from the point ip. | |
354 | // Outputs: | |
355 | // none. | |
356 | // Return: | |
357 | // The value Z correstponding to the line at angle th, offeset by | |
358 | // th, and the point p->GetZ/Rmin[ip] at the location r. | |
cee918ed | 359 | Double_t tantc = TMath::Tan(tc*TMath::DegToRad()); |
360 | Double_t costc = TMath::Cos(tc*TMath::DegToRad()); | |
172b0d90 | 361 | |
362 | return p->GetZ(ip)+(p->GetRmin(ip)+th/costc-r)/tantc; | |
363 | } | |
364 | //______________________________________________________________________ | |
166d14ba | 365 | void AliITSv11Geometry::RadiusOfCurvature(Double_t rc,Double_t theta0, |
366 | Double_t z0,Double_t r0, | |
367 | Double_t theta1,Double_t &z1, | |
cee918ed | 368 | Double_t &r1)const{ |
172b0d90 | 369 | // Given a initial point z0,r0, the initial angle theta0, and the radius |
370 | // of curvature, returns the point z1, r1 at the angle theta1. Theta | |
371 | // measured from the r axis in the clock wise direction [degrees]. | |
166d14ba | 372 | // Inputs: |
373 | // Double_t rc The radius of curvature | |
374 | // Double_t theta0 The starting angle (degrees) | |
375 | // Double_t z0 The value of z at theta0 | |
376 | // Double_t r0 The value of r at theta0 | |
377 | // Double_t theta1 The ending angle (degrees) | |
378 | // Outputs: | |
379 | // Double_t &z1 The value of z at theta1 | |
380 | // Double_t &r1 The value of r at theta1 | |
381 | // Return: | |
382 | // none. | |
172b0d90 | 383 | |
cee918ed | 384 | z1 = rc*(TMath::Sin(theta1*TMath::DegToRad())-TMath::Sin(theta0*TMath::DegToRad()))+z0; |
385 | r1 = rc*(TMath::Cos(theta1*TMath::DegToRad())-TMath::Cos(theta0*TMath::DegToRad()))+r0; | |
172b0d90 | 386 | return; |
387 | } | |
388 | //______________________________________________________________________ | |
166d14ba | 389 | void AliITSv11Geometry::InsidePoint(const TGeoPcon *p,Int_t i1,Int_t i2, |
390 | Int_t i3,Double_t c,TGeoPcon *q,Int_t j1, | |
cee918ed | 391 | Bool_t max)const{ |
172b0d90 | 392 | // Given two lines defined by the points i1, i2,i3 in the TGeoPcon |
393 | // class p that intersect at point p->GetZ(i2) return the point z,r | |
394 | // that is Cthick away in the TGeoPcon class q. If points i1=i2 | |
395 | // and max == kTRUE, then p->GetRmin(i1) and p->GetRmax(i2) are used. | |
396 | // if points i2=i3 and max=kTRUE then points p->GetRmax(i2) and | |
397 | // p->GetRmin(i3) are used. If i2=i3 and max=kFALSE, then p->GetRmin(i2) | |
398 | // and p->GetRmax(i3) are used. | |
399 | // Inputs: | |
400 | // TGeoPcon *p Class where points i1, i2, and i3 are taken from | |
401 | // Int_t i1 First point in class p | |
402 | // Int_t i2 Second point in class p | |
403 | // Int_t i3 Third point in class p | |
404 | // Double_t c Distance inside the outer surface/inner suface | |
405 | // that the point j1 is to be computed for. | |
406 | // TGeoPcon *q Pointer to class for results to be put into. | |
407 | // Int_t j1 Point in class q where data is to be stored. | |
408 | // Bool_t max if kTRUE, then a Rmax value is computed, | |
409 | // else a Rmin valule is computed. | |
410 | // Output: | |
411 | // TGeoPcon *q Pointer to class for results to be put into. | |
412 | // Return: | |
413 | // none. | |
414 | Double_t x0,y0,x1,y1,x2,y2,x,y; | |
415 | ||
416 | if(max){ | |
417 | c = -c; //cout <<"L394 c="<<c<<endl; | |
418 | y0 = p->GetRmax(i1); | |
419 | if(i1==i2) y0 = p->GetRmin(i1); //cout <<"L396 y0="<<y0<<endl; | |
420 | y1 = p->GetRmax(i2); //cout <<"L397 y1="<<y1<<endl; | |
421 | y2 = p->GetRmax(i3); //cout <<"L398 y2="<<y2<<endl; | |
422 | if(i2==i3) y2 = p->GetRmin(i3); //cout <<"L399 y2="<<y2<<endl; | |
423 | }else{ // min | |
424 | y0 = p->GetRmin(i1); //cout <<"L401 y0="<<y0<<endl; | |
425 | y1 = p->GetRmin(i2); //cout <<"L402 y1="<<y1<<endl; | |
426 | y2 = p->GetRmin(i3); | |
427 | if(i2==i3) y2 = p->GetRmax(i3); //cout <<"L404 y2="<<y2<<endl; | |
428 | } // end if | |
429 | x0 = p->GetZ(i1); //cout <<"L406 x0="<<x0<<endl; | |
430 | x1 = p->GetZ(i2); //cout <<"L407 x1="<<x1<<endl; | |
431 | x2 = p->GetZ(i3); //cout <<"L408 x2="<<x2<<endl; | |
432 | // | |
433 | InsidePoint(x0,y0,x1,y1,x2,y2,c,x,y); | |
434 | q->Z(j1) = x; | |
435 | if(max) q->Rmax(j1) = y; | |
436 | else q->Rmin(j1) = y; | |
437 | return; | |
438 | } | |
439 | //---------------------------------------------------------------------- | |
166d14ba | 440 | void AliITSv11Geometry::InsidePoint(Double_t x0,Double_t y0, |
441 | Double_t x1,Double_t y1, | |
442 | Double_t x2,Double_t y2,Double_t c, | |
cee918ed | 443 | Double_t &x,Double_t &y)const{ |
172b0d90 | 444 | // Given two intersecting lines defined by the points (x0,y0), (x1,y1) and |
445 | // (x1,y1), (x1,y2) {intersecting at (x1,y1)} the point (x,y) a distance | |
446 | // c away is returned such that two lines a distance c away from the | |
447 | // lines defined above intersect at (x,y). | |
448 | // Inputs: | |
449 | // Double_t x0 X point on the first intersecting sets of lines | |
450 | // Double_t y0 Y point on the first intersecting sets of lines | |
451 | // Double_t x1 X point on the first/second intersecting sets of lines | |
452 | // Double_t y1 Y point on the first/second intersecting sets of lines | |
453 | // Double_t x2 X point on the second intersecting sets of lines | |
454 | // Double_t y2 Y point on the second intersecting sets of lines | |
455 | // Double_t c Distance the two sets of lines are from each other | |
456 | // Output: | |
457 | // Double_t x X point for the intersecting sets of parellel lines | |
458 | // Double_t y Y point for the intersecting sets of parellel lines | |
459 | // Return: | |
460 | // none. | |
166d14ba | 461 | Double_t dx01,dx12,dy01,dy12,r01,r12,m; |
172b0d90 | 462 | dx01 = x0-x1; //cout <<"L410 dx01="<<dx01<<endl; |
463 | dx12 = x1-x2; //cout <<"L411 dx12="<<dx12<<endl; | |
464 | dy01 = y0-y1; //cout <<"L412 dy01="<<dy01<<endl; | |
465 | dy12 = y1-y2; //cout <<"L413 dy12="<<dy12<<endl; | |
166d14ba | 466 | r01 = TMath::Sqrt(dy01*dy01+dx01*dx01); //cout <<"L414 r01="<<r01<<endl; |
467 | r12 = TMath::Sqrt(dy12*dy12+dx12*dx12); //cout <<"L415 r12="<<r12<<endl; | |
172b0d90 | 468 | m = dx12*dy01-dy12*dx01; |
469 | if(m*m<DBL_EPSILON){ // m == n | |
470 | if(dy01==0.0){ // line are = | |
471 | x = x1+c; //cout <<"L419 x="<<x<<endl; | |
472 | y = y1; //cout <<"L420 y="<<y<<endl; | |
473 | return; | |
474 | }else if(dx01==0.0){ | |
475 | x = x1; | |
476 | y = y1+c; | |
477 | return; | |
478 | }else{ // dx01!=0 and dy01 !=0. | |
166d14ba | 479 | x = x1-0.5*c*r01/dy01; //cout <<"L434 x="<<x<<endl; |
480 | y = y1+0.5*c*r01/dx01; //cout <<"L435 y="<<y<<endl; | |
172b0d90 | 481 | } // end if |
482 | return; | |
483 | } // | |
cee918ed | 484 | x = x1+c*(dx12*r01-dx01*r12)/m; //cout <<"L442 x="<<x<<endl; |
485 | y = y1+c*(dy12*r01-dy01*r12)/m; //cout <<"L443 y="<<y<<endl; | |
172b0d90 | 486 | //cout <<"=============================================="<<endl; |
487 | return; | |
488 | } | |
489 | //---------------------------------------------------------------------- | |
166d14ba | 490 | void AliITSv11Geometry:: PrintArb8(const TGeoArb8 *a)const{ |
491 | // Prints out the content of the TGeoArb8. Usefull for debugging. | |
492 | // Inputs: | |
493 | // TGeoArb8 *a | |
494 | // Outputs: | |
495 | // none. | |
496 | // Return: | |
497 | // none. | |
498 | ||
cee918ed | 499 | if(!GetDebug()) return; |
500 | printf("%s",a->GetName()); | |
501 | a->InspectShape(); | |
166d14ba | 502 | return; |
172b0d90 | 503 | } |
504 | //---------------------------------------------------------------------- | |
166d14ba | 505 | void AliITSv11Geometry:: PrintPcon(const TGeoPcon *a)const{ |
506 | // Prints out the content of the TGeoPcon. Usefull for debugging. | |
507 | // Inputs: | |
508 | // TGeoPcon *a | |
509 | // Outputs: | |
510 | // none. | |
511 | // Return: | |
512 | // none. | |
513 | ||
cee918ed | 514 | if(!GetDebug()) return; |
166d14ba | 515 | cout << a->GetName() << ": N=" << a->GetNz() << " Phi1=" << a->GetPhi1() |
516 | << ", Dphi=" << a->GetDphi() << endl; | |
172b0d90 | 517 | cout << "i\t Z \t Rmin \t Rmax" << endl; |
166d14ba | 518 | for(Int_t iii=0;iii<a->GetNz();iii++){ |
519 | cout << iii << "\t" << a->GetZ(iii) << "\t" << a->GetRmin(iii) | |
520 | << "\t" << a->GetRmax(iii) << endl; | |
172b0d90 | 521 | } // end for iii |
166d14ba | 522 | return; |
172b0d90 | 523 | } |
524 | //---------------------------------------------------------------------- | |
166d14ba | 525 | void AliITSv11Geometry::PrintTube(const TGeoTube *a)const{ |
526 | // Prints out the content of the TGeoTube. Usefull for debugging. | |
527 | // Inputs: | |
528 | // TGeoTube *a | |
529 | // Outputs: | |
530 | // none. | |
531 | // Return: | |
532 | // none. | |
533 | ||
cee918ed | 534 | if(!GetDebug()) return; |
166d14ba | 535 | cout << a->GetName() <<": Rmin="<<a->GetRmin() |
536 | <<" Rmax=" <<a->GetRmax()<<" Dz="<<a->GetDz()<<endl; | |
537 | return; | |
172b0d90 | 538 | } |
539 | //---------------------------------------------------------------------- | |
166d14ba | 540 | void AliITSv11Geometry::PrintTubeSeg(const TGeoTubeSeg *a)const{ |
541 | // Prints out the content of the TGeoTubeSeg. Usefull for debugging. | |
542 | // Inputs: | |
543 | // TGeoTubeSeg *a | |
544 | // Outputs: | |
545 | // none. | |
546 | // Return: | |
547 | // none. | |
548 | ||
cee918ed | 549 | if(!GetDebug()) return; |
166d14ba | 550 | cout << a->GetName() <<": Phi1="<<a->GetPhi1()<< |
551 | " Phi2="<<a->GetPhi2()<<" Rmin="<<a->GetRmin() | |
552 | <<" Rmax=" <<a->GetRmax()<<" Dz="<<a->GetDz()<<endl; | |
553 | return; | |
172b0d90 | 554 | } |
555 | //---------------------------------------------------------------------- | |
166d14ba | 556 | void AliITSv11Geometry::PrintConeSeg(const TGeoConeSeg *a)const{ |
557 | // Prints out the content of the TGeoConeSeg. Usefull for debugging. | |
558 | // Inputs: | |
559 | // TGeoConeSeg *a | |
560 | // Outputs: | |
561 | // none. | |
562 | // Return: | |
563 | // none. | |
564 | ||
cee918ed | 565 | if(!GetDebug()) return; |
166d14ba | 566 | cout << a->GetName() <<": Phi1="<<a->GetPhi1()<< |
567 | " Phi2="<<a->GetPhi2()<<" Rmin1="<<a->GetRmin1() | |
568 | <<" Rmax1=" <<a->GetRmax1()<<" Rmin2="<<a->GetRmin2() | |
569 | <<" Rmax2=" <<a->GetRmax2()<<" Dz="<<a->GetDz()<<endl; | |
570 | return; | |
172b0d90 | 571 | } |
572 | //---------------------------------------------------------------------- | |
166d14ba | 573 | void AliITSv11Geometry::PrintBBox(const TGeoBBox *a)const{ |
574 | // Prints out the content of the TGeoBBox. Usefull for debugging. | |
575 | // Inputs: | |
576 | // TGeoBBox *a | |
577 | // Outputs: | |
578 | // none. | |
579 | // Return: | |
580 | // none. | |
581 | ||
cee918ed | 582 | if(!GetDebug()) return; |
166d14ba | 583 | cout << a->GetName() <<": Dx="<<a->GetDX()<< |
584 | " Dy="<<a->GetDY()<<" Dz="<<a->GetDZ() <<endl; | |
585 | return; | |
172b0d90 | 586 | } |
166d14ba | 587 | //--------------------------------------------------------------------- |
588 | void AliITSv11Geometry::DrawCrossSection(const TGeoPcon *p, | |
589 | Int_t fillc,Int_t fills, | |
590 | Int_t linec,Int_t lines,Int_t linew, | |
591 | Int_t markc,Int_t marks,Float_t marksize)const{ | |
592 | // Draws a cross sectional view of the TGeoPcon, Primarily for debugging. | |
593 | // A TCanvas should exist first. | |
594 | // Inputs: | |
595 | // TGeoPcon *p The TGeoPcon to be "drawn" | |
596 | // Int_t fillc The fill color to be used | |
597 | // Int_t fills The fill style to be used | |
598 | // Int_t linec The line color to be used | |
599 | // Int_t lines The line style to be used | |
600 | // Int_t linew The line width to be used | |
601 | // Int_t markc The markder color to be used | |
602 | // Int_t marks The markder style to be used | |
603 | // Float_t marksize The marker size | |
604 | // Outputs: | |
605 | // none. | |
606 | // Return: | |
607 | // none. | |
608 | Int_t n=0,m=0,i=0; | |
609 | Double_t *z=0,*r=0; | |
610 | TPolyMarker *pts=0; | |
611 | TPolyLine *line=0; | |
172b0d90 | 612 | |
166d14ba | 613 | n = p->GetNz(); |
614 | if(n<=0) return; | |
615 | m = 2*n+1; | |
616 | z = new Double_t[m]; | |
617 | r = new Double_t[m]; | |
618 | ||
619 | for(i=0;i<n;i++){ | |
620 | z[i] = p->GetZ(i); | |
621 | r[i] = p->GetRmax(i); | |
622 | z[i+n] = p->GetZ(n-1-i); | |
623 | r[i+n] = p->GetRmin(n-1-i); | |
624 | } // end for i | |
625 | z[n-1] = z[0]; | |
626 | r[n-1] = r[0]; | |
627 | ||
628 | line = new TPolyLine(n,z,r); | |
629 | pts = new TPolyMarker(n,z,r); | |
630 | ||
631 | line->SetFillColor(fillc); | |
632 | line->SetFillStyle(fills); | |
633 | line->SetLineColor(linec); | |
634 | line->SetLineStyle(lines); | |
635 | line->SetLineWidth(linew); | |
636 | pts->SetMarkerColor(markc); | |
637 | pts->SetMarkerStyle(marks); | |
638 | pts->SetMarkerSize(marksize); | |
639 | ||
640 | line->Draw("f"); | |
641 | line->Draw(); | |
642 | pts->Draw(); | |
643 | ||
644 | delete[] z; | |
645 | delete[] r; | |
646 | ||
647 | cout<<"Hit Return to continue"<<endl; | |
648 | cin >> n; | |
649 | delete line; | |
650 | delete pts; | |
651 | return; | |
652 | } | |
653 | //---------------------------------------------------------------------- |