Logo ROOT   6.10/09
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 #include "TGeoBBox.h"
16 
17 class TGeoTube : public TGeoBBox
18 {
19 protected :
20 // data members
21  Double_t fRmin; // inner radius
22  Double_t fRmax; // outer radius
23  Double_t fDz; // half length
24 // methods
25 
26 public:
27  // constructors
28  TGeoTube();
29  TGeoTube(Double_t rmin, Double_t rmax, Double_t dz);
30  TGeoTube(const char * name, Double_t rmin, Double_t rmax, Double_t dz);
31  TGeoTube(Double_t *params);
32  // destructor
33  virtual ~TGeoTube();
34  // methods
35 
36  virtual Double_t Capacity() const;
37  static Double_t Capacity(Double_t rmin, Double_t rmax, Double_t dz);
38  virtual void ComputeBBox();
39  virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm);
40  virtual void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize);
41  static void ComputeNormalS(const Double_t *point, const Double_t *dir, Double_t *norm,
42  Double_t rmin, Double_t rmax, Double_t dz);
43  virtual Bool_t Contains(const Double_t *point) const;
44  virtual void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const;
45  static Double_t DistFromInsideS(const Double_t *point, const Double_t *dir, Double_t rmin, Double_t rmax, Double_t dz);
46  virtual Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact=1,
47  Double_t step=TGeoShape::Big(), Double_t *safe=0) const;
48  virtual void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const;
49  static Double_t DistFromOutsideS(const Double_t *point, const Double_t *dir, Double_t rmin, Double_t rmax, Double_t dz);
50  virtual Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1,
51  Double_t step=TGeoShape::Big(), Double_t *safe=0) const;
52  virtual void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const;
53  static void DistToTube(Double_t rsq, Double_t nsq, Double_t rdotn, Double_t radius, Double_t &b, Double_t &delta);
54  virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
55  virtual TGeoVolume *Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv,
56  Double_t start, Double_t step);
57  virtual const char *GetAxisName(Int_t iaxis) const;
58  virtual Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const;
59  virtual void GetBoundingCylinder(Double_t *param) const;
60  virtual const TBuffer3D &GetBuffer3D(Int_t reqSections, Bool_t localFrame) const;
61  virtual Int_t GetByteCount() const {return 48;}
62  virtual Bool_t GetPointsOnSegments(Int_t npoints, Double_t *array) const;
63  virtual TGeoShape *GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const;
64  virtual void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const;
65  virtual Int_t GetNmeshVertices() const;
66  virtual Double_t GetRmin() const {return fRmin;}
67  virtual Double_t GetRmax() const {return fRmax;}
68  virtual Double_t GetDz() const {return fDz;}
69  Bool_t HasRmin() const {return (fRmin>0)?kTRUE:kFALSE;}
70  virtual void InspectShape() const;
71  virtual Bool_t IsCylType() const {return kTRUE;}
72  virtual TBuffer3D *MakeBuffer3D() const;
73  virtual Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const;
74  virtual void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const;
75  static Double_t SafetyS(const Double_t *point, Bool_t in, Double_t rmin, Double_t rmax, Double_t dz, Int_t skipz=0);
76  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
77  void SetTubeDimensions(Double_t rmin, Double_t rmax, Double_t dz);
78  virtual void SetDimensions(Double_t *param);
79  virtual void SetPoints(Double_t *points) const;
80  virtual void SetPoints(Float_t *points) const;
81  virtual void SetSegsAndPols(TBuffer3D &buff) const;
82  virtual void Sizeof3D() const;
83 
84  ClassDef(TGeoTube, 1) // cylindrical tube class
85 
86 };
87 
88 class TGeoTubeSeg : public TGeoTube
89 {
90 protected:
91  // data members
92  Double_t fPhi1; // first phi limit
93  Double_t fPhi2; // second phi limit
94  // Transient trigonometric data
95  Double_t fS1; //!sin(phi1)
96  Double_t fC1; //!cos(phi1)
97  Double_t fS2; //!sin(phi2)
98  Double_t fC2; //!cos(phi2)
99  Double_t fSm; //!sin(0.5*(phi1+phi2))
100  Double_t fCm; //!cos(0.5*(phi1+phi2))
101  Double_t fCdfi; //!cos(0.5*(phi1-phi2))
102 
103  void InitTrigonometry();
104 
105 public:
106  // constructors
107  TGeoTubeSeg();
108  TGeoTubeSeg(Double_t rmin, Double_t rmax, Double_t dz,
109  Double_t phi1, Double_t phi2);
110  TGeoTubeSeg(const char * name, Double_t rmin, Double_t rmax, Double_t dz,
111  Double_t phi1, Double_t phi2);
112  TGeoTubeSeg(Double_t *params);
113  // destructor
114  virtual ~TGeoTubeSeg();
115  // methods
116  virtual void AfterStreamer();
117  virtual Double_t Capacity() const;
118  static Double_t Capacity(Double_t rmin, Double_t rmax, Double_t dz, Double_t phi1, Double_t phi2);
119  virtual void ComputeBBox();
120  virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm);
121  virtual void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize);
122  static void ComputeNormalS(const Double_t *point, const Double_t *dir, Double_t *norm,
123  Double_t rmin, Double_t rmax, Double_t dz,
125  virtual Bool_t Contains(const Double_t *point) const;
126  virtual void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const;
127  virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
128  static Double_t DistFromInsideS(const Double_t *point, const Double_t *dir,Double_t rmin, Double_t rmax, Double_t dz,
129  Double_t c1, Double_t s1, Double_t c2, Double_t s2, Double_t cm, Double_t sm, Double_t cdfi);
130  virtual Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact=1,
131  Double_t step=TGeoShape::Big(), Double_t *safe=0) const;
132  virtual void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const;
133  static Double_t DistFromOutsideS(const Double_t *point, const Double_t *dir, Double_t rmin, Double_t rmax, Double_t dz,
134  Double_t c1, Double_t s1, Double_t c2, Double_t s2, Double_t cm, Double_t sm, Double_t cdfi);
135  virtual Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1,
136  Double_t step=TGeoShape::Big(), Double_t *safe=0) const;
137  virtual void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const;
138  virtual TGeoVolume *Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv,
139  Double_t start, Double_t step);
140  virtual Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const;
141  virtual void GetBoundingCylinder(Double_t *param) const;
142  virtual const TBuffer3D &GetBuffer3D(Int_t reqSections, Bool_t localFrame) const;
143  virtual Int_t GetByteCount() const {return 56;}
144  virtual Bool_t GetPointsOnSegments(Int_t npoints, Double_t *array) const;
145  virtual TGeoShape *GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const;
146  virtual Int_t GetNmeshVertices() const;
147  virtual void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const;
148  Double_t GetPhi1() const {return fPhi1;}
149  Double_t GetPhi2() const {return fPhi2;}
150  virtual void InspectShape() const;
151  virtual TBuffer3D *MakeBuffer3D() const;
152  virtual Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const;
153  virtual void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const;
154  static Double_t SafetyS(const Double_t *point, Bool_t in, Double_t rmin, Double_t rmax, Double_t dz,
155  Double_t phi1, Double_t phi2, Int_t skipz=0);
156  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
157  void SetTubsDimensions(Double_t rmin, Double_t rmax, Double_t dz,
158  Double_t phi1, Double_t phi2);
159  virtual void SetDimensions(Double_t *param);
160  virtual void SetPoints(Double_t *points) const;
161  virtual void SetPoints(Float_t *points) const;
162  virtual void SetSegsAndPols(TBuffer3D &buff) const;
163  virtual void Sizeof3D() const;
164 
165  ClassDef(TGeoTubeSeg, 1) // cylindrical tube segment class
166 };
167 
168 class TGeoCtub : public TGeoTubeSeg
169 {
170 protected:
171  // data members
172  Double_t fNlow[3]; // normal to lower cut plane
173  Double_t fNhigh[3]; // normal to higher cut plane
174 
175 public:
176  // constructors
177  TGeoCtub();
178  TGeoCtub(Double_t rmin, Double_t rmax, Double_t dz, Double_t phi1, Double_t phi2,
179  Double_t lx, Double_t ly, Double_t lz, Double_t tx, Double_t ty, Double_t tz);
180  TGeoCtub(const char *name, 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(Double_t *params);
183  // destructor
184  virtual ~TGeoCtub();
185  // methods
186  virtual Double_t Capacity() const;
187  virtual void ComputeBBox();
188  virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm);
189  virtual void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize);
190  virtual Bool_t Contains(const Double_t *point) const;
191  virtual void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const;
192  virtual Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact=1,
193  Double_t step=TGeoShape::Big(), Double_t *safe=0) const;
194  virtual void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const;
195  virtual Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1,
196  Double_t step=TGeoShape::Big(), Double_t *safe=0) const;
197  virtual void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const;
198  virtual TGeoVolume *Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv,
199  Double_t start, Double_t step);
200  virtual Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const;
201  virtual const TBuffer3D &GetBuffer3D(Int_t reqSections, Bool_t localFrame) const;
202  virtual Int_t GetByteCount() const {return 98;}
203  virtual Bool_t GetPointsOnSegments(Int_t npoints, Double_t *array) const;
204  virtual TGeoShape *GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const;
205  virtual void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const;
206  virtual Int_t GetNmeshVertices() const;
207  const Double_t *GetNlow() const {return &fNlow[0];}
208  const Double_t *GetNhigh() const {return &fNhigh[0];}
209  Double_t GetZcoord(Double_t xc, Double_t yc, Double_t zc) const;
210  virtual void InspectShape() const;
211  virtual Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const;
212  virtual void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const;
213  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
214  void SetCtubDimensions(Double_t rmin, Double_t rmax, Double_t dz,
215  Double_t phi1, Double_t phi2, Double_t lx, Double_t ly, Double_t lz,
216  Double_t tx, Double_t ty, Double_t tz);
217  virtual void SetDimensions(Double_t *param);
218  virtual void SetPoints(Double_t *points) const;
219  virtual void SetPoints(Float_t *points) const;
220 
221  ClassDef(TGeoCtub, 1) // cut tube segment class
222 };
223 
224 #endif
Double_t GetPhi2() const
Definition: TGeoTube.h:149
virtual Int_t GetByteCount() const
Definition: TGeoTube.h:61
Double_t fCm
sin(0.5*(phi1+phi2))
Definition: TGeoTube.h:100
Cylindrical tube class.
Definition: TGeoTube.h:17
Double_t fPhi2
Definition: TGeoTube.h:93
Double_t fPhi1
Definition: TGeoTube.h:92
virtual TBuffer3D * MakeBuffer3D() const
Creates a TBuffer3D describing this shape.
Definition: TGeoTube.cxx:647
Box class.
Definition: TGeoBBox.h:17
virtual void ComputeBBox()
compute bounding box of the tube
Definition: TGeoTube.cxx:210
Double_t GetPhi1() const
Definition: TGeoTube.h:148
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:95
const char Option_t
Definition: RtypesCore.h:62
Geometrical transformation package.
Definition: TGeoMatrix.h:38
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:48
Double_t fC2
sin(phi2)
Definition: TGeoTube.h:98
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:207
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
Float_t delta
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:67
virtual Int_t GetNmeshVertices() const
Return number of vertices of the mesh representation.
Definition: TGeoTube.cxx:1102
#define ClassDef(name, id)
Definition: Rtypes.h:297
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:69
Double_t fDz
Definition: TGeoTube.h:23
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:96
virtual void AfterStreamer()
Definition: TGeoShape.h:94
Base abstract class for all shapes.
Definition: TGeoShape.h:25
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:17
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:101
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
const Bool_t kFALSE
Definition: RtypesCore.h:92
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:168
TGeoTube()
Default constructor.
Definition: TGeoTube.cxx:128
return c2
Definition: legend2.C:14
virtual Int_t GetByteCount() const
Definition: TGeoTube.h:202
double Double_t
Definition: RtypesCore.h:55
const Double_t * GetNhigh() const
Definition: TGeoTube.h:208
Double_t fS2
cos(phi1)
Definition: TGeoTube.h:97
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:99
virtual Bool_t IsCylType() const
Definition: TGeoTube.h:71
static Double_t Big()
Definition: TGeoShape.h:88
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:21
virtual Double_t GetRmin() const
Definition: TGeoTube.h:66
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
virtual ~TGeoTube()
destructor
Definition: TGeoTube.cxx:186
const Bool_t kTRUE
Definition: RtypesCore.h:91
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:68
Double_t fRmax
Definition: TGeoTube.h:22
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:143
A phi segment of a tube.
Definition: TGeoTube.h:88