Geant4  10.01.p01
UTubs.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * This Software is part of the AIDA Unified Solids Library package *
4 // * See: https://aidasoft.web.cern.ch/USolids *
5 // ********************************************************************
6 //
7 // $Id:$
8 //
9 // --------------------------------------------------------------------
10 //
11 // UTubs
12 //
13 // Class description:
14 //
15 // A tube or tube segment with curved sides parallel to
16 // the z-axis. The tube has a specified half-length along
17 // the z-axis, about which it is centered, and a given
18 // minimum and maximum radius. A minimum radius of 0
19 // corresponds to filled tube /cylinder. The tube segment is
20 // specified by starting and delta angles for phi, with 0
21 // being the +x axis, PI/2 the +y axis.
22 // A delta angle of 2PI signifies a complete, unsegmented
23 // tube/cylinder.
24 //
25 // Member Data:
26 //
27 // fRMin Inner radius
28 // fRMax Outer radius
29 // fDz half length in z
30 //
31 // fSPhi The starting phi angle in radians,
32 // adjusted such that fSPhi+fDPhi<=2PI, fSPhi>-2PI
33 //
34 // fDPhi Delta angle of the segment.
35 //
36 // fPhiFullTube Boolean variable used for indicate the Phi Section
37 //
38 // 19.10.12 Marek Gayer
39 // Created from original implementation in Geant4
40 // --------------------------------------------------------------------
41 
42 #ifndef UTUBS_HH
43 #define UTUBS_HH
44 
45 #include "VUSolid.hh"
46 
47 class UTubs : public VUSolid
48 {
49  public: // with description
50 
51  UTubs(const std::string& pName,
52  double pRMin,
53  double pRMax,
54  double pDz,
55  double pSPhi,
56  double pDPhi);
57  //
58  // Constructs a tubs with the given name and dimensions
59 
60  virtual ~UTubs();
61  //
62  // Destructor
63 
64  // Accessors
65 
66  inline double GetInnerRadius() const;
67  inline double GetOuterRadius() const;
68  inline double GetZHalfLength() const;
69  inline double GetStartPhiAngle() const;
70  inline double GetDeltaPhiAngle() const;
71 
72  // Modifiers
73 
74  inline void SetInnerRadius(double newRMin);
75  inline void SetOuterRadius(double newRMax);
76  inline void SetZHalfLength(double newDz);
77  inline void SetStartPhiAngle(double newSPhi, bool trig = true);
78  inline void SetDeltaPhiAngle(double newDPhi);
79 
80  // Methods for solid
81 
82  inline double Capacity();
83  inline double SurfaceArea();
84 
85  VUSolid::EnumInside Inside(const UVector3& p) const;
86 
87  bool Normal(const UVector3& p, UVector3& normal) const;
88 
89  double DistanceToIn(const UVector3& p, const UVector3& v,
90  double aPstep = UUtils::kInfinity) const;
91  double SafetyFromInside(const UVector3& p, bool precise = false) const;
92  double DistanceToOut(const UVector3& p, const UVector3& v, UVector3& n,
93  bool& validNorm, double aPstep=UUtils::kInfinity) const;
94  double SafetyFromOutside(const UVector3& p, bool precise = false ) const;
95 
96  inline double SafetyFromInsideR(const UVector3& p, const double rho,
97  bool precise = false) const;
98  inline double SafetyFromOutsideR(const UVector3& p, const double rho,
99  bool precise = false) const;
101 
102  UVector3 GetPointOnSurface() const;
103 
104  VUSolid* Clone() const;
105 
106  std::ostream& StreamInfo(std::ostream& os) const;
107 
108  void Extent(UVector3& aMin, UVector3& aMax) const;
109 
110  virtual void GetParametersList(int /*aNumber*/, double* /*aArray*/) const;
111  virtual void ComputeBBox(UBBox* /*aBox*/, bool /*aStore = false*/) {}
112 
113  public: // without description
114 
115  UTubs();
116  //
117  // Fake default constructor for usage restricted to direct object
118  // persistency for clients requiring preallocation of memory for
119  // persistifiable objects.
120 
121  UTubs(const UTubs& rhs);
122  UTubs& operator=(const UTubs& rhs);
123  // Copy constructor and assignment operator.
124 
125  // Older names for access functions
126 
127  inline double GetRMin() const;
128  inline double GetRMax() const;
129  inline double GetDz() const;
130  inline double GetSPhi() const;
131  inline double GetDPhi() const;
132 
133  protected:
134 
135  // UVector3List*
136  // CreateRotatedVertices( const UAffineTransform& pTransform ) const;
137  //
138  // Creates the List of transformed vertices in the format required
139  // for VUSolid:: ClipCrossSection and ClipBetweenSections
140 
141  inline void Initialize();
142  //
143  // Reset relevant values to zero
144 
145  inline void CheckSPhiAngle(double sPhi);
146  inline void CheckDPhiAngle(double dPhi);
147  inline void CheckPhiAngles(double sPhi, double dPhi);
148  //
149  // Reset relevant flags and angle values
150 
151  inline void InitializeTrigonometry();
152  //
153  // Recompute relevant trigonometric values and cache them
154 
155  virtual UVector3 ApproxSurfaceNormal(const UVector3& p) const;
156  //
157  // Algorithm for SurfaceNormal() following the original
158  // specification for points not on the surface
159 
160  inline double SafetyToPhi(const UVector3& p, const double rho, bool& outside) const;
161  protected:
162 
164  // Used by distanceToOut
165  //
167 
168  // Used by normal
169  //
171 
173  //
174  // Radial and angular tolerances
175 
176  double fRMin, fRMax, fDz, fSPhi, fDPhi;
177  //
178  // Radial and angular dimensions
179 
182  //
183  // Cached trigonometric values
184 
186  //
187  // Flag for identification of section or full tube
188 };
189 
190 #include "UTubs.icc"
191 
192 #endif
double fCosSPhiDPhi
Definition: UTubs.hh:180
Definition: UTubs.hh:47
double fCosEPhi
Definition: UTubs.hh:180
double GetRMin() const
double fSinSPhiDPhi
Definition: UTubs.hh:180
double GetStartPhiAngle() const
double fCosHDPhiIT
Definition: UTubs.hh:180
double GetZHalfLength() const
double SafetyFromOutside(const UVector3 &p, bool precise=false) const
Definition: UTubs.cc:1030
double fSPhi
Definition: UTubs.hh:176
double SafetyFromInside(const UVector3 &p, bool precise=false) const
Definition: UTubs.cc:1534
virtual void GetParametersList(int, double *) const
Definition: UTubs.cc:1690
double GetInnerRadius() const
void SetInnerRadius(double newRMin)
VUSolid::EnumInside Inside(const UVector3 &p) const
Definition: UTubs.cc:153
double fSinCPhi
Definition: UTubs.hh:180
void InitializeTrigonometry()
VUSolid * Clone() const
Definition: UTubs.cc:1583
double GetRMax() const
void CheckSPhiAngle(double sPhi)
virtual void ComputeBBox(UBBox *, bool)
Definition: UTubs.hh:111
void CheckDPhiAngle(double dPhi)
double fDPhi
Definition: UTubs.hh:176
static double normal(HepRandomEngine *eptr)
Definition: RandPoisson.cc:77
void SetOuterRadius(double newRMax)
void CheckPhiAngles(double sPhi, double dPhi)
double fDz
Definition: UTubs.hh:176
static const double kInfinity
Definition: UUtils.hh:53
double DistanceToOut(const UVector3 &p, const UVector3 &v, UVector3 &n, bool &validNorm, double aPstep=UUtils::kInfinity) const
Definition: UTubs.cc:1095
double GetDeltaPhiAngle() const
UGeometryType GetEntityType() const
Definition: UTubs.cc:1574
double fCosSPhi
Definition: UTubs.hh:180
double GetDPhi() const
bool Normal(const UVector3 &p, UVector3 &normal) const
Definition: UTubs.cc:356
virtual UVector3 ApproxSurfaceNormal(const UVector3 &p) const
Definition: UTubs.cc:473
UTubs & operator=(const UTubs &rhs)
Definition: UTubs.cc:108
double SafetyFromOutsideR(const UVector3 &p, const double rho, bool precise=false) const
double Capacity()
double GetDz() const
double fRMin
Definition: UTubs.hh:176
double fSinSPhi
Definition: UTubs.hh:180
bool fPhiFullTube
Definition: UTubs.hh:185
double kAngTolerance
Definition: UTubs.hh:172
double fCubicVolume
Definition: UTubs.hh:163
ENorm
Definition: UTubs.hh:170
EnumInside
Definition: VUSolid.hh:23
const G4int n
void SetDeltaPhiAngle(double newDPhi)
UVector3 GetPointOnSurface() const
Definition: UTubs.cc:1615
void Extent(UVector3 &aMin, UVector3 &aMax) const
Definition: UTubs.cc:1684
virtual ~UTubs()
Definition: UTubs.cc:81
std::ostream & StreamInfo(std::ostream &os) const
Definition: UTubs.cc:1592
double fRMax
Definition: UTubs.hh:176
double SurfaceArea()
void SetStartPhiAngle(double newSPhi, bool trig=true)
double GetOuterRadius() const
std::string UGeometryType
Definition: UTypes.hh:39
double kRadTolerance
Definition: UTubs.hh:172
UTubs()
Definition: UTubs.cc:66
ESide
Definition: UTubs.hh:166
double fCosCPhi
Definition: UTubs.hh:180
double SafetyToPhi(const UVector3 &p, const double rho, bool &outside) const
double fSinEPhi
Definition: UTubs.hh:180
void SetZHalfLength(double newDz)
double DistanceToIn(const UVector3 &p, const UVector3 &v, double aPstep=UUtils::kInfinity) const
Definition: UTubs.cc:614
double SafetyFromInsideR(const UVector3 &p, const double rho, bool precise=false) const
double GetSPhi() const
double fSurfaceArea
Definition: UTubs.hh:163
void Initialize()
double fCosHDPhiOT
Definition: UTubs.hh:180