44#ifndef G4TWISTEDTUBS_HH
45#define G4TWISTEDTUBS_HH
112 const G4bool calcnorm =
false,
113 G4bool* validnorm =
nullptr,
126 std::ostream &
StreamInfo(std::ostream& os)
const override;
147 {
return fEndInnerRadius[i]; }
149 {
return fEndOuterRadius[i]; }
151 {
return (fEndInnerRadius[0] > fEndInnerRadius[1] ?
152 fEndInnerRadius[0] : fEndInnerRadius[1]); }
154 {
return (fEndOuterRadius[0] > fEndOuterRadius[1] ?
155 fEndOuterRadius[0] : fEndOuterRadius[1]); }
188 void CreateSurfaces();
216 G4VTwistSurface* fLowerEndcap;
217 G4VTwistSurface* fUpperEndcap;
218 G4VTwistSurface* fLatterTwisted;
219 G4VTwistSurface* fFormerTwisted;
220 G4VTwistSurface* fInnerHype;
221 G4VTwistSurface* fOuterHype;
226 mutable G4bool fRebuildPolyhedron =
false;
227 mutable G4Polyhedron* fpPolyhedron =
nullptr;
243 fPhiTwist = phitwist;
244 fEndZ[0] = negativeEndz;
245 fEndZ[1] = positiveEndz;
246 fEndZ2[0] = fEndZ[0] * fEndZ[0];
247 fEndZ2[1] = fEndZ[1] * fEndZ[1];
248 fInnerRadius = innerrad;
249 fOuterRadius = outerrad;
250 fInnerRadius2 = fInnerRadius * fInnerRadius;
251 fOuterRadius2 = fOuterRadius * fOuterRadius;
253 if (std::fabs(fEndZ[0]) >= std::fabs(fEndZ[1]))
255 fZHalfLength = std::fabs(fEndZ[0]);
259 fZHalfLength = std::fabs(fEndZ[1]);
262 G4double parity = (fPhiTwist > 0 ? 1 : -1);
263 G4double tanHalfTwist = std::tan(0.5 * fPhiTwist);
264 G4double innerNumerator = std::fabs(fInnerRadius * tanHalfTwist) * parity;
265 G4double outerNumerator = std::fabs(fOuterRadius * tanHalfTwist) * parity;
267 fTanInnerStereo = innerNumerator / fZHalfLength;
268 fTanOuterStereo = outerNumerator / fZHalfLength;
269 fTanInnerStereo2 = fTanInnerStereo * fTanInnerStereo;
270 fTanOuterStereo2 = fTanOuterStereo * fTanOuterStereo;
271 fInnerStereo = std::atan2(innerNumerator, fZHalfLength);
272 fOuterStereo = std::atan2(outerNumerator, fZHalfLength);
273 fEndInnerRadius[0] = std::sqrt(fInnerRadius2 + fEndZ2[0] * fTanInnerStereo2);
274 fEndInnerRadius[1] = std::sqrt(fInnerRadius2 + fEndZ2[1] * fTanInnerStereo2);
275 fEndOuterRadius[0] = std::sqrt(fOuterRadius2 + fEndZ2[0] * fTanOuterStereo2);
276 fEndOuterRadius[1] = std::sqrt(fOuterRadius2 + fEndZ2[1] * fTanOuterStereo2);
278 fKappa = tanHalfTwist / fZHalfLength;
279 fEndPhi[0] = std::atan2(fEndZ[0] * tanHalfTwist, fZHalfLength);
280 fEndPhi[1] = std::atan2(fEndZ[1] * tanHalfTwist, fZHalfLength);
283 G4cout <<
"/********* G4TwistedTubs::SetFields() Field Parameters ***************** " <<
G4endl;
285 G4cout <<
"/* fEndZ(0, 1) : " << fEndZ[0] <<
" , " << fEndZ[1] <<
G4endl;
286 G4cout <<
"/* fEndPhi(0, 1) : " << fEndPhi[0] <<
" , " << fEndPhi[1] <<
G4endl;
287 G4cout <<
"/* fInnerRadius, fOuterRadius : " << fInnerRadius <<
" , " << fOuterRadius <<
G4endl;
288 G4cout <<
"/* fEndInnerRadius(0, 1) : " << fEndInnerRadius[0] <<
" , "
289 << fEndInnerRadius[1] <<
G4endl;
290 G4cout <<
"/* fEndOuterRadius(0, 1) : " << fEndOuterRadius[0] <<
" , "
291 << fEndOuterRadius[1] <<
G4endl;
292 G4cout <<
"/* fInnerStereo, fOuterStereo : " << fInnerStereo <<
" , " << fOuterStereo <<
G4endl;
293 G4cout <<
"/* tanHalfTwist, fKappa : " << tanHalfTwist <<
" , " << fKappa <<
G4endl;
294 G4cout <<
"/*********************************************************************** " <<
G4endl;
CLHEP::Hep3Vector G4ThreeVector
G4GLOB_DLL std::ostream G4cout
G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcnorm=false, G4bool *validnorm=nullptr, G4ThreeVector *n=nullptr) const override
G4double GetOuterRadius() const
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const override
G4double GetZHalfLength() const
G4double GetPhiTwist() const
G4Polyhedron * CreatePolyhedron() const override
G4double GetInnerStereo() const
G4double GetTanInnerStereo() const
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const override
G4TwistedTubs & operator=(const G4TwistedTubs &rhs)
G4double GetEndInnerRadius() const
G4double GetEndOuterRadius() const
G4double GetOuterStereo() const
G4VSolid * Clone() const override
G4Polyhedron * GetPolyhedron() const override
~G4TwistedTubs() override
G4GeometryType GetEntityType() const override
G4double GetEndPhi(G4int i) const
G4TwistedTubs(const G4String &pname, G4double twistedangle, G4double endinnerrad, G4double endouterrad, G4double halfzlen, G4double dphi)
G4double GetTanOuterStereo() const
std::ostream & StreamInfo(std::ostream &os) const override
G4double GetSurfaceArea() override
G4double GetCubicVolume() override
void ComputeDimensions(G4VPVParameterisation *, const G4int, const G4VPhysicalVolume *) override
G4double GetTanInnerStereo2() const
G4double GetTanOuterStereo2() const
void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const override
G4VisExtent GetExtent() const override
G4ThreeVector GetPointOnSurface() const override
void DescribeYourselfTo(G4VGraphicsScene &scene) const override
G4double GetEndZ(G4int i) const
G4double GetKappa() const
G4double GetEndInnerRadius(G4int i) const
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const override
G4double GetInnerRadius() const
EInside Inside(const G4ThreeVector &p) const override
G4double GetEndOuterRadius(G4int i) const
G4VSolid(const G4String &name)