ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TGeoHype.h
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 #ifndef ROOT_TGeoHype
13 #define ROOT_TGeoHype
14 
15 #ifndef ROOT_TGeoTube
16 #include "TGeoTube.h"
17 #endif
18 
19 ///////////////////////////////////////////////////////////////////////////////
20 //
21 // TGeoHype - Hyperboloid class defined by 5 parameters. Bounded by:
22 // - Two z planes at z=+/-dz
23 // - Inner and outer lateral surfaces. These represent the surfaces
24 // described by the revolution of 2 hyperbolas about the Z axis:
25 // r^2 - (t*z)^2 = a^2
26 //
27 // r = distance between hyperbola and Z axis at coordinate z
28 // t = tangent of the stereo angle (angle made by hyperbola
29 // asimptotic lines and Z axis). t=0 means cylindrical surface.
30 // a = distance between hyperbola and Z axis at z=0
31 //
32 // The inner hyperbolic surface is described by:
33 // r^2 - (tin*z)^2 = rin^2
34 // - absence of the inner surface (filled hyperboloid can be forced
35 // by rin=0 and sin=0
36 // The outer hyperbolic surface is described by:
37 // r^2 - (tout*z)^2 = rout^2
38 // TGeoHype parameters: dz[cm], rin[cm], sin[deg], rout[cm], sout[deg].
39 // MANDATORY conditions:
40 // - rin < rout
41 // - rout > 0
42 // - rin^2 + (tin*dz)^2 > rout^2 + (tout*dz)^2
43 //
44 ///////////////////////////////////////////////////////////////////////////////
45 
46 
47 class TGeoHype : public TGeoTube
48 {
49 protected :
50 // data members inherited from TGeoTube:
51 // Double_t fRmin; // inner radius at z=0
52 // Double_t fRmax; // outer radius at z=0
53 // Double_t fDz; // half length
54  Double_t fStIn; // Stereo angle for inner surface
55  Double_t fStOut; // Stereo angle for inner surface
56 
57 private :
58 // Precomputed parameters:
59  Double_t fTin; // Tangent of stereo angle for inner surface
60  Double_t fTout; // Tangent of stereo angle for outer surface
61  Double_t fTinsq; // Squared tangent of stereo angle for inner surface
62  Double_t fToutsq; // Squared tangent of stereo angle for outer surface
63 
64 public:
65  // constructors
66  TGeoHype();
67  TGeoHype(Double_t rin, Double_t stin, Double_t rout, Double_t stout, Double_t dz);
68  TGeoHype(const char *name, Double_t rin, Double_t stin, Double_t rout, Double_t stout, Double_t dz);
69  TGeoHype(Double_t *params);
70  // destructor
71  virtual ~TGeoHype();
72  // methods
73 
74  virtual Double_t Capacity() const;
75  virtual void ComputeBBox();
76  virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm);
77  virtual void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize);
78  virtual Bool_t Contains(const Double_t *point) const;
79  virtual void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const;
80  virtual Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact=1,
81  Double_t step=TGeoShape::Big(), Double_t *safe=0) const;
82  virtual void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const;
83  virtual Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1,
84  Double_t step=TGeoShape::Big(), Double_t *safe=0) const;
85  virtual void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const;
86  Int_t DistToHype(const Double_t *point, const Double_t *dir, Double_t *s, Bool_t inner, Bool_t in) const;
88  virtual TGeoVolume *Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv,
89  Double_t start, Double_t step);
90  virtual Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const;
91  virtual void GetBoundingCylinder(Double_t *param) const;
92  virtual const TBuffer3D &GetBuffer3D(Int_t reqSections, Bool_t localFrame) const;
93  virtual Int_t GetByteCount() const {return 64;}
94  virtual Bool_t GetPointsOnSegments(Int_t /*npoints*/, Double_t * /*array*/) const {return kFALSE;}
95  virtual TGeoShape *GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const;
96  virtual void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const;
97  virtual Int_t GetNmeshVertices() const;
98  Double_t GetStIn() const {return fStIn;}
99  Double_t GetStOut() const {return fStOut;}
100  Bool_t HasInner() const {return !TestShapeBit(kGeoRSeg);}
101  Double_t RadiusHypeSq(Double_t z, Bool_t inner) const;
102  Double_t ZHypeSq(Double_t r, Bool_t inner) const;
103  virtual void InspectShape() const;
104  virtual Bool_t IsCylType() const {return kTRUE;}
105  virtual TBuffer3D *MakeBuffer3D() const;
106  //virtual void Paint(Option_t *option);
107  virtual Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const;
108  virtual void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const;
109  Double_t SafetyToHype(const Double_t *point, Bool_t inner, Bool_t in) const;
110  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
111  void SetHypeDimensions(Double_t rin, Double_t stin, Double_t rout, Double_t stout, Double_t dz);
112  virtual void SetDimensions(Double_t *param);
113  virtual void SetPoints(Double_t *points) const;
114  virtual void SetPoints(Float_t *points) const;
115  virtual void SetSegsAndPols(TBuffer3D &buff) const;
116  virtual void Sizeof3D() const;
117 
118  ClassDef(TGeoHype, 1) // hyperboloid class
119 
120 };
121 
122 #endif
Double_t GetStOut() const
Definition: TGeoHype.h:99
Double_t fStOut
Definition: TGeoHype.h:55
virtual ~TGeoHype()
destructor
Definition: TGeoHype.cxx:118
virtual Double_t Capacity() const
Computes capacity of the shape in [length^3].
Definition: TGeoHype.cxx:125
virtual TBuffer3D * MakeBuffer3D() const
Creates a TBuffer3D describing this shape.
Definition: TGeoHype.cxx:458
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:377
float Float_t
Definition: RtypesCore.h:53
const char Option_t
Definition: RtypesCore.h:62
virtual void SetPoints(Double_t *points) const
create tube mesh points
Definition: TGeoHype.cxx:822
virtual Bool_t GetPointsOnSegments(Int_t, Double_t *) const
Fills array with n random points located on the line segments of the shape mesh.
Definition: TGeoHype.h:94
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
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
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
Float_t py
Definition: hprod.C:33
Double_t fTout
Definition: TGeoHype.h:60
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
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:420
Double_t fTin
Definition: TGeoHype.h:59
virtual Bool_t Contains(const Double_t *point) const
test if point is inside this tube
Definition: TGeoHype.cxx:192
virtual void ComputeBBox()
Compute bounding box of the hyperboloid.
Definition: TGeoHype.cxx:135
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
#define ClassDef(name, id)
Definition: Rtypes.h:254
virtual Bool_t IsCylType() const
Definition: TGeoHype.h:104
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
compute closest distance from point px,py to each corner
Definition: TGeoHype.cxx:207
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:256
Float_t z[5]
Definition: Ifit.C:16
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:367
char * out
Definition: TBase64.cxx:29
point * points
Definition: X3DBuffer.c:20
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
ROOT::R::TRInterface & r
Definition: Object.C:4
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 specisied by dirs. Store output in dist...
Definition: TGeoHype.cxx:1006
virtual void SetDimensions(Double_t *param)
Set dimensions of the hyperboloid starting from an array.
Definition: TGeoHype.cxx:809
virtual void InspectShape() const
print shape parameters
Definition: TGeoHype.cxx:441
Double_t fTinsq
Definition: TGeoHype.h:61
virtual Int_t GetByteCount() const
Definition: TGeoHype.h:93
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
virtual const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const
Fills a static 3D buffer and returns a reference.
Definition: TGeoHype.cxx:954
Generic 3D primitive description class.
Definition: TBuffer3D.h:19
Double_t fStIn
Definition: TGeoHype.h:54
Double_t GetStIn() const
Definition: TGeoHype.h:98
virtual void Sizeof3D() const
Definition: TGeoHype.cxx:947
virtual void SetSegsAndPols(TBuffer3D &buff) const
Fill TBuffer3D structure for segments and polygons.
Definition: TGeoHype.cxx:480
virtual Int_t GetNmeshVertices() const
Return number of vertices of the mesh representation.
Definition: TGeoHype.cxx:930
Bool_t HasInner() const
Definition: TGeoHype.h:100
double Double_t
Definition: RtypesCore.h:55
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:316
virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm)
Compute normal to closest surface from POINT.
Definition: TGeoHype.cxx:155
static Double_t Big()
Definition: TGeoShape.h:98
Double_t fToutsq
Definition: TGeoHype.h:62
#define name(a, b)
Definition: linkTestLib0.cpp:5
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:216
Float_t px
Definition: hprod.C:33
Bool_t TestShapeBit(UInt_t f) const
Definition: TGeoShape.h:172
virtual void GetBoundingCylinder(Double_t *param) const
— Fill vector param[4] with the bounding cylinder parameters.
Definition: TGeoHype.cxx:406
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:998
const Bool_t kTRUE
Definition: Rtypes.h:91
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 specisied by dirs. Store output in dist...
Definition: TGeoHype.cxx:1014
double norm(double *x, double *p)
Definition: unuranDistr.cxx:40
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
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:1024
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:988