44#ifndef G4TWISTEDTUBS_HH
45#define G4TWISTEDTUBS_HH
183 const G4bool calcnorm =
false,
184 G4bool* validnorm =
nullptr,
201 std::ostream &
StreamInfo(std::ostream& os)
const override;
223 {
return fEndInnerRadius[i]; }
225 {
return fEndOuterRadius[i]; }
227 {
return (fEndInnerRadius[0] > fEndInnerRadius[1] ?
228 fEndInnerRadius[0] : fEndInnerRadius[1]); }
230 {
return (fEndOuterRadius[0] > fEndOuterRadius[1] ?
231 fEndOuterRadius[0] : fEndOuterRadius[1]); }
286 void CreateSurfaces();
318 G4VTwistSurface* fLowerEndcap;
319 G4VTwistSurface* fUpperEndcap;
320 G4VTwistSurface* fLatterTwisted;
321 G4VTwistSurface* fFormerTwisted;
322 G4VTwistSurface* fInnerHype;
323 G4VTwistSurface* fOuterHype;
328 mutable G4bool fRebuildPolyhedron =
false;
329 mutable G4Polyhedron* fpPolyhedron =
nullptr;
345 fPhiTwist = phitwist;
346 fEndZ[0] = negativeEndz;
347 fEndZ[1] = positiveEndz;
348 fEndZ2[0] = fEndZ[0] * fEndZ[0];
349 fEndZ2[1] = fEndZ[1] * fEndZ[1];
350 fInnerRadius = innerrad;
351 fOuterRadius = outerrad;
352 fInnerRadius2 = fInnerRadius * fInnerRadius;
353 fOuterRadius2 = fOuterRadius * fOuterRadius;
355 if (std::fabs(fEndZ[0]) >= std::fabs(fEndZ[1]))
357 fZHalfLength = std::fabs(fEndZ[0]);
361 fZHalfLength = std::fabs(fEndZ[1]);
364 G4double parity = (fPhiTwist > 0 ? 1 : -1);
365 G4double tanHalfTwist = std::tan(0.5 * fPhiTwist);
366 G4double innerNumerator = std::fabs(fInnerRadius * tanHalfTwist) * parity;
367 G4double outerNumerator = std::fabs(fOuterRadius * tanHalfTwist) * parity;
369 fTanInnerStereo = innerNumerator / fZHalfLength;
370 fTanOuterStereo = outerNumerator / fZHalfLength;
371 fTanInnerStereo2 = fTanInnerStereo * fTanInnerStereo;
372 fTanOuterStereo2 = fTanOuterStereo * fTanOuterStereo;
373 fInnerStereo = std::atan2(innerNumerator, fZHalfLength);
374 fOuterStereo = std::atan2(outerNumerator, fZHalfLength);
375 fEndInnerRadius[0] = std::sqrt(fInnerRadius2 + fEndZ2[0] * fTanInnerStereo2);
376 fEndInnerRadius[1] = std::sqrt(fInnerRadius2 + fEndZ2[1] * fTanInnerStereo2);
377 fEndOuterRadius[0] = std::sqrt(fOuterRadius2 + fEndZ2[0] * fTanOuterStereo2);
378 fEndOuterRadius[1] = std::sqrt(fOuterRadius2 + fEndZ2[1] * fTanOuterStereo2);
380 fKappa = tanHalfTwist / fZHalfLength;
381 fEndPhi[0] = std::atan2(fEndZ[0] * tanHalfTwist, fZHalfLength);
382 fEndPhi[1] = std::atan2(fEndZ[1] * tanHalfTwist, fZHalfLength);
385 G4cout <<
"/********* G4TwistedTubs::SetFields() Field Parameters ***************** " <<
G4endl;
387 G4cout <<
"/* fEndZ(0, 1) : " << fEndZ[0] <<
" , " << fEndZ[1] <<
G4endl;
388 G4cout <<
"/* fEndPhi(0, 1) : " << fEndPhi[0] <<
" , " << fEndPhi[1] <<
G4endl;
389 G4cout <<
"/* fInnerRadius, fOuterRadius : " << fInnerRadius <<
" , " << fOuterRadius <<
G4endl;
390 G4cout <<
"/* fEndInnerRadius(0, 1) : " << fEndInnerRadius[0] <<
" , "
391 << fEndInnerRadius[1] <<
G4endl;
392 G4cout <<
"/* fEndOuterRadius(0, 1) : " << fEndOuterRadius[0] <<
" , "
393 << fEndOuterRadius[1] <<
G4endl;
394 G4cout <<
"/* fInnerStereo, fOuterStereo : " << fInnerStereo <<
" , " << fOuterStereo <<
G4endl;
395 G4cout <<
"/* tanHalfTwist, fKappa : " << tanHalfTwist <<
" , " << fKappa <<
G4endl;
396 G4cout <<
"/*********************************************************************** " <<
G4endl;
CLHEP::Hep3Vector G4ThreeVector
G4GLOB_DLL std::ostream G4cout
G4ClippablePolygon in a utility class defining a polygon that can be clipped by a voxel.
G4SolidExtentList is utility class designed for calculating the extent of a CSG-like solid for a voxe...
G4TwistedTubs is a sector of a twisted hollow cylinder. A twisted cylinder which is placed along with...
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
G4VPVParameterisation ia an abstract base class for Parameterisation, able to compute the transformat...
G4VPhysicalVolume is an abstract base class for the representation of a positioned volume....
G4VSolid is an abstract base class for solids, physical shapes that can be tracked through....
G4VSolid(const G4String &name)
G4VTwistSurface is a base class for boundary surface of a G4VSolid.
G4VoxelLimits represents limitation/restrictions of space, where restrictions are only made perpendic...