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