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  Double_t sz = TGeoShape::Big();
272  if (TMath::Abs(point[2])>=fDz) {
273  // We might find Z plane crossing
274  if ((point[2]*dir[2]) < 0) {
275  // Compute distance to Z (always positive)
276  sz = (TMath::Abs(point[2])-fDz)/TMath::Abs(dir[2]);
277  // Extrapolate
278  xi = point[0]+sz*dir[0];
279  yi = point[1]+sz*dir[1];
280  Double_t r2 = xi*xi + yi*yi;
281  Double_t rmin2 = RadiusHypeSq(fDz, kTRUE);
282  if (r2 >= rmin2) {
283  Double_t rmax2 = RadiusHypeSq(fDz, kFALSE);
284  if (r2 <= rmax2) return sz;
285  }
286  }
287  }
288  // We do not cross Z planes.
290  Double_t sout = TGeoShape::Big();
291  Double_t s[2];
292  Int_t npos;
293  npos = DistToHype(point, dir, s, kTRUE, kFALSE);
294  if (npos) {
295  zi = point[2] + s[0]*dir[2];
296  if (TMath::Abs(zi) <= fDz) sin = s[0];
297  else if (npos==2) {
298  zi = point[2] + s[1]*dir[2];
299  if (TMath::Abs(zi) <= fDz) sin = s[1];
300  }
301  }
302  npos = DistToHype(point, dir, s, kFALSE, kFALSE);
303  if (npos) {
304  zi = point[2] + s[0]*dir[2];
305  if (TMath::Abs(zi) <= fDz) sout = s[0];
306  else if (npos==2) {
307  zi = point[2] + s[1]*dir[2];
308  if (TMath::Abs(zi) <= fDz) sout = s[1];
309  }
310  }
311  return TMath::Min(sin, sout);
312 }
313 
314 ////////////////////////////////////////////////////////////////////////////////
315 /// Compute distance from an arbitrary point to inner/outer surface of hyperboloid.
316 /// Returns number of positive solutions. S[2] contains the solutions.
317 
318 Int_t TGeoHype::DistToHype(const Double_t *point, const Double_t *dir, Double_t *s, Bool_t inner, Bool_t in) const
319 {
320  Double_t r0, t0, snext;
321  if (inner) {
322  if (!HasInner()) return 0;
323  r0 = fRmin;
324  t0 = fTinsq;
325  } else {
326  r0 = fRmax;
327  t0 = fToutsq;
328  }
329  Double_t a = dir[0]*dir[0] + dir[1]*dir[1] - t0*dir[2]*dir[2];
330  Double_t b = t0*point[2]*dir[2] - point[0]*dir[0] - point[1]*dir[1];
331  Double_t c = point[0]*point[0] + point[1]*point[1] - t0*point[2]*point[2] - r0*r0;
332 
333  if (TMath::Abs(a) < TGeoShape::Tolerance()) {
334  if (TMath::Abs(b) < TGeoShape::Tolerance()) return 0;
335  snext = 0.5*c/b;
336  if (snext < 0.) return 0;
337  s[0] = snext;
338  return 1;
339  }
340 
341  Double_t delta = b*b - a*c;
342  Double_t ainv = 1./a;
343  Int_t npos = 0;
344  if (delta < 0.) return 0;
345  delta = TMath::Sqrt(delta);
346  Double_t sone = TMath::Sign(1.,ainv);
347  Int_t i = -1;
348  while (i<2) {
349  snext = (b + i*sone*delta)*ainv;
350  i += 2;
351  if (snext<0) continue;
352  if (snext<1.E-8) {
353  Double_t r = TMath::Sqrt(point[0]*point[0]+point[1]*point[1]);
354  Double_t t = (inner)?fTinsq:fToutsq;
355  t *= -point[2]/r;
356  Double_t phi = TMath::ATan2(point[1], point[0]);
357  Double_t ndotd = TMath::Cos(phi)*dir[0]+TMath::Sin(phi)*dir[1]+t*dir[2];
358  if (inner) ndotd *= -1;
359  if (in) ndotd *= -1;
360  if (ndotd<0) s[npos++] = snext;
361  } else s[npos++] = snext;
362  }
363  return npos;
364 }
365 
366 ////////////////////////////////////////////////////////////////////////////////
367 /// Cannot divide hyperboloids.
368 
369 TGeoVolume *TGeoHype::Divide(TGeoVolume * /*voldiv*/, const char *divname, Int_t /*iaxis*/, Int_t /*ndiv*/,
370  Double_t /*start*/, Double_t /*step*/)
371 {
372  Error("Divide", "Hyperboloids cannot be divided. Division volume %s not created", divname);
373  return 0;
374 }
375 
376 ////////////////////////////////////////////////////////////////////////////////
377 /// Get range of shape for a given axis.
378 
380 {
381  xlo = 0;
382  xhi = 0;
383  Double_t dx = 0;
384  switch (iaxis) {
385  case 1: // R
386  xlo = fRmin;
388  dx = xhi-xlo;
389  return dx;
390  case 2: // Phi
391  xlo = 0;
392  xhi = 360;
393  dx = 360;
394  return dx;
395  case 3: // Z
396  xlo = -fDz;
397  xhi = fDz;
398  dx = xhi-xlo;
399  return dx;
400  }
401  return dx;
402 }
403 
404 ////////////////////////////////////////////////////////////////////////////////
405 /// Fill vector param[4] with the bounding cylinder parameters. The order
406 /// is the following : Rmin, Rmax, Phi1, Phi2, dZ
407 
409 {
410  param[0] = fRmin; // Rmin
411  param[0] *= param[0];
412  param[1] = TMath::Sqrt(RadiusHypeSq(fDz, kFALSE)); // Rmax
413  param[1] *= param[1];
414  param[2] = 0.; // Phi1
415  param[3] = 360.; // Phi2
416 }
417 
418 ////////////////////////////////////////////////////////////////////////////////
419 /// in case shape has some negative parameters, these has to be computed
420 /// in order to fit the mother
421 
423 {
424  if (!TestShapeBit(kGeoRunTimeShape)) return 0;
425  Double_t dz;
426  Double_t zmin,zmax;
427  dz = fDz;
428  if (fDz<0) {
429  mother->GetAxisRange(3,zmin,zmax);
430  if (zmax<0) return 0;
431  dz=zmax;
432  } else {
433  Error("GetMakeRuntimeShape", "Shape %s does not have negative Z range", GetName());
434  return 0;
435  }
436  TGeoShape *hype = new TGeoHype(GetName(), dz, fRmax, fStOut, fRmin, fStIn);
437  return hype;
438 }
439 
440 ////////////////////////////////////////////////////////////////////////////////
441 /// print shape parameters
442 
444 {
445  printf("*** Shape %s: TGeoHype ***\n", GetName());
446  printf(" Rin = %11.5f\n", fRmin);
447  printf(" sin = %11.5f\n", fStIn);
448  printf(" Rout = %11.5f\n", fRmax);
449  printf(" sout = %11.5f\n", fStOut);
450  printf(" dz = %11.5f\n", fDz);
451 
452  printf(" Bounding box:\n");
454 }
455 
456 ////////////////////////////////////////////////////////////////////////////////
457 /// Creates a TBuffer3D describing *this* shape.
458 /// Coordinates are in local reference frame.
459 
461 {
463  Bool_t hasRmin = HasInner();
464  Int_t nbPnts = (hasRmin)?(2*n*n):(n*n+2);
465  Int_t nbSegs = (hasRmin)?(4*n*n):(n*(2*n+1));
466  Int_t nbPols = (hasRmin)?(2*n*n):(n*(n+1));
467 
469  nbPnts, 3*nbPnts, nbSegs, 3*nbSegs, nbPols, 6*nbPols);
470  if (buff)
471  {
472  SetPoints(buff->fPnts);
473  SetSegsAndPols(*buff);
474  }
475 
476  return buff;
477 }
478 
479 ////////////////////////////////////////////////////////////////////////////////
480 /// Fill TBuffer3D structure for segments and polygons.
481 
483 {
484  Int_t c = GetBasicColor();
485  Int_t i, j, n;
487  Bool_t hasRmin = HasInner();
488  Int_t irin = 0;
489  Int_t irout = (hasRmin)?(n*n):2;
490  // Fill segments
491  // Case hasRmin:
492  // Inner circles: [isin = 0], n (per circle) * n ( circles)
493  // iseg = isin+n*i+j , i = 0, n-1 , j = 0, n-1
494  // seg(i=1,n; j=1,n) = [irin+n*i+j] and [irin+n*i+(j+1)%n]
495  // Inner generators: [isgenin = isin+n*n], n (per circle) *(n-1) (slices)
496  // iseg = isgenin + i*n + j, i=0,n-2, j=0,n-1
497  // seg(i,j) = [irin+n*i+j] and [irin+n*(i+1)+j]
498  // Outer circles: [isout = isgenin+n*(n-1)], n (per circle) * n ( circles)
499  // iseg = isout + i*n + j , iz = 0, n-1 , j = 0, n-1
500  // seg(i=1,n; j=1,n) = [irout+n*i+j] and [irout+n*i+(j+1)%n]
501  // Outer generators: [isgenout = isout+n*n], n (per circle) *(n-1) (slices)
502  // iseg = isgenout + i*n + j, i=0,n-2, j=0,n-1
503  // seg(i,j) = [irout+n*i+j] and [irout+n*(i+1)+j]
504  // Lower cap : [islow = isgenout + n*(n-1)], n radial segments
505  // iseg = islow + j, j=0,n-1
506  // seg(j) = [irin + j] and [irout+j]
507  // Upper cap: [ishi = islow + n], nradial segments
508  // iseg = ishi + j, j=0,n-1
509  // seg[j] = [irin + n*(n-1) + j] and [irout+n*(n-1) + j]
510  //
511  // Case !hasRmin:
512  // Outer circles: [isout=0], same outer circles (n*n)
513  // Outer generators: isgenout = isout + n*n
514  // Lower cap: [islow = isgenout+n*(n-1)], n seg.
515  // iseg = islow + j, j=0,n-1
516  // seg[j] = [irin] and [irout+j]
517  // Upper cap: [ishi = islow +n]
518  // iseg = ishi + j, j=0,n-1
519  // seg[j] = [irin+1] and [irout+n*(n-1) + j]
520 
521  Int_t isin = 0;
522  Int_t isgenin = (hasRmin)?(isin+n*n):0;
523  Int_t isout = (hasRmin)?(isgenin+n*(n-1)):0;
524  Int_t isgenout = isout+n*n;
525  Int_t islo = isgenout+n*(n-1);
526  Int_t ishi = islo + n;
527 
528  Int_t npt = 0;
529  // Fill inner circle segments (n*n)
530  if (hasRmin) {
531  for (i=0; i<n; i++) {
532  for (j=0; j<n; j++) {
533  npt = 3*(isin+n*i+j);
534  buff.fSegs[npt] = c;
535  buff.fSegs[npt+1] = irin+n*i+j;
536  buff.fSegs[npt+2] = irin+n*i+((j+1)%n);
537  }
538  }
539  // Fill inner generators (n*(n-1))
540  for (i=0; i<n-1; i++) {
541  for (j=0; j<n; j++) {
542  npt = 3*(isgenin+n*i+j);
543  buff.fSegs[npt] = c;
544  buff.fSegs[npt+1] = irin+n*i+j;
545  buff.fSegs[npt+2] = irin+n*(i+1)+j;
546  }
547  }
548  }
549  // Fill outer circle segments (n*n)
550  for (i=0; i<n; i++) {
551  for (j=0; j<n; j++) {
552  npt = 3*(isout + n*i+j);
553  buff.fSegs[npt] = c;
554  buff.fSegs[npt+1] = irout+n*i+j;
555  buff.fSegs[npt+2] = irout+n*i+((j+1)%n);
556  }
557  }
558  // Fill outer generators (n*(n-1))
559  for (i=0; i<n-1; i++) {
560  for (j=0; j<n; j++) {
561  npt = 3*(isgenout+n*i+j);
562  buff.fSegs[npt] = c;
563  buff.fSegs[npt+1] = irout+n*i+j;
564  buff.fSegs[npt+2] = irout+n*(i+1)+j;
565  }
566  }
567  // Fill lower cap (n)
568  for (j=0; j<n; j++) {
569  npt = 3*(islo+j);
570  buff.fSegs[npt] = c;
571  buff.fSegs[npt+1] = irin;
572  if (hasRmin) buff.fSegs[npt+1] += j;
573  buff.fSegs[npt+2] = irout + j;
574  }
575  // Fill upper cap (n)
576  for (j=0; j<n; j++) {
577  npt = 3*(ishi+j);
578  buff.fSegs[npt] = c;
579  buff.fSegs[npt+1] = irin+1;
580  if (hasRmin) buff.fSegs[npt+1] += n*(n-1)+j-1;
581  buff.fSegs[npt+2] = irout + n*(n-1)+j;
582  }
583 
584  // Fill polygons
585  // Inner polygons: [ipin = 0] (n-1) slices * n (edges)
586  // ipoly = ipin + n*i + j; i=0,n-2 j=0,n-1
587  // poly[i,j] = [isin+n*i+j] [isgenin+i*n+(j+1)%n] [isin+n*(i+1)+j] [isgenin+i*n+j]
588  // Outer polygons: [ipout = ipin+n*(n-1)] also (n-1)*n
589  // ipoly = ipout + n*i + j; i=0,n-2 j=0,n-1
590  // poly[i,j] = [isout+n*i+j] [isgenout+i*n+j] [isout+n*(i+1)+j] [isgenout+i*n+(j+1)%n]
591  // Lower cap: [iplow = ipout+n*(n-1): n polygons
592  // ipoly = iplow + j; j=0,n-1
593  // poly[i=0,j] = [isin+j] [islow+j] [isout+j] [islow+(j+1)%n]
594  // Upper cap: [ipup = iplow+n] : n polygons
595  // ipoly = ipup + j; j=0,n-1
596  // poly[i=n-1, j] = [isin+n*(n-1)+j] [ishi+(j+1)%n] [isout+n*(n-1)+j] [ishi+j]
597  //
598  // Case !hasRmin:
599  // ipin = 0 no inner polygons
600  // ipout = 0 same outer polygons
601  // Lower cap: iplow = ipout+n*(n-1): n polygons with 3 segments
602  // poly[i=0,j] = [isout+j] [islow+(j+1)%n] [islow+j]
603  // Upper cap: ipup = iplow+n;
604  // poly[i=n-1,j] = [isout+n*(n-1)+j] [ishi+j] [ishi+(j+1)%n]
605 
606  Int_t ipin = 0;
607  Int_t ipout = (hasRmin)?(ipin+n*(n-1)):0;
608  Int_t iplo = ipout+n*(n-1);
609  Int_t ipup = iplo+n;
610  // Inner polygons n*(n-1)
611  if (hasRmin) {
612  for (i=0; i<n-1; i++) {
613  for (j=0; j<n; j++) {
614  npt = 6*(ipin+n*i+j);
615  buff.fPols[npt] = c;
616  buff.fPols[npt+1] = 4;
617  buff.fPols[npt+2] = isin+n*i+j;
618  buff.fPols[npt+3] = isgenin+i*n+((j+1)%n);
619  buff.fPols[npt+4] = isin+n*(i+1)+j;
620  buff.fPols[npt+5] = isgenin+i*n+j;
621  }
622  }
623  }
624  // Outer polygons n*(n-1)
625  for (i=0; i<n-1; i++) {
626  for (j=0; j<n; j++) {
627  npt = 6*(ipout+n*i+j);
628  buff.fPols[npt] = c;
629  buff.fPols[npt+1] = 4;
630  buff.fPols[npt+2] = isout+n*i+j;
631  buff.fPols[npt+3] = isgenout+i*n+j;
632  buff.fPols[npt+4] = isout+n*(i+1)+j;
633  buff.fPols[npt+5] = isgenout+i*n+((j+1)%n);
634  }
635  }
636  // End caps
637  if (hasRmin) {
638  for (j=0; j<n; j++) {
639  npt = 6*(iplo+j);
640  buff.fPols[npt] = c+1;
641  buff.fPols[npt+1] = 4;
642  buff.fPols[npt+2] = isin+j;
643  buff.fPols[npt+3] = islo+j;
644  buff.fPols[npt+4] = isout+j;
645  buff.fPols[npt+5] = islo+((j+1)%n);
646  }
647  for (j=0; j<n; j++) {
648  npt = 6*(ipup+j);
649  buff.fPols[npt] = c+2;
650  buff.fPols[npt+1] = 4;
651  buff.fPols[npt+2] = isin+n*(n-1)+j;
652  buff.fPols[npt+3] = ishi+((j+1)%n);
653  buff.fPols[npt+4] = isout+n*(n-1)+j;
654  buff.fPols[npt+5] = ishi+j;
655  }
656  } else {
657  for (j=0; j<n; j++) {
658  npt = 6*iplo+5*j;
659  buff.fPols[npt] = c+1;
660  buff.fPols[npt+1] = 3;
661  buff.fPols[npt+2] = isout+j;
662  buff.fPols[npt+3] = islo+((j+1)%n);
663  buff.fPols[npt+4] = islo+j;
664  }
665  for (j=0; j<n; j++) {
666  npt = 6*iplo+5*(n+j);
667  buff.fPols[npt] = c+2;
668  buff.fPols[npt+1] = 3;
669  buff.fPols[npt+2] = isout+n*(n-1)+j;
670  buff.fPols[npt+3] = ishi+j;
671  buff.fPols[npt+4] = ishi+((j+1)%n);
672  }
673  }
674 }
675 
676 ////////////////////////////////////////////////////////////////////////////////
677 /// Compute r^2 = x^2 + y^2 at a given z coordinate, for either inner or outer hyperbolas.
678 
680 {
681  Double_t r0, tsq;
682  if (inner) {
683  r0 = fRmin;
684  tsq = fTinsq;
685  } else {
686  r0 = fRmax;
687  tsq = fToutsq;
688  }
689  return (r0*r0+tsq*z*z);
690 }
691 
692 ////////////////////////////////////////////////////////////////////////////////
693 /// Compute z^2 at a given r^2, for either inner or outer hyperbolas.
694 
696 {
697  Double_t r0, tsq;
698  if (inner) {
699  r0 = fRmin;
700  tsq = fTinsq;
701  } else {
702  r0 = fRmax;
703  tsq = fToutsq;
704  }
705  if (TMath::Abs(tsq) < TGeoShape::Tolerance()) return TGeoShape::Big();
706  return ((r*r-r0*r0)/tsq);
707 }
708 
709 ////////////////////////////////////////////////////////////////////////////////
710 /// computes the closest distance from given point to this shape, according
711 /// to option. The matching point on the shape is stored in spoint.
712 
713 Double_t TGeoHype::Safety(const Double_t *point, Bool_t in) const
714 {
715  Double_t safe, safrmin, safrmax;
716  if (in) {
717  safe = fDz-TMath::Abs(point[2]);
718  safrmin = SafetyToHype(point, kTRUE, in);
719  if (safrmin < safe) safe = safrmin;
720  safrmax = SafetyToHype(point, kFALSE,in);
721  if (safrmax < safe) safe = safrmax;
722  } else {
723  safe = -fDz+TMath::Abs(point[2]);
724  safrmin = SafetyToHype(point, kTRUE, in);
725  if (safrmin > safe) safe = safrmin;
726  safrmax = SafetyToHype(point, kFALSE,in);
727  if (safrmax > safe) safe = safrmax;
728  }
729  return safe;
730 }
731 
732 ////////////////////////////////////////////////////////////////////////////////
733 /// Compute an underestimate of the closest distance from a point to inner or
734 /// outer infinite hyperbolas.
735 
736 Double_t TGeoHype::SafetyToHype(const Double_t *point, Bool_t inner, Bool_t in) const
737 {
738  Double_t r, rsq, rhsq, rh, dr, tsq, saf;
739  if (inner && !HasInner()) return (in)?TGeoShape::Big():-TGeoShape::Big();
740  rsq = point[0]*point[0]+point[1]*point[1];
741  r = TMath::Sqrt(rsq);
742  rhsq = RadiusHypeSq(point[2], inner);
743  rh = TMath::Sqrt(rhsq);
744  dr = r - rh;
745  if (inner) {
746  if (!in && dr>0) return -TGeoShape::Big();
747  if (TMath::Abs(fStIn) < TGeoShape::Tolerance()) return TMath::Abs(dr);
748  if (fRmin<TGeoShape::Tolerance()) return TMath::Abs(dr/TMath::Sqrt(1.+ fTinsq));
749  tsq = fTinsq;
750  } else {
751  if (!in && dr<0) return -TGeoShape::Big();
752  if (TMath::Abs(fStOut) < TGeoShape::Tolerance()) return TMath::Abs(dr);
753  tsq = fToutsq;
754  }
755  if (TMath::Abs(dr)<TGeoShape::Tolerance()) return 0.;
756  // 1. dr<0 => approximate safety with distance to tangent to hyperbola in z = |point[2]|
757  Double_t m;
758  if (dr<0) {
759  m = rh/(tsq*TMath::Abs(point[2]));
760  saf = -m*dr/TMath::Sqrt(1.+m*m);
761  return saf;
762  }
763  // 2. dr>0 => approximate safety with distance from point to segment P1(r(z0),z0) and P2(r0, z(r0))
764  m = (TMath::Sqrt(ZHypeSq(r,inner)) - TMath::Abs(point[2]))/dr;
765  saf = m*dr/TMath::Sqrt(1.+m*m);
766  return saf;
767 }
768 
769 ////////////////////////////////////////////////////////////////////////////////
770 /// Save a primitive as a C++ statement(s) on output stream "out".
771 
772 void TGeoHype::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
773 {
774  if (TObject::TestBit(kGeoSavePrimitive)) return;
775  out << " // Shape: " << GetName() << " type: " << ClassName() << std::endl;
776  out << " rin = " << fRmin << ";" << std::endl;
777  out << " stin = " << fStIn << ";" << std::endl;
778  out << " rout = " << fRmax << ";" << std::endl;
779  out << " stout = " << fStOut << ";" << std::endl;
780  out << " dz = " << fDz << ";" << std::endl;
781  out << " TGeoShape *" << GetPointerName() << " = new TGeoHype(\"" << GetName() << "\",rin,stin,rout,stout,dz);" << std::endl;
783 }
784 
785 ////////////////////////////////////////////////////////////////////////////////
786 /// Set dimensions of the hyperboloid.
787 
789 {
790  fRmin = rin;
791  fRmax = rout;
792  fDz = dz;
793  fStIn = stin;
794  fStOut = stout;
796  fTinsq = fTin*fTin;
798  fToutsq = fTout*fTout;
799  if ((fRmin==0) && (fStIn==0)) SetShapeBit(kGeoRSeg, kTRUE);
800  else SetShapeBit(kGeoRSeg, kFALSE);
801 }
802 
803 ////////////////////////////////////////////////////////////////////////////////
804 /// Set dimensions of the hyperboloid starting from an array.
805 /// - param[0] = dz
806 /// - param[1] = rin
807 /// - param[2] = stin
808 /// - param[3] = rout
809 /// - param[4] = stout
810 
812 {
813  Double_t dz = param[0];
814  Double_t rin = param[1];
815  Double_t stin = param[2];
816  Double_t rout = param[3];
817  Double_t stout = param[4];
818  SetHypeDimensions(rin, stin, rout, stout, dz);
819 }
820 
821 ////////////////////////////////////////////////////////////////////////////////
822 /// create tube mesh points
823 
825 {
826  Double_t z,dz,r;
827  Int_t i,j, n;
828  if (!points) return;
830  Double_t dphi = 360./n;
831  Double_t phi = 0;
832  dz = 2.*fDz/(n-1);
833 
834  Int_t indx = 0;
835 
836  if (HasInner()) {
837  // Inner surface points
838  for (i=0; i<n; i++) {
839  z = -fDz+i*dz;
841  for (j=0; j<n; j++) {
842  phi = j*dphi*TMath::DegToRad();
843  points[indx++] = r * TMath::Cos(phi);
844  points[indx++] = r * TMath::Sin(phi);
845  points[indx++] = z;
846  }
847  }
848  } else {
849  points[indx++] = 0.;
850  points[indx++] = 0.;
851  points[indx++] = -fDz;
852  points[indx++] = 0.;
853  points[indx++] = 0.;
854  points[indx++] = fDz;
855  }
856  // Outer surface points
857  for (i=0; i<n; i++) {
858  z = -fDz + i*dz;
860  for (j=0; j<n; j++) {
861  phi = j*dphi*TMath::DegToRad();
862  points[indx++] = r * TMath::Cos(phi);
863  points[indx++] = r * TMath::Sin(phi);
864  points[indx++] = z;
865  }
866  }
867 }
868 
869 ////////////////////////////////////////////////////////////////////////////////
870 /// create tube mesh points
871 
873 {
874  Double_t z,dz,r;
875  Int_t i,j, n;
876  if (!points) return;
878  Double_t dphi = 360./n;
879  Double_t phi = 0;
880  dz = 2.*fDz/(n-1);
881 
882  Int_t indx = 0;
883 
884  if (HasInner()) {
885  // Inner surface points
886  for (i=0; i<n; i++) {
887  z = -fDz+i*dz;
889  for (j=0; j<n; j++) {
890  phi = j*dphi*TMath::DegToRad();
891  points[indx++] = r * TMath::Cos(phi);
892  points[indx++] = r * TMath::Sin(phi);
893  points[indx++] = z;
894  }
895  }
896  } else {
897  points[indx++] = 0.;
898  points[indx++] = 0.;
899  points[indx++] = -fDz;
900  points[indx++] = 0.;
901  points[indx++] = 0.;
902  points[indx++] = fDz;
903  }
904  // Outer surface points
905  for (i=0; i<n; i++) {
906  z = -fDz + i*dz;
908  for (j=0; j<n; j++) {
909  phi = j*dphi*TMath::DegToRad();
910  points[indx++] = r * TMath::Cos(phi);
911  points[indx++] = r * TMath::Sin(phi);
912  points[indx++] = z;
913  }
914  }
915 }
916 
917 ////////////////////////////////////////////////////////////////////////////////
918 /// Returns numbers of vertices, segments and polygons composing the shape mesh.
919 
920 void TGeoHype::GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const
921 {
923  Bool_t hasRmin = HasInner();
924  nvert = (hasRmin)?(2*n*n):(n*n+2);
925  nsegs = (hasRmin)?(4*n*n):(n*(2*n+1));
926  npols = (hasRmin)?(2*n*n):(n*(n+1));
927 }
928 
929 ////////////////////////////////////////////////////////////////////////////////
930 /// Return number of vertices of the mesh representation
931 
933 {
935  Int_t numPoints = (HasRmin())?(2*n*n):(n*n+2);
936  return numPoints;
937 }
938 
939 ////////////////////////////////////////////////////////////////////////////////
940 /// fill size of this 3-D object
941 
942 void TGeoHype::Sizeof3D() const
943 {
944 }
945 
946 ////////////////////////////////////////////////////////////////////////////////
947 /// Fills a static 3D buffer and returns a reference.
948 
949 const TBuffer3D & TGeoHype::GetBuffer3D(Int_t reqSections, Bool_t localFrame) const
950 {
951  static TBuffer3D buffer(TBuffer3DTypes::kGeneric);
952 
953  TGeoBBox::FillBuffer3D(buffer, reqSections, localFrame);
954 
955  if (reqSections & TBuffer3D::kRawSizes) {
957  Bool_t hasRmin = HasInner();
958  Int_t nbPnts = (hasRmin)?(2*n*n):(n*n+2);
959  Int_t nbSegs = (hasRmin)?(4*n*n):(n*(2*n+1));
960  Int_t nbPols = (hasRmin)?(2*n*n):(n*(n+1));
961  if (buffer.SetRawSizes(nbPnts, 3*nbPnts, nbSegs, 3*nbSegs, nbPols, 6*nbPols)) {
963  }
964  }
965  if ((reqSections & TBuffer3D::kRaw) && buffer.SectionsValid(TBuffer3D::kRawSizes)) {
966  SetPoints(buffer.fPnts);
967  if (!buffer.fLocalFrame) {
968  TransformPoints(buffer.fPnts, buffer.NbPnts());
969  }
970 
971  SetSegsAndPols(buffer);
973  }
974 
975  return buffer;
976 }
977 
978 ////////////////////////////////////////////////////////////////////////////////
979 /// Check the inside status for each of the points in the array.
980 /// Input: Array of point coordinates + vector size
981 /// Output: Array of Booleans for the inside of each point
982 
983 void TGeoHype::Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const
984 {
985  for (Int_t i=0; i<vecsize; i++) inside[i] = Contains(&points[3*i]);
986 }
987 
988 ////////////////////////////////////////////////////////////////////////////////
989 /// Compute the normal for an array o points so that norm.dot.dir is positive
990 /// Input: Arrays of point coordinates and directions + vector size
991 /// Output: Array of normal directions
992 
993 void TGeoHype::ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize)
994 {
995  for (Int_t i=0; i<vecsize; i++) ComputeNormal(&points[3*i], &dirs[3*i], &norms[3*i]);
996 }
997 
998 ////////////////////////////////////////////////////////////////////////////////
999 /// Compute distance from array of input points having directions specified by dirs. Store output in dists
1000 
1001 void TGeoHype::DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t* step) const
1002 {
1003  for (Int_t i=0; i<vecsize; i++) dists[i] = DistFromInside(&points[3*i], &dirs[3*i], 3, step[i]);
1004 }
1005 
1006 ////////////////////////////////////////////////////////////////////////////////
1007 /// Compute distance from array of input points having directions specified by dirs. Store output in dists
1008 
1009 void TGeoHype::DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t* step) const
1010 {
1011  for (Int_t i=0; i<vecsize; i++) dists[i] = DistFromOutside(&points[3*i], &dirs[3*i], 3, step[i]);
1012 }
1013 
1014 ////////////////////////////////////////////////////////////////////////////////
1015 /// Compute safe distance from each of the points in the input array.
1016 /// Input: Array of point coordinates, array of statuses for these points, size of the arrays
1017 /// Output: Safety values
1018 
1019 void TGeoHype::Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const
1020 {
1021  for (Int_t i=0; i<vecsize; i++) safe[i] = Safety(&points[3*i], inside[i]);
1022 }
TGeoHype::SetPoints
virtual void SetPoints(Double_t *points) const
create tube mesh points
Definition: TGeoHype.cxx:824
c
#define c(i)
Definition: RSha256.hxx:119
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:993
TGeoShape::kGeoRSeg
@ kGeoRSeg
Definition: TGeoShape.h:35
TGeoHype::fTout
Double_t fTout
Definition: TGeoHype.h:36
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
TObject::TestBit
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:172
TGeoTube::fRmin
Double_t fRmin
Definition: TGeoTube.h:27
TBuffer3D::SectionsValid
Bool_t SectionsValid(UInt_t mask) const
Definition: TBuffer3D.h:73
TMath::ATan2
Double_t ATan2(Double_t y, Double_t x)
Definition: TMath.h:668
TGeoShape::kGeoInvalidShape
@ kGeoInvalidShape
Definition: TGeoShape.h:42
TBuffer3D::SetSectionsValid
void SetSectionsValid(UInt_t mask)
Definition: TBuffer3D.h:71
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:1019
TMath::Cos
Double_t Cos(Double_t)
Definition: TMath.h:630
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:772
TGeoHype
Definition: TGeoHype.h:17
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:408
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:695
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:890
TMath::Sqrt
Double_t Sqrt(Double_t x)
Definition: TMath.h:680
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:87
TMath::Tan
Double_t Tan(Double_t)
Definition: TMath.h:634
TGeoBBox::fOrigin
Double_t fOrigin[3]
Definition: TGeoBBox.h:30
Float_t
float Float_t
Definition: RtypesCore.h:57
TGeoHype::fTin
Double_t fTin
Definition: TGeoHype.h:35
TGeant4Unit::s
static constexpr double s
Definition: TGeant4SystemOfUnits.h:168
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:942
TGeoManager::GetNsegments
Int_t GetNsegments() const
Get number of segments approximating circles.
Definition: TGeoManager.cxx:3349
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:788
sin
double sin(double)
TBuffer3D::NbPnts
UInt_t NbPnts() const
Definition: TBuffer3D.h:86
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:119
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:811
b
#define b(i)
Definition: RSha256.hxx:118
bool
TGeoShape::TestShapeBit
Bool_t TestShapeBit(UInt_t f) const
Definition: TGeoShape.h:163
TGeoTube::fRmax
Double_t fRmax
Definition: TGeoTube.h:28
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:369
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:983
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:422
TMath::LocMin
Long64_t LocMin(Long64_t n, const T *a)
Return index of array with the minimum element.
Definition: TMath.h:961
TBuffer3D
Definition: TBuffer3D.h:17
TMath::Pi
constexpr Double_t Pi()
Definition: TMath.h:43
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
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:949
TGeoShape
Definition: TGeoShape.h:25
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:736
TBuffer3DTypes::kGeneric
@ kGeneric
Definition: TBuffer3DTypes.h:36
TGeoBBox::InspectShape
virtual void InspectShape() const
Prints shape parameters.
Definition: TGeoBBox.cxx:792
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:28
a
auto * a
Definition: textangle.C:12
TBuffer3D.h
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
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:679
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:150
TGeoTube::HasRmin
Bool_t HasRmin() const
Definition: TGeoTube.h:75
TGeoTube
Definition: TGeoTube.h:17
TBuffer3DTypes.h
TMath::Sin
Double_t Sin(Double_t)
Definition: TMath.h:626
TGeoShape::kGeoRunTimeShape
@ kGeoRunTimeShape
Definition: TGeoShape.h:41
TBuffer3D::kRaw
@ kRaw
Definition: TBuffer3D.h:60
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:1032
TGeoTube::fDz
Double_t fDz
Definition: TGeoTube.h:29
TObject::Warning
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:876
TGeoHype::fTinsq
Double_t fTinsq
Definition: TGeoHype.h:37
TGeoHype::SetSegsAndPols
virtual void SetSegsAndPols(TBuffer3D &buff) const
Fill TBuffer3D structure for segments and polygons.
Definition: TGeoHype.cxx:482
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:920
TGeoHype::fToutsq
Double_t fToutsq
Definition: TGeoHype.h:38
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:713
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:29
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:379
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:30
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
Definition: TGeoMatrix.h:40
TBuffer3D::fLocalFrame
Bool_t fLocalFrame
Definition: TBuffer3D.h:96
TGeoHype::MakeBuffer3D
virtual TBuffer3D * MakeBuffer3D() const
Creates a TBuffer3D describing this shape.
Definition: TGeoHype.cxx:460
points
point * points
Definition: X3DBuffer.c:22
isin
#define isin(address, start, length)
TBuffer3D::kRawSizes
@ kRawSizes
Definition: TBuffer3D.h:59
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:118
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:31
TGeoHype::GetNmeshVertices
virtual Int_t GetNmeshVertices() const
Return number of vertices of the mesh representation.
Definition: TGeoHype.cxx:932
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:1009
TGeoHype::InspectShape
virtual void InspectShape() const
print shape parameters
Definition: TGeoHype.cxx:443
TGeoHype::HasInner
Bool_t HasInner() const
Definition: TGeoHype.h:76
TBuffer3D::fPols
Int_t * fPols
Definition: TBuffer3D.h:120
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:318
TMath::E
constexpr Double_t E()
Base of natural log:
Definition: TMath.h:102
TGeoVolume
Definition: TGeoVolume.h:44
TGeoBBox::fDX
Double_t fDX
Definition: TGeoBBox.h:27
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:1001
snext
#define snext(osub1, osub2)
Definition: triangle.c:1167
TMath.h
int