Geant4_10
G4Hype.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // $Id: G4Hype.hh 72937 2013-08-14 13:20:38Z gcosmo $
28 // $Original: G4Hype.hh,v 1.0 1998/06/09 16:57:50 safai Exp $
29 //
30 //
31 // --------------------------------------------------------------------
32 // GEANT 4 class header file
33 //
34 //
35 // G4Hype
36 //
37 // Class description:
38 //
39 // This class implements a tube with hyperbolic profile.
40 //
41 // It describes an hyperbolic volume with curved sides parallel to
42 // the z-axis. The solid has a specified half-length along the z axis,
43 // about which it is centered, and a given minimum and maximum radius.
44 // A minimum radius of 0 signifies a filled Hype (with hyperbolical
45 // inner surface). To have a filled Hype the user must specify
46 // inner radius = 0 AND inner stereo angle = 0.
47 //
48 // The inner and outer hyperbolical surfaces can have different
49 // stereo angles. A stereo angle of 0 gives a cylindrical surface.
50 
51 // Authors:
52 // Ernesto Lamanna (Ernesto.Lamanna@roma1.infn.it) &
53 // Francesco Safai Tehrani (Francesco.SafaiTehrani@roma1.infn.it)
54 // Rome, INFN & University of Rome "La Sapienza", 9 June 1998.
55 //
56 // --------------------------------------------------------------------
57 #ifndef G4HYPE_HH
58 #define G4HYPE_HH
59 
60 #include "G4VSolid.hh"
61 #include "G4ThreeVector.hh"
62 
63 class G4SolidExtentList;
64 class G4ClippablePolygon;
65 
66 class G4Hype : public G4VSolid
67 {
68  public: // with description
69 
70  G4Hype(const G4String& pName,
71  G4double newInnerRadius,
72  G4double newOuterRadius,
73  G4double newInnerStereo,
74  G4double newOuterStereo,
75  G4double newHalfLenZ);
76 
77  virtual ~G4Hype();
78 
80  const G4int n,
81  const G4VPhysicalVolume* pRep);
82 
83  G4bool CalculateExtent(const EAxis pAxis,
84  const G4VoxelLimits& pVoxelLimit,
85  const G4AffineTransform& pTransform,
86  G4double& pmin, G4double& pmax) const;
87 
88  inline G4double GetInnerRadius () const;
89  inline G4double GetOuterRadius () const;
90  inline G4double GetZHalfLength () const;
91  inline G4double GetInnerStereo () const;
92  inline G4double GetOuterStereo () const;
93 
94  inline void SetInnerRadius (G4double newIRad);
95  inline void SetOuterRadius (G4double newORad);
96  inline void SetZHalfLength (G4double newHLZ);
97  inline void SetInnerStereo (G4double newISte);
98  inline void SetOuterStereo (G4double newOSte);
99 
100  EInside Inside(const G4ThreeVector& p) const;
101 
102  G4ThreeVector SurfaceNormal(const G4ThreeVector& p) const;
103 
104  G4double DistanceToIn(const G4ThreeVector& p, const G4ThreeVector& v) const;
105  G4double DistanceToIn(const G4ThreeVector& p) const;
107  const G4bool calcNorm=G4bool(false),
108  G4bool *validNorm=0, G4ThreeVector *n=0) const;
109  G4double DistanceToOut(const G4ThreeVector& p) const;
110 
112 
113  G4VSolid* Clone() const;
114 
115  std::ostream& StreamInfo(std::ostream& os) const;
116 
119 
121 
122  void DescribeYourselfTo (G4VGraphicsScene& scene) const;
123  G4VisExtent GetExtent () const;
124  G4Polyhedron* CreatePolyhedron () const;
125  G4Polyhedron* GetPolyhedron () const;
126 
127  public: // without description
128 
129  G4Hype(__void__&);
130  // Fake default constructor for usage restricted to direct object
131  // persistency for clients requiring preallocation of memory for
132  // persistifiable objects.
133 
134  G4Hype(const G4Hype& rhs);
135  G4Hype& operator=(const G4Hype& rhs);
136  // Copy constructor and assignment operator.
137 
138  protected: // without description
139 
140  inline G4bool InnerSurfaceExists() const;
141  // whether we have an inner surface or not
142 
144  G4double r0, G4double tanPhi );
146  G4double r0, G4double tan2Phi );
147  // approximate isotropic distance to hyperbolic surface
148 
149  inline G4double HypeInnerRadius2(G4double zVal) const;
150  inline G4double HypeOuterRadius2(G4double zVal) const;
151  // values of hype radius at a given Z
152 
153  static G4int IntersectHype( const G4ThreeVector &p, const G4ThreeVector &v,
154  G4double r2, G4double tan2Phi, G4double s[2] );
155  // intersection with hyperbolic surface
156 
157  static void AddPolyToExtent( const G4ThreeVector &v0,
158  const G4ThreeVector &v1,
159  const G4ThreeVector &w1,
160  const G4ThreeVector &w0,
161  const G4VoxelLimits &voxelLimit,
162  const EAxis axis,
163  G4SolidExtentList &extentList );
164 
165  protected:
166 
172 
173  // precalculated parameters, squared quantities
174 
177  G4double tanInnerStereo2; // squared tan of Inner Stereo angle
178  G4double tanOuterStereo2; // squared tan of Outer Stereo angle
179  G4double innerRadius2; // squared Inner Radius
180  G4double outerRadius2; // squared Outer Radius
181  G4double endInnerRadius2; // squared endcap Inner Radius
182  G4double endOuterRadius2; // squared endcap Outer Radius
183  G4double endInnerRadius; // endcap Inner Radius
184  G4double endOuterRadius; // endcap Outer Radius
185 
186  // Used by distanceToOut
187 
189 
190  private:
191 
192  G4double asinh(G4double arg);
193 
194  private:
195 
196  G4double fCubicVolume;
197  G4double fSurfaceArea;
198 
199  G4double fHalfTol;
200 
201  mutable G4Polyhedron* fpPolyhedron;
202 
203 };
204 
205 #include "G4Hype.icc"
206 
207 #endif
G4double outerStereo
Definition: G4Hype.hh:171
G4double GetCubicVolume()
Definition: G4Hype.cc:1370
G4double outerRadius2
Definition: G4Hype.hh:180
G4double GetOuterStereo() const
G4Hype(const G4String &pName, G4double newInnerRadius, G4double newOuterRadius, G4double newInnerStereo, G4double newOuterStereo, G4double newHalfLenZ)
Definition: G4Hype.cc:68
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const
Definition: G4Hype.cc:593
G4double GetInnerStereo() const
G4double GetInnerRadius() const
G4double GetSurfaceArea()
Definition: G4Hype.cc:1381
G4double innerRadius2
Definition: G4Hype.hh:179
const XML_Char * s
Definition: expat.h:262
G4GeometryType GetEntityType() const
Definition: G4Hype.cc:1352
G4double innerStereo
Definition: G4Hype.hh:170
void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
Definition: G4Hype.cc:202
const char * p
Definition: xmltok.h:285
static G4double ApproxDistInside(G4double pr, G4double pz, G4double r0, G4double tan2Phi)
Definition: G4Hype.cc:1328
G4Polyhedron * CreatePolyhedron() const
Definition: G4Hype.cc:1541
G4double endOuterRadius2
Definition: G4Hype.hh:182
void DescribeYourselfTo(G4VGraphicsScene &scene) const
Definition: G4Hype.cc:1519
G4double tanOuterStereo
Definition: G4Hype.hh:176
int G4int
Definition: G4Types.hh:78
G4bool InnerSurfaceExists() const
virtual ~G4Hype()
Definition: G4Hype.cc:144
G4double HypeOuterRadius2(G4double zVal) const
G4double tanOuterStereo2
Definition: G4Hype.hh:178
G4VSolid * Clone() const
Definition: G4Hype.cc:1361
static G4double ApproxDistOutside(G4double pr, G4double pz, G4double r0, G4double tanPhi)
Definition: G4Hype.cc:1270
Char_t n[5]
G4double tanInnerStereo2
Definition: G4Hype.hh:177
void SetOuterRadius(G4double newORad)
G4double outerRadius
Definition: G4Hype.hh:168
G4double HypeInnerRadius2(G4double zVal) const
Definition: G4Hype.hh:66
G4double endOuterRadius
Definition: G4Hype.hh:184
bool G4bool
Definition: G4Types.hh:79
void SetInnerRadius(G4double newIRad)
G4double GetOuterRadius() const
G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=G4bool(false), G4bool *validNorm=0, G4ThreeVector *n=0) const
Definition: G4Hype.cc:969
G4Hype & operator=(const G4Hype &rhs)
Definition: G4Hype.cc:171
tuple v
Definition: test.py:18
G4double halfLenZ
Definition: G4Hype.hh:169
G4ThreeVector GetPointOnSurface() const
Definition: G4Hype.cc:1416
static void AddPolyToExtent(const G4ThreeVector &v0, const G4ThreeVector &v1, const G4ThreeVector &w1, const G4ThreeVector &w0, const G4VoxelLimits &voxelLimit, const EAxis axis, G4SolidExtentList &extentList)
Definition: G4Hype.cc:477
G4VisExtent GetExtent() const
Definition: G4Hype.cc:1528
static G4int IntersectHype(const G4ThreeVector &p, const G4ThreeVector &v, G4double r2, G4double tan2Phi, G4double s[2])
Definition: G4Hype.cc:1203
EInside
Definition: geomdefs.hh:58
EAxis
Definition: geomdefs.hh:54
G4double tanInnerStereo
Definition: G4Hype.hh:175
EInside Inside(const G4ThreeVector &p) const
Definition: G4Hype.cc:503
void SetZHalfLength(G4double newHLZ)
G4double GetZHalfLength() const
G4double endInnerRadius2
Definition: G4Hype.hh:181
void SetOuterStereo(G4double newOSte)
double G4double
Definition: G4Types.hh:76
G4double innerRadius
Definition: G4Hype.hh:167
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pmin, G4double &pmax) const
Definition: G4Hype.cc:213
G4double endInnerRadius
Definition: G4Hype.hh:183
std::ostream & StreamInfo(std::ostream &os) const
Definition: G4Hype.cc:1392
G4Polyhedron * GetPolyhedron() const
Definition: G4Hype.cc:1551
void SetInnerStereo(G4double newISte)
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const
Definition: G4Hype.cc:547