Geant4  10.02.p01
G4OTubs.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:$
28 //
29 //
30 // --------------------------------------------------------------------
31 // GEANT 4 class header file
32 //
33 //
34 // G4OTubs
35 //
36 // Class description:
37 //
38 // Temporary copy of original G4Tubs code for use by G4CutTubs.
39 
40 // --------------------------------------------------------------------
41 #ifndef G4OTUBS_HH
42 #define G4OTUBS_HH
43 
44 #include <CLHEP/Units/PhysicalConstants.h>
45 
46 #include "G4CSGSolid.hh"
47 #include "G4Polyhedron.hh"
48 
49 class G4OTubs : public G4CSGSolid
50 {
51  public: // with description
52 
53  G4OTubs( const G4String& pName,
54  G4double pRMin,
55  G4double pRMax,
56  G4double pDz,
57  G4double pSPhi,
58  G4double pDPhi );
59  //
60  // Constructs a tubs with the given name and dimensions
61 
62  virtual ~G4OTubs();
63  //
64  // Destructor
65 
66  // Accessors
67 
68  inline G4double GetInnerRadius () const;
69  inline G4double GetOuterRadius () const;
70  inline G4double GetZHalfLength () const;
71  inline G4double GetStartPhiAngle () const;
72  inline G4double GetDeltaPhiAngle () const;
73 
74  // Modifiers
75 
76  inline void SetInnerRadius (G4double newRMin);
77  inline void SetOuterRadius (G4double newRMax);
78  inline void SetZHalfLength (G4double newDz);
79  inline void SetStartPhiAngle (G4double newSPhi, G4bool trig=true);
80  inline void SetDeltaPhiAngle (G4double newDPhi);
81 
82  // Methods for solid
83 
84  inline G4double GetCubicVolume();
85  inline G4double GetSurfaceArea();
86 
87  G4bool CalculateExtent( const EAxis pAxis,
88  const G4VoxelLimits& pVoxelLimit,
89  const G4AffineTransform& pTransform,
90  G4double& pmin, G4double& pmax ) const;
91 
92  EInside Inside( const G4ThreeVector& p ) const;
93 
94  G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const;
95 
96  G4double DistanceToIn(const G4ThreeVector& p, const G4ThreeVector& v) const;
97  G4double DistanceToIn(const G4ThreeVector& p) const;
99  const G4bool calcNorm=G4bool(false),
100  G4bool *validNorm=0, G4ThreeVector *n=0) const;
101  G4double DistanceToOut(const G4ThreeVector& p) const;
102 
104 
106 
107  G4VSolid* Clone() const;
108 
109  std::ostream& StreamInfo( std::ostream& os ) const;
110 
111  // Visualisation functions
112 
113  void DescribeYourselfTo ( G4VGraphicsScene& scene ) const;
114  G4Polyhedron* CreatePolyhedron () const;
115 
116  public: // without description
117 
118  G4OTubs(__void__&);
119  //
120  // Fake default constructor for usage restricted to direct object
121  // persistency for clients requiring preallocation of memory for
122  // persistifiable objects.
123 
124  G4OTubs(const G4OTubs& rhs);
125  G4OTubs& operator=(const G4OTubs& rhs);
126  // Copy constructor and assignment operator.
127 
128  // Older names for access functions
129 
130  inline G4double GetRMin() const;
131  inline G4double GetRMax() const;
132  inline G4double GetDz () const;
133  inline G4double GetSPhi() const;
134  inline G4double GetDPhi() const;
135 
136  protected:
137 
139  CreateRotatedVertices( const G4AffineTransform& pTransform ) const;
140  //
141  // Creates the List of transformed vertices in the format required
142  // for G4VSolid:: ClipCrossSection and ClipBetweenSections
143 
144  inline void Initialize();
145  //
146  // Reset relevant values to zero
147 
148  inline void CheckSPhiAngle(G4double sPhi);
149  inline void CheckDPhiAngle(G4double dPhi);
150  inline void CheckPhiAngles(G4double sPhi, G4double dPhi);
151  //
152  // Reset relevant flags and angle values
153 
154  inline void InitializeTrigonometry();
155  //
156  // Recompute relevant trigonometric values and cache them
157 
158  virtual G4ThreeVector ApproxSurfaceNormal( const G4ThreeVector& p ) const;
159  //
160  // Algorithm for SurfaceNormal() following the original
161  // specification for points not on the surface
162 
163  protected:
164 
165  // Used by distanceToOut
166  //
168 
169  // Used by normal
170  //
172 
174  //
175  // Radial and angular tolerances
176 
178  //
179  // Radial and angular dimensions
180 
183  //
184  // Cached trigonometric values
185 
187  //
188  // Flag for identification of section or full tube
189 
191  //
192  // Cached half tolerance values
193 };
194 
195 #include "G4OTubs.icc"
196 
197 #endif
void SetOuterRadius(G4double newRMax)
G4GeometryType GetEntityType() const
Definition: G4OTubs.cc:1764
void DescribeYourselfTo(G4VGraphicsScene &scene) const
Definition: G4OTubs.cc:1875
G4double fDPhi
Definition: G4OTubs.hh:177
CLHEP::Hep3Vector G4ThreeVector
void SetStartPhiAngle(G4double newSPhi, G4bool trig=true)
G4double GetRMax() const
G4double GetSurfaceArea()
G4double cosSPhi
Definition: G4OTubs.hh:181
G4double fRMax
Definition: G4OTubs.hh:177
G4ThreeVector GetPointOnSurface() const
Definition: G4OTubs.cc:1805
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const
Definition: G4OTubs.cc:550
G4double GetRMin() const
void CheckPhiAngles(G4double sPhi, G4double dPhi)
G4double cosEPhi
Definition: G4OTubs.hh:181
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const
Definition: G4OTubs.cc:773
G4double kAngTolerance
Definition: G4OTubs.hh:173
G4double GetStartPhiAngle() const
G4double sinSPhi
Definition: G4OTubs.hh:181
G4double cosCPhi
Definition: G4OTubs.hh:181
G4VSolid * Clone() const
Definition: G4OTubs.cc:1773
void SetZHalfLength(G4double newDz)
void SetDeltaPhiAngle(G4double newDPhi)
G4OTubs & operator=(const G4OTubs &rhs)
Definition: G4OTubs.cc:138
G4double cosHDPhiOT
Definition: G4OTubs.hh:181
G4double halfRadTolerance
Definition: G4OTubs.hh:190
bool G4bool
Definition: G4Types.hh:79
G4OTubs(const G4String &pName, G4double pRMin, G4double pRMax, G4double pDz, G4double pSPhi, G4double pDPhi)
Definition: G4OTubs.cc:57
G4double sinEPhi
Definition: G4OTubs.hh:181
std::vector< G4ThreeVector > G4ThreeVectorList
Definition: G4VSolid.hh:79
void Initialize()
G4double GetDPhi() const
void CheckSPhiAngle(G4double sPhi)
G4double GetCubicVolume()
const G4int n
G4double GetZHalfLength() const
G4Polyhedron * CreatePolyhedron() const
Definition: G4OTubs.cc:1880
G4bool fPhiFullTube
Definition: G4OTubs.hh:186
void InitializeTrigonometry()
G4double GetOuterRadius() const
G4double halfAngTolerance
Definition: G4OTubs.hh:190
G4double halfCarTolerance
Definition: G4OTubs.hh:190
EInside
Definition: geomdefs.hh:58
EAxis
Definition: geomdefs.hh:54
void CheckDPhiAngle(G4double dPhi)
G4double GetDz() const
G4double fDz
Definition: G4OTubs.hh:177
G4double cosHDPhiIT
Definition: G4OTubs.hh:181
virtual ~G4OTubs()
Definition: G4OTubs.cc:111
G4double fSPhi
Definition: G4OTubs.hh:177
G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=G4bool(false), G4bool *validNorm=0, G4ThreeVector *n=0) const
Definition: G4OTubs.cc:1193
G4double kRadTolerance
Definition: G4OTubs.hh:173
G4double GetInnerRadius() const
G4double fRMin
Definition: G4OTubs.hh:177
G4double GetDeltaPhiAngle() const
EInside Inside(const G4ThreeVector &p) const
Definition: G4OTubs.cc:383
double G4double
Definition: G4Types.hh:76
G4double GetSPhi() const
G4ThreeVectorList * CreateRotatedVertices(const G4AffineTransform &pTransform) const
Definition: G4OTubs.cc:1678
virtual G4ThreeVector ApproxSurfaceNormal(const G4ThreeVector &p) const
Definition: G4OTubs.cc:641
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pmin, G4double &pmax) const
Definition: G4OTubs.cc:169
G4double sinCPhi
Definition: G4OTubs.hh:181
std::ostream & StreamInfo(std::ostream &os) const
Definition: G4OTubs.cc:1782
void SetInnerRadius(G4double newRMin)