Geant4  10.01
UCons.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 // UCons
12 //
13 // Class description:
14 //
15 // A UCons is, in the general case, a Phi segment of a cone, with
16 // half-length fDz, inner and outer radii specified at -fDz and +fDz.
17 // The Phi segment is described by a starting fSPhi angle, and the
18 // +fDPhi delta angle for the shape.
19 // If the delta angle is >=2*UUtils::kPi, the shape is treated as
20 // continuous in Phi
21 //
22 // Member Data:
23 //
24 // fRmin1 inside radius at -fDz
25 // fRmin2 inside radius at +fDz
26 // fRmax1 outside radius at -fDz
27 // fRmax2 outside radius at +fDz
28 // fDz half length in z
29 //
30 // fSPhi starting angle of the segment in radians
31 // fDPhi delta angle of the segment in radians
32 //
33 // fPhiFullCone Boolean variable used for indicate the Phi Section
34 //
35 // Note:
36 // Internally fSPhi & fDPhi are adjusted so that fDPhi<=2PI,
37 // and fDPhi+fSPhi<=2PI. This enables simpler comparisons to be
38 // made with (say) Phi of a point.
39 //
40 // 19.10.12 Marek Gayer
41 // Created from original implementation in Geant4
42 // --------------------------------------------------------------------
43 
44 #ifndef UCons_HH
45 #define UCons_HH
46 
47 #include "VUSolid.hh"
48 
49 class UCons : public VUSolid
50 {
51  public: // with description
52 
53  UCons(const std::string& pName,
54  double pRmin1, double pRmax1,
55  double pRmin2, double pRmax2,
56  double pDz,
57  double pSPhi, double pDPhi);
58  //
59  // Constructs a cone with the given name and dimensions
60 
61  ~UCons() ;
62  //
63  // Destructor
64 
65  // Accessors
66 
67  inline double GetInnerRadiusMinusZ() const;
68  inline double GetOuterRadiusMinusZ() const;
69  inline double GetInnerRadiusPlusZ() const;
70  inline double GetOuterRadiusPlusZ() const;
71  inline double GetZHalfLength() const;
72  inline double GetStartPhiAngle() const;
73  inline double GetDeltaPhiAngle() const;
74 
75  // Modifiers
76 
77  inline void SetInnerRadiusMinusZ(double Rmin1);
78  inline void SetOuterRadiusMinusZ(double Rmax1);
79  inline void SetInnerRadiusPlusZ(double Rmin2);
80  inline void SetOuterRadiusPlusZ(double Rmax2);
81  inline void SetZHalfLength(double newDz);
82  inline void SetStartPhiAngle(double newSPhi, bool trig = true);
83  inline void SetDeltaPhiAngle(double newDPhi);
84 
85  // Other methods for solid
86 
87  inline double Capacity();
88  inline double SurfaceArea();
89 
90  // inline VUSolid::EnumInside Inside( const UVector3& p ) const;
91 
92  bool Normal(const UVector3& p, UVector3& n) const;
93 
94  double DistanceToIn(const UVector3& p, const UVector3& v, double aPstep = UUtils::kInfinity) const;
95 
96  double SafetyFromOutside(const UVector3& p, bool precise = false) const;
97 
98 
99 
100  double DistanceToOut(const UVector3& aPoint,
101  const UVector3& aDirection,
102  UVector3& aNormalVector,
103  bool& aConvex,
104  double aPstep = UUtils::kInfinity) const;
105 
106  double SafetyFromInside(const UVector3& p, bool precise = false) const;
107 
109 
110  UVector3 GetPointOnSurface() const;
111 
112  VUSolid* Clone() const;
113 
114  std::ostream& StreamInfo(std::ostream& os) const;
115 
116 // void Extent (EAxisType aAxis, double &aMin, double &aMax) const;
117  void Extent(UVector3& aMin, UVector3& aMax) const;
118 
119  virtual void GetParametersList(int /*aNumber*/, double* /*aArray*/) const;
120 
121  virtual void ComputeBBox(UBBox* /*aBox*/, bool /*aStore = false*/) {}
122 
123  // Safety used for UPolycone
124 
125  inline double SafetyToPhi(const UVector3& p,
126  const double rho, bool& outside) const;
127  inline double SafetyFromInsideR(const UVector3& p,
128  const double rho,bool) const;
129  inline double SafetyFromOutsideR(const UVector3& p,
130  const double rho,bool) const;
131 
132  inline VUSolid::EnumInside Inside(const UVector3& p) const;
133 
134  public: // without description
135 
136  UCons();
137  //
138  // Fake default constructor for usage restricted to direct object
139  // persistency for clients requiring preallocation of memory for
140  // persistifiable objects.
141 
142  UCons(const UCons& rhs);
143  UCons& operator=(const UCons& rhs);
144  // Copy constructor and assignment operator.
145 
146  // Old access functions
147 
148  inline double GetRmin1() const;
149  inline double GetRmax1() const;
150  inline double GetRmin2() const;
151  inline double GetRmax2() const;
152  inline double GetDz() const;
153  inline double GetSPhi() const;
154  inline double GetDPhi() const;
155 
156  private:
157 
159 
160  inline void Initialize();
161  //
162  // Reset relevant values to zero
163 
164  inline void CheckSPhiAngle(double sPhi);
165  inline void CheckDPhiAngle(double dPhi);
166  inline void CheckPhiAngles(double sPhi, double dPhi);
167  //
168  // Reset relevant flags and angle values
169 
170  inline void InitializeTrigonometry();
171  //
172  // Recompute relevant trigonometric values and cache them
173 
174  UVector3 ApproxSurfaceNormal(const UVector3& p) const;
175  //
176  // Algorithm for SurfaceNormal() following the original
177  // specification for points not on the surface
178 
179  private:
180 
181  // Used by distanceToOut
182  //
184 
185  // used by normal
186  //
188 
190  //
191  // Radial and angular tolerances
192 
194  //
195  // Radial and angular dimensions
196 
199  //
200  // Cached trigonometric values
201 
203  //
204  // Flag for identification of section or full cone
205 
207 };
208 
209 #include "UCons.icc"
210 
211 #endif
double SafetyToPhi(const UVector3 &p, const double rho, bool &outside) const
void SetZHalfLength(double newDz)
double GetRmin1() const
double GetDPhi() const
double sinSPhi
Definition: UCons.hh:197
bool fPhiFullCone
Definition: UCons.hh:202
virtual void ComputeBBox(UBBox *, bool)
Definition: UCons.hh:121
VUSolid::EnumInside Inside(const UVector3 &p) const
double Capacity()
void Initialize()
double GetRmax2() const
void SetOuterRadiusMinusZ(double Rmax1)
UGeometryType GetEntityType() const
Definition: UCons.cc:2044
double fSPhi
Definition: UCons.hh:193
std::ostream & StreamInfo(std::ostream &os) const
Definition: UCons.cc:2063
double DistanceToIn(const UVector3 &p, const UVector3 &v, double aPstep=UUtils::kInfinity) const
Definition: UCons.cc:440
UCons & operator=(const UCons &rhs)
Definition: UCons.cc:130
double cosHDPhiOT
Definition: UCons.hh:197
void InitializeTrigonometry()
~UCons()
Definition: UCons.cc:106
double secRMax
Definition: UCons.hh:206
double cosCPhi
Definition: UCons.hh:197
double SafetyFromInsideR(const UVector3 &p, const double rho, bool) const
double SafetyFromOutsideR(const UVector3 &p, const double rho, bool) const
double GetOuterRadiusPlusZ() const
double GetSPhi() const
double SurfaceArea()
VUSolid * Clone() const
Definition: UCons.cc:2053
double SafetyFromInside(const UVector3 &p, bool precise=false) const
Definition: UCons.cc:1995
Definition: UCons.hh:49
double tanRMin
Definition: UCons.hh:206
void SetDeltaPhiAngle(double newDPhi)
ESide
Definition: UCons.hh:183
double tanRMax
Definition: UCons.hh:206
static const double kInfinity
Definition: UUtils.hh:53
double kAngTolerance
Definition: UCons.hh:189
double GetDz() const
double GetStartPhiAngle() const
bool Normal(const UVector3 &p, UVector3 &n) const
Definition: UCons.cc:174
double GetZHalfLength() const
double sinCPhi
Definition: UCons.hh:197
double fDPhi
Definition: UCons.hh:193
ENorm
Definition: UCons.hh:187
double fRmin2
Definition: UCons.hh:193
EnumInside
Definition: VUSolid.hh:23
const G4int n
double sinEPhi
Definition: UCons.hh:197
double fSurfaceArea
Definition: UCons.hh:158
double cosSPhi
Definition: UCons.hh:197
double GetInnerRadiusPlusZ() const
double fRmax1
Definition: UCons.hh:193
double GetOuterRadiusMinusZ() const
double fCubicVolume
Definition: UCons.hh:158
void Extent(UVector3 &aMin, UVector3 &aMax) const
Definition: UCons.cc:2185
double kRadTolerance
Definition: UCons.hh:189
virtual void GetParametersList(int, double *) const
Definition: UCons.cc:2192
double SafetyFromOutside(const UVector3 &p, bool precise=false) const
Definition: UCons.cc:1259
double GetRmax1() const
double fDz
Definition: UCons.hh:193
void CheckPhiAngles(double sPhi, double dPhi)
void SetInnerRadiusPlusZ(double Rmin2)
void CheckSPhiAngle(double sPhi)
double fRmin1
Definition: UCons.hh:193
double GetDeltaPhiAngle() const
double secRMin
Definition: UCons.hh:206
std::string UGeometryType
Definition: UTypes.hh:39
double GetInnerRadiusMinusZ() const
void SetOuterRadiusPlusZ(double Rmax2)
double cosHDPhiIT
Definition: UCons.hh:197
UCons()
Definition: UCons.cc:92
UVector3 GetPointOnSurface() const
Definition: UCons.cc:2090
void SetInnerRadiusMinusZ(double Rmin1)
UVector3 ApproxSurfaceNormal(const UVector3 &p) const
Definition: UCons.cc:298
void CheckDPhiAngle(double dPhi)
double fRmax2
Definition: UCons.hh:193
double cosEPhi
Definition: UCons.hh:197
double GetRmin2() const
void SetStartPhiAngle(double newSPhi, bool trig=true)
double DistanceToOut(const UVector3 &aPoint, const UVector3 &aDirection, UVector3 &aNormalVector, bool &aConvex, double aPstep=UUtils::kInfinity) const
Definition: UCons.cc:1343