File indexing completed on 2025-01-18 09:59:15
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 #ifndef G4TWISTTUBSSIDE_HH
0037 #define G4TWISTTUBSSIDE_HH
0038
0039 #include "G4VTwistSurface.hh"
0040
0041 class G4TwistTubsSide : public G4VTwistSurface
0042 {
0043 public:
0044
0045 G4TwistTubsSide(const G4String& name,
0046 const G4RotationMatrix& rot,
0047 const G4ThreeVector& tlate,
0048 G4int handedness,
0049 const G4double kappa,
0050 const EAxis axis0 = kXAxis,
0051 const EAxis axis1 = kZAxis,
0052 G4double axis0min = -kInfinity,
0053 G4double axis1min = -kInfinity,
0054 G4double axis0max = kInfinity,
0055 G4double axis1max = kInfinity );
0056
0057 G4TwistTubsSide(const G4String& name,
0058 G4double EndInnerRadius[2],
0059 G4double EndOuterRadius[2],
0060 G4double DPhi,
0061 G4double EndPhi[2],
0062 G4double EndZ[2],
0063 G4double InnerRadius,
0064 G4double OuterRadius,
0065 G4double Kappa,
0066 G4int handedness);
0067
0068 ~G4TwistTubsSide() override;
0069
0070 G4ThreeVector GetNormal(const G4ThreeVector& xx,
0071 G4bool isGlobal = false) override ;
0072
0073 G4int DistanceToSurface(const G4ThreeVector& gp,
0074 const G4ThreeVector& gv,
0075 G4ThreeVector gxx[],
0076 G4double distance[],
0077 G4int areacode[],
0078 G4bool isvalid[],
0079 EValidate validate = kValidateWithTol) override;
0080
0081 G4int DistanceToSurface(const G4ThreeVector& gp,
0082 G4ThreeVector gxx[],
0083 G4double distance[],
0084 G4int areacode[]) override;
0085
0086 inline G4ThreeVector ProjectAtPXPZ(const G4ThreeVector& p,
0087 G4bool isglobal = false) const ;
0088
0089 inline G4ThreeVector SurfacePoint(G4double, G4double,
0090 G4bool isGlobal = false) override ;
0091 inline G4double GetBoundaryMin(G4double phi) override ;
0092 inline G4double GetBoundaryMax(G4double phi) override ;
0093 inline G4double GetSurfaceArea() override ;
0094 void GetFacets( G4int m, G4int n, G4double xyz[][3],
0095 G4int faces[][4], G4int iside ) override ;
0096
0097 G4TwistTubsSide(__void__&);
0098
0099
0100
0101
0102 private:
0103
0104 G4double DistanceToPlane(const G4ThreeVector& p,
0105 const G4ThreeVector& A,
0106 const G4ThreeVector& B,
0107 const G4ThreeVector& C,
0108 const G4ThreeVector& D,
0109 const G4int parity,
0110 G4ThreeVector& xx,
0111 G4ThreeVector& n);
0112
0113 G4int GetAreaCode(const G4ThreeVector& xx,
0114 G4bool withTol = true) override;
0115
0116 void SetCorners() override;
0117
0118 void SetCorners( G4double endInnerRad[2],
0119 G4double endOuterRad[2],
0120 G4double endPhi[2],
0121 G4double endZ[2] ) ;
0122
0123 void SetBoundaries() override;
0124
0125 private:
0126
0127 G4double fKappa;
0128 };
0129
0130
0131
0132
0133
0134
0135 inline
0136 G4ThreeVector G4TwistTubsSide::ProjectAtPXPZ(const G4ThreeVector& p,
0137 G4bool isglobal) const
0138 {
0139
0140 G4ThreeVector tmpp;
0141 if (isglobal) { tmpp = fRot.inverse()*p - fTrans; }
0142 else { tmpp = p; }
0143 G4ThreeVector xx(p.x(), p.x() * fKappa * p.z(), p.z());
0144 if (isglobal) { return (fRot * xx + fTrans); }
0145 return xx;
0146 }
0147
0148 inline
0149 G4ThreeVector
0150 G4TwistTubsSide::SurfacePoint(G4double x, G4double z, G4bool isGlobal)
0151 {
0152 G4ThreeVector SurfPoint( x , x * fKappa * z , z ) ;
0153
0154 if (isGlobal) { return (fRot * SurfPoint + fTrans); }
0155 return SurfPoint;
0156 }
0157
0158 inline
0159 G4double G4TwistTubsSide::GetBoundaryMin(G4double)
0160 {
0161 return fAxisMin[0] ;
0162 }
0163
0164 inline
0165 G4double G4TwistTubsSide::GetBoundaryMax(G4double)
0166 {
0167 return fAxisMax[0] ;
0168 }
0169
0170 inline
0171 G4double G4TwistTubsSide::GetSurfaceArea()
0172 {
0173
0174 return ( fAxisMax[0] - fAxisMin[0] ) * ( fAxisMax[1] - fAxisMin[1] ) ;
0175 }
0176
0177 #endif