Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
45 
46 #include "G4CSGSolid.hh"
47 
48 class G4OTubs : public G4CSGSolid
49 {
50  public: // with description
51 
52  G4OTubs( const G4String& pName,
53  G4double pRMin,
54  G4double pRMax,
55  G4double pDz,
56  G4double pSPhi,
57  G4double pDPhi );
58  //
59  // Constructs a tubs with the given name and dimensions
60 
61  virtual ~G4OTubs();
62  //
63  // Destructor
64 
65  // Accessors
66 
67  inline G4double GetInnerRadius () const;
68  inline G4double GetOuterRadius () const;
69  inline G4double GetZHalfLength () const;
70  inline G4double GetStartPhiAngle () const;
71  inline G4double GetDeltaPhiAngle () const;
72 
73  // Modifiers
74 
75  inline void SetInnerRadius (G4double newRMin);
76  inline void SetOuterRadius (G4double newRMax);
77  inline void SetZHalfLength (G4double newDz);
78  inline void SetStartPhiAngle (G4double newSPhi, G4bool trig=true);
79  inline void SetDeltaPhiAngle (G4double newDPhi);
80 
81  // Methods for solid
82 
83  inline G4double GetCubicVolume();
84  inline G4double GetSurfaceArea();
85 
86  G4bool CalculateExtent( const EAxis pAxis,
87  const G4VoxelLimits& pVoxelLimit,
88  const G4AffineTransform& pTransform,
89  G4double& pmin, G4double& pmax ) const;
90 
91  EInside Inside( const G4ThreeVector& p ) const;
92 
93  G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const;
94 
95  G4double DistanceToIn(const G4ThreeVector& p, const G4ThreeVector& v) const;
96  G4double DistanceToIn(const G4ThreeVector& p) const;
98  const G4bool calcNorm=G4bool(false),
99  G4bool *validNorm=0, G4ThreeVector *n=0) const;
100  G4double DistanceToOut(const G4ThreeVector& p) const;
101 
103 
105 
106  G4VSolid* Clone() const;
107 
108  std::ostream& StreamInfo( std::ostream& os ) const;
109 
110  // Visualisation functions
111 
112  void DescribeYourselfTo ( G4VGraphicsScene& scene ) const;
113  G4Polyhedron* CreatePolyhedron () const;
114 
115  public: // without description
116 
117  G4OTubs(__void__&);
118  //
119  // Fake default constructor for usage restricted to direct object
120  // persistency for clients requiring preallocation of memory for
121  // persistifiable objects.
122 
123  G4OTubs(const G4OTubs& rhs);
124  G4OTubs& operator=(const G4OTubs& rhs);
125  // Copy constructor and assignment operator.
126 
127  // Older names for access functions
128 
129  inline G4double GetRMin() const;
130  inline G4double GetRMax() const;
131  inline G4double GetDz () const;
132  inline G4double GetSPhi() const;
133  inline G4double GetDPhi() const;
134 
135  protected:
136 
138  CreateRotatedVertices( const G4AffineTransform& pTransform ) const;
139  //
140  // Creates the List of transformed vertices in the format required
141  // for G4VSolid:: ClipCrossSection and ClipBetweenSections
142 
143  inline void Initialize();
144  //
145  // Reset relevant values to zero
146 
147  inline void CheckSPhiAngle(G4double sPhi);
148  inline void CheckDPhiAngle(G4double dPhi);
149  inline void CheckPhiAngles(G4double sPhi, G4double dPhi);
150  //
151  // Reset relevant flags and angle values
152 
153  inline void InitializeTrigonometry();
154  //
155  // Recompute relevant trigonometric values and cache them
156 
157  virtual G4ThreeVector ApproxSurfaceNormal( const G4ThreeVector& p ) const;
158  //
159  // Algorithm for SurfaceNormal() following the original
160  // specification for points not on the surface
161 
162  protected:
163 
164  // Used by distanceToOut
165  //
167 
168  // Used by normal
169  //
171 
173  //
174  // Radial and angular tolerances
175 
177  //
178  // Radial and angular dimensions
179 
182  //
183  // Cached trigonometric values
184 
186  //
187  // Flag for identification of section or full tube
188 
190  //
191  // Cached half tolerance values
192 };
193 
194 #include "G4OTubs.icc"
195 
196 #endif
void SetOuterRadius(G4double newRMax)
G4GeometryType GetEntityType() const
Definition: G4OTubs.cc:1767
void DescribeYourselfTo(G4VGraphicsScene &scene) const
Definition: G4OTubs.cc:1878
G4double fDPhi
Definition: G4OTubs.hh:176
void SetStartPhiAngle(G4double newSPhi, G4bool trig=true)
G4double GetRMax() const
G4double GetSurfaceArea()
G4double cosSPhi
Definition: G4OTubs.hh:180
G4double fRMax
Definition: G4OTubs.hh:176
G4ThreeVector GetPointOnSurface() const
Definition: G4OTubs.cc:1808
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const
Definition: G4OTubs.cc:553
G4double GetRMin() const
const char * p
Definition: xmltok.h:285
void CheckPhiAngles(G4double sPhi, G4double dPhi)
G4double cosEPhi
Definition: G4OTubs.hh:180
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const
Definition: G4OTubs.cc:776
G4double kAngTolerance
Definition: G4OTubs.hh:172
G4double GetStartPhiAngle() const
G4double sinSPhi
Definition: G4OTubs.hh:180
G4double cosCPhi
Definition: G4OTubs.hh:180
G4VSolid * Clone() const
Definition: G4OTubs.cc:1776
void SetZHalfLength(G4double newDz)
void SetDeltaPhiAngle(G4double newDPhi)
G4OTubs & operator=(const G4OTubs &rhs)
Definition: G4OTubs.cc:141
G4double cosHDPhiOT
Definition: G4OTubs.hh:180
G4double halfRadTolerance
Definition: G4OTubs.hh:189
bool G4bool
Definition: G4Types.hh:79
G4OTubs(const G4String &pName, G4double pRMin, G4double pRMax, G4double pDz, G4double pSPhi, G4double pDPhi)
Definition: G4OTubs.cc:60
G4double sinEPhi
Definition: G4OTubs.hh:180
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:1883
G4bool fPhiFullTube
Definition: G4OTubs.hh:185
void InitializeTrigonometry()
G4double GetOuterRadius() const
G4double halfAngTolerance
Definition: G4OTubs.hh:189
G4double halfCarTolerance
Definition: G4OTubs.hh:189
EInside
Definition: geomdefs.hh:58
EAxis
Definition: geomdefs.hh:54
void CheckDPhiAngle(G4double dPhi)
G4double GetDz() const
G4double fDz
Definition: G4OTubs.hh:176
G4double cosHDPhiIT
Definition: G4OTubs.hh:180
virtual ~G4OTubs()
Definition: G4OTubs.cc:114
G4double fSPhi
Definition: G4OTubs.hh:176
G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=G4bool(false), G4bool *validNorm=0, G4ThreeVector *n=0) const
Definition: G4OTubs.cc:1196
G4double kRadTolerance
Definition: G4OTubs.hh:172
G4double GetInnerRadius() const
G4double fRMin
Definition: G4OTubs.hh:176
G4double GetDeltaPhiAngle() const
EInside Inside(const G4ThreeVector &p) const
Definition: G4OTubs.cc:386
double G4double
Definition: G4Types.hh:76
G4double GetSPhi() const
G4ThreeVectorList * CreateRotatedVertices(const G4AffineTransform &pTransform) const
Definition: G4OTubs.cc:1681
virtual G4ThreeVector ApproxSurfaceNormal(const G4ThreeVector &p) const
Definition: G4OTubs.cc:644
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pmin, G4double &pmax) const
Definition: G4OTubs.cc:172
G4double sinCPhi
Definition: G4OTubs.hh:180
std::ostream & StreamInfo(std::ostream &os) const
Definition: G4OTubs.cc:1785
void SetInnerRadius(G4double newRMin)