Geant4  10.03
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  inline G4double GetSinStartPhi () const;
74  inline G4double GetCosStartPhi () const;
75  inline G4double GetSinEndPhi () const;
76  inline G4double GetCosEndPhi () const;
77 
78  // Modifiers
79 
80  inline void SetInnerRadius (G4double newRMin);
81  inline void SetOuterRadius (G4double newRMax);
82  inline void SetZHalfLength (G4double newDz);
83  inline void SetStartPhiAngle (G4double newSPhi, G4bool trig=true);
84  inline void SetDeltaPhiAngle (G4double newDPhi);
85 
86  // Methods for solid
87 
88  inline G4double GetCubicVolume();
89  inline G4double GetSurfaceArea();
90 
91  void Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
92 
93  G4bool CalculateExtent( const EAxis pAxis,
94  const G4VoxelLimits& pVoxelLimit,
95  const G4AffineTransform& pTransform,
96  G4double& pmin, G4double& pmax ) const;
97 
98  EInside Inside( const G4ThreeVector& p ) const;
99 
100  G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const;
101 
102  G4double DistanceToIn(const G4ThreeVector& p, const G4ThreeVector& v) const;
103  G4double DistanceToIn(const G4ThreeVector& p) const;
105  const G4bool calcNorm=G4bool(false),
106  G4bool *validNorm=0, G4ThreeVector *n=0) const;
107  G4double DistanceToOut(const G4ThreeVector& p) const;
108 
110 
112 
113  G4VSolid* Clone() const;
114 
115  std::ostream& StreamInfo( std::ostream& os ) const;
116 
117  // Visualisation functions
118 
119  void DescribeYourselfTo ( G4VGraphicsScene& scene ) const;
120  G4Polyhedron* CreatePolyhedron () const;
121 
122  public: // without description
123 
124  G4OTubs(__void__&);
125  //
126  // Fake default constructor for usage restricted to direct object
127  // persistency for clients requiring preallocation of memory for
128  // persistifiable objects.
129 
130  G4OTubs(const G4OTubs& rhs);
131  G4OTubs& operator=(const G4OTubs& rhs);
132  // Copy constructor and assignment operator.
133 
134  // Older names for access functions
135 
136  inline G4double GetRMin() const;
137  inline G4double GetRMax() const;
138  inline G4double GetDz () const;
139  inline G4double GetSPhi() const;
140  inline G4double GetDPhi() const;
141 
142  protected:
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
G4double GetCosStartPhi() const
void SetOuterRadius(G4double newRMax)
G4GeometryType GetEntityType() const
Definition: G4OTubs.cc:1612
void DescribeYourselfTo(G4VGraphicsScene &scene) const
Definition: G4OTubs.cc:1723
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
G4double GetSinStartPhi() const
G4ThreeVector GetPointOnSurface() const
Definition: G4OTubs.cc:1653
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const
Definition: G4OTubs.cc:490
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:713
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:1621
void SetZHalfLength(G4double newDz)
void SetDeltaPhiAngle(G4double newDPhi)
G4OTubs & operator=(const G4OTubs &rhs)
Definition: G4OTubs.cc:140
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:59
G4double GetSinEndPhi() const
G4double sinEPhi
Definition: G4OTubs.hh:181
void Initialize()
G4double GetDPhi() const
void CheckSPhiAngle(G4double sPhi)
G4double GetCubicVolume()
const G4int n
G4double GetZHalfLength() const
G4Polyhedron * CreatePolyhedron() const
Definition: G4OTubs.cc:1728
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 GetCosEndPhi() const
G4double GetDz() const
G4double fDz
Definition: G4OTubs.hh:177
G4double cosHDPhiIT
Definition: G4OTubs.hh:181
virtual ~G4OTubs()
Definition: G4OTubs.cc:113
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:1133
G4double kRadTolerance
Definition: G4OTubs.hh:173
G4double GetInnerRadius() const
void Extent(G4ThreeVector &pMin, G4ThreeVector &pMax) const
Definition: G4OTubs.cc:171
G4double fRMin
Definition: G4OTubs.hh:177
G4double GetDeltaPhiAngle() const
EInside Inside(const G4ThreeVector &p) const
Definition: G4OTubs.cc:323
double G4double
Definition: G4Types.hh:76
G4double GetSPhi() const
virtual G4ThreeVector ApproxSurfaceNormal(const G4ThreeVector &p) const
Definition: G4OTubs.cc:581
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pmin, G4double &pmax) const
Definition: G4OTubs.cc:213
G4double sinCPhi
Definition: G4OTubs.hh:181
std::ostream & StreamInfo(std::ostream &os) const
Definition: G4OTubs.cc:1630
void SetInnerRadius(G4double newRMin)