Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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  inline 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, double aPstep = UUtils::kInfinity) const;
90  double SafetyFromInside(const UVector3& p, bool precise = false) const;
91  double DistanceToOut(const UVector3& p, const UVector3& v, UVector3& n, bool& validNorm, double aPstep = UUtils::kInfinity) const;
92  double SafetyFromOutside(const UVector3& p, bool precise = false) const;
93 
95 
97 
98  VUSolid* Clone() const;
99 
100  std::ostream& StreamInfo(std::ostream& os) const;
101 
102 // void Extent (EAxisType aAxis, double &aMin, double &aMax) const;
103  void Extent(UVector3& aMin, UVector3& aMax) const;
104 
105  virtual void GetParametersList(int /*aNumber*/, double* /*aArray*/) const;
106  virtual void ComputeBBox(UBBox* /*aBox*/, bool /*aStore = false*/) {}
107 
108  public: // without description
109 
110  UTubs();
111  //
112  // Fake default constructor for usage restricted to direct object
113  // persistency for clients requiring preallocation of memory for
114  // persistifiable objects.
115 
116  UTubs(const UTubs& rhs);
117  UTubs& operator=(const UTubs& rhs);
118  // Copy constructor and assignment operator.
119 
120  // Older names for access functions
121 
122  inline double GetRMin() const;
123  inline double GetRMax() const;
124  inline double GetDz() const;
125  inline double GetSPhi() const;
126  inline double GetDPhi() const;
127 
128  protected:
129 
130  // UVector3List*
131  // CreateRotatedVertices( const UAffineTransform& pTransform ) const;
132  //
133  // Creates the List of transformed vertices in the format required
134  // for VUSolid:: ClipCrossSection and ClipBetweenSections
135 
136  inline void Initialize();
137  //
138  // Reset relevant values to zero
139 
140  inline void CheckSPhiAngle(double sPhi);
141  inline void CheckDPhiAngle(double dPhi);
142  inline void CheckPhiAngles(double sPhi, double dPhi);
143  //
144  // Reset relevant flags and angle values
145 
146  inline void InitializeTrigonometry();
147  //
148  // Recompute relevant trigonometric values and cache them
149 
150  virtual UVector3 ApproxSurfaceNormal(const UVector3& p) const;
151  //
152  // Algorithm for SurfaceNormal() following the original
153  // specification for points not on the surface
154 
155  protected:
156 
158  // Used by distanceToOut
159  //
161 
162  // Used by normal
163  //
165 
167  //
168  // Radial and angular tolerances
169 
170  double fRMin, fRMax, fDz, fSPhi, fDPhi;
171  //
172  // Radial and angular dimensions
173 
176  //
177  // Cached trigonometric values
178 
180  //
181  // Flag for identification of section or full tube
182 };
183 
184 #include "UTubs.icc"
185 
186 #endif
double fCosSPhiDPhi
Definition: UTubs.hh:174
Definition: UTubs.hh:47
double fCosEPhi
Definition: UTubs.hh:174
double GetRMin() const
double fSinSPhiDPhi
Definition: UTubs.hh:174
double GetStartPhiAngle() const
double fCosHDPhiIT
Definition: UTubs.hh:174
double GetZHalfLength() const
double SafetyFromOutside(const UVector3 &p, bool precise=false) const
Definition: UTubs.cc:1030
double fSPhi
Definition: UTubs.hh:170
double SafetyFromInside(const UVector3 &p, bool precise=false) const
Definition: UTubs.cc:1562
virtual void GetParametersList(int, double *) const
Definition: UTubs.cc:1754
double GetInnerRadius() const
const char * p
Definition: xmltok.h:285
void SetInnerRadius(double newRMin)
VUSolid::EnumInside Inside(const UVector3 &p) const
Definition: UTubs.cc:153
double fSinCPhi
Definition: UTubs.hh:174
void InitializeTrigonometry()
VUSolid * Clone() const
Definition: UTubs.cc:1647
double GetRMax() const
void CheckSPhiAngle(double sPhi)
virtual void ComputeBBox(UBBox *, bool)
Definition: UTubs.hh:106
void CheckDPhiAngle(double dPhi)
double fDPhi
Definition: UTubs.hh:170
void SetOuterRadius(double newRMax)
void CheckPhiAngles(double sPhi, double dPhi)
double fDz
Definition: UTubs.hh:170
double DistanceToOut(const UVector3 &p, const UVector3 &v, UVector3 &n, bool &validNorm, double aPstep=UUtils::kInfinity) const
Definition: UTubs.cc:1109
double GetDeltaPhiAngle() const
UGeometryType GetEntityType() const
Definition: UTubs.cc:1638
double fCosSPhi
Definition: UTubs.hh:174
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 Capacity()
double GetDz() const
double fRMin
Definition: UTubs.hh:170
double fSinSPhi
Definition: UTubs.hh:174
bool fPhiFullTube
Definition: UTubs.hh:179
double kAngTolerance
Definition: UTubs.hh:166
double fCubicVolume
Definition: UTubs.hh:157
ENorm
Definition: UTubs.hh:164
EnumInside
Definition: VUSolid.hh:23
const G4int n
void SetDeltaPhiAngle(double newDPhi)
UVector3 GetPointOnSurface() const
Definition: UTubs.cc:1679
void Extent(UVector3 &aMin, UVector3 &aMax) const
Definition: UTubs.cc:1748
virtual ~UTubs()
Definition: UTubs.cc:81
std::ostream & StreamInfo(std::ostream &os) const
Definition: UTubs.cc:1656
double fRMax
Definition: UTubs.hh:170
double SurfaceArea()
void SetStartPhiAngle(double newSPhi, bool trig=true)
double GetOuterRadius() const
std::string UGeometryType
Definition: UTypes.hh:70
double kRadTolerance
Definition: UTubs.hh:166
UTubs()
Definition: UTubs.cc:66
ESide
Definition: UTubs.hh:160
double fCosCPhi
Definition: UTubs.hh:174
double fSinEPhi
Definition: UTubs.hh:174
void SetZHalfLength(double newDz)
double DistanceToIn(const UVector3 &p, const UVector3 &v, double aPstep=UUtils::kInfinity) const
Definition: UTubs.cc:614
double GetSPhi() const
double fSurfaceArea
Definition: UTubs.hh:157
void Initialize()
double fCosHDPhiOT
Definition: UTubs.hh:174