File indexing completed on 2025-01-18 09:59:14
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055 #ifndef G4TUBS_HH
0056 #define G4TUBS_HH
0057
0058 #include "G4GeomTypes.hh"
0059
0060 #if defined(G4GEOM_USE_USOLIDS)
0061 #define G4GEOM_USE_UTUBS 1
0062 #endif
0063
0064 #if defined(G4GEOM_USE_UTUBS)
0065 #define G4UTubs G4Tubs
0066 #include "G4UTubs.hh"
0067 #else
0068
0069 #include <CLHEP/Units/PhysicalConstants.h>
0070
0071 #include "G4CSGSolid.hh"
0072 #include "G4Polyhedron.hh"
0073
0074 class G4Tubs : public G4CSGSolid
0075 {
0076 public:
0077
0078 G4Tubs( const G4String& pName,
0079 G4double pRMin,
0080 G4double pRMax,
0081 G4double pDz,
0082 G4double pSPhi,
0083 G4double pDPhi );
0084
0085
0086
0087 ~G4Tubs() override;
0088
0089
0090
0091
0092
0093 inline G4double GetInnerRadius () const;
0094 inline G4double GetOuterRadius () const;
0095 inline G4double GetZHalfLength () const;
0096 inline G4double GetStartPhiAngle () const;
0097 inline G4double GetDeltaPhiAngle () const;
0098 inline G4double GetSinStartPhi () const;
0099 inline G4double GetCosStartPhi () const;
0100 inline G4double GetSinEndPhi () const;
0101 inline G4double GetCosEndPhi () const;
0102
0103
0104
0105 inline void SetInnerRadius (G4double newRMin);
0106 inline void SetOuterRadius (G4double newRMax);
0107 inline void SetZHalfLength (G4double newDz);
0108 inline void SetStartPhiAngle (G4double newSPhi, G4bool trig=true);
0109 inline void SetDeltaPhiAngle (G4double newDPhi);
0110
0111
0112
0113 inline G4double GetCubicVolume() override;
0114 inline G4double GetSurfaceArea() override;
0115
0116 void ComputeDimensions( G4VPVParameterisation* p,
0117 const G4int n,
0118 const G4VPhysicalVolume* pRep ) override;
0119
0120 void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
0121
0122 G4bool CalculateExtent(const EAxis pAxis,
0123 const G4VoxelLimits& pVoxelLimit,
0124 const G4AffineTransform& pTransform,
0125 G4double& pmin, G4double& pmax) const override;
0126
0127 EInside Inside( const G4ThreeVector& p ) const override;
0128
0129 G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const override;
0130
0131 G4double DistanceToIn(const G4ThreeVector& p,
0132 const G4ThreeVector& v) const override;
0133 G4double DistanceToIn(const G4ThreeVector& p) const override;
0134 G4double DistanceToOut(const G4ThreeVector& p, const G4ThreeVector& v,
0135 const G4bool calcNorm = false,
0136 G4bool* validNorm = nullptr,
0137 G4ThreeVector* n = nullptr) const override;
0138 G4double DistanceToOut(const G4ThreeVector& p) const override;
0139
0140 G4GeometryType GetEntityType() const override;
0141
0142 G4ThreeVector GetPointOnSurface() const override;
0143
0144 G4VSolid* Clone() const override;
0145
0146 std::ostream& StreamInfo( std::ostream& os ) const override;
0147
0148
0149
0150 void DescribeYourselfTo (G4VGraphicsScene& scene) const override;
0151 G4Polyhedron* CreatePolyhedron () const override;
0152
0153 G4Tubs(__void__&);
0154
0155
0156
0157
0158
0159 G4Tubs(const G4Tubs& rhs);
0160 G4Tubs& operator=(const G4Tubs& rhs);
0161
0162
0163 protected:
0164
0165 inline void Initialize();
0166
0167
0168
0169 inline void CheckSPhiAngle(G4double sPhi);
0170 inline void CheckDPhiAngle(G4double dPhi);
0171 inline void CheckPhiAngles(G4double sPhi, G4double dPhi);
0172
0173
0174
0175 inline void InitializeTrigonometry();
0176
0177
0178
0179 inline G4double FastInverseRxy( const G4ThreeVector& pos, G4double invRad,
0180 G4double normalTolerance ) const;
0181
0182
0183
0184
0185
0186 virtual G4ThreeVector ApproxSurfaceNormal( const G4ThreeVector& p ) const;
0187
0188
0189
0190
0191 protected:
0192
0193
0194
0195 enum ESide {kNull,kRMin,kRMax,kSPhi,kEPhi,kPZ,kMZ};
0196
0197
0198
0199 enum ENorm {kNRMin,kNRMax,kNSPhi,kNEPhi,kNZ};
0200
0201 G4double kRadTolerance, kAngTolerance;
0202
0203
0204
0205 static constexpr G4double kNormTolerance = 1.0e-6;
0206
0207
0208
0209
0210 G4double fRMin, fRMax, fDz, fSPhi, fDPhi;
0211
0212
0213
0214 G4double sinCPhi, cosCPhi, cosHDPhi, cosHDPhiOT, cosHDPhiIT,
0215 sinSPhi, cosSPhi, sinEPhi, cosEPhi;
0216
0217
0218
0219 G4bool fPhiFullTube;
0220
0221
0222
0223 G4double fInvRmax, fInvRmin;
0224
0225
0226
0227 G4double halfCarTolerance, halfRadTolerance, halfAngTolerance;
0228
0229
0230 };
0231
0232 #include "G4Tubs.icc"
0233
0234 #endif
0235
0236 #endif