Logo ROOT   6.08/07
Reference Guide
TGeoTube.h
Go to the documentation of this file.
1 // @(#)root/base:$Id$
2 // Author: Andrei Gheata 24/10/01
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_TGeoTube
13 #define ROOT_TGeoTube
14 
15 #ifndef ROOT_TGeoBBox
16 #include "TGeoBBox.h"
17 #endif
18 
19 class TGeoTube : public TGeoBBox
20 {
21 protected :
22 // data members
23  Double_t fRmin; // inner radius
24  Double_t fRmax; // outer radius
25  Double_t fDz; // half length
26 // methods
27 
28 public:
29  // constructors
30  TGeoTube();
31  TGeoTube(Double_t rmin, Double_t rmax, Double_t dz);
32  TGeoTube(const char * name, Double_t rmin, Double_t rmax, Double_t dz);
33  TGeoTube(Double_t *params);
34  // destructor
35  virtual ~TGeoTube();
36  // methods
37 
38  virtual Double_t Capacity() const;
39  static Double_t Capacity(Double_t rmin, Double_t rmax, Double_t dz);
40  virtual void ComputeBBox();
41  virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm);
42  virtual void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize);
43  static void ComputeNormalS(const Double_t *point, const Double_t *dir, Double_t *norm,
44  Double_t rmin, Double_t rmax, Double_t dz);
45  virtual Bool_t Contains(const Double_t *point) const;
46  virtual void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const;
47  static Double_t DistFromInsideS(const Double_t *point, const Double_t *dir, Double_t rmin, Double_t rmax, Double_t dz);
48  virtual Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact=1,
49  Double_t step=TGeoShape::Big(), Double_t *safe=0) const;
50  virtual void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const;
51  static Double_t DistFromOutsideS(const Double_t *point, const Double_t *dir, Double_t rmin, Double_t rmax, Double_t dz);
52  virtual Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1,
53  Double_t step=TGeoShape::Big(), Double_t *safe=0) const;
54  virtual void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const;
55  static void DistToTube(Double_t rsq, Double_t nsq, Double_t rdotn, Double_t radius, Double_t &b, Double_t &delta);
56  virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
57  virtual TGeoVolume *Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv,
58  Double_t start, Double_t step);
59  virtual const char *GetAxisName(Int_t iaxis) const;
60  virtual Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const;
61  virtual void GetBoundingCylinder(Double_t *param) const;
62  virtual const TBuffer3D &GetBuffer3D(Int_t reqSections, Bool_t localFrame) const;
63  virtual Int_t GetByteCount() const {return 48;}
64  virtual Bool_t GetPointsOnSegments(Int_t npoints, Double_t *array) const;
65  virtual TGeoShape *GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const;
66  virtual void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const;
67  virtual Int_t GetNmeshVertices() const;
68  virtual Double_t GetRmin() const {return fRmin;}
69  virtual Double_t GetRmax() const {return fRmax;}
70  virtual Double_t GetDz() const {return fDz;}
71  Bool_t HasRmin() const {return (fRmin>0)?kTRUE:kFALSE;}
72  virtual void InspectShape() const;
73  virtual Bool_t IsCylType() const {return kTRUE;}
74  virtual TBuffer3D *MakeBuffer3D() const;
75  virtual Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const;
76  virtual void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const;
77  static Double_t SafetyS(const Double_t *point, Bool_t in, Double_t rmin, Double_t rmax, Double_t dz, Int_t skipz=0);
78  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
79  void SetTubeDimensions(Double_t rmin, Double_t rmax, Double_t dz);
80  virtual void SetDimensions(Double_t *param);
81  virtual void SetPoints(Double_t *points) const;
82  virtual void SetPoints(Float_t *points) const;
83  virtual void SetSegsAndPols(TBuffer3D &buff) const;
84  virtual void Sizeof3D() const;
85 
86  ClassDef(TGeoTube, 1) // cylindrical tube class
87 
88 };
89 
90 class TGeoTubeSeg : public TGeoTube
91 {
92 protected:
93  // data members
94  Double_t fPhi1; // first phi limit
95  Double_t fPhi2; // second phi limit
96  // Transient trigonometric data
97  Double_t fS1; //!sin(phi1)
98  Double_t fC1; //!cos(phi1)
99  Double_t fS2; //!sin(phi2)
100  Double_t fC2; //!cos(phi2)
101  Double_t fSm; //!sin(0.5*(phi1+phi2))
102  Double_t fCm; //!cos(0.5*(phi1+phi2))
103  Double_t fCdfi; //!cos(0.5*(phi1-phi2))
104 
105  void InitTrigonometry();
106 
107 public:
108  // constructors
109  TGeoTubeSeg();
110  TGeoTubeSeg(Double_t rmin, Double_t rmax, Double_t dz,
111  Double_t phi1, Double_t phi2);
112  TGeoTubeSeg(const char * name, Double_t rmin, Double_t rmax, Double_t dz,
113  Double_t phi1, Double_t phi2);
114  TGeoTubeSeg(Double_t *params);
115  // destructor
116  virtual ~TGeoTubeSeg();
117  // methods
118  virtual void AfterStreamer();
119  virtual Double_t Capacity() const;
120  static Double_t Capacity(Double_t rmin, Double_t rmax, Double_t dz, Double_t phi1, Double_t phi2);
121  virtual void ComputeBBox();
122  virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm);
123  virtual void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize);
124  static void ComputeNormalS(const Double_t *point, const Double_t *dir, Double_t *norm,
125  Double_t rmin, Double_t rmax, Double_t dz,
127  virtual Bool_t Contains(const Double_t *point) const;
128  virtual void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const;
129  virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
130  static Double_t DistFromInsideS(const Double_t *point, const Double_t *dir,Double_t rmin, Double_t rmax, Double_t dz,
131  Double_t c1, Double_t s1, Double_t c2, Double_t s2, Double_t cm, Double_t sm, Double_t cdfi);
132  virtual Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact=1,
133  Double_t step=TGeoShape::Big(), Double_t *safe=0) const;
134  virtual void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const;
135  static Double_t DistFromOutsideS(const Double_t *point, const Double_t *dir, Double_t rmin, Double_t rmax, Double_t dz,
136  Double_t c1, Double_t s1, Double_t c2, Double_t s2, Double_t cm, Double_t sm, Double_t cdfi);
137  virtual Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1,
138  Double_t step=TGeoShape::Big(), Double_t *safe=0) const;
139  virtual void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const;
140  virtual TGeoVolume *Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv,
141  Double_t start, Double_t step);
142  virtual Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const;
143  virtual void GetBoundingCylinder(Double_t *param) const;
144  virtual const TBuffer3D &GetBuffer3D(Int_t reqSections, Bool_t localFrame) const;
145  virtual Int_t GetByteCount() const {return 56;}
146  virtual Bool_t GetPointsOnSegments(Int_t npoints, Double_t *array) const;
147  virtual TGeoShape *GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const;
148  virtual Int_t GetNmeshVertices() const;
149  virtual void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const;
150  Double_t GetPhi1() const {return fPhi1;}
151  Double_t GetPhi2() const {return fPhi2;}
152  virtual void InspectShape() const;
153  virtual TBuffer3D *MakeBuffer3D() const;
154  virtual Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const;
155  virtual void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const;
156  static Double_t SafetyS(const Double_t *point, Bool_t in, Double_t rmin, Double_t rmax, Double_t dz,
157  Double_t phi1, Double_t phi2, Int_t skipz=0);
158  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
159  void SetTubsDimensions(Double_t rmin, Double_t rmax, Double_t dz,
160  Double_t phi1, Double_t phi2);
161  virtual void SetDimensions(Double_t *param);
162  virtual void SetPoints(Double_t *points) const;
163  virtual void SetPoints(Float_t *points) const;
164  virtual void SetSegsAndPols(TBuffer3D &buff) const;
165  virtual void Sizeof3D() const;
166 
167  ClassDef(TGeoTubeSeg, 1) // cylindrical tube segment class
168 };
169 
170 class TGeoCtub : public TGeoTubeSeg
171 {
172 protected:
173  // data members
174  Double_t fNlow[3]; // normal to lower cut plane
175  Double_t fNhigh[3]; // normal to higher cut plane
176 
177 public:
178  // constructors
179  TGeoCtub();
180  TGeoCtub(Double_t rmin, Double_t rmax, Double_t dz, Double_t phi1, Double_t phi2,
181  Double_t lx, Double_t ly, Double_t lz, Double_t tx, Double_t ty, Double_t tz);
182  TGeoCtub(const char *name, Double_t rmin, Double_t rmax, Double_t dz, Double_t phi1, Double_t phi2,
183  Double_t lx, Double_t ly, Double_t lz, Double_t tx, Double_t ty, Double_t tz);
184  TGeoCtub(Double_t *params);
185  // destructor
186  virtual ~TGeoCtub();
187  // methods
188  virtual Double_t Capacity() const;
189  virtual void ComputeBBox();
190  virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm);
191  virtual void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize);
192  virtual Bool_t Contains(const Double_t *point) const;
193  virtual void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const;
194  virtual Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact=1,
195  Double_t step=TGeoShape::Big(), Double_t *safe=0) const;
196  virtual void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const;
197  virtual Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1,
198  Double_t step=TGeoShape::Big(), Double_t *safe=0) const;
199  virtual void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const;
200  virtual TGeoVolume *Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv,
201  Double_t start, Double_t step);
202  virtual Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const;
203  virtual const TBuffer3D &GetBuffer3D(Int_t reqSections, Bool_t localFrame) const;
204  virtual Int_t GetByteCount() const {return 98;}
205  virtual Bool_t GetPointsOnSegments(Int_t npoints, Double_t *array) const;
206  virtual TGeoShape *GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const;
207  virtual void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const;
208  virtual Int_t GetNmeshVertices() const;
209  const Double_t *GetNlow() const {return &fNlow[0];}
210  const Double_t *GetNhigh() const {return &fNhigh[0];}
211  Double_t GetZcoord(Double_t xc, Double_t yc, Double_t zc) const;
212  virtual void InspectShape() const;
213  virtual Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const;
214  virtual void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const;
215  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
216  void SetCtubDimensions(Double_t rmin, Double_t rmax, Double_t dz,
217  Double_t phi1, Double_t phi2, Double_t lx, Double_t ly, Double_t lz,
218  Double_t tx, Double_t ty, Double_t tz);
219  virtual void SetDimensions(Double_t *param);
220  virtual void SetPoints(Double_t *points) const;
221  virtual void SetPoints(Float_t *points) const;
222 
223  ClassDef(TGeoCtub, 1) // cut tube segment class
224 };
225 
226 #endif
Double_t GetPhi2() const
Definition: TGeoTube.h:151
virtual Int_t GetByteCount() const
Definition: TGeoTube.h:63
Double_t fCm
sin(0.5*(phi1+phi2))
Definition: TGeoTube.h:102
Cylindrical tube class.
Definition: TGeoTube.h:19
Double_t fPhi2
Definition: TGeoTube.h:95
Double_t fPhi1
Definition: TGeoTube.h:94
virtual TBuffer3D * MakeBuffer3D() const
Creates a TBuffer3D describing this shape.
Definition: TGeoTube.cxx:647
Box class.
Definition: TGeoBBox.h:19
virtual void ComputeBBox()
compute bounding box of the tube
Definition: TGeoTube.cxx:210
Double_t GetPhi1() const
Definition: TGeoTube.h:150
float Float_t
Definition: RtypesCore.h:53
virtual void SetSegsAndPols(TBuffer3D &buff) const
Fill TBuffer3D structure for segments and polygons.
Definition: TGeoTube.cxx:672
Double_t fS1
Definition: TGeoTube.h:97
const char Option_t
Definition: RtypesCore.h:62
Geometrical transformation package.
Definition: TGeoMatrix.h:40
return c1
Definition: legend1.C:41
virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm)
Compute normal to closest surface from POINT.
Definition: TGeoTube.cxx:219
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: TGeoTube.cxx:1200
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition: TGeoVolume.h:61
Double_t fC2
sin(phi2)
Definition: TGeoTube.h:100
virtual Double_t Capacity() const
Computes capacity of the shape in [length^3].
Definition: TGeoTube.cxx:193
const Double_t * GetNlow() const
Definition: TGeoTube.h:209
virtual const char * GetAxisName(Int_t iaxis) const
Returns name of axis IAXIS.
Definition: TGeoTube.cxx:544
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
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: TGeoTube.cxx:1218
virtual Double_t GetRmax() const
Definition: TGeoTube.h:69
virtual Int_t GetNmeshVertices() const
Return number of vertices of the mesh representation.
Definition: TGeoTube.cxx:1102
#define ClassDef(name, id)
Definition: Rtypes.h:254
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
compute closest distance from point px,py to each corner
Definition: TGeoTube.cxx:273
virtual const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const
Fills a static 3D buffer and returns a reference.
Definition: TGeoTube.cxx:1140
virtual Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const
Get range of shape for a given axis.
Definition: TGeoTube.cxx:561
Bool_t HasRmin() const
Definition: TGeoTube.h:71
Double_t fDz
Definition: TGeoTube.h:25
virtual void SetDimensions(Double_t *param)
Set tube dimensions starting from a list.
Definition: TGeoTube.cxx:922
point * points
Definition: X3DBuffer.c:20
Double_t fC1
sin(phi1)
Definition: TGeoTube.h:98
virtual void AfterStreamer()
Definition: TGeoShape.h:96
Base abstract class for all shapes.
Definition: TGeoShape.h:27
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: TGeoTube.cxx:1113
static Double_t DistFromInsideS(const Double_t *point, const Double_t *dir, Double_t rmin, Double_t rmax, Double_t dz)
Compute distance from inside point to surface of the tube (static) Boundary safe algorithm.
Definition: TGeoTube.cxx:287
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: TGeoTube.cxx:1182
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
Definition: TGeoTube.cxx:896
static void DistToTube(Double_t rsq, Double_t nsq, Double_t rdotn, Double_t radius, Double_t &b, Double_t &delta)
Static method computing the distance to a tube with given radius, starting from POINT along DIR direc...
Definition: TGeoTube.cxx:460
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: TGeoTube.cxx:827
Generic 3D primitive description class.
Definition: TBuffer3D.h:19
static void ComputeNormalS(const Double_t *point, const Double_t *dir, Double_t *norm, Double_t rmin, Double_t rmax, Double_t dz)
Compute normal to closest surface from POINT.
Definition: TGeoTube.cxx:246
Double_t fCdfi
cos(0.5*(phi1+phi2))
Definition: TGeoTube.h:103
virtual TGeoVolume * Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step)
Divide this tube shape belonging to volume "voldiv" into ndiv volumes called divname, from start position with the given step.
Definition: TGeoTube.cxx:482
virtual Bool_t GetPointsOnSegments(Int_t npoints, Double_t *array) const
Fills array with n random points located on the line segments of the shape mesh.
Definition: TGeoTube.cxx:935
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: TGeoTube.cxx:1192
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: TGeoTube.cxx:1208
static Double_t SafetyS(const Double_t *point, Bool_t in, Double_t rmin, Double_t rmax, Double_t dz, Int_t skipz=0)
computes the closest distance from given point to this shape, according to option.
Definition: TGeoTube.cxx:867
A tube segment cut with 2 planes.
Definition: TGeoTube.h:170
TGeoTube()
Default constructor.
Definition: TGeoTube.cxx:128
return c2
Definition: legend2.C:14
virtual Int_t GetByteCount() const
Definition: TGeoTube.h:204
double Double_t
Definition: RtypesCore.h:55
const Double_t * GetNhigh() const
Definition: TGeoTube.h:210
Double_t fS2
cos(phi1)
Definition: TGeoTube.h:99
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: TGeoTube.cxx:604
Double_t fSm
cos(phi2)
Definition: TGeoTube.h:101
virtual Bool_t IsCylType() const
Definition: TGeoTube.h:73
static Double_t Big()
Definition: TGeoShape.h:90
virtual Bool_t Contains(const Double_t *point) const
test if point is inside this tube
Definition: TGeoTube.cxx:262
virtual void GetBoundingCylinder(Double_t *param) const
Fill vector param[4] with the bounding cylinder parameters.
Definition: TGeoTube.cxx:590
Double_t fRmin
Definition: TGeoTube.h:23
virtual Double_t GetRmin() const
Definition: TGeoTube.h:68
static Double_t DistFromOutsideS(const Double_t *point, const Double_t *dir, Double_t rmin, Double_t rmax, Double_t dz)
Static method to compute distance from outside point to a tube with given parameters Boundary safe al...
Definition: TGeoTube.cxx:348
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Definition: TRolke.cxx:630
virtual void Sizeof3D() const
fill size of this 3-D object
Definition: TGeoTube.cxx:1133
virtual void SetPoints(Double_t *points) const
create tube mesh points
Definition: TGeoTube.cxx:976
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 tube and safe distance Boundary safe algorithm...
Definition: TGeoTube.cxx:436
const Bool_t kTRUE
Definition: Rtypes.h:91
virtual ~TGeoTube()
destructor
Definition: TGeoTube.cxx:186
double norm(double *x, double *p)
Definition: unuranDistr.cxx:40
virtual void InspectShape() const
print shape parameters
Definition: TGeoTube.cxx:633
void SetTubeDimensions(Double_t rmin, Double_t rmax, Double_t dz)
Set tube dimensions.
Definition: TGeoTube.cxx:910
virtual Double_t GetDz() const
Definition: TGeoTube.h:70
char name[80]
Definition: TGX11.cxx:109
Double_t fRmax
Definition: TGeoTube.h:24
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 tube Boundary safe algorithm.
Definition: TGeoTube.cxx:332
virtual Int_t GetByteCount() const
Definition: TGeoTube.h:145
A phi segment of a tube.
Definition: TGeoTube.h:90