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