File indexing completed on 2025-01-18 09:58:05
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 inline
0030 G4double G4CutTubs::GetInnerRadius () const
0031 {
0032 return fRMin;
0033 }
0034
0035 inline
0036 G4double G4CutTubs::GetOuterRadius () const
0037 {
0038 return fRMax;
0039 }
0040
0041 inline
0042 G4double G4CutTubs::GetZHalfLength () const
0043 {
0044 return fDz;
0045 }
0046
0047 inline
0048 G4double G4CutTubs::GetStartPhiAngle () const
0049 {
0050 return fSPhi;
0051 }
0052
0053 inline
0054 G4double G4CutTubs::GetDeltaPhiAngle () const
0055 {
0056 return fDPhi;
0057 }
0058
0059 inline
0060 G4double G4CutTubs::GetSinStartPhi () const
0061 {
0062 return sinSPhi;
0063 }
0064
0065 inline
0066 G4double G4CutTubs::GetCosStartPhi () const
0067 {
0068 return cosSPhi;
0069 }
0070
0071 inline
0072 G4double G4CutTubs::GetSinEndPhi () const
0073 {
0074 return sinEPhi;
0075 }
0076
0077 inline
0078 G4double G4CutTubs::GetCosEndPhi () const
0079 {
0080 return cosEPhi;
0081 }
0082
0083 inline
0084 G4ThreeVector G4CutTubs::GetLowNorm () const
0085 {
0086 return fLowNorm;
0087 }
0088
0089 inline
0090 G4ThreeVector G4CutTubs::GetHighNorm () const
0091 {
0092 return fHighNorm;
0093 }
0094
0095 inline
0096 void G4CutTubs::Initialize()
0097 {
0098 fZMin = 0.;
0099 fZMax = 0.;
0100 fCubicVolume = 0.;
0101 fSurfaceArea = 0.;
0102 fRebuildPolyhedron = true;
0103 }
0104
0105 inline
0106 void G4CutTubs::InitializeTrigonometry()
0107 {
0108 G4double hDPhi = 0.5*fDPhi;
0109 G4double cPhi = fSPhi + hDPhi;
0110 G4double ePhi = fSPhi + fDPhi;
0111
0112 sinCPhi = std::sin(cPhi);
0113 cosCPhi = std::cos(cPhi);
0114 cosHDPhi = std::cos(hDPhi);
0115 cosHDPhiIT = std::cos(hDPhi - 0.5*kAngTolerance);
0116 cosHDPhiOT = std::cos(hDPhi + 0.5*kAngTolerance);
0117 sinSPhi = std::sin(fSPhi);
0118 cosSPhi = std::cos(fSPhi);
0119 sinEPhi = std::sin(ePhi);
0120 cosEPhi = std::cos(ePhi);
0121 }
0122
0123 inline void G4CutTubs::CheckSPhiAngle(G4double sPhi)
0124 {
0125
0126
0127 if ( sPhi < 0 )
0128 {
0129 fSPhi = CLHEP::twopi - std::fmod(std::fabs(sPhi),CLHEP::twopi);
0130 }
0131 else
0132 {
0133 fSPhi = std::fmod(sPhi,CLHEP::twopi) ;
0134 }
0135 if ( fSPhi+fDPhi > CLHEP::twopi )
0136 {
0137 fSPhi -= CLHEP::twopi ;
0138 }
0139 }
0140
0141 inline void G4CutTubs::CheckDPhiAngle(G4double dPhi)
0142 {
0143 fPhiFullCutTube = true;
0144 if ( dPhi >= CLHEP::twopi-kAngTolerance*0.5 )
0145 {
0146 fDPhi=CLHEP::twopi;
0147 fSPhi=0;
0148 }
0149 else
0150 {
0151 fPhiFullCutTube = false;
0152 if ( dPhi > 0 )
0153 {
0154 fDPhi = dPhi;
0155 }
0156 else
0157 {
0158 std::ostringstream message;
0159 message << "Invalid dphi." << G4endl
0160 << "Negative or zero delta-Phi (" << dPhi << "), for solid: "
0161 << GetName();
0162 G4Exception("G4CutTubs::CheckDPhiAngle()", "GeomSolids0002",
0163 FatalException, message);
0164 }
0165 }
0166 }
0167
0168 inline void G4CutTubs::CheckPhiAngles(G4double sPhi, G4double dPhi)
0169 {
0170 CheckDPhiAngle(dPhi);
0171 if ( (fDPhi<CLHEP::twopi) && ((sPhi) != 0.0) ) { CheckSPhiAngle(sPhi); }
0172 InitializeTrigonometry();
0173 }
0174
0175 inline
0176 void G4CutTubs::SetInnerRadius (G4double newRMin)
0177 {
0178 if ( newRMin < 0 )
0179 {
0180 std::ostringstream message;
0181 message << "Invalid radii." << G4endl
0182 << "Invalid values for radii in solid " << GetName() << G4endl
0183 << " newRMin = " << newRMin
0184 << ", fRMax = " << fRMax << G4endl
0185 << " Negative inner radius!";
0186 G4Exception("G4CutTubs::SetInnerRadius()", "GeomSolids0002",
0187 FatalException, message);
0188 }
0189 fRMin= newRMin;
0190 Initialize();
0191 }
0192
0193 inline
0194 void G4CutTubs::SetOuterRadius (G4double newRMax)
0195 {
0196 if ( newRMax <= 0 )
0197 {
0198 std::ostringstream message;
0199 message << "Invalid radii." << G4endl
0200 << "Invalid values for radii in solid " << GetName() << G4endl
0201 << " fRMin = " << fRMin
0202 << ", newRMax = " << newRMax << G4endl
0203 << " Invalid outer radius!";
0204 G4Exception("G4CutTubs::SetOuterRadius()", "GeomSolids0002",
0205 FatalException, message);
0206 }
0207 fRMax= newRMax;
0208 Initialize();
0209 }
0210
0211 inline
0212 void G4CutTubs::SetZHalfLength (G4double newDz)
0213 {
0214 if (newDz<=0)
0215 {
0216 std::ostringstream message;
0217 message << "Invalid Z half-length." << G4endl
0218 << "Negative Z half-length (" << newDz << "), for solid: "
0219 << GetName();
0220 G4Exception("G4CutTubs::SetZHalfLength()", "GeomSolids0002",
0221 FatalException, message);
0222 }
0223 fDz= newDz;
0224 Initialize();
0225 }
0226
0227 inline
0228 void G4CutTubs::SetStartPhiAngle (G4double newSPhi, G4bool compute)
0229 {
0230
0231
0232
0233 CheckSPhiAngle(newSPhi);
0234 fPhiFullCutTube = false;
0235 if (compute) { InitializeTrigonometry(); }
0236 Initialize();
0237 }
0238
0239 inline
0240 void G4CutTubs::SetDeltaPhiAngle (G4double newDPhi)
0241 {
0242 CheckPhiAngles(fSPhi, newDPhi);
0243 Initialize();
0244 }