Logo ROOT   6.14/05
Reference Guide
TGeoCone.h
Go to the documentation of this file.
1 // @(#)root/geom:$Id$
2 // Author: Andrei Gheata 31/01/02
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_TGeoCone
13 #define ROOT_TGeoCone
14 
15 #include "TGeoBBox.h"
16 
17 class TGeoCone : public TGeoBBox
18 {
19 protected :
20 // data members
21  Double_t fDz; // half length
22  Double_t fRmin1; // inner radius at -dz
23  Double_t fRmax1; // outer radius at -dz
24  Double_t fRmin2; // inner radius at +dz
25  Double_t fRmax2; // outer radius at +dz
26 // methods
27 public:
28  // constructors
29  TGeoCone();
30  TGeoCone(Double_t dz, Double_t rmin1, Double_t rmax1,
31  Double_t rmin2, Double_t rmax2);
32  TGeoCone(const char *name, Double_t dz, Double_t rmin1, Double_t rmax1,
33  Double_t rmin2, Double_t rmax2);
34  TGeoCone(Double_t *params);
35  // destructor
36  virtual ~TGeoCone();
37  // methods
38 
39  virtual Double_t Capacity() const;
40  static Double_t Capacity(Double_t dz, Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2);
41  virtual void ComputeBBox();
42  virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm);
43  virtual void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize);
44  static void ComputeNormalS(const Double_t *point, const Double_t *dir, Double_t *norm,
45  Double_t dz, Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2);
46  virtual Bool_t Contains(const Double_t *point) const;
47  virtual void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const;
48  virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
49  static void DistToCone(const Double_t *point, const Double_t *dir, Double_t dz, Double_t r1, Double_t r2, Double_t &b, Double_t &delta);
50  static Double_t DistFromInsideS(const Double_t *point, const Double_t *dir, Double_t dz,
51  Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2);
52  virtual Double_t DistFromInside(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 DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const;
55  static Double_t DistFromOutsideS(const Double_t *point, const Double_t *dir, Double_t dz,
56  Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2);
57  virtual Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1,
58  Double_t step=TGeoShape::Big(), Double_t *safe=0) const;
59  virtual void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const;
60  virtual TGeoVolume *Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv,
61  Double_t start, Double_t step);
62 
63  virtual const char *GetAxisName(Int_t iaxis) const;
64  virtual Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const;
65  virtual void GetBoundingCylinder(Double_t *param) const;
66  virtual Int_t GetByteCount() const {return 56;}
67  virtual const TBuffer3D &GetBuffer3D(Int_t reqSections, Bool_t localFrame) const;
68  virtual Double_t GetDz() const {return fDz;}
69  virtual TGeoShape *GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const;
70  virtual void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const;
71  virtual Int_t GetNmeshVertices() const;
72  virtual Bool_t GetPointsOnSegments(Int_t npoints, Double_t *array) const;
73  virtual Double_t GetRmin1() const {return fRmin1;}
74  virtual Double_t GetRmax1() const {return fRmax1;}
75  virtual Double_t GetRmin2() const {return fRmin2;}
76  virtual Double_t GetRmax2() const {return fRmax2;}
77 
78  virtual void InspectShape() const;
79  virtual Bool_t IsCylType() const {return kTRUE;}
80  virtual TBuffer3D *MakeBuffer3D() const;
81  virtual Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const;
82  virtual void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const;
83  static Double_t SafetyS(const Double_t *point, Bool_t in, Double_t dz, Double_t rmin1, Double_t rmax1,
84  Double_t rmin2, Double_t rmax2, Int_t skipz=0);
85  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
86  void SetConeDimensions(Double_t dz, Double_t rmin1, Double_t rmax1,
87  Double_t rmin2, Double_t rmax2);
88  virtual void SetDimensions(Double_t *param);
89  virtual void SetPoints(Double_t *points) const;
90  virtual void SetPoints(Float_t *points) const;
91  virtual void SetSegsAndPols(TBuffer3D &buffer) const;
92  virtual void Sizeof3D() const;
93 
94  ClassDef(TGeoCone, 1) // conical tube class
95 
96 };
97 
98 class TGeoConeSeg : public TGeoCone
99 {
100 protected:
101  // data members
102  Double_t fPhi1; // first phi limit
103  Double_t fPhi2; // second phi limit
104  // Transient trigonometric data
105  Double_t fS1; // sin(phi1)
106  Double_t fC1; // cos(phi1)
107  Double_t fS2; // sin(phi2)
108  Double_t fC2; // cos(phi2)
109  Double_t fSm; // sin(0.5*(phi1+phi2))
110  Double_t fCm; // cos(0.5*(phi1+phi2))
111  Double_t fCdfi; // cos(0.5*(phi1-phi2))
112 
113  void InitTrigonometry();
114 
115 public:
116  // constructors
117  TGeoConeSeg();
118  TGeoConeSeg(Double_t dz, Double_t rmin1, Double_t rmax1,
119  Double_t rmin2, Double_t rmax2, Double_t phi1, Double_t phi2);
120  TGeoConeSeg(const char *name, Double_t dz, Double_t rmin1, Double_t rmax1,
121  Double_t rmin2, Double_t rmax2, Double_t phi1, Double_t phi2);
122  TGeoConeSeg(Double_t *params);
123  // destructor
124  virtual ~TGeoConeSeg();
125  // methods
126  virtual void AfterStreamer();
127  virtual Double_t Capacity() const;
128  static Double_t Capacity(Double_t dz, Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2, Double_t phi1, Double_t phi2);
129  virtual void ComputeBBox();
130  virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm);
131  virtual void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize);
132  static void ComputeNormalS(const Double_t *point, const Double_t *dir, Double_t *norm,
133  Double_t dz, Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2,
135  virtual Bool_t Contains(const Double_t *point) const;
136  virtual void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const;
137 
138  virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
139  static Double_t DistToCons(const Double_t *point, const Double_t *dir, Double_t r1, Double_t z1, Double_t r2, Double_t z2, Double_t phi1, Double_t phi2);
140  static Double_t DistFromInsideS(const Double_t *point, const Double_t *dir, Double_t dz, Double_t rmin1, Double_t rmax1,
142  virtual Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact=1,
143  Double_t step=TGeoShape::Big(), Double_t *safe=0) const;
144  virtual void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const;
145  static Double_t DistFromOutsideS(const Double_t *point, const Double_t *dir, Double_t dz, Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2,
147  virtual Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1,
148  Double_t step=TGeoShape::Big(), Double_t *safe=0) const;
149  virtual void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const;
150  virtual TGeoVolume *Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv,
151  Double_t start, Double_t step);
152  virtual Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const;
153  virtual void GetBoundingCylinder(Double_t *param) const;
154  virtual const TBuffer3D &GetBuffer3D(Int_t reqSections, Bool_t localFrame) const;
155  virtual Int_t GetByteCount() const {return 64;}
156  virtual TGeoShape *GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const;
157  virtual void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const;
158  virtual Int_t GetNmeshVertices() const;
159  virtual Bool_t GetPointsOnSegments(Int_t npoints, Double_t *array) const;
160  Double_t GetPhi1() const {return fPhi1;}
161  Double_t GetPhi2() const {return fPhi2;}
162  virtual void InspectShape() const;
163  virtual TBuffer3D *MakeBuffer3D() const;
164  virtual Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const;
165  virtual void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const;
166  static Double_t SafetyS(const Double_t *point, Bool_t in, Double_t dz, Double_t rmin1, Double_t rmax1,
167  Double_t rmin2, Double_t rmax2, Double_t phi1, Double_t phi2, Int_t skipz=0);
168  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
169  void SetConsDimensions(Double_t dz, Double_t rmin1, Double_t rmax1,
170  Double_t rmin2, Double_t rmax2, Double_t phi1, Double_t phi2);
171  virtual void SetDimensions(Double_t *param);
172  virtual void SetPoints(Double_t *points) const;
173  virtual void SetPoints(Float_t *points) const;
174  virtual void SetSegsAndPols(TBuffer3D &buffer) const;
175  virtual void Sizeof3D() const;
176 
177  ClassDef(TGeoConeSeg, 2) // conical tube segment class
178 };
179 
180 #endif
static Double_t DistFromOutsideS(const Double_t *point, const Double_t *dir, Double_t dz, Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2)
Compute distance from outside point to surface of the tube Boundary safe algorithm.
Definition: TGeoCone.cxx:362
static Double_t DistFromInsideS(const Double_t *point, const Double_t *dir, Double_t dz, Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2)
Compute distance from inside point to surface of the cone (static) Boundary safe algorithm.
Definition: TGeoCone.cxx:275
Box class.
Definition: TGeoBBox.h:17
virtual Int_t GetByteCount() const
Definition: TGeoCone.h:66
float Float_t
Definition: RtypesCore.h:53
Double_t fSm
Definition: TGeoCone.h:109
const char Option_t
Definition: RtypesCore.h:62
Geometrical transformation package.
Definition: TGeoMatrix.h:40
return c1
Definition: legend1.C:41
virtual Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const
Get range of shape for a given axis.
Definition: TGeoCone.cxx:635
Double_t fS1
Definition: TGeoCone.h:105
virtual Int_t GetNmeshVertices() const
Return number of vertices of the mesh representation.
Definition: TGeoCone.cxx:1102
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition: TGeoVolume.h:48
virtual void ComputeBBox()
compute bounding box of the sphere
Definition: TGeoCone.cxx:171
static Double_t SafetyS(const Double_t *point, Bool_t in, Double_t dz, Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2, Int_t skipz=0)
computes the closest distance from given point to this shape, according to option.
Definition: TGeoCone.cxx:885
Double_t fRmin1
Definition: TGeoCone.h:22
static constexpr double cm
virtual void SetPoints(Double_t *points) const
Create cone mesh points.
Definition: TGeoCone.cxx:1003
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: TGeoCone.cxx:1172
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
Double_t GetPhi1() const
Definition: TGeoCone.h:160
virtual Double_t GetRmin2() const
Definition: TGeoCone.h:75
Double_t fRmax1
Definition: TGeoCone.h:23
virtual Double_t Capacity() const
Computes capacity of the shape in [length^3].
Definition: TGeoCone.cxx:146
Double_t fC2
Definition: TGeoCone.h:108
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: TGeoCone.cxx:1091
virtual void SetDimensions(Double_t *param)
Set cone dimensions from an array.
Definition: TGeoCone.cxx:990
Double_t fPhi1
Definition: TGeoCone.h:102
Double_t GetPhi2() const
Definition: TGeoCone.h:161
static void ComputeNormalS(const Double_t *point, const Double_t *dir, Double_t *norm, Double_t dz, Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2)
Compute normal to closest surface from POINT.
Definition: TGeoCone.cxx:224
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: TGeoCone.cxx:1164
#define ClassDef(name, id)
Definition: Rtypes.h:320
A phi segment of a conical tube.
Definition: TGeoCone.h:98
virtual void InspectShape() const
print shape parameters
Definition: TGeoCone.cxx:750
Double_t fC1
Definition: TGeoCone.h:106
TGeoCone()
Default constructor.
Definition: TGeoCone.cxx:85
Double_t fRmin2
Definition: TGeoCone.h:24
virtual Bool_t Contains(const Double_t *point) const
test if point is inside this cone
Definition: TGeoCone.cxx:261
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: TGeoCone.cxx:1190
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: TGeoCone.cxx:672
Double_t fRmax2
Definition: TGeoCone.h:25
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
Definition: TGeoCone.cxx:920
Double_t fS2
Definition: TGeoCone.h:107
point * points
Definition: X3DBuffer.c:20
virtual Double_t GetDz() const
Definition: TGeoCone.h:68
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: TGeoCone.cxx:703
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
compute closest distance from point px,py to each corner
Definition: TGeoCone.cxx:546
virtual Double_t GetRmin1() const
Definition: TGeoCone.h:73
virtual void AfterStreamer()
Definition: TGeoShape.h:94
Base abstract class for all shapes.
Definition: TGeoShape.h:25
virtual TBuffer3D * MakeBuffer3D() const
Creates a TBuffer3D describing this shape.
Definition: TGeoCone.cxx:766
static void DistToCone(const Double_t *point, const Double_t *dir, Double_t dz, Double_t r1, Double_t r2, Double_t &b, Double_t &delta)
Static method to compute distance to a conical surface with :
Definition: TGeoCone.cxx:512
virtual Double_t GetRmax1() const
Definition: TGeoCone.h:74
virtual Int_t GetByteCount() const
Definition: TGeoCone.h:155
virtual void GetBoundingCylinder(Double_t *param) const
Fill vector param[4] with the bounding cylinder parameters.
Definition: TGeoCone.cxx:658
Generic 3D primitive description class.
Definition: TBuffer3D.h:17
#define s1(x)
Definition: RSha256.hxx: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 specified by dirs. Store output in dist...
Definition: TGeoCone.cxx:1180
virtual TGeoVolume * Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step)
Divide this cone shape belonging to volume "voldiv" into ndiv volumes called divname, from start position with the given step.
Definition: TGeoCone.cxx:561
virtual void SetSegsAndPols(TBuffer3D &buffer) const
Fill TBuffer3D structure for segments and polygons.
Definition: TGeoCone.cxx:788
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
Definition: TGeoCone.cxx:492
return c2
Definition: legend2.C:14
double Double_t
Definition: RtypesCore.h:55
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: TGeoCone.cxx:1154
Double_t fDz
Definition: TGeoCone.h:21
Conical tube class.
Definition: TGeoCone.h:17
static Double_t Big()
Definition: TGeoShape.h:88
virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm)
Compute normal to closest surface from POINT.
Definition: TGeoCone.cxx:181
virtual Double_t GetRmax2() const
Definition: TGeoCone.h:76
virtual const char * GetAxisName(Int_t iaxis) const
Returns name of axis IAXIS.
Definition: TGeoCone.cxx:618
virtual ~TGeoCone()
destructor
Definition: TGeoCone.cxx:164
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 cone Boundary safe algorithm.
Definition: TGeoCone.cxx:347
void SetConeDimensions(Double_t dz, Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2)
Set cone dimensions.
Definition: TGeoCone.cxx:936
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 Bool_t IsCylType() const
Definition: TGeoCone.h:79
Double_t fCdfi
Definition: TGeoCone.h:111
virtual const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const
Fills a static 3D buffer and returns a reference.
Definition: TGeoCone.cxx:1119
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: TGeoCone.cxx:868
Double_t fPhi2
Definition: TGeoCone.h:103
Double_t fCm
Definition: TGeoCone.h:110
const Bool_t kTRUE
Definition: RtypesCore.h:87
char name[80]
Definition: TGX11.cxx:109
virtual void Sizeof3D() const
Fill size of this 3-D object.
Definition: TGeoCone.cxx:1112