138 :
TGeoTube(param[1],param[3],param[0])
175 Error(
"ComputeBBox",
"Shape %s hyperbolic surfaces are malformed: rin=%g, stin=%g, rout=%g, stout=%g",
190 Double_t rsq = point[0]*point[0]+point[1]*point[1];
198 if (i==0 ||
r<1.E-10) {
199 norm[0] = norm[1] = 0.;
214 if (norm[0]*dir[0]+norm[1]*dir[1]+norm[2]*dir[2]<0) {
227 Double_t r2 = point[0]*point[0]+point[1]*point[1];
229 if (r2>routsq)
return kFALSE;
232 if (r2<rinsq)
return kFALSE;
250 if (iact<3 && safe) {
259 sz = (
fDz-point[2])/dir[2];
260 if (sz<=0.)
return 0.;
263 sz = -(
fDz+point[2])/dir[2];
264 if (sz<=0.)
return 0.;
277 if (npos) srin = s[0];
279 if (npos) srout = s[0];
290 if (iact<3 && safe) {
303 if ((point[2]*dir[2]) < 0) {
307 xi = point[0]+sz*dir[0];
308 yi = point[1]+sz*dir[1];
313 if (r2 <= rmax2)
return sz;
324 zi = point[2] + s[0]*dir[2];
327 zi = point[2] + s[1]*dir[2];
333 zi = point[2] + s[0]*dir[2];
336 zi = point[2] + s[1]*dir[2];
358 Double_t a = dir[0]*dir[0] + dir[1]*dir[1] - t0*dir[2]*dir[2];
359 Double_t b = t0*point[2]*dir[2] - point[0]*dir[0] - point[1]*dir[1];
360 Double_t c = point[0]*point[0] + point[1]*point[1] - t0*point[2]*point[2] - r0*r0;
365 if (
snext < 0.)
return 0;
373 if (delta < 0.)
return 0;
378 snext = (
b + i*sone*delta)*ainv;
380 if (
snext<0)
continue;
387 if (inner) ndotd *= -1;
389 if (ndotd<0) s[npos++] =
snext;
390 }
else s[npos++] =
snext;
401 Error(
"Divide",
"Hyperboloids cannot be divided. Division volume %s not created", divname);
440 param[0] *= param[0];
442 param[1] *= param[1];
458 if (zmax<0)
return nullptr;
461 Error(
"GetMakeRuntimeShape",
"Shape %s does not have negative Z range",
GetName());
473 printf(
"*** Shape %s: TGeoHype ***\n",
GetName());
474 printf(
" Rin = %11.5f\n",
fRmin);
475 printf(
" sin = %11.5f\n",
fStIn);
476 printf(
" Rout = %11.5f\n",
fRmax);
477 printf(
" sout = %11.5f\n",
fStOut);
478 printf(
" dz = %11.5f\n",
fDz);
480 printf(
" Bounding box:\n");
492 Int_t nbPnts = (hasRmin)?(2*
n*
n):(
n*
n+2);
493 Int_t nbSegs = (hasRmin)?(4*
n*
n):(
n*(2*
n+1));
494 Int_t nbPols = (hasRmin)?(2*
n*
n):(
n*(
n+1));
497 nbPnts, 3*nbPnts, nbSegs, 3*nbSegs, nbPols, 6*nbPols);
517 Int_t irout = (hasRmin)?(
n*
n):2;
551 Int_t isout = (hasRmin)?(isgenin+
n*(
n-1)):0;
559 for (i=0; i<
n; i++) {
560 for (j=0; j<
n; j++) {
561 npt = 3*(
isin+
n*i+j);
563 buff.
fSegs[npt+1] = irin+
n*i+j;
564 buff.
fSegs[npt+2] = irin+
n*i+((j+1)%
n);
568 for (i=0; i<
n-1; i++) {
569 for (j=0; j<
n; j++) {
570 npt = 3*(isgenin+
n*i+j);
572 buff.
fSegs[npt+1] = irin+
n*i+j;
573 buff.
fSegs[npt+2] = irin+
n*(i+1)+j;
578 for (i=0; i<
n; i++) {
579 for (j=0; j<
n; j++) {
580 npt = 3*(isout +
n*i+j);
582 buff.
fSegs[npt+1] = irout+
n*i+j;
583 buff.
fSegs[npt+2] = irout+
n*i+((j+1)%
n);
587 for (i=0; i<
n-1; i++) {
588 for (j=0; j<
n; j++) {
589 npt = 3*(isgenout+
n*i+j);
591 buff.
fSegs[npt+1] = irout+
n*i+j;
592 buff.
fSegs[npt+2] = irout+
n*(i+1)+j;
596 for (j=0; j<
n; j++) {
599 buff.
fSegs[npt+1] = irin;
600 if (hasRmin) buff.
fSegs[npt+1] += j;
601 buff.
fSegs[npt+2] = irout + j;
604 for (j=0; j<
n; j++) {
607 buff.
fSegs[npt+1] = irin+1;
608 if (hasRmin) buff.
fSegs[npt+1] +=
n*(
n-1)+j-1;
609 buff.
fSegs[npt+2] = irout +
n*(
n-1)+j;
635 Int_t ipout = (hasRmin)?(ipin+
n*(
n-1)):0;
640 for (i=0; i<
n-1; i++) {
641 for (j=0; j<
n; j++) {
642 npt = 6*(ipin+
n*i+j);
644 buff.
fPols[npt+1] = 4;
646 buff.
fPols[npt+3] = isgenin+i*
n+((j+1)%
n);
648 buff.
fPols[npt+5] = isgenin+i*
n+j;
653 for (i=0; i<
n-1; i++) {
654 for (j=0; j<
n; j++) {
655 npt = 6*(ipout+
n*i+j);
657 buff.
fPols[npt+1] = 4;
658 buff.
fPols[npt+2] = isout+
n*i+j;
659 buff.
fPols[npt+3] = isgenout+i*
n+j;
660 buff.
fPols[npt+4] = isout+
n*(i+1)+j;
661 buff.
fPols[npt+5] = isgenout+i*
n+((j+1)%
n);
666 for (j=0; j<
n; j++) {
669 buff.
fPols[npt+1] = 4;
671 buff.
fPols[npt+3] = islo+j;
672 buff.
fPols[npt+4] = isout+j;
673 buff.
fPols[npt+5] = islo+((j+1)%
n);
675 for (j=0; j<
n; j++) {
678 buff.
fPols[npt+1] = 4;
680 buff.
fPols[npt+3] = ishi+((j+1)%
n);
681 buff.
fPols[npt+4] = isout+
n*(
n-1)+j;
682 buff.
fPols[npt+5] = ishi+j;
685 for (j=0; j<
n; j++) {
688 buff.
fPols[npt+1] = 3;
689 buff.
fPols[npt+2] = isout+j;
690 buff.
fPols[npt+3] = islo+((j+1)%
n);
691 buff.
fPols[npt+4] = islo+j;
693 for (j=0; j<
n; j++) {
694 npt = 6*iplo+5*(
n+j);
696 buff.
fPols[npt+1] = 3;
697 buff.
fPols[npt+2] = isout+
n*(
n-1)+j;
698 buff.
fPols[npt+3] = ishi+j;
699 buff.
fPols[npt+4] = ishi+((j+1)%
n);
717 return (r0*r0+tsq*z*z);
734 return ((
r*
r-r0*r0)/tsq);
747 if (safrmin < safe) safe = safrmin;
749 if (safrmax < safe) safe = safrmax;
753 if (safrmin > safe) safe = safrmin;
755 if (safrmax > safe) safe = safrmax;
768 rsq = point[0]*point[0]+point[1]*point[1];
804 out <<
" rin = " <<
fRmin <<
";" << std::endl;
805 out <<
" stin = " <<
fStIn <<
";" << std::endl;
806 out <<
" rout = " <<
fRmax <<
";" << std::endl;
807 out <<
" stout = " <<
fStOut <<
";" << std::endl;
808 out <<
" dz = " <<
fDz <<
";" << std::endl;
809 out <<
" TGeoShape *" <<
GetPointerName() <<
" = new TGeoHype(\"" <<
GetName() <<
"\",rin,stin,rout,stout,dz);" << std::endl;
866 for (i=0; i<
n; i++) {
869 for (j=0; j<
n; j++) {
885 for (i=0; i<
n; i++) {
888 for (j=0; j<
n; j++) {
914 for (i=0; i<
n; i++) {
917 for (j=0; j<
n; j++) {
933 for (i=0; i<
n; i++) {
936 for (j=0; j<
n; j++) {
952 nvert = (hasRmin)?(2*
n*
n):(
n*
n+2);
953 nsegs = (hasRmin)?(4*
n*
n):(
n*(2*
n+1));
954 npols = (hasRmin)?(2*
n*
n):(
n*(
n+1));
986 Int_t nbPnts = (hasRmin)?(2*
n*
n):(
n*
n+2);
987 Int_t nbSegs = (hasRmin)?(4*
n*
n):(
n*(2*
n+1));
988 Int_t nbPols = (hasRmin)?(2*
n*
n):(
n*(
n+1));
989 if (buffer.
SetRawSizes(nbPnts, 3*nbPnts, nbSegs, 3*nbSegs, nbPols, 6*nbPols)) {
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
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
R__EXTERN TGeoManager * gGeoManager
#define isin(address, start, length)
Generic 3D primitive description class.
Bool_t SectionsValid(UInt_t mask) const
void SetSectionsValid(UInt_t mask)
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.
virtual void InspectShape() const
Prints shape parameters.
virtual 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
Compute distance from outside point to surface of the box.
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...
A hyperboloid is represented as a solid limited by two planes perpendicular to the Z axis (top and bo...
virtual TGeoVolume * Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step)
Cannot divide hyperboloids.
virtual void SetPoints(Double_t *points) const
create tube mesh points
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.
Double_t ZHypeSq(Double_t r, Bool_t inner) const
Compute z^2 at a given r^2, for either inner or outer hyperbolas.
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
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.
virtual const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const
Fills a static 3D buffer and returns a reference.
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.
virtual void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const
Returns numbers of vertices, segments and polygons composing the shape mesh.
virtual Double_t Capacity() const
Computes capacity of the shape in [length^3].
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...
virtual void GetBoundingCylinder(Double_t *param) const
Fill vector param[4] with the bounding cylinder parameters.
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.
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
compute closest distance from point px,py to each corner
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.
virtual TBuffer3D * MakeBuffer3D() const
Creates a TBuffer3D describing this shape.
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.
virtual void SetDimensions(Double_t *param)
Set dimensions of the hyperboloid starting from an array.
TGeoHype()
Default constructor.
virtual 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
Compute distance from inside point to surface of the hyperboloid.
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...
virtual void InspectShape() const
print shape parameters
virtual ~TGeoHype()
destructor
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
virtual Int_t GetNmeshVertices() const
Return number of vertices of the mesh representation.
virtual Bool_t Contains(const Double_t *point) const
test if point is inside this tube
void SetHypeDimensions(Double_t rin, Double_t stin, Double_t rout, Double_t stout, Double_t dz)
Set dimensions of the hyperboloid.
virtual void ComputeBBox()
Compute bounding box of the hyperboloid.
virtual 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
compute distance from outside point to surface of the hyperboloid.
virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm)
Compute normal to closest surface from POINT.
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...
virtual Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const
Get range of shape for a given axis.
virtual void Sizeof3D() const
fill size of this 3-D object
virtual void SetSegsAndPols(TBuffer3D &buff) const
Fill TBuffer3D structure for segments and polygons.
Int_t GetNsegments() const
Get number of segments approximating circles.
Geometrical transformation package.
Base abstract class for all shapes.
virtual Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const =0
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.
virtual const char * GetName() const
Get the shape name.
static Double_t Tolerance()
Bool_t TestShapeBit(UInt_t f) const
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual const char * ClassName() const
Returns name of class to which the object belongs.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Long64_t LocMin(Long64_t n, const T *a)
Returns index of array with the minimum element.
T1 Sign(T1 a, T2 b)
Returns a value with the magnitude of a and the sign of b.
Double_t ATan2(Double_t y, Double_t x)
Returns the principal value of the arc tangent of y/x, expressed in radians.
constexpr Double_t DegToRad()
Conversion from degree to radian: .
Double_t Sqrt(Double_t x)
Returns the square root of x.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
Double_t Tan(Double_t)
Returns the tangent of an angle of x radians.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
#define snext(osub1, osub2)