File indexing completed on 2025-01-18 09:59:12
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
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073 #ifndef G4TORUS_HH
0074 #define G4TORUS_HH
0075
0076 #include "G4GeomTypes.hh"
0077
0078 #if defined(G4GEOM_USE_USOLIDS)
0079 #define G4GEOM_USE_UTORUS 1
0080 #endif
0081
0082 #if (defined(G4GEOM_USE_UTORUS) && defined(G4GEOM_USE_SYS_USOLIDS))
0083 #define G4UTorus G4Torus
0084 #include "G4UTorus.hh"
0085 #else
0086
0087 #include <CLHEP/Units/PhysicalConstants.h>
0088
0089 #include "G4CSGSolid.hh"
0090
0091 class G4Torus : public G4CSGSolid
0092 {
0093
0094 public:
0095
0096 G4Torus(const G4String &pName,
0097 G4double pRmin,
0098 G4double pRmax,
0099 G4double pRtor,
0100 G4double pSPhi,
0101 G4double pDPhi);
0102
0103 ~G4Torus() override;
0104
0105
0106
0107 inline G4double GetRmin() const;
0108 inline G4double GetRmax() const;
0109 inline G4double GetRtor() const;
0110 inline G4double GetSPhi() const;
0111 inline G4double GetDPhi() const;
0112 inline G4double GetSinStartPhi () const;
0113 inline G4double GetCosStartPhi () const;
0114 inline G4double GetSinEndPhi () const;
0115 inline G4double GetCosEndPhi () const;
0116
0117
0118
0119 inline G4double GetCubicVolume() override;
0120 inline G4double GetSurfaceArea() override;
0121
0122 EInside Inside(const G4ThreeVector& p) const override;
0123 void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
0124 G4bool CalculateExtent(const EAxis pAxis,
0125 const G4VoxelLimits& pVoxelLimit,
0126 const G4AffineTransform& pTransform,
0127 G4double& pmin, G4double& pmax) const override;
0128 void ComputeDimensions( G4VPVParameterisation* p,
0129 const G4int n,
0130 const G4VPhysicalVolume* pRep) override;
0131 G4ThreeVector SurfaceNormal( const G4ThreeVector& p) const override;
0132 G4double DistanceToIn(const G4ThreeVector& p,
0133 const G4ThreeVector& v) const override;
0134 G4double DistanceToIn(const G4ThreeVector& p) const override;
0135 G4double DistanceToOut(const G4ThreeVector& p,const G4ThreeVector& v,
0136 const G4bool calcNorm = false,
0137 G4bool* validNorm = nullptr,
0138 G4ThreeVector* n = nullptr) const override;
0139 G4double DistanceToOut(const G4ThreeVector& p) const override;
0140
0141 G4GeometryType GetEntityType() const override;
0142
0143 G4ThreeVector GetPointOnSurface() const override;
0144
0145 G4VSolid* Clone() const override;
0146
0147 std::ostream& StreamInfo(std::ostream& os) const override;
0148
0149
0150
0151 void DescribeYourselfTo (G4VGraphicsScene& scene) const override;
0152 G4Polyhedron* CreatePolyhedron () const override;
0153
0154 void SetAllParameters(G4double pRmin, G4double pRmax, G4double pRtor,
0155 G4double pSPhi, G4double pDPhi);
0156
0157 G4Torus(__void__&);
0158
0159
0160
0161
0162 G4Torus(const G4Torus& rhs);
0163 G4Torus& operator=(const G4Torus& rhs);
0164
0165
0166 private:
0167
0168 void TorusRootsJT(const G4ThreeVector& p,
0169 const G4ThreeVector& v,
0170 G4double r,
0171 std::vector<G4double>& roots) const ;
0172
0173 G4double SolveNumericJT(const G4ThreeVector& p,
0174 const G4ThreeVector& v,
0175 G4double r,
0176 G4bool IsDistanceToIn) const;
0177
0178 G4ThreeVector ApproxSurfaceNormal( const G4ThreeVector& p) const;
0179
0180
0181
0182 private:
0183
0184 G4double fRmin,fRmax,fRtor,fSPhi,fDPhi;
0185
0186
0187 enum ESide {kNull,kRMin,kRMax,kSPhi,kEPhi};
0188
0189
0190 enum ENorm {kNRMin,kNRMax,kNSPhi,kNEPhi};
0191
0192 G4double fRminTolerance, fRmaxTolerance, kRadTolerance, kAngTolerance;
0193
0194
0195 G4double halfCarTolerance, halfAngTolerance;
0196
0197
0198 };
0199
0200 #include "G4Torus.icc"
0201
0202 #endif
0203
0204
0205 #endif