00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069 #ifndef G4TUBS_HH
00070 #define G4TUBS_HH
00071
00072 #include <CLHEP/Units/PhysicalConstants.h>
00073
00074 #include "G4CSGSolid.hh"
00075
00076 class G4Tubs : public G4CSGSolid
00077 {
00078 public:
00079
00080 G4Tubs( const G4String& pName,
00081 G4double pRMin,
00082 G4double pRMax,
00083 G4double pDz,
00084 G4double pSPhi,
00085 G4double pDPhi );
00086
00087
00088
00089 virtual ~G4Tubs();
00090
00091
00092
00093
00094
00095 inline G4double GetInnerRadius () const;
00096 inline G4double GetOuterRadius () const;
00097 inline G4double GetZHalfLength () const;
00098 inline G4double GetStartPhiAngle () const;
00099 inline G4double GetDeltaPhiAngle () const;
00100
00101
00102
00103 inline void SetInnerRadius (G4double newRMin);
00104 inline void SetOuterRadius (G4double newRMax);
00105 inline void SetZHalfLength (G4double newDz);
00106 inline void SetStartPhiAngle (G4double newSPhi, G4bool trig=true);
00107 inline void SetDeltaPhiAngle (G4double newDPhi);
00108
00109
00110
00111 inline G4double GetCubicVolume();
00112 inline G4double GetSurfaceArea();
00113
00114 void ComputeDimensions( G4VPVParameterisation* p,
00115 const G4int n,
00116 const G4VPhysicalVolume* pRep );
00117
00118 G4bool CalculateExtent( const EAxis pAxis,
00119 const G4VoxelLimits& pVoxelLimit,
00120 const G4AffineTransform& pTransform,
00121 G4double& pmin, G4double& pmax ) const;
00122
00123 EInside Inside( const G4ThreeVector& p ) const;
00124
00125 G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const;
00126
00127 G4double DistanceToIn(const G4ThreeVector& p, const G4ThreeVector& v) const;
00128 G4double DistanceToIn(const G4ThreeVector& p) const;
00129 G4double DistanceToOut(const G4ThreeVector& p, const G4ThreeVector& v,
00130 const G4bool calcNorm=G4bool(false),
00131 G4bool *validNorm=0, G4ThreeVector *n=0) const;
00132 G4double DistanceToOut(const G4ThreeVector& p) const;
00133
00134 G4GeometryType GetEntityType() const;
00135
00136 G4ThreeVector GetPointOnSurface() const;
00137
00138 G4VSolid* Clone() const;
00139
00140 std::ostream& StreamInfo( std::ostream& os ) const;
00141
00142
00143
00144 void DescribeYourselfTo ( G4VGraphicsScene& scene ) const;
00145 G4Polyhedron* CreatePolyhedron () const;
00146 G4NURBS* CreateNURBS () const;
00147
00148 public:
00149
00150 G4Tubs(__void__&);
00151
00152
00153
00154
00155
00156 G4Tubs(const G4Tubs& rhs);
00157 G4Tubs& operator=(const G4Tubs& rhs);
00158
00159
00160
00161
00162 inline G4double GetRMin() const;
00163 inline G4double GetRMax() const;
00164 inline G4double GetDz () const;
00165 inline G4double GetSPhi() const;
00166 inline G4double GetDPhi() const;
00167
00168 protected:
00169
00170 G4ThreeVectorList*
00171 CreateRotatedVertices( const G4AffineTransform& pTransform ) const;
00172
00173
00174
00175
00176 inline void Initialize();
00177
00178
00179
00180 inline void CheckSPhiAngle(G4double sPhi);
00181 inline void CheckDPhiAngle(G4double dPhi);
00182 inline void CheckPhiAngles(G4double sPhi, G4double dPhi);
00183
00184
00185
00186 inline void InitializeTrigonometry();
00187
00188
00189
00190 virtual G4ThreeVector ApproxSurfaceNormal( const G4ThreeVector& p ) const;
00191
00192
00193
00194
00195 protected:
00196
00197
00198
00199 enum ESide {kNull,kRMin,kRMax,kSPhi,kEPhi,kPZ,kMZ};
00200
00201
00202
00203 enum ENorm {kNRMin,kNRMax,kNSPhi,kNEPhi,kNZ};
00204
00205 G4double kRadTolerance, kAngTolerance;
00206
00207
00208
00209 G4double fRMin, fRMax, fDz, fSPhi, fDPhi;
00210
00211
00212
00213 G4double sinCPhi, cosCPhi, cosHDPhiOT, cosHDPhiIT,
00214 sinSPhi, cosSPhi, sinEPhi, cosEPhi;
00215
00216
00217
00218 G4bool fPhiFullTube;
00219
00220
00221 };
00222
00223 #include "G4Tubs.icc"
00224
00225 #endif