]>
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> | |
db486a6e | 34 | #include <TArc.h> |
35 | #include <TLine.h> | |
36 | #include <TArrow.h> | |
37 | #include <TCanvas.h> | |
38 | #include <TText.h> | |
172b0d90 | 39 | #include <TGeoPcon.h> |
40 | #include <TGeoCone.h> | |
41 | #include <TGeoTube.h> // contaings TGeoTubeSeg | |
42 | #include <TGeoArb8.h> | |
166d14ba | 43 | #include <TPolyMarker.h> |
44 | #include <TPolyLine.h> | |
172b0d90 | 45 | #include "AliITSv11Geometry.h" |
46 | ||
47 | ClassImp(AliITSv11Geometry) | |
a98296c1 | 48 | |
db486a6e | 49 | const Double_t AliITSv11Geometry::fgkmicron = 1.0E-4; |
a98296c1 | 50 | const Double_t AliITSv11Geometry::fgkmm = 0.10; |
51 | const Double_t AliITSv11Geometry::fgkcm = 1.00; | |
52 | const Double_t AliITSv11Geometry::fgkDegree = 1.0; | |
53 | const Double_t AliITSv11Geometry::fgkRadian = 180./3.14159265358979323846; | |
a53658c6 | 54 | const Double_t AliITSv11Geometry::fgkgcm3 = 1.0; // assume default is g/cm^3 |
55 | const Double_t AliITSv11Geometry::fgkCelsius = 1.0; // Assume default is C | |
56 | const Double_t AliITSv11Geometry::fgkPascal = 1.0E-3; // Assume kPascal | |
57 | const Double_t AliITSv11Geometry::fgkKPascal = 1.0; // Asume kPascal | |
58 | const Double_t AliITSv11Geometry::fgkeV = 1.0E-9; // GeV default | |
59 | const Double_t AliITSv11Geometry::fgkKeV = 1.0e-6; // GeV default | |
60 | const Double_t AliITSv11Geometry::fgkMeV = 1.0e-3; // GeV default | |
61 | const Double_t AliITSv11Geometry::fgkGeV = 1.0; // GeV default | |
172b0d90 | 62 | //______________________________________________________________________ |
166d14ba | 63 | Double_t AliITSv11Geometry::Yfrom2Points(Double_t x0,Double_t y0, |
64 | Double_t x1,Double_t y1, | |
cee918ed | 65 | Double_t x)const{ |
166d14ba | 66 | // Given the two points (x0,y0) and (x1,y1) and the location x, returns |
67 | // the value y corresponding to that point x on the line defined by the | |
68 | // two points. | |
69 | // Inputs: | |
70 | // Double_t x0 The first x value defining the line | |
71 | // Double_t y0 The first y value defining the line | |
72 | // Double_t x1 The second x value defining the line | |
73 | // Double_t y1 The second y value defining the line | |
74 | // Double_t x The x value for which the y value is wanted. | |
75 | // Outputs: | |
76 | // none. | |
77 | // Return: | |
78 | // The value y corresponding to the point x on the line defined by | |
79 | // the two points (x0,y0) and (x1,y1). | |
80 | ||
81 | if(x0==x1 && y0==y1) { | |
82 | printf("Error: AliITSv11Geometry::Yfrom2Ponts The two points are " | |
83 | "the same (%e,%e) and (%e,%e)",x0,y0,x1,y1); | |
84 | return 0.0; | |
85 | } // end if | |
86 | if(x0==x1){ | |
87 | printf("Warning: AliITSv11Geometry::Yfrom2Points x0=%e == x1=%e. " | |
88 | "line vertical ""returning mean y",x0,x1); | |
89 | return 0.5*(y0+y1); | |
90 | }// end if x0==x1 | |
91 | Double_t m = (y0-y1)/(x0-x1); | |
92 | return m*(x-x0)+y0; | |
93 | } | |
94 | //______________________________________________________________________ | |
95 | Double_t AliITSv11Geometry::Xfrom2Points(Double_t x0,Double_t y0, | |
96 | Double_t x1,Double_t y1, | |
cee918ed | 97 | Double_t y)const{ |
166d14ba | 98 | // Given the two points (x0,y0) and (x1,y1) and the location y, returns |
99 | // the value x corresponding to that point y on the line defined by the | |
100 | // two points. | |
101 | // Inputs: | |
102 | // Double_t x0 The first x value defining the line | |
103 | // Double_t y0 The first y value defining the line | |
104 | // Double_t x1 The second x value defining the line | |
105 | // Double_t y1 The second y value defining the line | |
106 | // Double_t y The y value for which the x value is wanted. | |
107 | // Outputs: | |
108 | // none. | |
109 | // Return: | |
110 | // The value x corresponding to the point y on the line defined by | |
111 | // the two points (x0,y0) and (x1,y1). | |
112 | ||
113 | if(x0==x1 && y0==y1) { | |
114 | printf("Error: AliITSv11Geometry::Yfrom2Ponts The two points are " | |
115 | "the same (%e,%e) and (%e,%e)",x0,y0,x1,y1); | |
116 | return 0.0; | |
117 | } // end if | |
118 | if(y0==y1){ | |
119 | printf("Warrning: AliITSv11Geometry::Yfrom2Points y0=%e == y1=%e. " | |
120 | "line horizontal returning mean x",y0,y1); | |
121 | return 0.5*(x0+x1); | |
122 | }// end if y0==y1 | |
123 | Double_t m = (x0-x1)/(y0-y1); | |
124 | return m*(y-y0)+x0; | |
125 | } | |
126 | //______________________________________________________________________ | |
127 | Double_t AliITSv11Geometry::RmaxFrom2Points(const TGeoPcon *p,Int_t i1, | |
cee918ed | 128 | Int_t i2,Double_t z)const{ |
172b0d90 | 129 | // functions Require at parts of Volume A to be already defined. |
130 | // Retruns the value of Rmax corresponding to point z alone the line | |
131 | // defined by the two points p.Rmax(i1),p-GetZ(i1) and p->GetRmax(i2), | |
132 | // p->GetZ(i2). | |
166d14ba | 133 | // Inputs: |
134 | // TGeoPcon *p The Polycone where the two points come from | |
135 | // Int_t i1 Point 1 | |
136 | // Int_t i2 Point 2 | |
137 | // Double_t z The value of z for which Rmax is to be found | |
138 | // Outputs: | |
139 | // none. | |
140 | // Return: | |
141 | // Double_t Rmax the value corresponding to z | |
172b0d90 | 142 | Double_t d0,d1,d2,r; |
143 | ||
144 | d0 = p->GetRmax(i1)-p->GetRmax(i2);// cout <<"L263: d0="<<d0<<endl; | |
145 | d1 = z-p->GetZ(i2);// cout <<"L264: d1="<<d1<<endl; | |
146 | d2 = p->GetZ(i1)-p->GetZ(i2);// cout <<"L265: d2="<<d2<<endl; | |
147 | r = p->GetRmax(i2) + d1*d0/d2;// cout <<"L266: r="<<r<<endl; | |
148 | return r; | |
149 | } | |
150 | //______________________________________________________________________ | |
166d14ba | 151 | Double_t AliITSv11Geometry::RminFrom2Points(const TGeoPcon *p,Int_t i1, |
cee918ed | 152 | 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 | // TGeoPcon *p The Polycone where the two points come from | |
158 | // Int_t i1 Point 1 | |
159 | // Int_t i2 Point 2 | |
160 | // Double_t z The value of z for which Rmax is to be found | |
161 | // Outputs: | |
162 | // none. | |
163 | // Return: | |
164 | // Double_t Rmax the value corresponding to z | |
172b0d90 | 165 | |
166 | return p->GetRmin(i2)+(p->GetRmin(i1)-p->GetRmin(i2))*(z-p->GetZ(i2))/ | |
167 | (p->GetZ(i1)-p->GetZ(i2)); | |
168 | } | |
169 | //______________________________________________________________________ | |
166d14ba | 170 | Double_t AliITSv11Geometry::RFrom2Points(const Double_t *p,const Double_t *az, |
cee918ed | 171 | Int_t i1,Int_t i2,Double_t z)const{ |
172b0d90 | 172 | // Retruns the value of Rmin corresponding to point z 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 | // Double_t az Array of z values | |
177 | // Double_t r Array of r values | |
178 | // Int_t i1 First Point in arrays | |
179 | // Int_t i2 Second Point in arrays | |
180 | // Double_t z Value z at which r is to be found | |
181 | // Outputs: | |
182 | // none. | |
183 | // Return: | |
184 | // The value r corresponding to z and the line defined by the two points | |
172b0d90 | 185 | |
166d14ba | 186 | return p[i2]+(p[i1]-p[i2])*(z-az[i2])/(az[i1]-az[i2]); |
172b0d90 | 187 | } |
188 | //______________________________________________________________________ | |
166d14ba | 189 | Double_t AliITSv11Geometry::Zfrom2MinPoints(const TGeoPcon *p,Int_t i1, |
cee918ed | 190 | Int_t i2,Double_t r)const{ |
172b0d90 | 191 | // Retruns the value of Z corresponding to point R alone the line |
192 | // defined by the two points p->GetRmin(i1),p->GetZ(i1) and | |
193 | // p->GetRmin(i2),p->GetZ(i2) | |
166d14ba | 194 | // Inputs: |
195 | // TGeoPcon *p The Poly cone where the two points come from. | |
196 | // Int_t i1 First Point in arrays | |
197 | // Int_t i2 Second Point in arrays | |
198 | // Double_t r Value r min at which z is to be found | |
199 | // Outputs: | |
200 | // none. | |
201 | // Return: | |
202 | // The value z corresponding to r min and the line defined by | |
203 | // the two points | |
172b0d90 | 204 | |
205 | return p->GetZ(i2)+(p->GetZ(i1)-p->GetZ(i2))*(r-p->GetRmin(i2))/ | |
206 | (p->GetRmin(i1)-p->GetRmin(i2)); | |
207 | } | |
208 | //______________________________________________________________________ | |
166d14ba | 209 | Double_t AliITSv11Geometry::Zfrom2MaxPoints(const TGeoPcon *p,Int_t i1, |
cee918ed | 210 | Int_t i2,Double_t r)const{ |
172b0d90 | 211 | // Retruns the value of Z corresponding to point R alone the line |
212 | // defined by the two points p->GetRmax(i1),p->GetZ(i1) and | |
213 | // p->GetRmax(i2),p->GetZ(i2) | |
166d14ba | 214 | // Inputs: |
215 | // TGeoPcon *p The Poly cone where the two points come from. | |
216 | // Int_t i1 First Point in arrays | |
217 | // Int_t i2 Second Point in arrays | |
218 | // Double_t r Value r max at which z is to be found | |
219 | // Outputs: | |
220 | // none. | |
221 | // Return: | |
222 | // The value z corresponding to r max and the line defined by | |
223 | // the two points | |
172b0d90 | 224 | |
225 | return p->GetZ(i2)+(p->GetZ(i1)-p->GetZ(i2))*(r-p->GetRmax(i2))/ | |
226 | (p->GetRmax(i1)-p->GetRmax(i2)); | |
227 | } | |
228 | //______________________________________________________________________ | |
166d14ba | 229 | Double_t AliITSv11Geometry::Zfrom2Points(const Double_t *z,const Double_t *ar, |
cee918ed | 230 | Int_t i1,Int_t i2,Double_t r)const{ |
166d14ba | 231 | // Retruns the value of z corresponding to point R alone the line |
172b0d90 | 232 | // defined by the two points p->GetRmax(i1),p->GetZ(i1) and |
233 | // p->GetRmax(i2),p->GetZ(i2) | |
166d14ba | 234 | // Inputs: |
235 | // Double_t z Array of z values | |
236 | // Double_t ar Array of r values | |
237 | // Int_t i1 First Point in arrays | |
238 | // Int_t i2 Second Point in arrays | |
239 | // Double_t r Value r at which z is to be found | |
240 | // Outputs: | |
241 | // none. | |
242 | // Return: | |
243 | // The value z corresponding to r and the line defined by the two points | |
172b0d90 | 244 | |
166d14ba | 245 | return z[i2]+(z[i1]-z[i2])*(r-ar[i2])/(ar[i1]-ar[i2]); |
172b0d90 | 246 | } |
247 | //______________________________________________________________________ | |
166d14ba | 248 | Double_t AliITSv11Geometry::RmaxFromZpCone(const TGeoPcon *p,int ip, |
249 | Double_t tc,Double_t z, | |
cee918ed | 250 | Double_t th)const{ |
166d14ba | 251 | // General Outer Cone surface equation Rmax. |
252 | // Intputs: | |
253 | // TGeoPcon *p The poly cone where the initial point comes from | |
254 | // Int_t ip The index in p to get the point location | |
255 | // Double_t tc The angle of that part of the cone is at | |
256 | // Double_t z The value of z to compute Rmax from | |
257 | // Double_t th The perpendicular distance the parralell line is | |
258 | // from the point ip. | |
259 | // Outputs: | |
260 | // none. | |
261 | // Return: | |
262 | // The value Rmax correstponding to the line at angle th, offeset by | |
263 | // th, and the point p->GetZ/Rmin[ip] at the location z. | |
cee918ed | 264 | Double_t tantc = TMath::Tan(tc*TMath::DegToRad()); |
265 | Double_t costc = TMath::Cos(tc*TMath::DegToRad()); | |
172b0d90 | 266 | |
267 | return -tantc*(z-p->GetZ(ip))+p->GetRmax(ip)+th/costc; | |
268 | } | |
269 | //______________________________________________________________________ | |
166d14ba | 270 | Double_t AliITSv11Geometry::RFromZpCone(const Double_t *ar, |
271 | const Double_t *az,int ip, | |
272 | Double_t tc,Double_t z, | |
cee918ed | 273 | Double_t th)const{ |
166d14ba | 274 | // General Cone surface equation R(z). |
275 | // Intputs: | |
276 | // Double_t ar The array of R values | |
277 | // Double_t az The array of Z values | |
278 | // Int_t ip The index in p to get the point location | |
279 | // Double_t tc The angle of that part of the cone is at | |
280 | // Double_t z The value of z to compute R from | |
281 | // Double_t th The perpendicular distance the parralell line is | |
282 | // from the point ip. | |
283 | // Outputs: | |
284 | // none. | |
285 | // Return: | |
286 | // The value R correstponding to the line at angle th, offeset by | |
287 | // th, and the point p->GetZ/Rmax[ip] at the locatin z. | |
cee918ed | 288 | Double_t tantc = TMath::Tan(tc*TMath::DegToRad()); |
289 | Double_t costc = TMath::Cos(tc*TMath::DegToRad()); | |
172b0d90 | 290 | |
166d14ba | 291 | return -tantc*(z-az[ip])+ar[ip]+th/costc; |
172b0d90 | 292 | } |
293 | //______________________________________________________________________ | |
166d14ba | 294 | Double_t AliITSv11Geometry::RminFromZpCone(const TGeoPcon *p,Int_t ip, |
295 | Double_t tc,Double_t z, | |
cee918ed | 296 | Double_t th)const{ |
166d14ba | 297 | // General Inner Cone surface equation Rmin. |
298 | // Intputs: | |
299 | // TGeoPcon *p The poly cone where the initial point comes from | |
300 | // Int_t ip The index in p to get the point location | |
301 | // Double_t tc The angle of that part of the cone is at | |
302 | // Double_t z The value of z to compute Rmin from | |
303 | // Double_t th The perpendicular distance the parralell line is | |
304 | // from the point ip. | |
305 | // Outputs: | |
306 | // none. | |
307 | // Return: | |
308 | // The value Rmin correstponding to the line at angle th, offeset by | |
309 | // th, and the point p->GetZ/Rmin[ip] at the location z. | |
cee918ed | 310 | Double_t tantc = TMath::Tan(tc*TMath::DegToRad()); |
311 | Double_t costc = TMath::Cos(tc*TMath::DegToRad()); | |
172b0d90 | 312 | |
313 | return -tantc*(z-p->GetZ(ip))+p->GetRmin(ip)+th/costc; | |
314 | } | |
315 | //______________________________________________________________________ | |
166d14ba | 316 | Double_t AliITSv11Geometry::ZFromRmaxpCone(const TGeoPcon *p,int ip, |
317 | Double_t tc,Double_t r, | |
cee918ed | 318 | Double_t th)const{ |
166d14ba | 319 | // General Outer cone Surface equation for z. |
320 | // Intputs: | |
321 | // TGeoPcon *p The poly cone where the initial point comes from | |
322 | // Int_t ip The index in p to get the point location | |
323 | // Double_t tc The angle of that part of the cone is at | |
324 | // Double_t r The value of Rmax to compute z from | |
325 | // Double_t th The perpendicular distance the parralell line is | |
326 | // from the point ip. | |
327 | // Outputs: | |
328 | // none. | |
329 | // Return: | |
330 | // The value Z correstponding to the line at angle th, offeset by | |
331 | // th, and the point p->GetZ/Rmax[ip] at the location r. | |
cee918ed | 332 | Double_t tantc = TMath::Tan(tc*TMath::DegToRad()); |
333 | Double_t costc = TMath::Cos(tc*TMath::DegToRad()); | |
172b0d90 | 334 | |
335 | return p->GetZ(ip)+(p->GetRmax(ip)+th/costc-r)/tantc; | |
336 | } | |
337 | //______________________________________________________________________ | |
166d14ba | 338 | Double_t AliITSv11Geometry::ZFromRmaxpCone(const Double_t *ar, |
339 | const Double_t *az,int ip, | |
340 | Double_t tc,Double_t r, | |
cee918ed | 341 | Double_t th)const{ |
166d14ba | 342 | // General Outer cone Surface equation for z. |
343 | // Intputs: | |
344 | // Double_t ar The array of R values | |
345 | // Double_t az The array of Z values | |
346 | // Int_t ip The index in p to get the point location | |
347 | // Double_t tc The angle of that part of the cone is at | |
348 | // Double_t r The value of Rmax to compute z from | |
349 | // Double_t th The perpendicular distance the parralell line is | |
350 | // from the point ip. | |
351 | // Outputs: | |
352 | // none. | |
353 | // Return: | |
354 | // The value Z correstponding to the line at angle th, offeset by | |
355 | // th, and the point p->GetZ/Rmax[ip] at the locatin r. | |
cee918ed | 356 | Double_t tantc = TMath::Tan(tc*TMath::DegToRad()); |
357 | Double_t costc = TMath::Cos(tc*TMath::DegToRad()); | |
172b0d90 | 358 | |
166d14ba | 359 | return az[ip]+(ar[ip]+th/costc-r)/tantc; |
172b0d90 | 360 | } |
361 | //______________________________________________________________________ | |
166d14ba | 362 | Double_t AliITSv11Geometry::ZFromRminpCone(const TGeoPcon *p,int ip, |
363 | Double_t tc,Double_t r, | |
cee918ed | 364 | Double_t th)const{ |
166d14ba | 365 | // General Inner cone Surface equation for z. |
366 | // Intputs: | |
367 | // TGeoPcon *p The poly cone where the initial point comes from | |
368 | // Int_t ip The index in p to get the point location | |
369 | // Double_t tc The angle of that part of the cone is at | |
370 | // Double_t r The value of Rmin to compute z from | |
371 | // Double_t th The perpendicular distance the parralell line is | |
372 | // from the point ip. | |
373 | // Outputs: | |
374 | // none. | |
375 | // Return: | |
376 | // The value Z correstponding to the line at angle th, offeset by | |
377 | // th, and the point p->GetZ/Rmin[ip] at the location r. | |
cee918ed | 378 | Double_t tantc = TMath::Tan(tc*TMath::DegToRad()); |
379 | Double_t costc = TMath::Cos(tc*TMath::DegToRad()); | |
172b0d90 | 380 | |
381 | return p->GetZ(ip)+(p->GetRmin(ip)+th/costc-r)/tantc; | |
382 | } | |
383 | //______________________________________________________________________ | |
166d14ba | 384 | void AliITSv11Geometry::RadiusOfCurvature(Double_t rc,Double_t theta0, |
385 | Double_t z0,Double_t r0, | |
386 | Double_t theta1,Double_t &z1, | |
cee918ed | 387 | Double_t &r1)const{ |
172b0d90 | 388 | // Given a initial point z0,r0, the initial angle theta0, and the radius |
389 | // of curvature, returns the point z1, r1 at the angle theta1. Theta | |
390 | // measured from the r axis in the clock wise direction [degrees]. | |
166d14ba | 391 | // Inputs: |
392 | // Double_t rc The radius of curvature | |
393 | // Double_t theta0 The starting angle (degrees) | |
394 | // Double_t z0 The value of z at theta0 | |
395 | // Double_t r0 The value of r at theta0 | |
396 | // Double_t theta1 The ending angle (degrees) | |
397 | // Outputs: | |
398 | // Double_t &z1 The value of z at theta1 | |
399 | // Double_t &r1 The value of r at theta1 | |
400 | // Return: | |
401 | // none. | |
172b0d90 | 402 | |
cee918ed | 403 | z1 = rc*(TMath::Sin(theta1*TMath::DegToRad())-TMath::Sin(theta0*TMath::DegToRad()))+z0; |
404 | r1 = rc*(TMath::Cos(theta1*TMath::DegToRad())-TMath::Cos(theta0*TMath::DegToRad()))+r0; | |
172b0d90 | 405 | return; |
406 | } | |
407 | //______________________________________________________________________ | |
166d14ba | 408 | void AliITSv11Geometry::InsidePoint(const TGeoPcon *p,Int_t i1,Int_t i2, |
409 | Int_t i3,Double_t c,TGeoPcon *q,Int_t j1, | |
cee918ed | 410 | Bool_t max)const{ |
172b0d90 | 411 | // Given two lines defined by the points i1, i2,i3 in the TGeoPcon |
412 | // class p that intersect at point p->GetZ(i2) return the point z,r | |
413 | // that is Cthick away in the TGeoPcon class q. If points i1=i2 | |
414 | // and max == kTRUE, then p->GetRmin(i1) and p->GetRmax(i2) are used. | |
415 | // if points i2=i3 and max=kTRUE then points p->GetRmax(i2) and | |
416 | // p->GetRmin(i3) are used. If i2=i3 and max=kFALSE, then p->GetRmin(i2) | |
417 | // and p->GetRmax(i3) are used. | |
418 | // Inputs: | |
419 | // TGeoPcon *p Class where points i1, i2, and i3 are taken from | |
420 | // Int_t i1 First point in class p | |
421 | // Int_t i2 Second point in class p | |
422 | // Int_t i3 Third point in class p | |
423 | // Double_t c Distance inside the outer surface/inner suface | |
424 | // that the point j1 is to be computed for. | |
425 | // TGeoPcon *q Pointer to class for results to be put into. | |
426 | // Int_t j1 Point in class q where data is to be stored. | |
427 | // Bool_t max if kTRUE, then a Rmax value is computed, | |
428 | // else a Rmin valule is computed. | |
429 | // Output: | |
430 | // TGeoPcon *q Pointer to class for results to be put into. | |
431 | // Return: | |
432 | // none. | |
433 | Double_t x0,y0,x1,y1,x2,y2,x,y; | |
434 | ||
435 | if(max){ | |
436 | c = -c; //cout <<"L394 c="<<c<<endl; | |
437 | y0 = p->GetRmax(i1); | |
438 | if(i1==i2) y0 = p->GetRmin(i1); //cout <<"L396 y0="<<y0<<endl; | |
439 | y1 = p->GetRmax(i2); //cout <<"L397 y1="<<y1<<endl; | |
440 | y2 = p->GetRmax(i3); //cout <<"L398 y2="<<y2<<endl; | |
441 | if(i2==i3) y2 = p->GetRmin(i3); //cout <<"L399 y2="<<y2<<endl; | |
442 | }else{ // min | |
443 | y0 = p->GetRmin(i1); //cout <<"L401 y0="<<y0<<endl; | |
444 | y1 = p->GetRmin(i2); //cout <<"L402 y1="<<y1<<endl; | |
445 | y2 = p->GetRmin(i3); | |
446 | if(i2==i3) y2 = p->GetRmax(i3); //cout <<"L404 y2="<<y2<<endl; | |
447 | } // end if | |
448 | x0 = p->GetZ(i1); //cout <<"L406 x0="<<x0<<endl; | |
449 | x1 = p->GetZ(i2); //cout <<"L407 x1="<<x1<<endl; | |
450 | x2 = p->GetZ(i3); //cout <<"L408 x2="<<x2<<endl; | |
451 | // | |
452 | InsidePoint(x0,y0,x1,y1,x2,y2,c,x,y); | |
453 | q->Z(j1) = x; | |
454 | if(max) q->Rmax(j1) = y; | |
455 | else q->Rmin(j1) = y; | |
456 | return; | |
457 | } | |
458 | //---------------------------------------------------------------------- | |
166d14ba | 459 | void AliITSv11Geometry::InsidePoint(Double_t x0,Double_t y0, |
460 | Double_t x1,Double_t y1, | |
461 | Double_t x2,Double_t y2,Double_t c, | |
cee918ed | 462 | Double_t &x,Double_t &y)const{ |
172b0d90 | 463 | // Given two intersecting lines defined by the points (x0,y0), (x1,y1) and |
543b7370 | 464 | // (x1,y1), (x2,y2) {intersecting at (x1,y1)} the point (x,y) a distance |
172b0d90 | 465 | // c away is returned such that two lines a distance c away from the |
466 | // lines defined above intersect at (x,y). | |
467 | // Inputs: | |
468 | // Double_t x0 X point on the first intersecting sets of lines | |
469 | // Double_t y0 Y point on the first intersecting sets of lines | |
470 | // Double_t x1 X point on the first/second intersecting sets of lines | |
471 | // Double_t y1 Y point on the first/second intersecting sets of lines | |
472 | // Double_t x2 X point on the second intersecting sets of lines | |
473 | // Double_t y2 Y point on the second intersecting sets of lines | |
474 | // Double_t c Distance the two sets of lines are from each other | |
475 | // Output: | |
476 | // Double_t x X point for the intersecting sets of parellel lines | |
477 | // Double_t y Y point for the intersecting sets of parellel lines | |
478 | // Return: | |
479 | // none. | |
166d14ba | 480 | Double_t dx01,dx12,dy01,dy12,r01,r12,m; |
543b7370 | 481 | |
482 | //printf("InsidePoint: x0=% #12.7g y0=% #12.7g x1=% #12.7g y1=% #12.7g " | |
483 | // "x2=% #12.7g y2=% #12.7g c=% #12.7g ",x0,y0,x1,y2,x2,y2,c); | |
172b0d90 | 484 | dx01 = x0-x1; //cout <<"L410 dx01="<<dx01<<endl; |
485 | dx12 = x1-x2; //cout <<"L411 dx12="<<dx12<<endl; | |
486 | dy01 = y0-y1; //cout <<"L412 dy01="<<dy01<<endl; | |
487 | dy12 = y1-y2; //cout <<"L413 dy12="<<dy12<<endl; | |
166d14ba | 488 | r01 = TMath::Sqrt(dy01*dy01+dx01*dx01); //cout <<"L414 r01="<<r01<<endl; |
489 | r12 = TMath::Sqrt(dy12*dy12+dx12*dx12); //cout <<"L415 r12="<<r12<<endl; | |
172b0d90 | 490 | m = dx12*dy01-dy12*dx01; |
491 | if(m*m<DBL_EPSILON){ // m == n | |
492 | if(dy01==0.0){ // line are = | |
493 | x = x1+c; //cout <<"L419 x="<<x<<endl; | |
494 | y = y1; //cout <<"L420 y="<<y<<endl; | |
543b7370 | 495 | //printf("dy01==0.0 x=% #12.7g y=% #12.7g\n",x,y); |
172b0d90 | 496 | return; |
497 | }else if(dx01==0.0){ | |
498 | x = x1; | |
499 | y = y1+c; | |
543b7370 | 500 | //printf("dx01==0.0 x=% #12.7g y=% #12.7g\n",x,y); |
172b0d90 | 501 | return; |
502 | }else{ // dx01!=0 and dy01 !=0. | |
166d14ba | 503 | x = x1-0.5*c*r01/dy01; //cout <<"L434 x="<<x<<endl; |
504 | y = y1+0.5*c*r01/dx01; //cout <<"L435 y="<<y<<endl; | |
543b7370 | 505 | //printf("m*m<DBL_E x=% #12.7g y=% #12.7g\n",x,y); |
172b0d90 | 506 | } // end if |
507 | return; | |
508 | } // | |
cee918ed | 509 | x = x1+c*(dx12*r01-dx01*r12)/m; //cout <<"L442 x="<<x<<endl; |
510 | y = y1+c*(dy12*r01-dy01*r12)/m; //cout <<"L443 y="<<y<<endl; | |
543b7370 | 511 | //printf(" x=% #12.7g y=% #12.7g\n",x,y); |
172b0d90 | 512 | //cout <<"=============================================="<<endl; |
513 | return; | |
514 | } | |
515 | //---------------------------------------------------------------------- | |
166d14ba | 516 | void AliITSv11Geometry:: PrintArb8(const TGeoArb8 *a)const{ |
517 | // Prints out the content of the TGeoArb8. Usefull for debugging. | |
518 | // Inputs: | |
519 | // TGeoArb8 *a | |
520 | // Outputs: | |
521 | // none. | |
522 | // Return: | |
523 | // none. | |
524 | ||
cee918ed | 525 | if(!GetDebug()) return; |
526 | printf("%s",a->GetName()); | |
527 | a->InspectShape(); | |
166d14ba | 528 | return; |
172b0d90 | 529 | } |
530 | //---------------------------------------------------------------------- | |
166d14ba | 531 | void AliITSv11Geometry:: PrintPcon(const TGeoPcon *a)const{ |
532 | // Prints out the content of the TGeoPcon. Usefull for debugging. | |
533 | // Inputs: | |
534 | // TGeoPcon *a | |
535 | // Outputs: | |
536 | // none. | |
537 | // Return: | |
538 | // none. | |
539 | ||
cee918ed | 540 | if(!GetDebug()) return; |
166d14ba | 541 | cout << a->GetName() << ": N=" << a->GetNz() << " Phi1=" << a->GetPhi1() |
542 | << ", Dphi=" << a->GetDphi() << endl; | |
172b0d90 | 543 | cout << "i\t Z \t Rmin \t Rmax" << endl; |
166d14ba | 544 | for(Int_t iii=0;iii<a->GetNz();iii++){ |
545 | cout << iii << "\t" << a->GetZ(iii) << "\t" << a->GetRmin(iii) | |
546 | << "\t" << a->GetRmax(iii) << endl; | |
172b0d90 | 547 | } // end for iii |
166d14ba | 548 | return; |
172b0d90 | 549 | } |
550 | //---------------------------------------------------------------------- | |
166d14ba | 551 | void AliITSv11Geometry::PrintTube(const TGeoTube *a)const{ |
552 | // Prints out the content of the TGeoTube. Usefull for debugging. | |
553 | // Inputs: | |
554 | // TGeoTube *a | |
555 | // Outputs: | |
556 | // none. | |
557 | // Return: | |
558 | // none. | |
559 | ||
cee918ed | 560 | if(!GetDebug()) return; |
166d14ba | 561 | cout << a->GetName() <<": Rmin="<<a->GetRmin() |
562 | <<" Rmax=" <<a->GetRmax()<<" Dz="<<a->GetDz()<<endl; | |
563 | return; | |
172b0d90 | 564 | } |
565 | //---------------------------------------------------------------------- | |
166d14ba | 566 | void AliITSv11Geometry::PrintTubeSeg(const TGeoTubeSeg *a)const{ |
567 | // Prints out the content of the TGeoTubeSeg. Usefull for debugging. | |
568 | // Inputs: | |
569 | // TGeoTubeSeg *a | |
570 | // Outputs: | |
571 | // none. | |
572 | // Return: | |
573 | // none. | |
574 | ||
cee918ed | 575 | if(!GetDebug()) return; |
166d14ba | 576 | cout << a->GetName() <<": Phi1="<<a->GetPhi1()<< |
577 | " Phi2="<<a->GetPhi2()<<" Rmin="<<a->GetRmin() | |
578 | <<" Rmax=" <<a->GetRmax()<<" Dz="<<a->GetDz()<<endl; | |
579 | return; | |
172b0d90 | 580 | } |
581 | //---------------------------------------------------------------------- | |
166d14ba | 582 | void AliITSv11Geometry::PrintConeSeg(const TGeoConeSeg *a)const{ |
583 | // Prints out the content of the TGeoConeSeg. Usefull for debugging. | |
584 | // Inputs: | |
585 | // TGeoConeSeg *a | |
586 | // Outputs: | |
587 | // none. | |
588 | // Return: | |
589 | // none. | |
590 | ||
cee918ed | 591 | if(!GetDebug()) return; |
166d14ba | 592 | cout << a->GetName() <<": Phi1="<<a->GetPhi1()<< |
593 | " Phi2="<<a->GetPhi2()<<" Rmin1="<<a->GetRmin1() | |
594 | <<" Rmax1=" <<a->GetRmax1()<<" Rmin2="<<a->GetRmin2() | |
595 | <<" Rmax2=" <<a->GetRmax2()<<" Dz="<<a->GetDz()<<endl; | |
596 | return; | |
172b0d90 | 597 | } |
598 | //---------------------------------------------------------------------- | |
166d14ba | 599 | void AliITSv11Geometry::PrintBBox(const TGeoBBox *a)const{ |
600 | // Prints out the content of the TGeoBBox. Usefull for debugging. | |
601 | // Inputs: | |
602 | // TGeoBBox *a | |
603 | // Outputs: | |
604 | // none. | |
605 | // Return: | |
606 | // none. | |
607 | ||
cee918ed | 608 | if(!GetDebug()) return; |
166d14ba | 609 | cout << a->GetName() <<": Dx="<<a->GetDX()<< |
610 | " Dy="<<a->GetDY()<<" Dz="<<a->GetDZ() <<endl; | |
611 | return; | |
172b0d90 | 612 | } |
166d14ba | 613 | //--------------------------------------------------------------------- |
614 | void AliITSv11Geometry::DrawCrossSection(const TGeoPcon *p, | |
615 | Int_t fillc,Int_t fills, | |
616 | Int_t linec,Int_t lines,Int_t linew, | |
617 | Int_t markc,Int_t marks,Float_t marksize)const{ | |
618 | // Draws a cross sectional view of the TGeoPcon, Primarily for debugging. | |
619 | // A TCanvas should exist first. | |
620 | // Inputs: | |
621 | // TGeoPcon *p The TGeoPcon to be "drawn" | |
622 | // Int_t fillc The fill color to be used | |
623 | // Int_t fills The fill style to be used | |
624 | // Int_t linec The line color to be used | |
625 | // Int_t lines The line style to be used | |
626 | // Int_t linew The line width to be used | |
627 | // Int_t markc The markder color to be used | |
628 | // Int_t marks The markder style to be used | |
629 | // Float_t marksize The marker size | |
630 | // Outputs: | |
631 | // none. | |
632 | // Return: | |
633 | // none. | |
634 | Int_t n=0,m=0,i=0; | |
635 | Double_t *z=0,*r=0; | |
636 | TPolyMarker *pts=0; | |
637 | TPolyLine *line=0; | |
172b0d90 | 638 | |
166d14ba | 639 | n = p->GetNz(); |
640 | if(n<=0) return; | |
641 | m = 2*n+1; | |
642 | z = new Double_t[m]; | |
643 | r = new Double_t[m]; | |
644 | ||
645 | for(i=0;i<n;i++){ | |
646 | z[i] = p->GetZ(i); | |
647 | r[i] = p->GetRmax(i); | |
648 | z[i+n] = p->GetZ(n-1-i); | |
649 | r[i+n] = p->GetRmin(n-1-i); | |
650 | } // end for i | |
651 | z[n-1] = z[0]; | |
652 | r[n-1] = r[0]; | |
653 | ||
654 | line = new TPolyLine(n,z,r); | |
655 | pts = new TPolyMarker(n,z,r); | |
656 | ||
657 | line->SetFillColor(fillc); | |
658 | line->SetFillStyle(fills); | |
659 | line->SetLineColor(linec); | |
660 | line->SetLineStyle(lines); | |
661 | line->SetLineWidth(linew); | |
662 | pts->SetMarkerColor(markc); | |
663 | pts->SetMarkerStyle(marks); | |
664 | pts->SetMarkerSize(marksize); | |
665 | ||
666 | line->Draw("f"); | |
667 | line->Draw(); | |
668 | pts->Draw(); | |
669 | ||
670 | delete[] z; | |
671 | delete[] r; | |
672 | ||
673 | cout<<"Hit Return to continue"<<endl; | |
674 | cin >> n; | |
675 | delete line; | |
676 | delete pts; | |
677 | return; | |
678 | } | |
db486a6e | 679 | //______________________________________________________________________ |
680 | Bool_t AliITSv11Geometry::AngleOfIntersectionWithLine(Double_t x0,Double_t y0, | |
681 | Double_t x1,Double_t y1, | |
682 | Double_t xc,Double_t yc, | |
683 | Double_t rc,Double_t &t0, | |
684 | Double_t &t1)const{ | |
685 | // Computes the angles, t0 and t1 corresponding to the intersection of | |
686 | // the line, defined by {x0,y0} {x1,y1}, and the circle, defined by | |
687 | // its center {xc,yc} and radius r. If the line does not intersect the | |
688 | // line, function returns kFALSE, otherwise it returns kTRUE. If the | |
689 | // line is tangent to the circle, the angles t0 and t1 will be the same. | |
690 | // Inputs: | |
691 | // Double_t x0 X of first point defining the line | |
692 | // Double_t y0 Y of first point defining the line | |
693 | // Double_t x1 X of Second point defining the line | |
694 | // Double_t y1 Y of Second point defining the line | |
695 | // Double_t xc X of Circle center point defining the line | |
696 | // Double_t yc Y of Circle center point defining the line | |
697 | // Double_t r radius of circle | |
698 | // Outputs: | |
699 | // Double_t &t0 First angle where line intersects circle | |
700 | // Double_t &t1 Second angle where line intersects circle | |
701 | // Return: | |
702 | // kTRUE, line intersects circle, kFALSE line does not intersect circle | |
703 | // or the line is not properly defined point {x0,y0} and {x1,y1} | |
704 | // are the same point. | |
705 | Double_t dx,dy,cx,cy,s2,t[4]; | |
706 | Double_t a0,b0,c0,a1,b1,c1,sinthp,sinthm,costhp,costhm; | |
707 | Int_t i,j; | |
708 | ||
709 | t0 = 400.0; | |
710 | t1 = 400.0; | |
711 | dx = x1-x0; | |
712 | dy = y1-y0; | |
713 | cx = xc-x0; | |
714 | cy = yc-y0; | |
715 | s2 = dx*dx+dy*dy; | |
716 | if(s2==0.0) return kFALSE; | |
717 | ||
718 | a0 = rc*rc*s2; | |
719 | if(a0==0.0) return kFALSE; | |
720 | b0 = 2.0*rc*dx*(dx*cy-cx*dy); | |
721 | c0 = dx*dx*cy*cy-2.0*dy*dx*cy*cx+cx*cx*dy*dy-rc*rc*dy*dy; | |
722 | c0 = 0.25*b0*b0/(a0*a0)-c0/a0; | |
723 | if(c0<0.0) return kFALSE; | |
724 | sinthp = -0.5*b0/a0+TMath::Sqrt(c0); | |
725 | sinthm = -0.5*b0/a0-TMath::Sqrt(c0); | |
726 | ||
727 | a1 = rc*rc*s2; | |
728 | if(a1==0.0) return kFALSE; | |
729 | b1 = 2.0*rc*dy*(dy*cx-dx*cy); | |
730 | c1 = dy*dy*cx*cx-2.0*dy*dx*cy*cx+dx*dx*cy*cy-rc*rc*dx*dx; | |
731 | c1 = 0.25*b1*b1/(a1*a1)-c1/a1; | |
732 | if(c1<0.0) return kFALSE; | |
733 | costhp = -0.5*b1/a1+TMath::Sqrt(c1); | |
734 | costhm = -0.5*b1/a1-TMath::Sqrt(c1); | |
735 | ||
736 | t[0] = t[1] = t[2] = t[3] = 400.; | |
737 | a0 = TMath::ATan2(sinthp,costhp); if(a0<0.0) a0 += 2.0*TMath::Pi(); | |
738 | a1 = TMath::ATan2(sinthp,costhm); if(a1<0.0) a1 += 2.0*TMath::Pi(); | |
739 | b0 = TMath::ATan2(sinthm,costhp); if(b0<0.0) b0 += 2.0*TMath::Pi(); | |
740 | b1 = TMath::ATan2(sinthm,costhm); if(b1<0.0) b1 += 2.0*TMath::Pi(); | |
741 | x1 = xc+rc*TMath::Cos(a0); | |
742 | y1 = yc+rc*TMath::Sin(a0); | |
743 | s2 = dx*(y1-y0)-dy*(x1-x0); | |
744 | if(s2*s2<DBL_EPSILON) t[0] = a0*TMath::RadToDeg(); | |
745 | x1 = xc+rc*TMath::Cos(a1); | |
746 | y1 = yc+rc*TMath::Sin(a1); | |
747 | s2 = dx*(y1-y0)-dy*(x1-x0); | |
748 | if(s2*s2<DBL_EPSILON) t[1] = a1*TMath::RadToDeg(); | |
749 | x1 = xc+rc*TMath::Cos(b0); | |
750 | y1 = yc+rc*TMath::Sin(b0); | |
751 | s2 = dx*(y1-y0)-dy*(x1-x0); | |
752 | if(s2*s2<DBL_EPSILON) t[2] = b0*TMath::RadToDeg(); | |
753 | x1 = xc+rc*TMath::Cos(b1); | |
754 | y1 = yc+rc*TMath::Sin(b1); | |
755 | s2 = dx*(y1-y0)-dy*(x1-x0); | |
756 | if(s2*s2<DBL_EPSILON) t[3] = b1*TMath::RadToDeg(); | |
757 | for(i=0;i<4;i++)for(j=i+1;j<4;j++){ | |
758 | if(t[i]>t[j]) {t0 = t[i];t[i] = t[j];t[j] = t0;} | |
759 | } // end for i,j | |
760 | t0 = t[0]; | |
761 | t1 = t[1]; | |
762 | // | |
763 | return kTRUE; | |
764 | } | |
765 | //______________________________________________________________________ | |
766 | Double_t AliITSv11Geometry::AngleForRoundedCorners0(Double_t dx,Double_t dy, | |
767 | Double_t sdr)const{ | |
768 | // Basic function used to determine the ending angle and starting angles | |
769 | // for rounded corners given the relative distance between the centers | |
770 | // of the circles and the difference/sum of their radii. Case 0. | |
771 | // Inputs: | |
772 | // Double_t dx difference in x locations of the circle centers | |
773 | // Double_t dy difference in y locations of the circle centers | |
774 | // Double_t sdr difference or sum of the circle radii | |
775 | // Outputs: | |
776 | // none. | |
777 | // Return: | |
778 | // the angle in Degrees | |
779 | Double_t a,b; | |
780 | ||
781 | b = dy*dy+dx*dx-sdr*sdr; | |
782 | if(b<0.0) Error("AngleForRoundedCorners0", | |
783 | "dx^2(%e)+dy^2(%e)-sdr^2(%e)=b=%e<0",dx,dy,sdr,b); | |
784 | b = TMath::Sqrt(b); | |
785 | a = -sdr*dy+dx*b; | |
786 | b = -sdr*dx-dy*b; | |
787 | return TMath::ATan2(a,b)*TMath::RadToDeg(); | |
788 | ||
789 | } | |
790 | //______________________________________________________________________ | |
791 | Double_t AliITSv11Geometry::AngleForRoundedCorners1(Double_t dx,Double_t dy, | |
792 | Double_t sdr)const{ | |
793 | // Basic function used to determine the ending angle and starting angles | |
794 | // for rounded corners given the relative distance between the centers | |
795 | // of the circles and the difference/sum of their radii. Case 1. | |
796 | // Inputs: | |
797 | // Double_t dx difference in x locations of the circle centers | |
798 | // Double_t dy difference in y locations of the circle centers | |
799 | // Double_t sdr difference or sum of the circle radii | |
800 | // Outputs: | |
801 | // none. | |
802 | // Return: | |
803 | // the angle in Degrees | |
804 | Double_t a,b; | |
805 | ||
806 | b = dy*dy+dx*dx-sdr*sdr; | |
807 | if(b<0.0) Error("AngleForRoundedCorners1", | |
808 | "dx^2(%e)+dy^2(%e)-sdr^2(%e)=b=%e<0",dx,dy,sdr,b); | |
809 | b = TMath::Sqrt(b); | |
810 | a = -sdr*dy-dx*b; | |
811 | b = -sdr*dx+dy*b; | |
812 | return TMath::ATan2(a,b)*TMath::RadToDeg(); | |
813 | ||
814 | } | |
166d14ba | 815 | //---------------------------------------------------------------------- |
db486a6e | 816 | void AliITSv11Geometry::AnglesForRoundedCorners(Double_t x0,Double_t y0, |
817 | Double_t r0,Double_t x1, | |
818 | Double_t y1,Double_t r1, | |
819 | Double_t &t0,Double_t &t1) | |
820 | const{ | |
821 | // Function to compute the ending angle, for arc 0, and starting angle, | |
822 | // for arc 1, such that a straight line will connect them with no | |
823 | // discontinuities. | |
824 | //Begin_Html | |
825 | /* | |
826 | <img src="picts/ITS/AliITSv11Geometry_AnglesForRoundedCorners.gif"> | |
827 | */ | |
828 | //End_Html | |
829 | // Inputs: | |
830 | // Double_t x0 X Coordinate of arc 0 center. | |
831 | // Double_t y0 Y Coordinate of arc 0 center. | |
832 | // Double_t r0 Radius of curvature of arc 0. For signe see figure. | |
833 | // Double_t x1 X Coordinate of arc 1 center. | |
834 | // Double_t y1 Y Coordinate of arc 1 center. | |
835 | // Double_t r1 Radius of curvature of arc 1. For signe see figure. | |
836 | // Outputs: | |
837 | // Double_t t0 Ending angle of arch 0, with respect to x axis, Degrees. | |
838 | // Double_t t1 Starting angle of arch 1, with respect to x axis, | |
839 | // Degrees. | |
840 | // Return: | |
841 | // none. | |
842 | Double_t t; | |
843 | ||
844 | if(r0>=0.0&&r1>=0.0) { // Inside to inside ++ | |
845 | t = AngleForRoundedCorners1(x1-x0,y1-y0,r1-r0); | |
846 | t0 = t1 = t; | |
847 | return; | |
848 | }else if(r0>=0.0&&r1<=0.0){ // Inside to Outside +- | |
849 | r1 = -r1; // make positive | |
850 | t = AngleForRoundedCorners0(x1-x0,y1-y0,r1+r0); | |
851 | t0 = 180.0 + t; | |
852 | if(t0<0.0) t += 360.; | |
853 | if(t<0.0) t += 360.; | |
854 | t1 = t; | |
855 | return; | |
856 | }else if(r0<=0.0&&r1>=0.0){ // Outside to Inside -+ | |
857 | r0 = - r0; // make positive | |
858 | t = AngleForRoundedCorners1(x1-x0,y1-y0,r1+r0); | |
859 | t0 = 180.0 + t; | |
860 | if(t0>180.) t0 -= 360.; | |
861 | if(t >180.) t -= 360.; | |
862 | t1 = t; | |
863 | return; | |
864 | }else if(r0<=0.0&&r1<=0.0) { // Outside to outside -- | |
865 | r0 = -r0; // make positive | |
866 | r1 = -r1; // make positive | |
867 | t = AngleForRoundedCorners0(x1-x0,y1-y0,r1-r0); | |
868 | t0 = t1 = t; | |
869 | return; | |
870 | } // end if | |
871 | return; | |
872 | } | |
873 | //---------------------------------------------------------------------- | |
874 | void AliITSv11Geometry::MakeFigure1(Double_t x0,Double_t y0,Double_t r0, | |
875 | Double_t x1,Double_t y1,Double_t r1){ | |
876 | // Function to create the figure discribing how the function | |
877 | // AnglesForRoundedCorners works. | |
878 | // | |
879 | // Inputs: | |
880 | // Double_t x0 X Coordinate of arc 0 center. | |
881 | // Double_t y0 Y Coordinate of arc 0 center. | |
882 | // Double_t r0 Radius of curvature of arc 0. For signe see figure. | |
883 | // Double_t x1 X Coordinate of arc 1 center. | |
884 | // Double_t y1 Y Coordinate of arc 1 center. | |
885 | // Double_t r1 Radius of curvature of arc 1. For signe see figure. | |
886 | // Outputs: | |
887 | // none. | |
888 | // Return: | |
889 | // none. | |
890 | Double_t t0[4],t1[4],xa0[4],ya0[4],xa1[4],ya1[4],ra0[4],ra1[4]; | |
891 | Double_t xmin,ymin,xmax,ymax,h; | |
892 | Int_t j; | |
893 | ||
894 | for(j=0;j<4;j++) { | |
895 | ra0[j] = r0; if(j%2) ra0[j] = -r0; | |
896 | ra1[j] = r1; if(j>1) ra1[j] = -r1; | |
897 | AnglesForRoundedCorners(x0,y0,ra0[j],x1,y1,ra1[j],t0[j],t1[j]); | |
898 | xa0[j] = TMath::Abs(r0)*CosD(t0[j])+x0; | |
899 | ya0[j] = TMath::Abs(r0)*SinD(t0[j])+y0; | |
900 | xa1[j] = TMath::Abs(r1)*CosD(t1[j])+x1; | |
901 | ya1[j] = TMath::Abs(r1)*SinD(t1[j])+y1; | |
902 | } // end for j | |
903 | if(r0<0.0) r0 = -r0; | |
904 | if(r1<0.0) r1 = -r1; | |
905 | xmin = TMath::Min(x0 - r0,x1-r1); | |
906 | ymin = TMath::Min(y0 - r0,y1-r1); | |
907 | xmax = TMath::Max(x0 + r0,x1+r1); | |
908 | ymax = TMath::Max(y0 + r0,y1+r1); | |
909 | for(j=1;j<4;j++) { | |
910 | xmin = TMath::Min(xmin,xa0[j]); | |
911 | xmin = TMath::Min(xmin,xa1[j]); | |
912 | ymin = TMath::Min(ymin,ya0[j]); | |
913 | ymin = TMath::Min(ymin,ya1[j]); | |
914 | ||
915 | xmax = TMath::Max(xmax,xa0[j]); | |
916 | xmax = TMath::Max(xmax,xa1[j]); | |
917 | ymax = TMath::Max(ymax,ya0[j]); | |
918 | ymax = TMath::Max(ymax,ya1[j]); | |
919 | } // end for j | |
920 | if(xmin<0.0) xmin *= 1.1; else xmin *= 0.9; | |
921 | if(ymin<0.0) ymin *= 1.1; else ymin *= 0.9; | |
922 | if(xmax<0.0) xmax *= 0.9; else xmax *= 1.1; | |
923 | if(ymax<0.0) ymax *= 0.9; else ymax *= 1.1; | |
924 | j = (Int_t)(500.0*(ymax-ymin)/(xmax-xmin)); | |
925 | TCanvas *can = new TCanvas("AliITSv11Geometry_AnglesForRoundedCorners", | |
926 | "Figure for AliITSv11Geometry",500,j); | |
927 | h = ymax-ymin; if(h<0) h = -h; | |
928 | can->Range(xmin,ymin,xmax,ymax); | |
929 | TArc *c0 = new TArc(x0,y0,r0); | |
930 | TArc *c1 = new TArc(x1,y1,r1); | |
931 | TLine *line[4]; | |
932 | TArrow *ar0[4]; | |
933 | TArrow *ar1[4]; | |
934 | for(j=0;j<4;j++){ | |
935 | ar0[j] = new TArrow(x0,y0,xa0[j],ya0[j]); | |
936 | ar1[j] = new TArrow(x1,y1,xa1[j],ya1[j]); | |
937 | line[j] = new TLine(xa0[j],ya0[j],xa1[j],ya1[j]); | |
938 | ar0[j]->SetLineColor(j+1); | |
939 | ar0[j]->SetArrowSize(0.1*r0/h); | |
940 | ar1[j]->SetLineColor(j+1); | |
941 | ar1[j]->SetArrowSize(0.1*r1/h); | |
942 | line[j]->SetLineColor(j+1); | |
943 | } // end for j | |
944 | c0->Draw(); | |
945 | c1->Draw(); | |
946 | for(j=0;j<4;j++){ | |
947 | ar0[j]->Draw(); | |
948 | ar1[j]->Draw(); | |
949 | line[j]->Draw(); | |
950 | } // end for j | |
951 | TText *t = new TText(); | |
952 | t->SetTextSize(0.02); | |
953 | Char_t txt[100]; | |
954 | sprintf(txt,"(x0=%5.2f,y0=%5.2f)",x0,y0); | |
955 | t->DrawText(x0,y0,txt); | |
956 | sprintf(txt,"(x1=%5.2f,y1=%5.2f)",x1,y1); | |
957 | for(j=0;j<4;j++) { | |
958 | t->SetTextColor(j+1); | |
959 | t->DrawText(x1,y1,txt); | |
960 | sprintf(txt,"r0=%5.2f",ra0[j]); | |
961 | t->DrawText(0.5*(x0+xa0[j]),0.5*(y0+ya0[j]),txt); | |
962 | sprintf(txt,"r1=%5.2f",ra1[j]); | |
963 | t->DrawText(0.5*(x1+xa1[j]),0.5*(y1+ya1[j]),txt); | |
964 | } // end for j | |
965 | } |