File indexing completed on 2025-01-18 09:58:04
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 #ifndef G4CONS_HH
0059 #define G4CONS_HH
0060
0061 #include "G4GeomTypes.hh"
0062
0063 #if defined(G4GEOM_USE_USOLIDS)
0064 #define G4GEOM_USE_UCONS 1
0065 #endif
0066
0067 #if defined(G4GEOM_USE_UCONS)
0068 #define G4UCons G4Cons
0069 #include "G4UCons.hh"
0070 #else
0071
0072 #include <CLHEP/Units/PhysicalConstants.h>
0073
0074 #include "G4CSGSolid.hh"
0075 #include "G4Polyhedron.hh"
0076
0077 class G4Cons : public G4CSGSolid
0078 {
0079 public:
0080
0081 G4Cons(const G4String& pName,
0082 G4double pRmin1, G4double pRmax1,
0083 G4double pRmin2, G4double pRmax2,
0084 G4double pDz,
0085 G4double pSPhi, G4double pDPhi);
0086
0087
0088
0089 ~G4Cons() override ;
0090
0091
0092
0093
0094
0095 inline G4double GetInnerRadiusMinusZ() const;
0096 inline G4double GetOuterRadiusMinusZ() const;
0097 inline G4double GetInnerRadiusPlusZ() const;
0098 inline G4double GetOuterRadiusPlusZ() const;
0099 inline G4double GetZHalfLength() const;
0100 inline G4double GetStartPhiAngle() const;
0101 inline G4double GetDeltaPhiAngle() const;
0102 inline G4double GetSinStartPhi() const;
0103 inline G4double GetCosStartPhi() const;
0104 inline G4double GetSinEndPhi() const;
0105 inline G4double GetCosEndPhi() const;
0106
0107
0108
0109 inline void SetInnerRadiusMinusZ (G4double Rmin1 );
0110 inline void SetOuterRadiusMinusZ (G4double Rmax1 );
0111 inline void SetInnerRadiusPlusZ (G4double Rmin2 );
0112 inline void SetOuterRadiusPlusZ (G4double Rmax2 );
0113 inline void SetZHalfLength (G4double newDz );
0114 inline void SetStartPhiAngle (G4double newSPhi, G4bool trig=true);
0115 inline void SetDeltaPhiAngle (G4double newDPhi);
0116
0117
0118
0119 inline G4double GetCubicVolume() override;
0120 inline G4double GetSurfaceArea() override;
0121
0122 void ComputeDimensions( G4VPVParameterisation* p,
0123 const G4int n,
0124 const G4VPhysicalVolume* pRep) override;
0125
0126 void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
0127
0128 G4bool CalculateExtent(const EAxis pAxis,
0129 const G4VoxelLimits& pVoxelLimit,
0130 const G4AffineTransform& pTransform,
0131 G4double& pMin, G4double& pMax) const override;
0132
0133 EInside Inside( const G4ThreeVector& p ) const override;
0134
0135 G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const override;
0136
0137 G4double DistanceToIn (const G4ThreeVector& p,
0138 const G4ThreeVector& v) const override;
0139 G4double DistanceToIn (const G4ThreeVector& p) const override;
0140 G4double DistanceToOut(const G4ThreeVector& p,
0141 const G4ThreeVector& v,
0142 const G4bool calcNorm = false,
0143 G4bool* validNorm = nullptr,
0144 G4ThreeVector* n = nullptr) const override;
0145 G4double DistanceToOut(const G4ThreeVector& p) const override;
0146
0147 G4GeometryType GetEntityType() const override;
0148
0149 G4ThreeVector GetPointOnSurface() const override;
0150
0151 G4VSolid* Clone() const override;
0152
0153 std::ostream& StreamInfo(std::ostream& os) const override;
0154
0155
0156
0157 void DescribeYourselfTo( G4VGraphicsScene& scene ) const override;
0158 G4Polyhedron* CreatePolyhedron() const override;
0159
0160 G4Cons(__void__&);
0161
0162
0163
0164
0165
0166 G4Cons(const G4Cons& rhs);
0167 G4Cons& operator=(const G4Cons& rhs);
0168
0169
0170 private:
0171
0172 inline void Initialize();
0173
0174
0175
0176 inline void CheckSPhiAngle(G4double sPhi);
0177 inline void CheckDPhiAngle(G4double dPhi);
0178 inline void CheckPhiAngles(G4double sPhi, G4double dPhi);
0179
0180
0181
0182 inline void InitializeTrigonometry();
0183
0184
0185
0186 G4ThreeVector ApproxSurfaceNormal(const G4ThreeVector& p) const;
0187
0188
0189
0190
0191 private:
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 G4double fRmin1, fRmin2, fRmax1, fRmax2, fDz, fSPhi, fDPhi;
0206
0207
0208
0209 G4double sinCPhi, cosCPhi, cosHDPhi, cosHDPhiOT, cosHDPhiIT,
0210 sinSPhi, cosSPhi, sinEPhi, cosEPhi;
0211
0212
0213
0214 G4bool fPhiFullCone = false;
0215
0216
0217
0218 G4double halfCarTolerance, halfRadTolerance, halfAngTolerance;
0219
0220
0221 };
0222
0223 #include "G4Cons.icc"
0224
0225 #endif
0226
0227 #endif