Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGeoHype.cxx
Go to the documentation of this file.
1// @(#)root/geom:$Id$
2// Author: Mihaela Gheata 20/11/04
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#include <iostream>
13
14#include "TGeoManager.h"
15#include "TGeoVolume.h"
16#include "TVirtualGeoPainter.h"
17#include "TGeoHype.h"
18#include "TBuffer3D.h"
19#include "TBuffer3DTypes.h"
20#include "TMath.h"
21
22/** \class TGeoHype
23\ingroup Shapes_classes
24
25A hyperboloid is represented as a solid limited by two planes
26perpendicular to the Z axis (top and bottom planes) and two hyperbolic
27surfaces of revolution about Z axis (inner and outer surfaces). The
28class describing hyperboloids is TGeoHype has 5 input parameters:
29
30~~~ {.cpp}
31TGeoHype(Double_t rin,Double_t stin,Double_t rout,
32Double_t stout,Double_t dz);
33~~~
34
35Begin_Macro
36{
37 TCanvas *c = new TCanvas("c", "c",0,0,600,600);
38 new TGeoManager("hype", "hyperboloid");
39 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
40 TGeoMedium *med = new TGeoMedium("MED",1,mat);
41 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
42 gGeoManager->SetTopVolume(top);
43 TGeoVolume *vol = gGeoManager->MakeHype("HYPE",med,10, 45 ,20,45,40);
44 TGeoHype *hype = (TGeoHype*)vol->GetShape();
45 top->AddNode(vol,1);
46 gGeoManager->CloseGeometry();
47 gGeoManager->SetNsegments(80);
48 top->Draw();
49 TView *view = gPad->GetView();
50 if (view) view->ShowAxis();
51}
52End_Macro
53
54The hyperbolic surface equation is taken in the form:
55
56~~~{.cpp}
57r^2 - z^2 * tan(st)^2 = rmin^2
58~~~
59
60- `r,z:` cylindrical coordinates for a point on the surface
61- `st:` stereo angle between the hyperbola asymptotic lines and Z axis
62- `rmin:` minimum distance between hyperbola and Z axis (at `z=0`)
63
64The input parameters for a hyperboloid represent:
65
66- `rin, stin:` minimum radius and stereo angle in degrees for the inner surface
67- `rout, stout:` minimum radius and stereo angle in degrees for the outer surface
68- `dz:` half length in Z (bounding planes positions at `+/-dz`)
69
70The following conditions are mandatory in order to avoid intersections
71between the inner and outer hyperbolic surfaces in the range `+/-dz`:
72
73- `rin < rout`
74- `rout > 0`
75- `rin^2 + dz^2 * tan(stin)^2 > rout^2 + dz^2 * tan(stout)^2`
76
77Particular cases:
78
79- `rin=0, stin0:` the inner surface is conical
80- `stin=0 / stout=0:` cylindrical surface(s)
81
82*/
83
84
85////////////////////////////////////////////////////////////////////////////////
86/// Default constructor
87
89{
91 fStIn = 0.;
92 fStOut = 0.;
93 fTin = 0.;
94 fTinsq = 0.;
95 fTout = 0.;
96 fToutsq = 0.;
97}
98
99////////////////////////////////////////////////////////////////////////////////
100/// Constructor specifying hyperboloid parameters.
101
103{
106 // dz<0 can be used to force dz of hyperboloid fit the container volume
107 if (fDz < 0)
109 ComputeBBox();
110}
111////////////////////////////////////////////////////////////////////////////////
112/// Constructor specifying parameters and name.
113
115 : TGeoTube(name, rin, rout, dz)
116{
119 // dz<0 can be used to force dz of hyperboloid fit the container volume
120 if (fDz < 0)
122 ComputeBBox();
123}
124
125////////////////////////////////////////////////////////////////////////////////
126/// Default constructor specifying a list of parameters
127/// - param[0] = dz
128/// - param[1] = rin
129/// - param[2] = stin
130/// - param[3] = rout
131/// - param[4] = stout
132
133TGeoHype::TGeoHype(Double_t *param) : TGeoTube(param[1], param[3], param[0])
134{
136 SetDimensions(param);
137 // dz<0 can be used to force dz of hyperboloid fit the container volume
138 if (fDz < 0)
140 ComputeBBox();
141}
142
143////////////////////////////////////////////////////////////////////////////////
144/// destructor
145
147
148////////////////////////////////////////////////////////////////////////////////
149/// Computes capacity of the shape in [length^3]
150
152{
153 Double_t capacity = 2. * TMath::Pi() * fDz * (fRmax * fRmax - fRmin * fRmin) +
154 (2. * TMath::Pi() / 3.) * fDz * fDz * fDz * (fToutsq - fTinsq);
155 return capacity;
156}
157
158////////////////////////////////////////////////////////////////////////////////
159/// Compute bounding box of the hyperboloid
160
162{
163 if (fRmin < 0.) {
164 Warning("ComputeBBox", "Shape %s has invalid rmin=%g ! SET TO 0.", GetName(), fRmin);
165 fRmin = 0.;
166 }
167 if ((fRmin > fRmax) || (fRmin * fRmin + fTinsq * fDz * fDz > fRmax * fRmax + fToutsq * fDz * fDz)) {
169 Error("ComputeBBox", "Shape %s hyperbolic surfaces are malformed: rin=%g, stin=%g, rout=%g, stout=%g", GetName(),
171 return;
172 }
173
175 fDZ = fDz;
176}
177
178////////////////////////////////////////////////////////////////////////////////
179/// Compute normal to closest surface from POINT.
180
181void TGeoHype::ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm) const
182{
183 Double_t saf[3];
184 Double_t rsq = point[0] * point[0] + point[1] * point[1];
186 Double_t rin = (HasInner()) ? (TMath::Sqrt(RadiusHypeSq(point[2], kTRUE))) : 0.;
188 saf[0] = TMath::Abs(fDz - TMath::Abs(point[2]));
189 saf[1] = (HasInner()) ? TMath::Abs(rin - r) : TGeoShape::Big();
190 saf[2] = TMath::Abs(rout - r);
191 Int_t i = TMath::LocMin(3, saf);
192 if (i == 0 || r < 1.E-10) {
193 norm[0] = norm[1] = 0.;
194 norm[2] = TMath::Sign(1., dir[2]);
195 return;
196 }
197 Double_t t = (i == 1) ? fTinsq : fToutsq;
198 ;
199 t *= -point[2] / r;
200 Double_t ct = TMath::Sqrt(1. / (1. + t * t));
201 Double_t st = t * ct;
202 Double_t phi = TMath::ATan2(point[1], point[0]);
203 Double_t cphi = TMath::Cos(phi);
204 Double_t sphi = TMath::Sin(phi);
205
206 norm[0] = ct * cphi;
207 norm[1] = ct * sphi;
208 norm[2] = st;
209 if (norm[0] * dir[0] + norm[1] * dir[1] + norm[2] * dir[2] < 0) {
210 norm[0] = -norm[0];
211 norm[1] = -norm[1];
212 norm[2] = -norm[2];
213 }
214}
215
216////////////////////////////////////////////////////////////////////////////////
217/// test if point is inside this tube
218
220{
221 if (TMath::Abs(point[2]) > fDz)
222 return kFALSE;
223 Double_t r2 = point[0] * point[0] + point[1] * point[1];
224 Double_t routsq = RadiusHypeSq(point[2], kFALSE);
225 if (r2 > routsq)
226 return kFALSE;
227 if (!HasInner())
228 return kTRUE;
229 Double_t rinsq = RadiusHypeSq(point[2], kTRUE);
230 if (r2 < rinsq)
231 return kFALSE;
232 return kTRUE;
233}
234
235////////////////////////////////////////////////////////////////////////////////
236/// compute closest distance from point px,py to each corner
237
239{
240 Int_t numPoints = GetNmeshVertices();
241 return ShapeDistancetoPrimitive(numPoints, px, py);
242}
243
244////////////////////////////////////////////////////////////////////////////////
245/// Compute distance from inside point to surface of the hyperboloid.
246
249{
250 if (iact < 3 && safe) {
251 *safe = Safety(point, kTRUE);
252 if (iact == 0)
253 return TGeoShape::Big();
254 if ((iact == 1) && (*safe > step))
255 return TGeoShape::Big();
256 }
257 // compute distance to surface
258 // Do Z
260 if (dir[2] > 0) {
261 sz = (fDz - point[2]) / dir[2];
262 if (sz <= 0.)
263 return 0.;
264 } else {
265 if (dir[2] < 0) {
266 sz = -(fDz + point[2]) / dir[2];
267 if (sz <= 0.)
268 return 0.;
269 }
270 }
271
272 // Do R
275 Double_t sr;
276 // inner and outer surfaces
277 Double_t s[2];
278 Int_t npos;
279 npos = DistToHype(point, dir, s, kTRUE, kTRUE);
280 if (npos)
281 srin = s[0];
282 npos = DistToHype(point, dir, s, kFALSE, kTRUE);
283 if (npos)
284 srout = s[0];
285 sr = TMath::Min(srin, srout);
286 return TMath::Min(sz, sr);
287}
288
289////////////////////////////////////////////////////////////////////////////////
290/// compute distance from outside point to surface of the hyperboloid.
291
294{
295 if (iact < 3 && safe) {
296 *safe = Safety(point, kFALSE);
297 if (iact == 0)
298 return TGeoShape::Big();
299 if ((iact == 1) && (step <= *safe))
300 return TGeoShape::Big();
301 }
302 // Check if the bounding box is crossed within the requested distance
303 Double_t sdist = TGeoBBox::DistFromOutside(point, dir, fDX, fDY, fDZ, fOrigin, step);
304 if (sdist >= step)
305 return TGeoShape::Big();
306 // find distance to shape
307 // Do Z
308 Double_t xi, yi, zi;
309 if (TMath::Abs(point[2]) >= fDz) {
310 // We might find Z plane crossing
311 if ((point[2] * dir[2]) < 0) {
312 // Compute distance to Z (always positive)
313 Double_t sz = (TMath::Abs(point[2]) - fDz) / TMath::Abs(dir[2]);
314 // Extrapolate
315 xi = point[0] + sz * dir[0];
316 yi = point[1] + sz * dir[1];
317 Double_t r2 = xi * xi + yi * yi;
319 if (r2 >= rmin2) {
321 if (r2 <= rmax2)
322 return sz;
323 }
324 }
325 }
326 // We do not cross Z planes.
327 Double_t sin = TGeoShape::Big();
329 Double_t s[2];
330 Int_t npos;
331 npos = DistToHype(point, dir, s, kTRUE, kFALSE);
332 if (npos) {
333 zi = point[2] + s[0] * dir[2];
334 if (TMath::Abs(zi) <= fDz)
335 sin = s[0];
336 else if (npos == 2) {
337 zi = point[2] + s[1] * dir[2];
338 if (TMath::Abs(zi) <= fDz)
339 sin = s[1];
340 }
341 }
342 npos = DistToHype(point, dir, s, kFALSE, kFALSE);
343 if (npos) {
344 zi = point[2] + s[0] * dir[2];
345 if (TMath::Abs(zi) <= fDz)
346 sout = s[0];
347 else if (npos == 2) {
348 zi = point[2] + s[1] * dir[2];
349 if (TMath::Abs(zi) <= fDz)
350 sout = s[1];
351 }
352 }
353 return TMath::Min(sin, sout);
354}
355
356////////////////////////////////////////////////////////////////////////////////
357/// Compute distance from an arbitrary point to inner/outer surface of hyperboloid.
358/// Returns number of positive solutions. S[2] contains the solutions.
359
361{
363 if (inner) {
364 if (!HasInner())
365 return 0;
366 r0 = fRmin;
367 t0 = fTinsq;
368 } else {
369 r0 = fRmax;
370 t0 = fToutsq;
371 }
372 Double_t a = dir[0] * dir[0] + dir[1] * dir[1] - t0 * dir[2] * dir[2];
373 Double_t b = t0 * point[2] * dir[2] - point[0] * dir[0] - point[1] * dir[1];
374 Double_t c = point[0] * point[0] + point[1] * point[1] - t0 * point[2] * point[2] - r0 * r0;
375
378 return 0;
379 snext = 0.5 * c / b;
380 if (snext < 0.)
381 return 0;
382 s[0] = snext;
383 return 1;
384 }
385
386 Double_t delta = b * b - a * c;
387 Double_t ainv = 1. / a;
388 Int_t npos = 0;
389 if (delta < 0.)
390 return 0;
391 delta = TMath::Sqrt(delta);
393 Int_t i = -1;
394 while (i < 2) {
395 snext = (b + i * sone * delta) * ainv;
396 i += 2;
397 if (snext < 0)
398 continue;
399 if (snext < 1.E-8) {
400 Double_t r = TMath::Sqrt(point[0] * point[0] + point[1] * point[1]);
401 Double_t t = (inner) ? fTinsq : fToutsq;
402 t *= -point[2] / r;
403 Double_t phi = TMath::ATan2(point[1], point[0]);
404 Double_t ndotd = TMath::Cos(phi) * dir[0] + TMath::Sin(phi) * dir[1] + t * dir[2];
405 if (inner)
406 ndotd *= -1;
407 if (in)
408 ndotd *= -1;
409 if (ndotd < 0)
410 s[npos++] = snext;
411 } else
412 s[npos++] = snext;
413 }
414 return npos;
415}
416
417////////////////////////////////////////////////////////////////////////////////
418/// Cannot divide hyperboloids.
419
420TGeoVolume *TGeoHype::Divide(TGeoVolume * /*voldiv*/, const char *divname, Int_t /*iaxis*/, Int_t /*ndiv*/,
421 Double_t /*start*/, Double_t /*step*/)
422{
423 Error("Divide", "Hyperboloids cannot be divided. Division volume %s not created", divname);
424 return nullptr;
425}
426
427////////////////////////////////////////////////////////////////////////////////
428/// Get range of shape for a given axis.
429
431{
432 xlo = 0;
433 xhi = 0;
434 Double_t dx = 0;
435 switch (iaxis) {
436 case 1: // R
437 xlo = fRmin;
439 dx = xhi - xlo;
440 return dx;
441 case 2: // Phi
442 xlo = 0;
443 xhi = 360;
444 dx = 360;
445 return dx;
446 case 3: // Z
447 xlo = -fDz;
448 xhi = fDz;
449 dx = xhi - xlo;
450 return dx;
451 }
452 return dx;
453}
454
455////////////////////////////////////////////////////////////////////////////////
456/// Fill vector param[4] with the bounding cylinder parameters. The order
457/// is the following : Rmin, Rmax, Phi1, Phi2, dZ
458
460{
461 param[0] = fRmin; // Rmin
462 param[0] *= param[0];
463 param[1] = TMath::Sqrt(RadiusHypeSq(fDz, kFALSE)); // Rmax
464 param[1] *= param[1];
465 param[2] = 0.; // Phi1
466 param[3] = 360.; // Phi2
467}
468
469////////////////////////////////////////////////////////////////////////////////
470/// in case shape has some negative parameters, these has to be computed
471/// in order to fit the mother
472
474{
476 return nullptr;
477 Double_t dz = fDz;
478 Double_t zmin, zmax;
479 if (fDz < 0) {
480 mother->GetAxisRange(3, zmin, zmax);
481 if (zmax < 0)
482 return nullptr;
483 dz = zmax;
484 } else {
485 Error("GetMakeRuntimeShape", "Shape %s does not have negative Z range", GetName());
486 return nullptr;
487 }
489 return hype;
490}
491
492////////////////////////////////////////////////////////////////////////////////
493/// print shape parameters
494
496{
497 printf("*** Shape %s: TGeoHype ***\n", GetName());
498 printf(" Rin = %11.5f\n", fRmin);
499 printf(" sin = %11.5f\n", fStIn);
500 printf(" Rout = %11.5f\n", fRmax);
501 printf(" sout = %11.5f\n", fStOut);
502 printf(" dz = %11.5f\n", fDz);
503
504 printf(" Bounding box:\n");
506}
507
508////////////////////////////////////////////////////////////////////////////////
509/// Creates a TBuffer3D describing *this* shape.
510/// Coordinates are in local reference frame.
511
513{
516 Int_t nbPnts = (hasRmin) ? (2 * n * n) : (n * n + 2);
517 Int_t nbSegs = (hasRmin) ? (4 * n * n) : (n * (2 * n + 1));
518 Int_t nbPols = (hasRmin) ? (2 * n * n) : (n * (n + 1));
519
520 TBuffer3D *buff =
522 if (buff) {
523 SetPoints(buff->fPnts);
525 }
526
527 return buff;
528}
529
530////////////////////////////////////////////////////////////////////////////////
531/// Fill TBuffer3D structure for segments and polygons.
532
534{
536 Int_t i, j, n;
539 Int_t irin = 0;
540 Int_t irout = (hasRmin) ? (n * n) : 2;
541 // Fill segments
542 // Case hasRmin:
543 // Inner circles: [isin = 0], n (per circle) * n ( circles)
544 // iseg = isin+n*i+j , i = 0, n-1 , j = 0, n-1
545 // seg(i=1,n; j=1,n) = [irin+n*i+j] and [irin+n*i+(j+1)%n]
546 // Inner generators: [isgenin = isin+n*n], n (per circle) *(n-1) (slices)
547 // iseg = isgenin + i*n + j, i=0,n-2, j=0,n-1
548 // seg(i,j) = [irin+n*i+j] and [irin+n*(i+1)+j]
549 // Outer circles: [isout = isgenin+n*(n-1)], n (per circle) * n ( circles)
550 // iseg = isout + i*n + j , iz = 0, n-1 , j = 0, n-1
551 // seg(i=1,n; j=1,n) = [irout+n*i+j] and [irout+n*i+(j+1)%n]
552 // Outer generators: [isgenout = isout+n*n], n (per circle) *(n-1) (slices)
553 // iseg = isgenout + i*n + j, i=0,n-2, j=0,n-1
554 // seg(i,j) = [irout+n*i+j] and [irout+n*(i+1)+j]
555 // Lower cap : [islow = isgenout + n*(n-1)], n radial segments
556 // iseg = islow + j, j=0,n-1
557 // seg(j) = [irin + j] and [irout+j]
558 // Upper cap: [ishi = islow + n], nradial segments
559 // iseg = ishi + j, j=0,n-1
560 // seg[j] = [irin + n*(n-1) + j] and [irout+n*(n-1) + j]
561 //
562 // Case !hasRmin:
563 // Outer circles: [isout=0], same outer circles (n*n)
564 // Outer generators: isgenout = isout + n*n
565 // Lower cap: [islow = isgenout+n*(n-1)], n seg.
566 // iseg = islow + j, j=0,n-1
567 // seg[j] = [irin] and [irout+j]
568 // Upper cap: [ishi = islow +n]
569 // iseg = ishi + j, j=0,n-1
570 // seg[j] = [irin+1] and [irout+n*(n-1) + j]
571
572 Int_t isin = 0;
573 Int_t isgenin = (hasRmin) ? (isin + n * n) : 0;
574 Int_t isout = (hasRmin) ? (isgenin + n * (n - 1)) : 0;
575 Int_t isgenout = isout + n * n;
576 Int_t islo = isgenout + n * (n - 1);
577 Int_t ishi = islo + n;
578
579 Int_t npt = 0;
580 // Fill inner circle segments (n*n)
581 if (hasRmin) {
582 for (i = 0; i < n; i++) {
583 for (j = 0; j < n; j++) {
584 npt = 3 * (isin + n * i + j);
585 buff.fSegs[npt] = c;
586 buff.fSegs[npt + 1] = irin + n * i + j;
587 buff.fSegs[npt + 2] = irin + n * i + ((j + 1) % n);
588 }
589 }
590 // Fill inner generators (n*(n-1))
591 for (i = 0; i < n - 1; i++) {
592 for (j = 0; j < n; j++) {
593 npt = 3 * (isgenin + n * i + j);
594 buff.fSegs[npt] = c;
595 buff.fSegs[npt + 1] = irin + n * i + j;
596 buff.fSegs[npt + 2] = irin + n * (i + 1) + j;
597 }
598 }
599 }
600 // Fill outer circle segments (n*n)
601 for (i = 0; i < n; i++) {
602 for (j = 0; j < n; j++) {
603 npt = 3 * (isout + n * i + j);
604 buff.fSegs[npt] = c;
605 buff.fSegs[npt + 1] = irout + n * i + j;
606 buff.fSegs[npt + 2] = irout + n * i + ((j + 1) % n);
607 }
608 }
609 // Fill outer generators (n*(n-1))
610 for (i = 0; i < n - 1; i++) {
611 for (j = 0; j < n; j++) {
612 npt = 3 * (isgenout + n * i + j);
613 buff.fSegs[npt] = c;
614 buff.fSegs[npt + 1] = irout + n * i + j;
615 buff.fSegs[npt + 2] = irout + n * (i + 1) + j;
616 }
617 }
618 // Fill lower cap (n)
619 for (j = 0; j < n; j++) {
620 npt = 3 * (islo + j);
621 buff.fSegs[npt] = c;
622 buff.fSegs[npt + 1] = irin;
623 if (hasRmin)
624 buff.fSegs[npt + 1] += j;
625 buff.fSegs[npt + 2] = irout + j;
626 }
627 // Fill upper cap (n)
628 for (j = 0; j < n; j++) {
629 npt = 3 * (ishi + j);
630 buff.fSegs[npt] = c;
631 buff.fSegs[npt + 1] = irin + 1;
632 if (hasRmin)
633 buff.fSegs[npt + 1] += n * (n - 1) + j - 1;
634 buff.fSegs[npt + 2] = irout + n * (n - 1) + j;
635 }
636
637 // Fill polygons
638 // Inner polygons: [ipin = 0] (n-1) slices * n (edges)
639 // ipoly = ipin + n*i + j; i=0,n-2 j=0,n-1
640 // poly[i,j] = [isin+n*i+j] [isgenin+i*n+(j+1)%n] [isin+n*(i+1)+j] [isgenin+i*n+j]
641 // Outer polygons: [ipout = ipin+n*(n-1)] also (n-1)*n
642 // ipoly = ipout + n*i + j; i=0,n-2 j=0,n-1
643 // poly[i,j] = [isout+n*i+j] [isgenout+i*n+j] [isout+n*(i+1)+j] [isgenout+i*n+(j+1)%n]
644 // Lower cap: [iplow = ipout+n*(n-1): n polygons
645 // ipoly = iplow + j; j=0,n-1
646 // poly[i=0,j] = [isin+j] [islow+j] [isout+j] [islow+(j+1)%n]
647 // Upper cap: [ipup = iplow+n] : n polygons
648 // ipoly = ipup + j; j=0,n-1
649 // poly[i=n-1, j] = [isin+n*(n-1)+j] [ishi+(j+1)%n] [isout+n*(n-1)+j] [ishi+j]
650 //
651 // Case !hasRmin:
652 // ipin = 0 no inner polygons
653 // ipout = 0 same outer polygons
654 // Lower cap: iplow = ipout+n*(n-1): n polygons with 3 segments
655 // poly[i=0,j] = [isout+j] [islow+(j+1)%n] [islow+j]
656 // Upper cap: ipup = iplow+n;
657 // poly[i=n-1,j] = [isout+n*(n-1)+j] [ishi+j] [ishi+(j+1)%n]
658
659 Int_t ipin = 0;
660 Int_t ipout = (hasRmin) ? (ipin + n * (n - 1)) : 0;
661 Int_t iplo = ipout + n * (n - 1);
662 Int_t ipup = iplo + n;
663 // Inner polygons n*(n-1)
664 if (hasRmin) {
665 for (i = 0; i < n - 1; i++) {
666 for (j = 0; j < n; j++) {
667 npt = 6 * (ipin + n * i + j);
668 buff.fPols[npt] = c;
669 buff.fPols[npt + 1] = 4;
670 buff.fPols[npt + 2] = isin + n * i + j;
671 buff.fPols[npt + 3] = isgenin + i * n + ((j + 1) % n);
672 buff.fPols[npt + 4] = isin + n * (i + 1) + j;
673 buff.fPols[npt + 5] = isgenin + i * n + j;
674 }
675 }
676 }
677 // Outer polygons n*(n-1)
678 for (i = 0; i < n - 1; i++) {
679 for (j = 0; j < n; j++) {
680 npt = 6 * (ipout + n * i + j);
681 buff.fPols[npt] = c;
682 buff.fPols[npt + 1] = 4;
683 buff.fPols[npt + 2] = isout + n * i + j;
684 buff.fPols[npt + 3] = isgenout + i * n + j;
685 buff.fPols[npt + 4] = isout + n * (i + 1) + j;
686 buff.fPols[npt + 5] = isgenout + i * n + ((j + 1) % n);
687 }
688 }
689 // End caps
690 if (hasRmin) {
691 for (j = 0; j < n; j++) {
692 npt = 6 * (iplo + j);
693 buff.fPols[npt] = c + 1;
694 buff.fPols[npt + 1] = 4;
695 buff.fPols[npt + 2] = isin + j;
696 buff.fPols[npt + 3] = islo + j;
697 buff.fPols[npt + 4] = isout + j;
698 buff.fPols[npt + 5] = islo + ((j + 1) % n);
699 }
700 for (j = 0; j < n; j++) {
701 npt = 6 * (ipup + j);
702 buff.fPols[npt] = c + 2;
703 buff.fPols[npt + 1] = 4;
704 buff.fPols[npt + 2] = isin + n * (n - 1) + j;
705 buff.fPols[npt + 3] = ishi + ((j + 1) % n);
706 buff.fPols[npt + 4] = isout + n * (n - 1) + j;
707 buff.fPols[npt + 5] = ishi + j;
708 }
709 } else {
710 for (j = 0; j < n; j++) {
711 npt = 6 * iplo + 5 * j;
712 buff.fPols[npt] = c + 1;
713 buff.fPols[npt + 1] = 3;
714 buff.fPols[npt + 2] = isout + j;
715 buff.fPols[npt + 3] = islo + ((j + 1) % n);
716 buff.fPols[npt + 4] = islo + j;
717 }
718 for (j = 0; j < n; j++) {
719 npt = 6 * iplo + 5 * (n + j);
720 buff.fPols[npt] = c + 2;
721 buff.fPols[npt + 1] = 3;
722 buff.fPols[npt + 2] = isout + n * (n - 1) + j;
723 buff.fPols[npt + 3] = ishi + j;
724 buff.fPols[npt + 4] = ishi + ((j + 1) % n);
725 }
726 }
727}
728
729////////////////////////////////////////////////////////////////////////////////
730/// Compute r^2 = x^2 + y^2 at a given z coordinate, for either inner or outer hyperbolas.
731
733{
734 Double_t r0, tsq;
735 if (inner) {
736 r0 = fRmin;
737 tsq = fTinsq;
738 } else {
739 r0 = fRmax;
740 tsq = fToutsq;
741 }
742 return (r0 * r0 + tsq * z * z);
743}
744
745////////////////////////////////////////////////////////////////////////////////
746/// Compute z^2 at a given r^2, for either inner or outer hyperbolas.
747
749{
750 Double_t r0, tsq;
751 if (inner) {
752 r0 = fRmin;
753 tsq = fTinsq;
754 } else {
755 r0 = fRmax;
756 tsq = fToutsq;
757 }
759 return TGeoShape::Big();
760 return ((r * r - r0 * r0) / tsq);
761}
762
763////////////////////////////////////////////////////////////////////////////////
764/// computes the closest distance from given point to this shape, according
765/// to option. The matching point on the shape is stored in spoint.
766
768{
770 if (in) {
771 safe = fDz - TMath::Abs(point[2]);
772 safrmin = SafetyToHype(point, kTRUE, in);
773 if (safrmin < safe)
774 safe = safrmin;
775 safrmax = SafetyToHype(point, kFALSE, in);
776 if (safrmax < safe)
777 safe = safrmax;
778 } else {
779 safe = -fDz + TMath::Abs(point[2]);
780 safrmin = SafetyToHype(point, kTRUE, in);
781 if (safrmin > safe)
782 safe = safrmin;
783 safrmax = SafetyToHype(point, kFALSE, in);
784 if (safrmax > safe)
785 safe = safrmax;
786 }
787 return safe;
788}
789
790////////////////////////////////////////////////////////////////////////////////
791/// Compute an underestimate of the closest distance from a point to inner or
792/// outer infinite hyperbolas.
793
795{
796 Double_t r, rsq, rhsq, rh, dr, tsq, saf;
797 if (inner && !HasInner())
798 return (in) ? TGeoShape::Big() : -TGeoShape::Big();
799 rsq = point[0] * point[0] + point[1] * point[1];
800 r = TMath::Sqrt(rsq);
801 rhsq = RadiusHypeSq(point[2], inner);
803 dr = r - rh;
804 if (inner) {
805 if (!in && dr > 0)
806 return -TGeoShape::Big();
808 return TMath::Abs(dr);
810 return TMath::Abs(dr / TMath::Sqrt(1. + fTinsq));
811 tsq = fTinsq;
812 } else {
813 if (!in && dr < 0)
814 return -TGeoShape::Big();
816 return TMath::Abs(dr);
817 tsq = fToutsq;
818 }
820 return 0.;
821 // 1. dr<0 => approximate safety with distance to tangent to hyperbola in z = |point[2]|
822 Double_t m;
823 if (dr < 0) {
824 m = rh / (tsq * TMath::Abs(point[2]));
825 saf = -m * dr / TMath::Sqrt(1. + m * m);
826 return saf;
827 }
828 // 2. dr>0 => approximate safety with distance from point to segment P1(r(z0),z0) and P2(r0, z(r0))
829 m = (TMath::Sqrt(ZHypeSq(r, inner)) - TMath::Abs(point[2])) / dr;
830 saf = m * dr / TMath::Sqrt(1. + m * m);
831 return saf;
832}
833
834////////////////////////////////////////////////////////////////////////////////
835/// Save a primitive as a C++ statement(s) on output stream "out".
836
837void TGeoHype::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
838{
840 return;
841 out << " // Shape: " << GetName() << " type: " << ClassName() << std::endl;
842 out << " rin = " << fRmin << ";" << std::endl;
843 out << " stin = " << fStIn << ";" << std::endl;
844 out << " rout = " << fRmax << ";" << std::endl;
845 out << " stout = " << fStOut << ";" << std::endl;
846 out << " dz = " << fDz << ";" << std::endl;
847 out << " TGeoShape *" << GetPointerName() << " = new TGeoHype(\"" << GetName() << "\",rin,stin,rout,stout,dz);"
848 << std::endl;
850}
851
852////////////////////////////////////////////////////////////////////////////////
853/// Set dimensions of the hyperboloid.
854
871
872////////////////////////////////////////////////////////////////////////////////
873/// Set dimensions of the hyperboloid starting from an array.
874/// - param[0] = dz
875/// - param[1] = rin
876/// - param[2] = stin
877/// - param[3] = rout
878/// - param[4] = stout
879
881{
882 Double_t dz = param[0];
883 Double_t rin = param[1];
884 Double_t stin = param[2];
885 Double_t rout = param[3];
886 Double_t stout = param[4];
888}
889
890////////////////////////////////////////////////////////////////////////////////
891/// create tube mesh points
892
894{
895 Double_t z, dz, r;
896 Int_t i, j, n;
897 if (!points)
898 return;
900 Double_t dphi = 360. / n;
901 Double_t phi = 0;
902 dz = 2. * fDz / (n - 1);
903
904 Int_t indx = 0;
905
906 if (HasInner()) {
907 // Inner surface points
908 for (i = 0; i < n; i++) {
909 z = -fDz + i * dz;
911 for (j = 0; j < n; j++) {
912 phi = j * dphi * TMath::DegToRad();
913 points[indx++] = r * TMath::Cos(phi);
914 points[indx++] = r * TMath::Sin(phi);
915 points[indx++] = z;
916 }
917 }
918 } else {
919 points[indx++] = 0.;
920 points[indx++] = 0.;
921 points[indx++] = -fDz;
922 points[indx++] = 0.;
923 points[indx++] = 0.;
924 points[indx++] = fDz;
925 }
926 // Outer surface points
927 for (i = 0; i < n; i++) {
928 z = -fDz + i * dz;
930 for (j = 0; j < n; j++) {
931 phi = j * dphi * TMath::DegToRad();
932 points[indx++] = r * TMath::Cos(phi);
933 points[indx++] = r * TMath::Sin(phi);
934 points[indx++] = z;
935 }
936 }
937}
938
939////////////////////////////////////////////////////////////////////////////////
940/// create tube mesh points
941
943{
944 Double_t z, dz, r;
945 Int_t i, j, n;
946 if (!points)
947 return;
949 Double_t dphi = 360. / n;
950 Double_t phi = 0;
951 dz = 2. * fDz / (n - 1);
952
953 Int_t indx = 0;
954
955 if (HasInner()) {
956 // Inner surface points
957 for (i = 0; i < n; i++) {
958 z = -fDz + i * dz;
960 for (j = 0; j < n; j++) {
961 phi = j * dphi * TMath::DegToRad();
962 points[indx++] = r * TMath::Cos(phi);
963 points[indx++] = r * TMath::Sin(phi);
964 points[indx++] = z;
965 }
966 }
967 } else {
968 points[indx++] = 0.;
969 points[indx++] = 0.;
970 points[indx++] = -fDz;
971 points[indx++] = 0.;
972 points[indx++] = 0.;
973 points[indx++] = fDz;
974 }
975 // Outer surface points
976 for (i = 0; i < n; i++) {
977 z = -fDz + i * dz;
979 for (j = 0; j < n; j++) {
980 phi = j * dphi * TMath::DegToRad();
981 points[indx++] = r * TMath::Cos(phi);
982 points[indx++] = r * TMath::Sin(phi);
983 points[indx++] = z;
984 }
985 }
986}
987
988////////////////////////////////////////////////////////////////////////////////
989/// Returns numbers of vertices, segments and polygons composing the shape mesh.
990
992{
995 nvert = (hasRmin) ? (2 * n * n) : (n * n + 2);
996 nsegs = (hasRmin) ? (4 * n * n) : (n * (2 * n + 1));
997 npols = (hasRmin) ? (2 * n * n) : (n * (n + 1));
998}
999
1000////////////////////////////////////////////////////////////////////////////////
1001/// Return number of vertices of the mesh representation
1002
1004{
1006 Int_t numPoints = (HasRmin()) ? (2 * n * n) : (n * n + 2);
1007 return numPoints;
1008}
1009
1010////////////////////////////////////////////////////////////////////////////////
1011/// fill size of this 3-D object
1012
1013void TGeoHype::Sizeof3D() const {}
1014
1015////////////////////////////////////////////////////////////////////////////////
1016/// Fills a static 3D buffer and returns a reference.
1017
1019{
1020 static TBuffer3D buffer(TBuffer3DTypes::kGeneric);
1021
1023
1027 Int_t nbPnts = (hasRmin) ? (2 * n * n) : (n * n + 2);
1028 Int_t nbSegs = (hasRmin) ? (4 * n * n) : (n * (2 * n + 1));
1029 Int_t nbPols = (hasRmin) ? (2 * n * n) : (n * (n + 1));
1030 if (buffer.SetRawSizes(nbPnts, 3 * nbPnts, nbSegs, 3 * nbSegs, nbPols, 6 * nbPols)) {
1032 }
1033 }
1035 SetPoints(buffer.fPnts);
1036 if (!buffer.fLocalFrame) {
1037 TransformPoints(buffer.fPnts, buffer.NbPnts());
1038 }
1039
1040 SetSegsAndPols(buffer);
1042 }
1043
1044 return buffer;
1045}
1046
1047////////////////////////////////////////////////////////////////////////////////
1048/// Check the inside status for each of the points in the array.
1049/// Input: Array of point coordinates + vector size
1050/// Output: Array of Booleans for the inside of each point
1051
1053{
1054 for (Int_t i = 0; i < vecsize; i++)
1055 inside[i] = Contains(&points[3 * i]);
1056}
1057
1058////////////////////////////////////////////////////////////////////////////////
1059/// Compute the normal for an array o points so that norm.dot.dir is positive
1060/// Input: Arrays of point coordinates and directions + vector size
1061/// Output: Array of normal directions
1062
1064{
1065 for (Int_t i = 0; i < vecsize; i++)
1066 ComputeNormal(&points[3 * i], &dirs[3 * i], &norms[3 * i]);
1067}
1068
1069////////////////////////////////////////////////////////////////////////////////
1070/// Compute distance from array of input points having directions specified by dirs. Store output in dists
1071
1073 Double_t *step) const
1074{
1075 for (Int_t i = 0; i < vecsize; i++)
1076 dists[i] = DistFromInside(&points[3 * i], &dirs[3 * i], 3, step[i]);
1077}
1078
1079////////////////////////////////////////////////////////////////////////////////
1080/// Compute distance from array of input points having directions specified by dirs. Store output in dists
1081
1083 Double_t *step) const
1084{
1085 for (Int_t i = 0; i < vecsize; i++)
1086 dists[i] = DistFromOutside(&points[3 * i], &dirs[3 * i], 3, step[i]);
1087}
1088
1089////////////////////////////////////////////////////////////////////////////////
1090/// Compute safe distance from each of the points in the input array.
1091/// Input: Array of point coordinates, array of statuses for these points, size of the arrays
1092/// Output: Safety values
1093
1095{
1096 for (Int_t i = 0; i < vecsize; i++)
1097 safe[i] = Safety(&points[3 * i], inside[i]);
1098}
#define b(i)
Definition RSha256.hxx:100
#define c(i)
Definition RSha256.hxx:101
#define a(i)
Definition RSha256.hxx:99
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:71
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:208
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Definition TError.cxx:252
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t points
char name[80]
Definition TGX11.cxx:110
R__EXTERN TGeoManager * gGeoManager
#define isin(address, start, length)
Generic 3D primitive description class.
Definition TBuffer3D.h:18
UInt_t NbPnts() const
Definition TBuffer3D.h:80
Bool_t SectionsValid(UInt_t mask) const
Definition TBuffer3D.h:67
void SetSectionsValid(UInt_t mask)
Definition TBuffer3D.h:65
Bool_t fLocalFrame
Definition TBuffer3D.h:90
Bool_t SetRawSizes(UInt_t reqPnts, UInt_t reqPntsCapacity, UInt_t reqSegs, UInt_t reqSegsCapacity, UInt_t reqPols, UInt_t reqPolsCapacity)
Set kRaw tessellation section of buffer with supplied sizes.
Double_t * fPnts
Definition TBuffer3D.h:113
void FillBuffer3D(TBuffer3D &buffer, Int_t reqSections, Bool_t localFrame) const override
Fills the supplied buffer, with sections in desired frame See TBuffer3D.h for explanation of sections...
Double_t fDX
Definition TGeoBBox.h:20
Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=nullptr) const override
Compute distance from outside point to surface of the box.
Definition TGeoBBox.cxx:432
Double_t fOrigin[3]
Definition TGeoBBox.h:23
void InspectShape() const override
Prints shape parameters.
Definition TGeoBBox.cxx:810
Double_t fDY
Definition TGeoBBox.h:21
Double_t fDZ
Definition TGeoBBox.h:22
Int_t GetNmeshVertices() const override
Return number of vertices of the mesh representation.
const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const override
Fills a static 3D buffer and returns a reference.
Double_t SafetyToHype(const Double_t *point, Bool_t inner, Bool_t in) const
Compute an underestimate of the closest distance from a point to inner or outer infinite hyperbolas.
Definition TGeoHype.cxx:794
TGeoShape * GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const override
in case shape has some negative parameters, these has to be computed in order to fit the mother
Definition TGeoHype.cxx:473
Double_t ZHypeSq(Double_t r, Bool_t inner) const
Compute z^2 at a given r^2, for either inner or outer hyperbolas.
Definition TGeoHype.cxx:748
~TGeoHype() override
destructor
Definition TGeoHype.cxx:146
void SetSegsAndPols(TBuffer3D &buff) const override
Fill TBuffer3D structure for segments and polygons.
Definition TGeoHype.cxx:533
void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const override
Compute distance from array of input points having directions specified by dirs. Store output in dist...
Double_t RadiusHypeSq(Double_t z, Bool_t inner) const
Compute r^2 = x^2 + y^2 at a given z coordinate, for either inner or outer hyperbolas.
Definition TGeoHype.cxx:732
TGeoVolume * Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step) override
Cannot divide hyperboloids.
Definition TGeoHype.cxx:420
Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const override
computes the closest distance from given point to this shape, according to option.
Definition TGeoHype.cxx:767
void ComputeBBox() override
Compute bounding box of the hyperboloid.
Definition TGeoHype.cxx:161
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
Definition TGeoHype.cxx:837
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
compute closest distance from point px,py to each corner
Definition TGeoHype.cxx:238
Double_t Capacity() const override
Computes capacity of the shape in [length^3].
Definition TGeoHype.cxx:151
void Sizeof3D() const override
fill size of this 3-D object
Int_t DistToHype(const Double_t *point, const Double_t *dir, Double_t *s, Bool_t inner, Bool_t in) const
Compute distance from an arbitrary point to inner/outer surface of hyperboloid.
Definition TGeoHype.cxx:360
void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize) override
Compute the normal for an array o points so that norm.dot.dir is positive Input: Arrays of point coor...
void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const override
Compute safe distance from each of the points in the input array.
void SetDimensions(Double_t *param) override
Set dimensions of the hyperboloid starting from an array.
Definition TGeoHype.cxx:880
void SetPoints(Double_t *points) const override
create tube mesh points
Definition TGeoHype.cxx:893
TGeoHype()
Default constructor.
Definition TGeoHype.cxx:88
Double_t fStIn
Definition TGeoHype.h:23
Double_t fToutsq
Definition TGeoHype.h:31
Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=nullptr) const override
Compute distance from inside point to surface of the hyperboloid.
Definition TGeoHype.cxx:248
void GetBoundingCylinder(Double_t *param) const override
Fill vector param[4] with the bounding cylinder parameters.
Definition TGeoHype.cxx:459
void SetHypeDimensions(Double_t rin, Double_t stin, Double_t rout, Double_t stout, Double_t dz)
Set dimensions of the hyperboloid.
Definition TGeoHype.cxx:855
Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=nullptr) const override
compute distance from outside point to surface of the hyperboloid.
Definition TGeoHype.cxx:293
void InspectShape() const override
print shape parameters
Definition TGeoHype.cxx:495
Double_t fStOut
Definition TGeoHype.h:24
Bool_t Contains(const Double_t *point) const override
test if point is inside this tube
Definition TGeoHype.cxx:219
Double_t fTinsq
Definition TGeoHype.h:30
void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm) const override
Compute normal to closest surface from POINT.
Definition TGeoHype.cxx:181
void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const override
Returns numbers of vertices, segments and polygons composing the shape mesh.
Definition TGeoHype.cxx:991
Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const override
Get range of shape for a given axis.
Definition TGeoHype.cxx:430
TBuffer3D * MakeBuffer3D() const override
Creates a TBuffer3D describing this shape.
Definition TGeoHype.cxx:512
Double_t fTout
Definition TGeoHype.h:29
Double_t fTin
Definition TGeoHype.h:28
void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const override
Compute distance from array of input points having directions specified by dirs. Store output in dist...
Bool_t HasInner() const
Definition TGeoHype.h:74
void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const override
Check the inside status for each of the points in the array.
Int_t GetNsegments() const
Get number of segments approximating circles.
Geometrical transformation package.
Definition TGeoMatrix.h:38
Base abstract class for all shapes.
Definition TGeoShape.h:25
static Double_t Big()
Definition TGeoShape.h:94
Int_t GetBasicColor() const
Get the basic color (0-7).
void TransformPoints(Double_t *points, UInt_t NbPoints) const
Tranform a set of points (LocalToMaster)
void SetShapeBit(UInt_t f, Bool_t set)
Equivalent of TObject::SetBit.
const char * GetPointerName() const
Provide a pointer name containing uid.
Int_t ShapeDistancetoPrimitive(Int_t numpoints, Int_t px, Int_t py) const
Returns distance to shape primitive mesh.
const char * GetName() const override
Get the shape name.
@ kGeoSavePrimitive
Definition TGeoShape.h:64
@ kGeoInvalidShape
Definition TGeoShape.h:41
@ kGeoRunTimeShape
Definition TGeoShape.h:40
static Double_t Tolerance()
Definition TGeoShape.h:97
Bool_t TestShapeBit(UInt_t f) const
Definition TGeoShape.h:175
Cylindrical tube class.
Definition TGeoTube.h:17
Double_t fRmin
Definition TGeoTube.h:20
Double_t fDz
Definition TGeoTube.h:22
Double_t fRmax
Definition TGeoTube.h:21
Bool_t HasRmin() const
Definition TGeoTube.h:75
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition TGeoVolume.h:43
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition TObject.h:202
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition TObject.cxx:226
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:864
const Int_t n
Definition legend1.C:16
Long64_t LocMin(Long64_t n, const T *a)
Returns index of array with the minimum element.
Definition TMath.h:993
T1 Sign(T1 a, T2 b)
Returns a value with the magnitude of a and the sign of b.
Definition TMathBase.h:176
Double_t ATan2(Double_t y, Double_t x)
Returns the principal value of the arc tangent of y/x, expressed in radians.
Definition TMath.h:657
constexpr Double_t DegToRad()
Conversion from degree to radian: .
Definition TMath.h:82
Double_t Sqrt(Double_t x)
Returns the square root of x.
Definition TMath.h:673
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Definition TMathBase.h:199
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Definition TMath.h:605
constexpr Double_t Pi()
Definition TMath.h:40
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
Definition TMath.h:599
Double_t Tan(Double_t)
Returns the tangent of an angle of x radians.
Definition TMath.h:611
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Definition TMathBase.h:124
TMarker m
Definition textangle.C:8