Project
Loading...
Searching...
No Matches
V11Geometry.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
14
16
17#include <fairlogger/Logger.h> // for LOG
18
19#include <TArc.h> // for TArc
20#include <TArrow.h> // for TArrow
21#include <TCanvas.h> // for TCanvas
22#include <TGeoArb8.h> // for TGeoArb8
23#include <TGeoElement.h> // for TGeoElement
24#include <TGeoMaterial.h> // for TGeoMixture, TGeoMaterial, etc
25#include <TGeoPcon.h> // for TGeoPcon
26#include <TGeoCone.h> // for TGeoConSeg
27#include <TLine.h> // for TLine
28#include <TPolyLine.h> // for TPolyLine
29#include <TPolyMarker.h> // for TPolyMarker
30#include <TText.h> // for TText
31#include "TMath.h" // for DegToRad, Cos, Sqrt, ATan2, Sin, Tan, Pi, etc
32#include "TMathBase.h" // for Max, Min, Abs
33#include <TGeoTube.h> // for TGeoTubeSeg
34
35#include <cstdio> // for printf, snprintf
36#include <Riostream.h>
37
38using std::cin;
39using std::cout;
40using std::endl;
41
42using namespace o2::its;
43
45
46const Double_t V11Geometry::sMicron = 1.0E-4;
47const Double_t V11Geometry::sMm = 0.10;
48const Double_t V11Geometry::sCm = 1.00;
49const Double_t V11Geometry::sDegree = 1.0;
50const Double_t V11Geometry::sRadian = 180. / 3.14159265358979323846;
51const Double_t V11Geometry::sGCm3 = 1.0; // assume default is g/cm^3
52const Double_t V11Geometry::sKgm3 = 1.0E+3; // assume Kg/m^3
53const Double_t V11Geometry::sKgdm3 = 1.0; // assume Kg/dm^3
54const Double_t V11Geometry::sCelsius = 1.0; // Assume default is C
55const Double_t V11Geometry::sPascal = 1.0E-3; // Assume kPascal
56const Double_t V11Geometry::sKPascal = 1.0; // Asume kPascal
57const Double_t V11Geometry::sEV = 1.0E-9; // GeV default
58const Double_t V11Geometry::sKEV = 1.0e-6; // GeV default
59const Double_t V11Geometry::sMEV = 1.0e-3; // GeV default
60const Double_t V11Geometry::sGEV = 1.0; // GeV default
61
62void V11Geometry::intersectLines(Double_t m, Double_t x0, Double_t y0, Double_t n, Double_t x1,
63 Double_t y1, Double_t& xi, Double_t& yi) const
64{
65 if (TMath::Abs(m - n) < 0.000001) {
66 LOG(error) << "Lines are parallel: m = " << m << " n = " << n;
67 return;
68 }
69
70 xi = (y1 - n * x1 - y0 + m * x0) / (m - n);
71 yi = y0 + m * (xi - x0);
72
73 return;
74}
75
76Bool_t V11Geometry::intersectCircle(Double_t m, Double_t x0, Double_t y0, Double_t rr, Double_t xc,
77 Double_t yc, Double_t& xi1, Double_t& yi1, Double_t& xi2,
78 Double_t& yi2)
79{
80 Double_t p = m * x0 - y0;
81 Double_t q = m * m + 1;
82
83 p = p - m * xc + yc;
84
85 Double_t delta = m * m * p * p - q * (p * p - rr * rr);
86
87 if (delta < 0) {
88 return kFALSE;
89 } else {
90 Double_t root = TMath::Sqrt(delta);
91 xi1 = (m * p + root) / q + xc;
92 xi2 = (m * p - root) / q + xc;
93 yi1 = m * (xi1 - x0) + y0;
94 yi2 = m * (xi2 - x0) + y0;
95 return kTRUE;
96 }
97}
98
99Double_t V11Geometry::yFrom2Points(Double_t x0, Double_t y0, Double_t x1, Double_t y1, Double_t x)
100 const
101{
102 if (x0 == x1 && y0 == y1) {
103 printf(
104 "Error: V11Geometry::Yfrom2Ponts The two points are "
105 "the same (%e,%e) and (%e,%e)",
106 x0, y0, x1, y1);
107 return 0.0;
108 } // end if
109 if (x0 == x1) {
110 printf(
111 "Warning: V11Geometry::yFrom2Points x0=%e == x1=%e. "
112 "line vertical "
113 "returning mean y",
114 x0, x1);
115 return 0.5 * (y0 + y1);
116 } // end if x0==x1
117 Double_t m = (y0 - y1) / (x0 - x1);
118 return m * (x - x0) + y0;
119}
120
121Double_t V11Geometry::xFrom2Points(Double_t x0, Double_t y0, Double_t x1, Double_t y1, Double_t y)
122 const
123{
124 if (x0 == x1 && y0 == y1) {
125 printf(
126 "Error: V11Geometry::Yfrom2Ponts The two points are "
127 "the same (%e,%e) and (%e,%e)",
128 x0, y0, x1, y1);
129 return 0.0;
130 } // end if
131 if (y0 == y1) {
132 printf(
133 "Warrning: V11Geometry::yFrom2Points y0=%e == y1=%e. "
134 "line horizontal returning mean x",
135 y0, y1);
136 return 0.5 * (x0 + x1);
137 } // end if y0==y1
138 Double_t m = (x0 - x1) / (y0 - y1);
139 return m * (y - y0) + x0;
140}
141
142Double_t V11Geometry::rMaxFrom2Points(const TGeoPcon* p, Int_t i1, Int_t i2, Double_t z) const
143{
144 Double_t d0, d1, d2, r;
145
146 d0 = p->GetRmax(i1) - p->GetRmax(i2); // cout <<"L263: d0="<<d0<<endl;
147 d1 = z - p->GetZ(i2); // cout <<"L264: d1="<<d1<<endl;
148 d2 = p->GetZ(i1) - p->GetZ(i2); // cout <<"L265: d2="<<d2<<endl;
149 r = p->GetRmax(i2) + d1 * d0 / d2; // cout <<"L266: r="<<r<<endl;
150 return r;
151}
152
153Double_t V11Geometry::rMinFrom2Points(const TGeoPcon* p, Int_t i1, Int_t i2, Double_t z) const
154{
155 return p->GetRmin(i2) +
156 (p->GetRmin(i1) - p->GetRmin(i2)) * (z - p->GetZ(i2)) / (p->GetZ(i1) - p->GetZ(i2));
157}
158
159Double_t V11Geometry::rFrom2Points(const Double_t* p, const Double_t* az, Int_t i1, Int_t i2,
160 Double_t z) const
161{
162 return p[i2] + (p[i1] - p[i2]) * (z - az[i2]) / (az[i1] - az[i2]);
163}
164
165Double_t V11Geometry::zFrom2MinPoints(const TGeoPcon* p, Int_t i1, Int_t i2, Double_t r) const
166{
167 return p->GetZ(i2) +
168 (p->GetZ(i1) - p->GetZ(i2)) * (r - p->GetRmin(i2)) / (p->GetRmin(i1) - p->GetRmin(i2));
169}
170
171Double_t V11Geometry::zFrom2MaxPoints(const TGeoPcon* p, Int_t i1, Int_t i2, Double_t r) const
172{
173 return p->GetZ(i2) +
174 (p->GetZ(i1) - p->GetZ(i2)) * (r - p->GetRmax(i2)) / (p->GetRmax(i1) - p->GetRmax(i2));
175}
176
177Double_t V11Geometry::zFrom2Points(const Double_t* z, const Double_t* ar, Int_t i1, Int_t i2,
178 Double_t r) const
179{
180 return z[i2] + (z[i1] - z[i2]) * (r - ar[i2]) / (ar[i1] - ar[i2]);
181}
182
183Double_t V11Geometry::rMaxFromZpCone(const TGeoPcon* p, int ip, Double_t tc, Double_t z,
184 Double_t th) const
185{
186 Double_t tantc = TMath::Tan(tc * TMath::DegToRad());
187 Double_t costc = TMath::Cos(tc * TMath::DegToRad());
188
189 return -tantc * (z - p->GetZ(ip)) + p->GetRmax(ip) + th / costc;
190}
191
192Double_t V11Geometry::rFromZpCone(const Double_t* ar, const Double_t* az, int ip, Double_t tc,
193 Double_t z, Double_t th) const
194{
195 Double_t tantc = TMath::Tan(tc * TMath::DegToRad());
196 Double_t costc = TMath::Cos(tc * TMath::DegToRad());
197
198 return -tantc * (z - az[ip]) + ar[ip] + th / costc;
199}
200
201Double_t V11Geometry::rMinFromZpCone(const TGeoPcon* p, Int_t ip, Double_t tc, Double_t z,
202 Double_t th) const
203{
204 Double_t tantc = TMath::Tan(tc * TMath::DegToRad());
205 Double_t costc = TMath::Cos(tc * TMath::DegToRad());
206
207 return -tantc * (z - p->GetZ(ip)) + p->GetRmin(ip) + th / costc;
208}
209
210Double_t V11Geometry::zFromRMaxpCone(const TGeoPcon* p, int ip, Double_t tc, Double_t r,
211 Double_t th) const
212{
213 Double_t tantc = TMath::Tan(tc * TMath::DegToRad());
214 Double_t costc = TMath::Cos(tc * TMath::DegToRad());
215
216 return p->GetZ(ip) + (p->GetRmax(ip) + th / costc - r) / tantc;
217}
218
219Double_t V11Geometry::zFromRMaxpCone(const Double_t* ar, const Double_t* az, int ip, Double_t tc,
220 Double_t r, Double_t th) const
221{
222 Double_t tantc = TMath::Tan(tc * TMath::DegToRad());
223 Double_t costc = TMath::Cos(tc * TMath::DegToRad());
224
225 return az[ip] + (ar[ip] + th / costc - r) / tantc;
226}
227
228Double_t V11Geometry::zFromRMinpCone(const TGeoPcon* p, int ip, Double_t tc, Double_t r,
229 Double_t th) const
230{
231 Double_t tantc = TMath::Tan(tc * TMath::DegToRad());
232 Double_t costc = TMath::Cos(tc * TMath::DegToRad());
233
234 return p->GetZ(ip) + (p->GetRmin(ip) + th / costc - r) / tantc;
235}
236
237void V11Geometry::radiusOfCurvature(Double_t rc, Double_t theta0, Double_t z0, Double_t r0,
238 Double_t theta1, Double_t& z1, Double_t& r1) const
239{
240 z1 = rc * (TMath::Sin(theta1 * TMath::DegToRad()) - TMath::Sin(theta0 * TMath::DegToRad())) + z0;
241 r1 = rc * (TMath::Cos(theta1 * TMath::DegToRad()) - TMath::Cos(theta0 * TMath::DegToRad())) + r0;
242 return;
243}
244
245void V11Geometry::insidePoint(const TGeoPcon* p, Int_t i1, Int_t i2, Int_t i3, Double_t c,
246 TGeoPcon* q, Int_t j1, Bool_t max) const
247{
248 Double_t x0, y0, x1, y1, x2, y2, x, y;
249
250 if (max) {
251 c = -c; // cout <<"L394 c="<<c<<endl;
252 y0 = p->GetRmax(i1);
253 if (i1 == i2) {
254 y0 = p->GetRmin(i1); // cout <<"L396 y0="<<y0<<endl;
255 }
256 y1 = p->GetRmax(i2); // cout <<"L397 y1="<<y1<<endl;
257 y2 = p->GetRmax(i3); // cout <<"L398 y2="<<y2<<endl;
258 if (i2 == i3) {
259 y2 = p->GetRmin(i3); // cout <<"L399 y2="<<y2<<endl;
260 }
261 } else { // min
262 y0 = p->GetRmin(i1); // cout <<"L401 y0="<<y0<<endl;
263 y1 = p->GetRmin(i2); // cout <<"L402 y1="<<y1<<endl;
264 y2 = p->GetRmin(i3);
265
266 if (i2 == i3) {
267 y2 = p->GetRmax(i3); // cout <<"L404 y2="<<y2<<endl;
268 }
269 } // end if
270 x0 = p->GetZ(i1); // cout <<"L406 x0="<<x0<<endl;
271 x1 = p->GetZ(i2); // cout <<"L407 x1="<<x1<<endl;
272 x2 = p->GetZ(i3); // cout <<"L408 x2="<<x2<<endl;
273
274 insidePoint(x0, y0, x1, y1, x2, y2, c, x, y);
275 q->Z(j1) = x;
276
277 if (max) {
278 q->Rmax(j1) = y;
279 } else {
280 q->Rmin(j1) = y;
281 }
282 return;
283}
284
285void V11Geometry::insidePoint(Double_t x0, Double_t y0, Double_t x1, Double_t y1, Double_t x2,
286 Double_t y2, Double_t c, Double_t& x, Double_t& y) const
287{
288 Double_t dx01, dx12, dy01, dy12, r01, r12, m;
289
290 // printf("InsidePoint: x0=% #12.7g y0=% #12.7g x1=% #12.7g y1=% #12.7g "
291 // "x2=% #12.7g y2=% #12.7g c=% #12.7g ",x0,y0,x1,y2,x2,y2,c);
292 dx01 = x0 - x1; // cout <<"L410 dx01="<<dx01<<endl;
293 dx12 = x1 - x2; // cout <<"L411 dx12="<<dx12<<endl;
294 dy01 = y0 - y1; // cout <<"L412 dy01="<<dy01<<endl;
295 dy12 = y1 - y2; // cout <<"L413 dy12="<<dy12<<endl;
296 r01 = TMath::Sqrt(dy01 * dy01 + dx01 * dx01); // cout <<"L414 r01="<<r01<<endl;
297 r12 = TMath::Sqrt(dy12 * dy12 + dx12 * dx12); // cout <<"L415 r12="<<r12<<endl;
298 m = dx12 * dy01 - dy12 * dx01;
299 if (m * m < DBL_EPSILON) { // m == n
300 if (dy01 == 0.0) { // line are =
301 x = x1 + c; // cout <<"L419 x="<<x<<endl;
302 y = y1; // cout <<"L420 y="<<y<<endl;
303 // printf("dy01==0.0 x=% #12.7g y=% #12.7g\n",x,y);
304 return;
305 } else if (dx01 == 0.0) {
306 x = x1;
307 y = y1 + c;
308 // printf("dx01==0.0 x=% #12.7g y=% #12.7g\n",x,y);
309 return;
310 } else { // dx01!=0 and dy01 !=0.
311 x = x1 - 0.5 * c * r01 / dy01; // cout <<"L434 x="<<x<<endl;
312 y = y1 + 0.5 * c * r01 / dx01; // cout <<"L435 y="<<y<<endl;
313 // printf("m*m<DBL_E x=% #12.7g y=% #12.7g\n",x,y);
314 } // end if
315 return;
316 }
317 x = x1 + c * (dx12 * r01 - dx01 * r12) / m; // cout <<"L442 x="<<x<<endl;
318 y = y1 + c * (dy12 * r01 - dy01 * r12) / m; // cout <<"L443 y="<<y<<endl;
319 // printf(" x=% #12.7g y=% #12.7g\n",x,y);
320 // cout <<"=============================================="<<endl;
321 return;
322}
323
324void V11Geometry::printArb8(const TGeoArb8* a) const
325{
326 if (!getDebug()) {
327 return;
328 }
329 printf("%s", a->GetName());
330 a->InspectShape();
331 return;
332}
333
334void V11Geometry::printPcon(const TGeoPcon* a) const
335{
336 if (!getDebug()) {
337 return;
338 }
339 cout << a->GetName() << ": N=" << a->GetNz() << " Phi1=" << a->GetPhi1()
340 << ", Dphi=" << a->GetDphi() << endl;
341 cout << "i\t Z \t Rmin \t Rmax" << endl;
342 for (Int_t iii = 0; iii < a->GetNz(); iii++) {
343 cout << iii << "\t" << a->GetZ(iii) << "\t" << a->GetRmin(iii) << "\t" << a->GetRmax(iii)
344 << endl;
345 } // end for iii
346 return;
347}
348
349void V11Geometry::printTube(const TGeoTube* a) const
350{
351 if (!getDebug()) {
352 return;
353 }
354 cout << a->GetName() << ": Rmin=" << a->GetRmin() << " Rmax=" << a->GetRmax()
355 << " Dz=" << a->GetDz() << endl;
356 return;
357}
358
359void V11Geometry::printTubeSeg(const TGeoTubeSeg* a) const
360{
361 if (!getDebug()) {
362 return;
363 }
364 cout << a->GetName() << ": Phi1=" << a->GetPhi1() << " Phi2=" << a->GetPhi2()
365 << " Rmin=" << a->GetRmin() << " Rmax=" << a->GetRmax() << " Dz=" << a->GetDz() << endl;
366 return;
367}
368
369void V11Geometry::printConeSeg(const TGeoConeSeg* a) const
370{
371 if (!getDebug()) {
372 return;
373 }
374 cout << a->GetName() << ": Phi1=" << a->GetPhi1() << " Phi2=" << a->GetPhi2()
375 << " Rmin1=" << a->GetRmin1() << " Rmax1=" << a->GetRmax1() << " Rmin2=" << a->GetRmin2()
376 << " Rmax2=" << a->GetRmax2() << " Dz=" << a->GetDz() << endl;
377 return;
378}
379
380void V11Geometry::printBBox(const TGeoBBox* a) const
381{
382 if (!getDebug()) {
383 return;
384 }
385 cout << a->GetName() << ": Dx=" << a->GetDX() << " Dy=" << a->GetDY() << " Dz=" << a->GetDZ()
386 << endl;
387 return;
388}
389
391{
392 Int_t i;
393 Double_t w;
394
395 // Define some elements
396 auto* itsH = new TGeoElement(Form("%s_H", mDetName), "Hydrogen", 1, 1.00794);
397 auto* itsHe = new TGeoElement(Form("%s_He", mDetName), "Helium", 2, 4.002602);
398 auto* itsC = new TGeoElement(Form("%s_C", mDetName), "Carbon", 6, 12.0107);
399 auto* itsN = new TGeoElement(Form("%s_N", mDetName), "Nitrogen", 7, 14.0067);
400 auto* itsO = new TGeoElement(Form("%s_O", mDetName), "Oxygen", 8, 15.994);
401 auto* itsF = new TGeoElement(Form("%s_F", mDetName), "Florine", 9, 18.9984032);
402 auto* itsNe = new TGeoElement(Form("%s_Ne", mDetName), "Neon", 10, 20.1797);
403 auto* itsMg = new TGeoElement(Form("%s_Mg", mDetName), "Magnesium", 12, 24.3050);
404 auto* itsAl = new TGeoElement(Form("%s_Al", mDetName), "Aluminum", 13, 26981538);
405 auto* itsSi = new TGeoElement(Form("%s_Si", mDetName), "Silicon", 14, 28.0855);
406 auto* itsP = new TGeoElement(Form("%s_P", mDetName), "Phosphorous", 15, 30.973761);
407 auto* itsS = new TGeoElement(Form("%s_S", mDetName), "Sulfur", 16, 32.065);
408 auto* itsAr = new TGeoElement(Form("%s_Ar", mDetName), "Argon", 18, 39.948);
409 auto* itsTi = new TGeoElement(Form("%s_Ti", mDetName), "Titanium", 22, 47.867);
410 auto* itsCr = new TGeoElement(Form("%s_Cr", mDetName), "Chromium", 24, 51.9961);
411 auto* itsMn = new TGeoElement(Form("%s_Mn", mDetName), "Manganese", 25, 54.938049);
412 auto* itsFe = new TGeoElement(Form("%s_Fe", mDetName), "Iron", 26, 55.845);
413 auto* itsCo = new TGeoElement(Form("%s_Co", mDetName), "Cobalt", 27, 58.933200);
414 auto* itsNi = new TGeoElement(Form("%s_Ni", mDetName), "Nickrl", 28, 56.6930);
415 auto* itsCu = new TGeoElement(Form("%s_Cu", mDetName), "Copper", 29, 63.546);
416 auto* itsZn = new TGeoElement(Form("%s_Zn", mDetName), "Zinc", 30, 65.39);
417 auto* itsKr = new TGeoElement(Form("%s_Kr", mDetName), "Krypton", 36, 83.80);
418 auto* itsMo = new TGeoElement(Form("%s_Mo", mDetName), "Molylibdium", 42, 95.94);
419 auto* itsXe = new TGeoElement(Form("%s_Xe", mDetName), "Zeon", 54, 131.293);
420
421 // Start with the Materials since for any one material there
422 // can be defined more than one Medium.
423 // Air, dry. at 15degree C, 101325Pa at sea-level, % by volume
424 // (% by weight). Density is 351 Kg/m^3
425 // N2 78.084% (75.47%), O2 20.9476% (23.20%), Ar 0.934 (1.28%)%,
426 // C02 0.0314% (0.0590%), Ne 0.001818% (0.0012%, CH4 0.002% (),
427 // He 0.000524% (0.00007%), Kr 0.000114% (0.0003%), H2 0.00005% (3.5E-6%),
428 // Xe 0.0000087% (0.00004 %), H2O 0.0% (dry) + trace amounts at the ppm
429 // levels.
430 auto* itsAir = new TGeoMixture(Form("%s_Air", mDetName), 9);
431 w = 75.47E-2;
432 itsAir->AddElement(itsN, w); // Nitorgen, atomic
433 w = 23.29E-2 + // O2
434 5.90E-4 * 2. * 15.994 / (12.0107 + 2. * 15.994); // CO2.
435 itsAir->AddElement(itsO, w); // Oxygen, atomic
436 w = 1.28E-2;
437 itsAir->AddElement(itsAr, w); // Argon, atomic
438 w = 5.90E-4 * 12.0107 / (12.0107 + 2. * 15.994) + // CO2
439 2.0E-5 * 12.0107 / (12.0107 + 4. * 1.00794); // CH4
440 itsAir->AddElement(itsC, w); // Carbon, atomic
441 w = 1.818E-5;
442 itsAir->AddElement(itsNe, w); // Ne, atomic
443 w = 3.5E-8;
444 itsAir->AddElement(itsHe, w); // Helium, atomic
445 w = 7.0E-7;
446 itsAir->AddElement(itsKr, w); // Krypton, atomic
447 w = 3.0E-6;
448 itsAir->AddElement(itsH, w); // Hydrogen, atomic
449 w = 4.0E-7;
450 itsAir->AddElement(itsXe, w); // Xenon, atomic
451 itsAir->SetDensity(351.0 * sKgm3);
452 itsAir->SetPressure(101325 * sPascal);
453 itsAir->SetTemperature(15.0 * sCelsius);
454 itsAir->SetState(TGeoMaterial::kMatStateGas);
455
456 // Silicone
457 auto* itsSiDet = new TGeoMaterial(Form("%s_Si", mDetName), itsSi, 2.33 * sGCm3);
458 itsSiDet->SetTemperature(15.0 * sCelsius);
459 itsSiDet->SetState(TGeoMaterial::kMatStateSolid);
460
461 // Epoxy C18 H19 O3
462 auto* itsEpoxy = new TGeoMixture(Form("%s_Epoxy", mDetName), 3);
463 itsEpoxy->AddElement(itsC, 18);
464 itsEpoxy->AddElement(itsH, 19);
465 itsEpoxy->AddElement(itsO, 3);
466 itsEpoxy->SetDensity(1.8 * sGCm3);
467 itsEpoxy->SetTemperature(15.0 * sCelsius);
468 itsEpoxy->SetState(TGeoMaterial::kMatStateSolid);
469
470 // Carbon Fiber, M55J, 60% fiber by volume. Fiber density
471 // 1.91 g/cm^3. See ToryaCA M55J data sheet.
472 // Begin_Html
473 /*
474 <A HREF="http://torayusa.com/cfa/pdfs/M55JDataSheet.pdf"> Data Sheet
475 </A>
476 */
477 // End_Html
478 auto* itsCarbonFiber = new TGeoMixture(Form("%s_CarbonFiber-M55J", mDetName), 4);
479 // Assume that the epoxy fill in the space between the fibers and so
480 // no change in the total volume. To compute w, assume 1cm^3 total
481 // volume.
482 w = 1.91 / (1.91 + (1. - .60) * itsEpoxy->GetDensity());
483 itsCarbonFiber->AddElement(itsC, w);
484 w = (1. - .60) * itsEpoxy->GetDensity() / (1.91 + (1. - .06) * itsEpoxy->GetDensity());
485
486 for (i = 0; i < itsEpoxy->GetNelements(); i++) {
487 itsCarbonFiber->AddElement(itsEpoxy->GetElement(i), itsEpoxy->GetWmixt()[i] * w);
488 }
489
490 itsCarbonFiber->SetDensity((1.91 + (1. - .60) * itsEpoxy->GetDensity()) * sGCm3);
491 itsCarbonFiber->SetTemperature(22.0 * sCelsius);
492 itsCarbonFiber->SetState(TGeoMaterial::kMatStateSolid);
493
494 // Rohacell 51A millable foam product.
495 // C9 H13 N1 O2 52Kg/m^3
496 // Elemental composition, Private comunications with
497 // Bjorn S. Nilsen
498 // Begin_Html
499 /*
500 <A HREF="http://www.rohacell.com/en/performanceplastics8344.html">
501 Rohacell-A see Properties
502 </A>
503 */
504 // End_Html
505 auto* itsFoam = new TGeoMixture(Form("%s_Foam", mDetName), 4);
506 itsFoam->AddElement(itsC, 9);
507 itsFoam->AddElement(itsH, 13);
508 itsFoam->AddElement(itsN, 1);
509 itsFoam->AddElement(itsO, 2);
510 itsFoam->SetTitle("Rohacell 51 A");
511 itsFoam->SetDensity(52. * sKgm3);
512 itsFoam->SetTemperature(22.0 * sCelsius);
513 itsFoam->SetState(TGeoMaterial::kMatStateSolid);
514
515 // Kapton % by weight, H 2.6362, C69.1133, N 7.3270, O 20.0235
516 // Density 1.42 g/cm^3
517 // Begin_Html
518 /*
519 <A HREF="http://www2.dupont.com/Kapton/en_US/assets/downloads/pdf/summaryofprop.pdf">
520 Kapton. also see </A>
521 <A HREF="http://physics.nist.gov/cgi-bin/Star/compos.pl?matno=179">
522 </A>
523 */
524 // End_Html
525 auto* itsKapton = new TGeoMixture(Form("%s_Kapton", mDetName), 4);
526 itsKapton->AddElement(itsH, 0.026362);
527 itsKapton->AddElement(itsC, 0.691133);
528 itsKapton->AddElement(itsN, 0.073270);
529 itsKapton->AddElement(itsO, 0.200235);
530 itsKapton->SetTitle("Kapton ribon and cable base");
531 itsKapton->SetDensity(1.42 * sGCm3);
532 itsKapton->SetTemperature(22.0 * sCelsius);
533 itsKapton->SetState(TGeoMaterial::kMatStateSolid);
534
535 // UPILEX-S C16 H6 O4 N2 polymer (a Kapton like material)
536 // Density 1.47 g/cm^3
537 // Begin_Html
538 /*
539 <A HREF="http://northamerica.ube.com/page.php?pageid=9">
540 UPILEX-S. also see </A>
541 <A HREF="http://northamerica.ube.com/page.php?pageid=81">
542 </A>
543 */
544 // End_Html
545 auto* itsUpilex = new TGeoMixture(Form("%s_Upilex", mDetName), 4);
546 itsUpilex->AddElement(itsC, 16);
547 itsUpilex->AddElement(itsH, 6);
548 itsUpilex->AddElement(itsN, 2);
549 itsUpilex->AddElement(itsO, 4);
550 itsUpilex->SetTitle("Upilex ribon, cable, and pcb base");
551 itsUpilex->SetDensity(1.47 * sGCm3);
552 itsUpilex->SetTemperature(22.0 * sCelsius);
553 itsUpilex->SetState(TGeoMaterial::kMatStateSolid);
554
555 // Aluminum 6061 (Al used by US groups)
556 // % by weight, Cr 0.04-0.35 range [0.0375 nominal value used]
557 // Cu 0.15-0.4 [0.275], Fe Max 0.7 [0.35], Mg 0.8-1.2 [1.0],
558 // Mn Max 0.15 [0.075] Si 0.4-0.8 [0.6], Ti Max 0.15 [0.075],
559 // Zn Max 0.25 [0.125], Rest Al [97.4625]. Density 2.7 g/cm^3
560 // Begin_Html
561 /*
562 <A HREG="http://www.matweb.com/SpecificMaterial.asp?bassnum=MA6016&group=General">
563 Aluminum 6061 specifications
564 </A>
565 */
566 // End_Html
567 auto* itsAl6061 = new TGeoMixture(Form("%s_Al6061", mDetName), 9);
568 itsAl6061->AddElement(itsCr, 0.000375);
569 itsAl6061->AddElement(itsCu, 0.00275);
570 itsAl6061->AddElement(itsFe, 0.0035);
571 itsAl6061->AddElement(itsMg, 0.01);
572 itsAl6061->AddElement(itsMn, 0.00075);
573 itsAl6061->AddElement(itsSi, 0.006);
574 itsAl6061->AddElement(itsTi, 0.00075);
575 itsAl6061->AddElement(itsZn, 0.00125);
576 itsAl6061->AddElement(itsAl, 0.974625);
577 itsAl6061->SetTitle("Aluminum Alloy 6061");
578 itsAl6061->SetDensity(2.7 * sGCm3);
579 itsAl6061->SetTemperature(22.0 * sCelsius);
580 itsAl6061->SetState(TGeoMaterial::kMatStateSolid);
581
582 // Aluminum 7075 (Al used by Italian groups)
583 // % by weight, Cr 0.18-0.28 range [0.23 nominal value used]
584 // Cu 1.2-2.0 [1.6], Fe Max 0.5 [0.25], Mg 2.1-2.9 [2.5],
585 // Mn Max 0.3 [0.125] Si Max 0.4 [0.2], Ti Max 0.2 [0.1],
586 // Zn 5.1-6.1 [5.6], Rest Al [89.395]. Density 2.81 g/cm^3
587 // Begin_Html
588 /*
589 <A HREG="http://asm.matweb.com/search/SpecificMaterial.asp?bassnum=MA7075T6">
590 Aluminum 7075 specifications
591 </A>
592 */
593 // End_Html
594 auto* itsAl7075 = new TGeoMixture(Form("%s_Al7075", mDetName), 9);
595 itsAl7075->AddElement(itsCr, 0.0023);
596 itsAl7075->AddElement(itsCu, 0.016);
597 itsAl7075->AddElement(itsFe, 0.0025);
598 itsAl7075->AddElement(itsMg, 0.025);
599 itsAl7075->AddElement(itsMn, 0.00125);
600 itsAl7075->AddElement(itsSi, 0.002);
601 itsAl7075->AddElement(itsTi, 0.001);
602 itsAl7075->AddElement(itsZn, 0.056);
603 itsAl7075->AddElement(itsAl, 0.89395);
604 itsAl7075->SetTitle("Aluminum Alloy 7075");
605 itsAl7075->SetDensity(2.81 * sGCm3);
606 itsAl7075->SetTemperature(22.0 * sCelsius);
607 itsAl7075->SetState(TGeoMaterial::kMatStateSolid);
608
609 // "Ruby" spheres, Al2 O3
610 // "Ruby" Sphere posts, Ryton R-4 04
611 // Begin_Html
612 /*
613 <A HREF="">
614 Ruby Sphere Posts
615 </A>
616 */
617 // End_Html
618 auto* itsRuby = new TGeoMixture(Form("%s_RubySphere", mDetName), 2);
619 itsRuby->AddElement(itsAl, 2);
620 itsRuby->AddElement(itsO, 3);
621 itsRuby->SetTitle("Ruby reference sphere");
622 itsRuby->SetDensity(2.81 * sGCm3);
623 itsRuby->SetTemperature(22.0 * sCelsius);
624 itsRuby->SetState(TGeoMaterial::kMatStateSolid);
625
626 // Inox, AISI 304L, compoistion % by weight (assumed)
627 // C Max 0.03 [0.015], Mn Max 2.00 [1.00], Si Max 1.00 [0.50]
628 // P Max 0.045 [0.0225], S Max 0.03 [0.015], Ni 8.0-10.5 [9.25]
629 // Cr 18-20 [19.], Mo 2.-2.5 [2.25], rest Fe: density 7.93 Kg/dm^3
630 // Begin_Html
631 /*
632 <A HREF="http://www.cimap.fr/caracter.pdf">
633 Stainless steal (INOX) AISI 304L composition
634 </A>
635 */
636 // End_Html
637 auto* itsInox304L = new TGeoMixture(Form("%s_Inox304L", mDetName), 9);
638 itsInox304L->AddElement(itsC, 0.00015);
639 itsInox304L->AddElement(itsMn, 0.010);
640 itsInox304L->AddElement(itsSi, 0.005);
641 itsInox304L->AddElement(itsP, 0.000225);
642 itsInox304L->AddElement(itsS, 0.00015);
643 itsInox304L->AddElement(itsNi, 0.0925);
644 itsInox304L->AddElement(itsCr, 0.1900);
645 itsInox304L->AddElement(itsMo, 0.0225);
646 itsInox304L->AddElement(itsFe, 0.679475); // Rest Fe
647 itsInox304L->SetTitle("ITS Stainless Steal (Inox) type AISI 304L");
648 itsInox304L->SetDensity(7.93 * sKgdm3);
649 itsInox304L->SetTemperature(22.0 * sCelsius);
650 itsInox304L->SetState(TGeoMaterial::kMatStateSolid);
651
652 // Inox, AISI 316L, composition % by weight (assumed)
653 // C Max 0.03 [0.015], Mn Max 2.00 [1.00], Si Max 1.00 [0.50]
654 // P Max 0.045 [0.0225], S Max 0.03 [0.015], Ni 10.0-14. [12.]
655 // Cr 16-18 [17.], Mo 2-3 [2.5]: density 7.97 Kg/dm^3
656 // Begin_Html
657 /*
658 <A HREF="http://www.cimap.fr/caracter.pdf">
659 Stainless steal (INOX) AISI 316L composition
660 </A>
661 */
662 // End_Html
663 auto* itsInox316L = new TGeoMixture(Form("%s_Inox316L", mDetName), 9);
664 itsInox316L->AddElement(itsC, 0.00015);
665 itsInox316L->AddElement(itsMn, 0.010);
666 itsInox316L->AddElement(itsSi, 0.005);
667 itsInox316L->AddElement(itsP, 0.000225);
668 itsInox316L->AddElement(itsS, 0.00015);
669 itsInox316L->AddElement(itsNi, 0.12);
670 itsInox316L->AddElement(itsCr, 0.17);
671 itsInox316L->AddElement(itsMo, 0.025);
672 itsInox316L->AddElement(itsFe, 0.66945); // Rest Fe
673 itsInox316L->SetTitle("ITS Stainless Steal (Inox) type AISI 316L");
674 itsInox316L->SetDensity(7.97 * sKgdm3);
675 itsInox316L->SetTemperature(22.0 * sCelsius);
676 itsInox316L->SetState(TGeoMaterial::kMatStateSolid);
677
678 // Inox, Phynox or Elgiloy AMS 5833, composition % by weight
679 // C Max 0.15 [0.15], Mn Max 2.00 [2.00], Be max 0.0001 [none]
680 // Ni 18. [18.], Cr 21.5 [21.5], Mo 7.5 [7.5], Co 42 [42.]:
681 // density 8.3 Kg/dm^3
682 // Begin_Html
683 /*
684 <A HREF="http://www.freepatentsonline.com/20070032816.html">
685 Compostion of Phynox or Elgiloy AMS 5833, also see
686 </A>
687 <A HREF="http://www.alloywire.com/phynox_alloy.html">
688 under corss reference number [0024].
689 </A>
690 */
691 // End_Html
692 auto* itsPhynox = new TGeoMixture(Form("%s_Phynox", mDetName), 7);
693 itsPhynox->AddElement(itsC, 0.0015);
694 itsPhynox->AddElement(itsMn, 0.020);
695 itsPhynox->AddElement(itsNi, 0.18);
696 itsPhynox->AddElement(itsCr, 0.215);
697 itsPhynox->AddElement(itsMo, 0.075);
698 itsPhynox->AddElement(itsCo, 0.42);
699 itsPhynox->AddElement(itsFe, 0.885);
700 itsPhynox->SetTitle("ITS Cooling tube alloy");
701 itsPhynox->SetDensity(8.3 * sGCm3);
702 itsPhynox->SetTemperature(22.0 * sCelsius);
703 itsPhynox->SetState(TGeoMaterial::kMatStateSolid);
704
705 // G10FR4
706
707 // Demineralized Water H2O SDD & SSD Cooling liquid
708 auto* itsWater = new TGeoMixture(Form("%s_Water", mDetName), 2);
709 itsWater->AddElement(itsH, 2);
710 itsWater->AddElement(itsO, 1);
711 itsWater->SetTitle("ITS Cooling Water");
712 itsWater->SetDensity(1.0 * sGCm3);
713 itsWater->SetTemperature(22.0 * sCelsius);
714 itsWater->SetState(TGeoMaterial::kMatStateLiquid);
715
716 // Freon SPD Cooling liquid PerFluorobuthane C4F10
717 // Begin_Html
718 /*
719 <A HREF="
720 http://st-support-cooling-electronics.web.cern.ch/st-support-cooling-electronics/default.htm">
721 SPD 2 phase cooling using PerFluorobuthane
722 </A>
723 */
724 // End_Html
725 auto* itsFreon = new TGeoMixture(Form("%s_SPD_Freon", mDetName), 2);
726 itsFreon->AddElement(itsC, 4);
727 itsFreon->AddElement(itsF, 10);
728 itsFreon->SetTitle("ITS SPD 2 phase Cooling freon");
729 itsFreon->SetDensity(1.52 * sGCm3);
730 itsFreon->SetTemperature(22.0 * sCelsius);
731 itsFreon->SetState(TGeoMaterial::kMatStateLiquid);
732
733 // Int_t ifield = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Integ();
734 // Float_t fieldm = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Max();
735
736 // Float_t tmaxfd = 0.1;// 1.0;// Degree
737 // Float_t stemax = 1.0;// cm
738 // Float_t deemax = 0.1;// 30.0;// Fraction of particle's energy 0<deemax<=1
739 // Float_t epsil = 1.0E-4;// 1.0; cm
740 // Float_t stmin = 0.0; // cm "Default value used"
741
742 // Float_t tmaxfdSi = 0.1; // .10000E+01; // Degree
743 // Float_t stemaxSi = 0.0075; // .10000E+01; // cm
744 // Float_t deemaxSi = 0.1; // Fraction of particle's energy 0<deemax<=1
745 // Float_t epsilSi = 1.0E-4;// .10000E+01;
746 /*
747 Float_t stminSi = 0.0; // cm "Default value used"
748
749 Float_t tmaxfdAir = 0.1; // .10000E+01; // Degree
750 Float_t stemaxAir = .10000E+01; // cm
751 Float_t deemaxAir = 0.1; // 0.30000E-02; // Fraction of particle's energy 0<deemax<=1
752 Float_t epsilAir = 1.0E-4;// .10000E+01;
753 Float_t stminAir = 0.0; // cm "Default value used"
754
755 Float_t tmaxfdServ = 1.0; // 10.0; // Degree
756 Float_t stemaxServ = 1.0; // 0.01; // cm
757 Float_t deemaxServ = 0.5; // 0.1; // Fraction of particle's energy 0<deemax<=1
758 Float_t epsilServ = 1.0E-3; // 0.003; // cm
759 Float_t stminServ = 0.0; //0.003; // cm "Default value used"
760
761 // Freon PerFluorobuthane C4F10 see
762 // http://st-support-cooling-electronics.web.cern.ch/
763 // st-support-cooling-electronics/default.htm
764 Float_t afre[2] = { 12.011,18.9984032 };
765 Float_t zfre[2] = { 6., 9. };
766 Float_t wfre[2] = { 4.,10. };
767 Float_t densfre = 1.52;
768
769 //CM55J
770 Float_t aCM55J[4]={12.0107,14.0067,15.9994,1.00794};
771 Float_t zCM55J[4]={6.,7.,8.,1.};
772 Float_t wCM55J[4]={0.908508078,0.010387573,0.055957585,0.025146765};
773 Float_t dCM55J = 1.63;
774
775 //ALCM55J
776 Float_t aALCM55J[5]={12.0107,14.0067,15.9994,1.00794,26.981538};
777 Float_t zALCM55J[5]={6.,7.,8.,1.,13.};
778 Float_t wALCM55J[5]={0.817657902,0.0093488157,0.0503618265,0.0226320885,0.1};
779 Float_t dALCM55J = 1.9866;
780
781 //Si Chips
782 Float_t aSICHIP[6]={12.0107,14.0067,15.9994,1.00794,28.0855,107.8682};
783 Float_t zSICHIP[6]={6.,7.,8.,1.,14., 47.};
784 Float_t wSICHIP[6]={0.039730642,0.001396798,0.01169634,
785 0.004367771,0.844665,0.09814344903};
786 Float_t dSICHIP = 2.36436;
787
788 //Inox
789 Float_t aINOX[9]={12.0107,54.9380, 28.0855,30.9738,32.066,
790 58.6928,55.9961,95.94,55.845};
791 Float_t zINOX[9]={6.,25.,14.,15.,16., 28.,24.,42.,26.};
792 Float_t wINOX[9]={0.0003,0.02,0.01,0.00045,0.0003,0.12,0.17,0.025,0.654};
793 Float_t dINOX = 8.03;
794
795 //SDD HV microcable
796 Float_t aHVm[5]={12.0107,1.00794,14.0067,15.9994,26.981538};
797 Float_t zHVm[5]={6.,1.,7.,8.,13.};
798 Float_t wHVm[5]={0.520088819984,0.01983871336,0.0551367996,0.157399667056, 0.247536};
799 Float_t dHVm = 1.6087;
800
801 //SDD LV+signal cable
802 Float_t aLVm[5]={12.0107,1.00794,14.0067,15.9994,26.981538};
803 Float_t zLVm[5]={6.,1.,7.,8.,13.};
804 Float_t wLVm[5]={0.21722436468,0.0082859922,0.023028867,0.06574077612, 0.68572};
805 Float_t dLVm = 2.1035;
806
807 //SDD hybrid microcab
808 Float_t aHLVm[5]={12.0107,1.00794,14.0067,15.9994,26.981538};
809 Float_t zHLVm[5]={6.,1.,7.,8.,13.};
810 Float_t wHLVm[5]={0.24281879711,0.00926228815,0.02574224025,0.07348667449, 0.64869};
811 Float_t dHLVm = 2.0502;
812
813 //SDD anode microcab
814 Float_t aALVm[5]={12.0107,1.00794,14.0067,15.9994,26.981538};
815 Float_t zALVm[5]={6.,1.,7.,8.,13.};
816 Float_t wALVm[5]={0.392653705471,0.0128595919215,
817 0.041626868025,0.118832707289, 0.431909};
818 Float_t dALVm = 2.0502;
819
820 //X7R capacitors
821 Float_t aX7R[7]={137.327,47.867,15.9994,58.6928,63.5460,118.710,207.2};
822 Float_t zX7R[7]={56.,22.,8.,28.,29.,50.,82.};
823 Float_t wX7R[7]={0.251639432,0.084755042,0.085975822,
824 0.038244751,0.009471271,0.321736471,0.2081768};
825 Float_t dX7R = 7.14567;
826
827 // AIR
828 Float_t aAir[4]={12.0107,14.0067,15.9994,39.948};
829 Float_t zAir[4]={6.,7.,8.,18.};
830 Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827};
831 Float_t dAir = 1.20479E-3;
832
833 // Water
834 Float_t aWater[2]={1.00794,15.9994};
835 Float_t zWater[2]={1.,8.};
836 Float_t wWater[2]={0.111894,0.888106};
837 Float_t dWater = 1.0;
838
839 // CERAMICS
840 // 94.4% Al2O3 , 2.8% SiO2 , 2.3% MnO , 0.5% Cr2O3
841 Float_t acer[5] = { 26.981539,15.9994,28.0855,54.93805,51.9961 };
842 Float_t zcer[5] = { 13., 8., 14., 25., 24. };
843 Float_t wcer[5] = {.4443408,.5213375,.0130872,.0178135,.003421};
844 Float_t denscer = 3.6;
845
846 // G10FR4
847 Float_t zG10FR4[14] = {14.00, 20.00, 13.00, 12.00, 5.00,
848 22.00, 11.00, 19.00, 26.00, 9.00,
849 8.00, 6.00, 7.00, 1.00};
850 Float_t aG10FR4[14] = {28.0855000,40.0780000,26.9815380,24.3050000,
851 10.8110000,47.8670000,22.9897700,39.0983000,
852 55.8450000,18.9984000,15.9994000,12.0107000,
853 14.0067000,1.0079400};
854 Float_t wG10FR4[14] = {0.15144894,0.08147477,0.04128158,0.00904554,
855 0.01397570,0.00287685,0.00445114,0.00498089,
856 0.00209828,0.00420000,0.36043788,0.27529426,
857 0.01415852,0.03427566};
858 Float_t densG10FR4= 1.8;
859
860 //--- EPOXY --- C18 H19 O3
861 Float_t aEpoxy[3] = {15.9994, 1.00794, 12.0107} ;
862 Float_t zEpoxy[3] = { 8., 1., 6.} ;
863 Float_t wEpoxy[3] = { 3., 19., 18.} ;
864 Float_t dEpoxy = 1.8 ;
865
866 // rohacell: C9 H13 N1 O2
867 Float_t arohac[4] = {12.01, 1.01, 14.010, 16.};
868 Float_t zrohac[4] = { 6., 1., 7., 8.};
869 Float_t wrohac[4] = { 9., 13., 1., 2.};
870 Float_t drohac = 0.05;
871
872 // If he/she means stainless steel (inox) + Aluminium and Zeff=15.3383 then
873 // %Al=81.6164 %inox=100-%Al
874 Float_t aInAl[5] = {27., 55.847,51.9961,58.6934,28.0855 };
875 Float_t zInAl[5] = {13., 26.,24.,28.,14. };
876 Float_t wInAl[5] = {.816164, .131443,.0330906,.0183836,.000919182};
877 Float_t dInAl = 3.075;
878
879 // Kapton
880 Float_t aKapton[4]={1.00794,12.0107, 14.010,15.9994};
881 Float_t zKapton[4]={1.,6.,7.,8.};
882 Float_t wKapton[4]={0.026362,0.69113,0.07327,0.209235};
883 Float_t dKapton = 1.42;
884
885 //SDD ruby sph.
886 Float_t aAlOxide[2] = { 26.981539,15.9994};
887 Float_t zAlOxide[2] = { 13., 8.};
888 Float_t wAlOxide[2] = {0.4707, 0.5293};
889 Float_t dAlOxide = 3.97;
890 */
891}
892
893void V11Geometry::drawCrossSection(const TGeoPcon* p, Int_t fillc, Int_t fills, Int_t linec,
894 Int_t lines, Int_t linew, Int_t markc, Int_t marks,
895 Float_t marksize) const
896{
897 Int_t n = 0, m = 0, i = 0;
898 Double_t *z = nullptr, *r = nullptr;
899 TPolyMarker* pts = nullptr;
900 TPolyLine* line = nullptr;
901
902 n = p->GetNz();
903 if (n <= 0) {
904 return;
905 }
906 m = 2 * n + 1;
907 z = new Double_t[m];
908 r = new Double_t[m];
909
910 for (i = 0; i < n; i++) {
911 z[i] = p->GetZ(i);
912 r[i] = p->GetRmax(i);
913 z[i + n] = p->GetZ(n - 1 - i);
914 r[i + n] = p->GetRmin(n - 1 - i);
915 } // end for i
916 z[n - 1] = z[0];
917 r[n - 1] = r[0];
918
919 line = new TPolyLine(n, z, r);
920 pts = new TPolyMarker(n, z, r);
921
922 line->SetFillColor(fillc);
923 line->SetFillStyle(fills);
924 line->SetLineColor(linec);
925 line->SetLineStyle(lines);
926 line->SetLineWidth(linew);
927 pts->SetMarkerColor(markc);
928 pts->SetMarkerStyle(marks);
929 pts->SetMarkerSize(marksize);
930
931 line->Draw("f");
932 line->Draw();
933 pts->Draw();
934
935 delete[] z;
936 delete[] r;
937
938 cout << "Hit Return to continue" << endl;
939 cin >> n;
940 delete line;
941 delete pts;
942 return;
943}
944
945Bool_t V11Geometry::angleOfIntersectionWithLine(Double_t x0, Double_t y0, Double_t x1, Double_t y1,
946 Double_t xc, Double_t yc, Double_t rc, Double_t& t0,
947 Double_t& t1) const
948{
949 Double_t dx, dy, cx, cy, s2, t[4];
950 Double_t a0, b0, c0, a1, b1, c1, sinthp, sinthm, costhp, costhm;
951 Int_t i, j;
952
953 t0 = 400.0;
954 t1 = 400.0;
955 dx = x1 - x0;
956 dy = y1 - y0;
957 cx = xc - x0;
958 cy = yc - y0;
959 s2 = dx * dx + dy * dy;
960 if (s2 == 0.0) {
961 return kFALSE;
962 }
963
964 a0 = rc * rc * s2;
965 if (a0 == 0.0) {
966 return kFALSE;
967 }
968 b0 = 2.0 * rc * dx * (dx * cy - cx * dy);
969 c0 = dx * dx * cy * cy - 2.0 * dy * dx * cy * cx + cx * cx * dy * dy - rc * rc * dy * dy;
970 c0 = 0.25 * b0 * b0 / (a0 * a0) - c0 / a0;
971 if (c0 < 0.0) {
972 return kFALSE;
973 }
974 sinthp = -0.5 * b0 / a0 + TMath::Sqrt(c0);
975 sinthm = -0.5 * b0 / a0 - TMath::Sqrt(c0);
976
977 a1 = rc * rc * s2;
978 if (a1 == 0.0) {
979 return kFALSE;
980 }
981 b1 = 2.0 * rc * dy * (dy * cx - dx * cy);
982 c1 = dy * dy * cx * cx - 2.0 * dy * dx * cy * cx + dx * dx * cy * cy - rc * rc * dx * dx;
983 c1 = 0.25 * b1 * b1 / (a1 * a1) - c1 / a1;
984 if (c1 < 0.0) {
985 return kFALSE;
986 }
987 costhp = -0.5 * b1 / a1 + TMath::Sqrt(c1);
988 costhm = -0.5 * b1 / a1 - TMath::Sqrt(c1);
989
990 t[0] = t[1] = t[2] = t[3] = 400.;
991 a0 = TMath::ATan2(sinthp, costhp);
992 if (a0 < 0.0) {
993 a0 += 2.0 * TMath::Pi();
994 }
995 a1 = TMath::ATan2(sinthp, costhm);
996 if (a1 < 0.0) {
997 a1 += 2.0 * TMath::Pi();
998 }
999 b0 = TMath::ATan2(sinthm, costhp);
1000 if (b0 < 0.0) {
1001 b0 += 2.0 * TMath::Pi();
1002 }
1003 b1 = TMath::ATan2(sinthm, costhm);
1004 if (b1 < 0.0) {
1005 b1 += 2.0 * TMath::Pi();
1006 }
1007 x1 = xc + rc * TMath::Cos(a0);
1008 y1 = yc + rc * TMath::Sin(a0);
1009 s2 = dx * (y1 - y0) - dy * (x1 - x0);
1010 if (s2 * s2 < DBL_EPSILON) {
1011 t[0] = a0 * TMath::RadToDeg();
1012 }
1013 x1 = xc + rc * TMath::Cos(a1);
1014 y1 = yc + rc * TMath::Sin(a1);
1015 s2 = dx * (y1 - y0) - dy * (x1 - x0);
1016 if (s2 * s2 < DBL_EPSILON) {
1017 t[1] = a1 * TMath::RadToDeg();
1018 }
1019 x1 = xc + rc * TMath::Cos(b0);
1020 y1 = yc + rc * TMath::Sin(b0);
1021 s2 = dx * (y1 - y0) - dy * (x1 - x0);
1022 if (s2 * s2 < DBL_EPSILON) {
1023 t[2] = b0 * TMath::RadToDeg();
1024 }
1025 x1 = xc + rc * TMath::Cos(b1);
1026 y1 = yc + rc * TMath::Sin(b1);
1027 s2 = dx * (y1 - y0) - dy * (x1 - x0);
1028 if (s2 * s2 < DBL_EPSILON) {
1029 t[3] = b1 * TMath::RadToDeg();
1030 }
1031 for (i = 0; i < 4; i++) {
1032 for (j = i + 1; j < 4; j++) {
1033 if (t[i] > t[j]) {
1034 t0 = t[i];
1035 t[i] = t[j];
1036 t[j] = t0;
1037 }
1038 } // end for i,j
1039 }
1040 t0 = t[0];
1041 t1 = t[1];
1042
1043 return kTRUE;
1044}
1045
1046Double_t V11Geometry::angleForRoundedCorners0(Double_t dx, Double_t dy, Double_t sdr) const
1047{
1048 Double_t a, b;
1049
1050 b = dy * dy + dx * dx - sdr * sdr;
1051 if (b < 0.0) {
1052 Error("AngleForRoundedCorners0", "dx^2(%e)+dy^2(%e)-sdr^2(%e)=b=%e<0", dx, dy, sdr, b);
1053 }
1054 b = TMath::Sqrt(b);
1055 a = -sdr * dy + dx * b;
1056 b = -sdr * dx - dy * b;
1057 return TMath::ATan2(a, b) * TMath::RadToDeg();
1058}
1059
1060Double_t V11Geometry::angleForRoundedCorners1(Double_t dx, Double_t dy, Double_t sdr) const
1061{
1062 Double_t a, b;
1063
1064 b = dy * dy + dx * dx - sdr * sdr;
1065 if (b < 0.0) {
1066 Error("AngleForRoundedCorners1", "dx^2(%e)+dy^2(%e)-sdr^2(%e)=b=%e<0", dx, dy, sdr, b);
1067 }
1068 b = TMath::Sqrt(b);
1069 a = -sdr * dy - dx * b;
1070 b = -sdr * dx + dy * b;
1071 return TMath::ATan2(a, b) * TMath::RadToDeg();
1072}
1073
1074void V11Geometry::anglesForRoundedCorners(Double_t x0, Double_t y0, Double_t r0, Double_t x1,
1075 Double_t y1, Double_t r1, Double_t& t0, Double_t& t1)
1076 const
1077{
1078 Double_t t;
1079
1080 if (r0 >= 0.0 && r1 >= 0.0) { // Inside to inside ++
1081 t = angleForRoundedCorners1(x1 - x0, y1 - y0, r1 - r0);
1082 t0 = t1 = t;
1083 return;
1084 } else if (r0 >= 0.0 && r1 <= 0.0) { // Inside to Outside +-
1085 r1 = -r1; // make positive
1086 t = angleForRoundedCorners0(x1 - x0, y1 - y0, r1 + r0);
1087 t0 = 180.0 + t;
1088 if (t0 < 0.0) {
1089 t += 360.;
1090 }
1091 if (t < 0.0) {
1092 t += 360.;
1093 }
1094 t1 = t;
1095 return;
1096 } else if (r0 <= 0.0 && r1 >= 0.0) { // Outside to Inside -+
1097 r0 = -r0; // make positive
1098 t = angleForRoundedCorners1(x1 - x0, y1 - y0, r1 + r0);
1099 t0 = 180.0 + t;
1100 if (t0 > 180.) {
1101 t0 -= 360.;
1102 }
1103 if (t > 180.) {
1104 t -= 360.;
1105 }
1106 t1 = t;
1107 return;
1108 } else if (r0 <= 0.0 && r1 <= 0.0) { // Outside to outside --
1109 r0 = -r0; // make positive
1110 r1 = -r1; // make positive
1111 t = angleForRoundedCorners0(x1 - x0, y1 - y0, r1 - r0);
1112 t0 = t1 = t;
1113 return;
1114 }
1115 return;
1116}
1117
1118void V11Geometry::makeFigure1(Double_t x0, Double_t y0, Double_t r0, Double_t x1, Double_t y1,
1119 Double_t r1)
1120{
1121 Double_t t0[4], t1[4], xa0[4], ya0[4], xa1[4], ya1[4], ra0[4], ra1[4];
1122 Double_t xmin, ymin, xmax, ymax, h;
1123 Int_t j;
1124
1125 for (j = 0; j < 4; j++) {
1126 ra0[j] = r0;
1127 if (j % 2) {
1128 ra0[j] = -r0;
1129 }
1130 ra1[j] = r1;
1131 if (j > 1) {
1132 ra1[j] = -r1;
1133 }
1134 anglesForRoundedCorners(x0, y0, ra0[j], x1, y1, ra1[j], t0[j], t1[j]);
1135 xa0[j] = TMath::Abs(r0) * cosD(t0[j]) + x0;
1136 ya0[j] = TMath::Abs(r0) * sinD(t0[j]) + y0;
1137 xa1[j] = TMath::Abs(r1) * cosD(t1[j]) + x1;
1138 ya1[j] = TMath::Abs(r1) * sinD(t1[j]) + y1;
1139 }
1140 if (r0 < 0.0) {
1141 r0 = -r0;
1142 }
1143 if (r1 < 0.0) {
1144 r1 = -r1;
1145 }
1146 xmin = TMath::Min(x0 - r0, x1 - r1);
1147 ymin = TMath::Min(y0 - r0, y1 - r1);
1148 xmax = TMath::Max(x0 + r0, x1 + r1);
1149 ymax = TMath::Max(y0 + r0, y1 + r1);
1150
1151 for (j = 1; j < 4; j++) {
1152 xmin = TMath::Min(xmin, xa0[j]);
1153 xmin = TMath::Min(xmin, xa1[j]);
1154 ymin = TMath::Min(ymin, ya0[j]);
1155 ymin = TMath::Min(ymin, ya1[j]);
1156
1157 xmax = TMath::Max(xmax, xa0[j]);
1158 xmax = TMath::Max(xmax, xa1[j]);
1159 ymax = TMath::Max(ymax, ya0[j]);
1160 ymax = TMath::Max(ymax, ya1[j]);
1161 }
1162 if (xmin < 0.0) {
1163 xmin *= 1.1;
1164 } else {
1165 xmin *= 0.9;
1166 }
1167 if (ymin < 0.0) {
1168 ymin *= 1.1;
1169 } else {
1170 ymin *= 0.9;
1171 }
1172 if (xmax < 0.0) {
1173 xmax *= 0.9;
1174 } else {
1175 xmax *= 1.1;
1176 }
1177 if (ymax < 0.0) {
1178 ymax *= 0.9;
1179 } else {
1180 ymax *= 1.1;
1181 }
1182 j = (Int_t)(500.0 * (ymax - ymin) / (xmax - xmin));
1183 auto* can =
1184 new TCanvas("V11Geometry_AnglesForRoundedCorners", "Figure for V11Geometry", 500, j);
1185 h = ymax - ymin;
1186 if (h < 0) {
1187 h = -h;
1188 }
1189 can->Range(xmin, ymin, xmax, ymax);
1190 auto* c0 = new TArc(x0, y0, r0);
1191 auto* c1 = new TArc(x1, y1, r1);
1192 TLine* line[4];
1193 TArrow* ar0[4];
1194 TArrow* ar1[4];
1195
1196 for (j = 0; j < 4; j++) {
1197 ar0[j] = new TArrow(x0, y0, xa0[j], ya0[j]);
1198 ar1[j] = new TArrow(x1, y1, xa1[j], ya1[j]);
1199 line[j] = new TLine(xa0[j], ya0[j], xa1[j], ya1[j]);
1200 ar0[j]->SetLineColor(j + 1);
1201 ar0[j]->SetArrowSize(0.1 * r0 / h);
1202 ar1[j]->SetLineColor(j + 1);
1203 ar1[j]->SetArrowSize(0.1 * r1 / h);
1204 line[j]->SetLineColor(j + 1);
1205 }
1206 c0->Draw();
1207 c1->Draw();
1208
1209 for (j = 0; j < 4; j++) {
1210 ar0[j]->Draw();
1211 ar1[j]->Draw();
1212 line[j]->Draw();
1213 }
1214
1215 auto* t = new TText();
1216 t->SetTextSize(0.02);
1217 Char_t txt[100];
1218 snprintf(txt, 99, "(x0=%5.2f,y0=%5.2f)", x0, y0);
1219 t->DrawText(x0, y0, txt);
1220 snprintf(txt, 99, "(x1=%5.2f,y1=%5.2f)", x1, y1);
1221
1222 for (j = 0; j < 4; j++) {
1223 t->SetTextColor(j + 1);
1224 t->DrawText(x1, y1, txt);
1225 snprintf(txt, 99, "r0=%5.2f", ra0[j]);
1226 t->DrawText(0.5 * (x0 + xa0[j]), 0.5 * (y0 + ya0[j]), txt);
1227 snprintf(txt, 99, "r1=%5.2f", ra1[j]);
1228 t->DrawText(0.5 * (x1 + xa1[j]), 0.5 * (y1 + ya1[j]), txt);
1229 }
1230}
int32_t i
const GPUTPCGMMerger::trackCluster & b1
const GPUTPCGMMerger::trackCluster & a1
bool const GPUTPCGMMerger::trackCluster * c1
uint32_t j
Definition RawData.h:0
uint32_t c
Definition RawData.h:2
ClassImp(o2::its::V11Geometry)
Definition of the V11Geometry class.
Class for time synchronization of RawReader instances.
Double_t zFrom2MaxPoints(const TGeoPcon *p, Int_t i1, Int_t i2, Double_t r) const
void printTube(const TGeoTube *a) const
void printPcon(const TGeoPcon *a) const
static Bool_t intersectCircle(Double_t m, Double_t x0, Double_t y0, Double_t rr, Double_t xc, Double_t yc, Double_t &xi1, Double_t &yi1, Double_t &xi2, Double_t &yi2)
static const Double_t sKEV
Energy in KeV.
void insidePoint(const TGeoPcon *p, Int_t i1, Int_t i2, Int_t i3, Double_t Cthick, TGeoPcon *q, Int_t j1, Bool_t max) const
Double_t rFromZpCone(const Double_t *ar, const Double_t *az, int ip, Double_t tc, Double_t z, Double_t th=0.0) const
void printTubeSeg(const TGeoTubeSeg *a) const
Double_t rFrom2Points(const Double_t *ar, const Double_t *az, Int_t i1, Int_t i2, Double_t z) const
static const Double_t sGCm3
Density in g/cm^3.
void intersectLines(Double_t m, Double_t x0, Double_t y0, Double_t n, Double_t x1, Double_t y1, Double_t &xi, Double_t &yi) const
Double_t cosD(Double_t deg) const
Cosine function.
Definition V11Geometry.h:91
void printConeSeg(const TGeoConeSeg *a) const
void printBBox(const TGeoBBox *a) const
Double_t zFromRMaxpCone(const TGeoPcon *p, int ip, Double_t tc, Double_t r, Double_t th=0.0) const
Double_t xFrom2Points(Double_t x0, Double_t y0, Double_t x1, Double_t y1, Double_t y) const
Double_t rMaxFromZpCone(const TGeoPcon *p, int ip, Double_t tc, Double_t z, Double_t th=0.0) const
Double_t sinD(Double_t deg) const
Definition V11Geometry.h:85
static const Double_t sKPascal
Preasure in KPascal.
Bool_t angleOfIntersectionWithLine(Double_t x0, Double_t y0, Double_t x1, Double_t y1, Double_t xc, Double_t yc, Double_t rc, Double_t &t0, Double_t &t1) const
void makeFigure1(Double_t x0=0.0, Double_t y0=0.0, Double_t r0=2.0, Double_t x1=-4.0, Double_t y1=-2.0, Double_t r1=1.0)
static const Double_t sMm
Convert mm to TGeom's cm.
Double_t rMaxFrom2Points(const TGeoPcon *p, Int_t i1, Int_t i2, Double_t z) const
Double_t yFrom2Points(Double_t x0, Double_t y0, Double_t x1, Double_t y1, Double_t x) const
void drawCrossSection(const TGeoPcon *p, Int_t fillc=7, Int_t fills=4050, Int_t linec=3, Int_t lines=1, Int_t linew=4, Int_t markc=2, Int_t marks=4, Float_t marksize=1.0) const
static const Double_t sKgm3
Density in kg/m^3.
void radiusOfCurvature(Double_t rc, Double_t theta0, Double_t z0, Double_t r0, Double_t theta1, Double_t &z1, Double_t &r1) const
Double_t rMinFromZpCone(const TGeoPcon *p, Int_t ip, Double_t tc, Double_t z, Double_t th=0.0) const
static const Double_t sEV
Energy in eV.
Double_t zFromRMinpCone(const TGeoPcon *p, int ip, Double_t tc, Double_t r, Double_t th=0.0) const
static const Double_t sPascal
Preasure in Pascal.
Double_t zFrom2MinPoints(const TGeoPcon *p, Int_t i1, Int_t i2, Double_t r) const
static const Double_t sDegree
Convert degrees to TGeom's degrees.
static const Double_t sMicron
Convert micron to TGeom's cm.
static const Double_t sKgdm3
Density in kg/dm^3.
Double_t zFrom2Points(const Double_t *az, const Double_t *ar, Int_t i1, Int_t i2, Double_t r) const
static const Double_t sGEV
Energy in GeV.
static const Double_t sRadian
To Radians.
static const Double_t sCelsius
Temperature in degrees Celcius.
void printArb8(const TGeoArb8 *a) const
Bool_t getDebug(Int_t level=1) const
Returns the debug flag value.
Definition V11Geometry.h:76
Double_t rMinFrom2Points(const TGeoPcon *p, Int_t i1, Int_t i2, Double_t z) const
static const Double_t sMEV
Energy in MeV.
static const Double_t sCm
Convert cm to TGeom's cm.
void anglesForRoundedCorners(Double_t x0, Double_t y0, Double_t r0, Double_t x1, Double_t y1, Double_t r1, Double_t &t0, Double_t &t1) const
GLdouble n
Definition glcorearb.h:1982
GLint GLenum GLint x
Definition glcorearb.h:403
const GLfloat * m
Definition glcorearb.h:4066
GLuint GLfloat GLfloat GLfloat GLfloat y1
Definition glcorearb.h:5034
GLuint GLfloat GLfloat GLfloat x1
Definition glcorearb.h:5034
GLboolean GLboolean GLboolean b
Definition glcorearb.h:1233
GLint y
Definition glcorearb.h:270
GLuint GLfloat x0
Definition glcorearb.h:5034
GLboolean r
Definition glcorearb.h:1233
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t0
Definition glcorearb.h:5034
GLboolean GLboolean GLboolean GLboolean a
Definition glcorearb.h:1233
GLubyte GLubyte GLubyte GLubyte w
Definition glcorearb.h:852
GLuint GLfloat GLfloat y0
Definition glcorearb.h:5034
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t1
Definition glcorearb.h:5034
constexpr size_t max
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"