Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4TwistedTubs Class Reference

G4TwistedTubs is a sector of a twisted hollow cylinder. A twisted cylinder which is placed along with Z axis and is separated into phi-segments should become a hyperboloid, and its each segmented piece should be tilted with a stereo angle. More...

#include <G4TwistedTubs.hh>

Inheritance diagram for G4TwistedTubs:

Public Member Functions

 G4TwistedTubs (const G4String &pname, G4double twistedangle, G4double endinnerrad, G4double endouterrad, G4double halfzlen, G4double dphi)
 G4TwistedTubs (const G4String &pname, G4double twistedangle, G4double endinnerrad, G4double endouterrad, G4double halfzlen, G4int nseg, G4double totphi)
 G4TwistedTubs (const G4String &pname, G4double twistedangle, G4double innerrad, G4double outerrad, G4double negativeEndz, G4double positiveEndz, G4double dphi)
 G4TwistedTubs (const G4String &pname, G4double twistedangle, G4double innerrad, G4double outerrad, G4double negativeEndz, G4double positiveEndz, G4int nseg, G4double totphi)
 ~G4TwistedTubs () override
void ComputeDimensions (G4VPVParameterisation *, const G4int, const G4VPhysicalVolume *) override
void BoundingLimits (G4ThreeVector &pMin, G4ThreeVector &pMax) const override
G4bool CalculateExtent (const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const override
G4double DistanceToIn (const G4ThreeVector &p, const G4ThreeVector &v) const override
G4double DistanceToIn (const G4ThreeVector &p) const override
G4double DistanceToOut (const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcnorm=false, G4bool *validnorm=nullptr, G4ThreeVector *n=nullptr) const override
G4double DistanceToOut (const G4ThreeVector &p) const override
EInside Inside (const G4ThreeVector &p) const override
G4ThreeVector SurfaceNormal (const G4ThreeVector &p) const override
void DescribeYourselfTo (G4VGraphicsScene &scene) const override
G4PolyhedronCreatePolyhedron () const override
G4PolyhedronGetPolyhedron () const override
G4VisExtent GetExtent () const override
std::ostream & StreamInfo (std::ostream &os) const override
G4double GetDPhi () const
G4double GetPhiTwist () const
G4double GetInnerRadius () const
G4double GetOuterRadius () const
G4double GetInnerStereo () const
G4double GetOuterStereo () const
G4double GetZHalfLength () const
G4double GetKappa () const
G4double GetTanInnerStereo () const
G4double GetTanInnerStereo2 () const
G4double GetTanOuterStereo () const
G4double GetTanOuterStereo2 () const
G4double GetEndZ (G4int i) const
G4double GetEndPhi (G4int i) const
G4double GetEndInnerRadius (G4int i) const
G4double GetEndOuterRadius (G4int i) const
G4double GetEndInnerRadius () const
G4double GetEndOuterRadius () const
G4GeometryType GetEntityType () const override
G4VSolidClone () const override
G4double GetCubicVolume () override
G4double GetSurfaceArea () override
G4ThreeVector GetPointOnSurface () const override
 G4TwistedTubs (__void__ &)
 G4TwistedTubs (const G4TwistedTubs &rhs)
G4TwistedTubsoperator= (const G4TwistedTubs &rhs)
Public Member Functions inherited from G4VSolid
 G4VSolid (const G4String &name)
virtual ~G4VSolid ()
 G4VSolid (const G4VSolid &rhs)
G4VSolidoperator= (const G4VSolid &rhs)
G4bool operator== (const G4VSolid &s) const
G4String GetName () const
void SetName (const G4String &name)
G4double GetTolerance () const
virtual G4int GetNumOfConstituents () const
virtual G4bool IsFaceted () const
void DumpInfo () const
virtual const G4VSolidGetConstituentSolid (G4int no) const
virtual G4VSolidGetConstituentSolid (G4int no)
virtual const G4DisplacedSolidGetDisplacedSolidPtr () const
virtual G4DisplacedSolidGetDisplacedSolidPtr ()
 G4VSolid (__void__ &)
G4double EstimateCubicVolume (G4int nStat, G4double epsilon) const
G4double EstimateSurfaceArea (G4int nStat, G4double epsilon) const

Additional Inherited Members

Protected Member Functions inherited from G4VSolid
void CalculateClippedPolygonExtent (G4ThreeVectorList &pPolygon, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis, G4double &pMin, G4double &pMax) const
void ClipCrossSection (G4ThreeVectorList *pVertices, const G4int pSectionIndex, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis, G4double &pMin, G4double &pMax) const
void ClipBetweenSections (G4ThreeVectorList *pVertices, const G4int pSectionIndex, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis, G4double &pMin, G4double &pMax) const
void ClipPolygon (G4ThreeVectorList &pPolygon, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis) const
Protected Attributes inherited from G4VSolid
G4double kCarTolerance

Detailed Description

G4TwistedTubs is a sector of a twisted hollow cylinder. A twisted cylinder which is placed along with Z axis and is separated into phi-segments should become a hyperboloid, and its each segmented piece should be tilted with a stereo angle.

Definition at line 62 of file G4TwistedTubs.hh.

Constructor & Destructor Documentation

◆ G4TwistedTubs() [1/6]

G4TwistedTubs::G4TwistedTubs ( const G4String & pname,
G4double twistedangle,
G4double endinnerrad,
G4double endouterrad,
G4double halfzlen,
G4double dphi )

Constructs a twisted tube, given radii and twist angle.

Parameters
[in]pNameThe solid name.
[in]twistedangleThe twisted angle.
[in]endinnerradInner radius at endcap.
[in]endouterradOuter radius at endcap.
[in]halfzlenHalf Z length.
[in]dphiPhi angle of a segment.

Definition at line 62 of file G4TwistedTubs.cc.

68 : G4VSolid(pname), fDPhi(dphi),
69 fLowerEndcap(nullptr), fUpperEndcap(nullptr), fLatterTwisted(nullptr),
70 fFormerTwisted(nullptr), fInnerHype(nullptr), fOuterHype(nullptr)
71{
72 if (endinnerrad < DBL_MIN)
73 {
74 G4Exception("G4TwistedTubs::G4TwistedTubs()", "GeomSolids0002",
75 FatalErrorInArgument, "Invalid end-inner-radius!");
76 }
77
78 G4double sinhalftwist = std::sin(0.5 * twistedangle);
79
80 G4double endinnerradX = endinnerrad * sinhalftwist;
81 G4double innerrad = std::sqrt( endinnerrad * endinnerrad
82 - endinnerradX * endinnerradX );
83
84 G4double endouterradX = endouterrad * sinhalftwist;
85 G4double outerrad = std::sqrt( endouterrad * endouterrad
86 - endouterradX * endouterradX );
87
88 // temporary treatment!!
89 SetFields(twistedangle, innerrad, outerrad, -halfzlen, halfzlen);
90 CreateSurfaces();
91}
@ FatalErrorInArgument
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
double G4double
Definition G4Types.hh:83
G4VSolid(const G4String &name)
Definition G4VSolid.cc:59
#define DBL_MIN
Definition templates.hh:54

Referenced by Clone(), G4TwistedTubs(), and operator=().

◆ G4TwistedTubs() [2/6]

G4TwistedTubs::G4TwistedTubs ( const G4String & pname,
G4double twistedangle,
G4double endinnerrad,
G4double endouterrad,
G4double halfzlen,
G4int nseg,
G4double totphi )

Constructs a twisted tube, given radii, twist angle and number of segments.

Parameters
[in]pNameThe solid name.
[in]twistedangleThe twisted angle.
[in]endinnerradInner radius at endcap.
[in]endouterradOuter radius at endcap.
[in]halfzlenHalf Z length.
[in]nsegNumber of segments in Phi.
[in]totphiTotal angle of all segments.

Definition at line 93 of file G4TwistedTubs.cc.

100 : G4VSolid(pname),
101 fLowerEndcap(nullptr), fUpperEndcap(nullptr), fLatterTwisted(nullptr),
102 fFormerTwisted(nullptr), fInnerHype(nullptr), fOuterHype(nullptr)
103{
104
105 if (nseg == 0)
106 {
107 std::ostringstream message;
108 message << "Invalid number of segments." << G4endl
109 << " nseg = " << nseg;
110 G4Exception("G4TwistedTubs::G4TwistedTubs()", "GeomSolids0002",
111 FatalErrorInArgument, message);
112 }
113 if (totphi == DBL_MIN || endinnerrad < DBL_MIN)
114 {
115 G4Exception("G4TwistedTubs::G4TwistedTubs()", "GeomSolids0002",
116 FatalErrorInArgument, "Invalid total-phi or end-inner-radius!");
117 }
118
119 G4double sinhalftwist = std::sin(0.5 * twistedangle);
120
121 G4double endinnerradX = endinnerrad * sinhalftwist;
122 G4double innerrad = std::sqrt( endinnerrad * endinnerrad
123 - endinnerradX * endinnerradX );
124
125 G4double endouterradX = endouterrad * sinhalftwist;
126 G4double outerrad = std::sqrt( endouterrad * endouterrad
127 - endouterradX * endouterradX );
128
129 // temporary treatment!!
130 fDPhi = totphi / nseg;
131 SetFields(twistedangle, innerrad, outerrad, -halfzlen, halfzlen);
132 CreateSurfaces();
133}
#define G4endl
Definition G4ios.hh:67

◆ G4TwistedTubs() [3/6]

G4TwistedTubs::G4TwistedTubs ( const G4String & pname,
G4double twistedangle,
G4double innerrad,
G4double outerrad,
G4double negativeEndz,
G4double positiveEndz,
G4double dphi )

Constructs a twisted tube, given radii, twist angle and EndZ values.

Parameters
[in]pNameThe solid name.
[in]twistedangleThe twisted angle.
[in]innerradInner radius at z=0.
[in]outerradOuter radius at z=0.
[in]negativeEndz-ve Z endplate.
[in]positiveEndz+ve Z endplate.
[in]dphiPhi angle of a segment.

Definition at line 135 of file G4TwistedTubs.cc.

142 : G4VSolid(pname), fDPhi(dphi),
143 fLowerEndcap(nullptr), fUpperEndcap(nullptr), fLatterTwisted(nullptr),
144 fFormerTwisted(nullptr), fInnerHype(nullptr), fOuterHype(nullptr)
145{
146 if (innerrad < DBL_MIN)
147 {
148 G4Exception("G4TwistedTubs::G4TwistedTubs()", "GeomSolids0002",
149 FatalErrorInArgument, "Invalid end-inner-radius!");
150 }
151
152 SetFields(twistedangle, innerrad, outerrad, negativeEndz, positiveEndz);
153 CreateSurfaces();
154}

◆ G4TwistedTubs() [4/6]

G4TwistedTubs::G4TwistedTubs ( const G4String & pname,
G4double twistedangle,
G4double innerrad,
G4double outerrad,
G4double negativeEndz,
G4double positiveEndz,
G4int nseg,
G4double totphi )

Constructs a twisted tube, given radii, twist angle, EndZ values and number of segments.

Parameters
[in]pNameThe solid name.
[in]twistedangleThe twisted angle.
[in]innerradInner radius at z=0.
[in]outerradOuter radius at z=0.
[in]negativeEndz-ve Z endplate.
[in]positiveEndz+ve Z endplate.
[in]nsegNumber of segments in Phi.
[in]totphiTotal angle of all segments.

Definition at line 156 of file G4TwistedTubs.cc.

164 : G4VSolid(pname),
165 fLowerEndcap(nullptr), fUpperEndcap(nullptr), fLatterTwisted(nullptr),
166 fFormerTwisted(nullptr), fInnerHype(nullptr), fOuterHype(nullptr)
167{
168 if (nseg == 0)
169 {
170 std::ostringstream message;
171 message << "Invalid number of segments." << G4endl
172 << " nseg = " << nseg;
173 G4Exception("G4TwistedTubs::G4TwistedTubs()", "GeomSolids0002",
174 FatalErrorInArgument, message);
175 }
176 if (totphi == DBL_MIN || innerrad < DBL_MIN)
177 {
178 G4Exception("G4TwistedTubs::G4TwistedTubs()", "GeomSolids0002",
179 FatalErrorInArgument, "Invalid total-phi or end-inner-radius!");
180 }
181
182 fDPhi = totphi / nseg;
183 SetFields(twistedangle, innerrad, outerrad, negativeEndz, positiveEndz);
184 CreateSurfaces();
185}

◆ ~G4TwistedTubs()

G4TwistedTubs::~G4TwistedTubs ( )
override

Destructor.

Definition at line 201 of file G4TwistedTubs.cc.

202{
203 delete fLowerEndcap;
204 delete fUpperEndcap;
205 delete fLatterTwisted;
206 delete fFormerTwisted;
207 delete fInnerHype;
208 delete fOuterHype;
209 delete fpPolyhedron; fpPolyhedron = nullptr;
210}

◆ G4TwistedTubs() [5/6]

G4TwistedTubs::G4TwistedTubs ( __void__ & a)

Fake default constructor for usage restricted to direct object persistency for clients requiring preallocation of memory for persistifiable objects.

Definition at line 190 of file G4TwistedTubs.cc.

191 : G4VSolid(a),
192 fLowerEndcap(nullptr), fUpperEndcap(nullptr),
193 fLatterTwisted(nullptr), fFormerTwisted(nullptr),
194 fInnerHype(nullptr), fOuterHype(nullptr)
195{
196}

◆ G4TwistedTubs() [6/6]

G4TwistedTubs::G4TwistedTubs ( const G4TwistedTubs & rhs)

Copy constructor and assignment operator.

Definition at line 215 of file G4TwistedTubs.cc.

216 : G4VSolid(rhs), fPhiTwist(rhs.fPhiTwist),
217 fInnerRadius(rhs.fInnerRadius), fOuterRadius(rhs.fOuterRadius),
218 fDPhi(rhs.fDPhi), fZHalfLength(rhs.fZHalfLength),
219 fInnerStereo(rhs.fInnerStereo), fOuterStereo(rhs.fOuterStereo),
220 fTanInnerStereo(rhs.fTanInnerStereo), fTanOuterStereo(rhs.fTanOuterStereo),
221 fKappa(rhs.fKappa), fInnerRadius2(rhs.fInnerRadius2),
222 fOuterRadius2(rhs.fOuterRadius2), fTanInnerStereo2(rhs.fTanInnerStereo2),
223 fTanOuterStereo2(rhs.fTanOuterStereo2),
224 fLowerEndcap(nullptr), fUpperEndcap(nullptr), fLatterTwisted(nullptr), fFormerTwisted(nullptr),
225 fInnerHype(nullptr), fOuterHype(nullptr),
226 fCubicVolume(rhs.fCubicVolume), fSurfaceArea(rhs.fSurfaceArea)
227{
228 for (auto i=0; i<2; ++i)
229 {
230 fEndZ[i] = rhs.fEndZ[i];
231 fEndInnerRadius[i] = rhs.fEndInnerRadius[i];
232 fEndOuterRadius[i] = rhs.fEndOuterRadius[i];
233 fEndPhi[i] = rhs.fEndPhi[i];
234 fEndZ2[i] = rhs.fEndZ2[i];
235 }
236 CreateSurfaces();
237}

Member Function Documentation

◆ BoundingLimits()

void G4TwistedTubs::BoundingLimits ( G4ThreeVector & pMin,
G4ThreeVector & pMax ) const
overridevirtual

Computes the bounding limits of the solid.

Parameters
[out]pMinThe minimum bounding limit point.
[out]pMaxThe maximum bounding limit point.

Reimplemented from G4VSolid.

Definition at line 298 of file G4TwistedTubs.cc.

300{
301 // Find bounding tube
302 G4double rmin = GetInnerRadius();
304
305 G4double zmin = std::min(GetEndZ(0), GetEndZ(1));
306 G4double zmax = std::max(GetEndZ(0), GetEndZ(1));
307
308 G4double dphi = 0.5*GetDPhi();
309 G4double sphi = std::min(GetEndPhi(0), GetEndPhi(1)) - dphi;
310 G4double ephi = std::max(GetEndPhi(0), GetEndPhi(1)) + dphi;
311 G4double totalphi = ephi - sphi;
312
313 // Find bounding box
314 if (dphi <= 0 || totalphi >= CLHEP::twopi)
315 {
316 pMin.set(-rmax,-rmax, zmin);
317 pMax.set( rmax, rmax, zmax);
318 }
319 else
320 {
321 G4TwoVector vmin,vmax;
322 G4GeomTools::DiskExtent(rmin, rmax, sphi, totalphi, vmin, vmax);
323 pMin.set(vmin.x(), vmin.y(), zmin);
324 pMax.set(vmax.x(), vmax.y(), zmax);
325 }
326
327 // Check correctness of the bounding box
328 //
329 if (pMin.x() >= pMax.x() || pMin.y() >= pMax.y() || pMin.z() >= pMax.z())
330 {
331 std::ostringstream message;
332 message << "Bad bounding box (min >= max) for solid: "
333 << GetName() << " !"
334 << "\npMin = " << pMin
335 << "\npMax = " << pMax;
336 G4Exception("G4TwistedTubs::BoundingLimits()", "GeomMgt0001",
337 JustWarning, message);
338 DumpInfo();
339 }
340}
@ JustWarning
CLHEP::Hep2Vector G4TwoVector
double x() const
double y() const
double z() const
double x() const
double y() const
void set(double x, double y, double z)
static G4bool DiskExtent(G4double rmin, G4double rmax, G4double startPhi, G4double delPhi, G4TwoVector &pmin, G4TwoVector &pmax)
G4double GetEndOuterRadius() const
G4double GetEndPhi(G4int i) const
G4double GetEndZ(G4int i) const
G4double GetInnerRadius() const
G4double GetDPhi() const
G4String GetName() const
void DumpInfo() const

Referenced by CalculateExtent(), and GetExtent().

◆ CalculateExtent()

G4bool G4TwistedTubs::CalculateExtent ( const EAxis pAxis,
const G4VoxelLimits & pVoxelLimit,
const G4AffineTransform & pTransform,
G4double & pMin,
G4double & pMax ) const
overridevirtual

Calculates the minimum and maximum extent of the solid, when under the specified transform, and within the specified limits.

Parameters
[in]pAxisThe axis along which compute the extent.
[in]pVoxelLimitThe limiting space dictated by voxels.
[in]pTransformThe internal transformation applied to the solid.
[out]pMinThe minimum extent value.
[out]pMaxThe maximum extent value.
Returns
True if the solid is intersected by the extent region.

Implements G4VSolid.

Definition at line 346 of file G4TwistedTubs.cc.

350{
351 G4ThreeVector bmin, bmax;
352
353 // Get bounding box
354 BoundingLimits(bmin,bmax);
355
356 // Find extent
357 G4BoundingEnvelope bbox(bmin,bmax);
358 return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
359}
CLHEP::Hep3Vector G4ThreeVector
void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const override

◆ Clone()

G4VSolid * G4TwistedTubs::Clone ( ) const
overridevirtual

Makes a clone of the object for use in multi-treading.

Returns
A pointer to the new cloned allocated solid.

Reimplemented from G4VSolid.

Definition at line 899 of file G4TwistedTubs.cc.

900{
901 return new G4TwistedTubs(*this);
902}
G4TwistedTubs(const G4String &pname, G4double twistedangle, G4double endinnerrad, G4double endouterrad, G4double halfzlen, G4double dphi)

◆ ComputeDimensions()

void G4TwistedTubs::ComputeDimensions ( G4VPVParameterisation * ,
const G4int ,
const G4VPhysicalVolume *  )
overridevirtual

Thows a fatal exception. Parameterisations are not allowed on this shape.

Reimplemented from G4VSolid.

Definition at line 286 of file G4TwistedTubs.cc.

289{
290 G4Exception("G4TwistedTubs::ComputeDimensions()",
291 "GeomSolids0001", FatalException,
292 "G4TwistedTubs does not support Parameterisation.");
293}
@ FatalException

◆ CreatePolyhedron()

G4Polyhedron * G4TwistedTubs::CreatePolyhedron ( ) const
overridevirtual

Creates a Polyhedron used for Visualisation. It is the caller's responsibility to delete it. A null pointer means "not created".

Reimplemented from G4VSolid.

Definition at line 774 of file G4TwistedTubs.cc.

775{
776 // number of meshes
777 //
778 G4double absPhiTwist = std::abs(fPhiTwist);
779 G4double dA = std::max(fDPhi,absPhiTwist);
780 const G4int k =
782 const G4int n =
783 G4int(G4Polyhedron::GetNumberOfRotationSteps() * absPhiTwist / twopi) + 2;
784
785 const G4int nnodes = 4*(k-1)*(n-2) + 2*k*k ;
786 const G4int nfaces = 4*(k-1)*(n-1) + 2*(k-1)*(k-1) ;
787
788 auto ph = new G4Polyhedron;
789 typedef G4double G4double3[3];
790 typedef G4int G4int4[4];
791 auto xyz = new G4double3[nnodes]; // number of nodes
792 auto faces = new G4int4[nfaces] ; // number of faces
793 fLowerEndcap->GetFacets(k,k,xyz,faces,0) ;
794 fUpperEndcap->GetFacets(k,k,xyz,faces,1) ;
795 fInnerHype->GetFacets(k,n,xyz,faces,2) ;
796 fFormerTwisted->GetFacets(k,n,xyz,faces,3) ;
797 fOuterHype->GetFacets(k,n,xyz,faces,4) ;
798 fLatterTwisted->GetFacets(k,n,xyz,faces,5) ;
799
800 ph->createPolyhedron(nnodes,nfaces,xyz,faces);
801
802 delete[] xyz;
803 delete[] faces;
804
805 return ph;
806}
int G4int
Definition G4Types.hh:85
static G4int GetNumberOfRotationSteps()

Referenced by GetPolyhedron().

◆ DescribeYourselfTo()

void G4TwistedTubs::DescribeYourselfTo ( G4VGraphicsScene & scene) const
overridevirtual

Methods for creating graphical representations (i.e. for visualisation).

Implements G4VSolid.

Definition at line 752 of file G4TwistedTubs.cc.

753{
754 scene.AddSolid (*this);
755}
virtual void AddSolid(const G4Box &)=0

◆ DistanceToIn() [1/2]

G4double G4TwistedTubs::DistanceToIn ( const G4ThreeVector & p) const
overridevirtual

Calculates the distance to the nearest surface of a shape from an outside point. The distance can be an underestimate.

Parameters
[in]pThe point at offset p.
Returns
The safety distance to enter the shape.

Implements G4VSolid.

Definition at line 512 of file G4TwistedTubs.cc.

513{
514 // DistanceToIn(p):
515 // Calculate distance to surface of shape from `outside',
516 // allowing for tolerance
517
518 //
519 // Calculate DistanceToIn(p)
520 //
521
522 EInside currentside = Inside(p);
523
524 switch (currentside)
525 {
526 case (kInside) :
527 {}
528 case (kSurface) :
529 {
530 return 0;
531 }
532 case (kOutside) :
533 {
534 // Initialize
535 G4double distance = kInfinity;
536
537 // find intersections and choose nearest one.
538 G4VTwistSurface *surfaces[6];
539 surfaces[0] = fLowerEndcap;
540 surfaces[1] = fUpperEndcap;
541 surfaces[2] = fLatterTwisted;
542 surfaces[3] = fFormerTwisted;
543 surfaces[4] = fInnerHype;
544 surfaces[5] = fOuterHype;
545
546 G4ThreeVector xx;
547 G4ThreeVector bestxx;
548 for (const auto & surface : surfaces)
549 {
550 G4double tmpdistance = surface->DistanceTo(p, xx);
551 if (tmpdistance < distance)
552 {
553 distance = tmpdistance;
554 bestxx = xx;
555 }
556 }
557 return distance;
558 }
559 default :
560 {
561 G4Exception("G4TwistedTubs::DistanceToIn(p)", "GeomSolids0003",
562 FatalException, "Unknown point location!");
563 }
564 } // switch end
565
566 return kInfinity;
567}
EInside Inside(const G4ThreeVector &p) const override
EInside
Definition geomdefs.hh:67
@ kInside
Definition geomdefs.hh:70
@ kOutside
Definition geomdefs.hh:68
@ kSurface
Definition geomdefs.hh:69

◆ DistanceToIn() [2/2]

G4double G4TwistedTubs::DistanceToIn ( const G4ThreeVector & p,
const G4ThreeVector & v ) const
overridevirtual

Concrete implementations of the expected query interfaces for solids, as defined in the base class G4VSolid.

Implements G4VSolid.

Definition at line 445 of file G4TwistedTubs.cc.

447{
448
449 // DistanceToIn (p, v):
450 // Calculate distance to surface of shape from `outside'
451 // along with the v, allowing for tolerance.
452 // The function returns kInfinity if no intersection or
453 // just grazing within tolerance.
454
455 //
456 // Calculate DistanceToIn(p,v)
457 //
458
459 EInside currentside = Inside(p);
460
461 if (currentside == kInside)
462 {
463 }
464 else
465 {
466 if (currentside == kSurface)
467 {
468 // particle is just on a boundary.
469 // If the particle is entering to the volume, return 0.
470 //
471 G4ThreeVector normal = SurfaceNormal(p);
472 if (normal*v < 0)
473 {
474 return 0;
475 }
476 }
477 }
478
479 // now, we can take smallest positive distance.
480
481 // Initialize
482 //
483 G4double distance = kInfinity;
484
485 // find intersections and choose nearest one.
486 //
487 G4VTwistSurface* surfaces[6];
488 surfaces[0] = fLowerEndcap;
489 surfaces[1] = fUpperEndcap;
490 surfaces[2] = fLatterTwisted;
491 surfaces[3] = fFormerTwisted;
492 surfaces[4] = fInnerHype;
493 surfaces[5] = fOuterHype;
494
495 G4ThreeVector xx;
496 G4ThreeVector bestxx;
497 for (const auto & surface : surfaces)
498 {
499 G4double tmpdistance = surface->DistanceToIn(p, v, xx);
500 if (tmpdistance < distance)
501 {
502 distance = tmpdistance;
503 bestxx = xx;
504 }
505 }
506 return distance;
507}
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const override

◆ DistanceToOut() [1/2]

G4double G4TwistedTubs::DistanceToOut ( const G4ThreeVector & p) const
overridevirtual

Calculates the distance to the nearest surface of a shape from an inside point 'p'. The distance can be an underestimate.

Parameters
[in]pThe point at offset p.
Returns
The safety distance to exit the shape.

Implements G4VSolid.

Definition at line 658 of file G4TwistedTubs.cc.

659{
660 // DistanceToOut(p):
661 // Calculate distance to surface of shape from `inside',
662 // allowing for tolerance
663
664 //
665 // Calculate DistanceToOut(p)
666 //
667
668 EInside currentside = Inside(p);
669
670 switch (currentside)
671 {
672 case (kOutside) :
673 {
674 }
675 case (kSurface) :
676 {
677 return 0;
678 }
679 case (kInside) :
680 {
681 // Initialize
682 G4double distance = kInfinity;
683
684 // find intersections and choose nearest one.
685 G4VTwistSurface* surfaces[6];
686 surfaces[0] = fLatterTwisted;
687 surfaces[1] = fFormerTwisted;
688 surfaces[2] = fInnerHype;
689 surfaces[3] = fOuterHype;
690 surfaces[4] = fLowerEndcap;
691 surfaces[5] = fUpperEndcap;
692
693 G4ThreeVector xx;
694 G4ThreeVector bestxx;
695 for (const auto & surface : surfaces)
696 {
697 G4double tmpdistance = surface->DistanceTo(p, xx);
698 if (tmpdistance < distance)
699 {
700 distance = tmpdistance;
701 bestxx = xx;
702 }
703 }
704 return distance;
705 }
706 default :
707 {
708 G4Exception("G4TwistedTubs::DistanceToOut(p)", "GeomSolids0003",
709 FatalException, "Unknown point location!");
710 }
711 } // switch end
712
713 return 0.;
714}

◆ DistanceToOut() [2/2]

G4double G4TwistedTubs::DistanceToOut ( const G4ThreeVector & p,
const G4ThreeVector & v,
const G4bool calcNorm = false,
G4bool * validNorm = nullptr,
G4ThreeVector * n = nullptr ) const
overridevirtual

Returns the distance along the normalised vector 'v' to the shape, from a point at an offset 'p' inside or on the surface of the shape. Intersections with surfaces, when the point is less than Tolerance/2 from a surface must be ignored.

Parameters
[in]pThe point at offset p.
[in]vThe normalised direction vector.
[in]calcNormFlag to indicate if to calculate the normal or not.
[out]validNormFlag set to true if the solid lies entirely behind or on the exiting surface. It is set false if the solid does not lie entirely behind or on the exiting surface. 'calcNorm' must be true, otherwise it is unused.
[out]nThe exiting outwards normal vector (undefined Magnitude). 'calcNorm' must be true, otherwise it is unused.
Returns
The distance to exit the shape.

Implements G4VSolid.

Definition at line 572 of file G4TwistedTubs.cc.

577{
578 // DistanceToOut (p, v):
579 // Calculate distance to surface of shape from `inside'
580 // along with the v, allowing for tolerance.
581 // The function returns kInfinity if no intersection or
582 // just grazing within tolerance.
583
584 //
585 // Calculate DistanceToOut(p,v)
586 //
587
588 EInside currentside = Inside(p);
589 if (currentside == kOutside)
590 {
591 }
592 else
593 {
594 if (currentside == kSurface)
595 {
596 // particle is just on a boundary.
597 // If the particle is exiting from the volume, return 0.
598 //
599 G4ThreeVector normal = SurfaceNormal(p);
600 if (normal*v > 0)
601 {
602 if (calcNorm)
603 {
604 *norm = normal;
605 *validNorm = true;
606 }
607 return 0;
608 }
609 }
610 }
611
612 // now, we can take smallest positive distance.
613
614 // Initialize
615 //
616 G4double distance = kInfinity;
617
618 // find intersections and choose nearest one.
619 //
620 G4VTwistSurface* surfaces[6];
621 surfaces[0] = fLatterTwisted;
622 surfaces[1] = fFormerTwisted;
623 surfaces[2] = fInnerHype;
624 surfaces[3] = fOuterHype;
625 surfaces[4] = fLowerEndcap;
626 surfaces[5] = fUpperEndcap;
627
628 G4int besti = -1;
629 G4ThreeVector xx;
630 G4ThreeVector bestxx;
631 for (auto i=0; i<6; ++i)
632 {
633 G4double tmpdistance = surfaces[i]->DistanceToOut(p, v, xx);
634 if (tmpdistance < distance)
635 {
636 distance = tmpdistance;
637 bestxx = xx;
638 besti = i;
639 }
640 }
641
642 if (calcNorm)
643 {
644 if (besti != -1)
645 {
646 *norm = (surfaces[besti]->GetNormal(p, true));
647 *validNorm = surfaces[besti]->IsValidNorm();
648 }
649 }
650
651 return distance;
652}
virtual G4ThreeVector GetNormal(const G4ThreeVector &p, G4bool isGlobal)=0
G4bool IsValidNorm() const
virtual G4double DistanceToOut(const G4ThreeVector &gp, const G4ThreeVector &gv, G4ThreeVector &gxxbest)

◆ GetCubicVolume()

G4double G4TwistedTubs::GetCubicVolume ( )
overridevirtual

Returning an estimation of the solid volume (capacity) and surface area, in internal units. Caches the computed value once computed the first time.

Reimplemented from G4VSolid.

Definition at line 955 of file G4TwistedTubs.cc.

956{
957 if (fCubicVolume == 0)
958 {
959 G4AutoLock l(&twtubsMutex);
960 G4double DPhi = GetDPhi();
961 G4double Z0 = GetEndZ(0);
962 G4double Z1 = GetEndZ(1);
963 G4double Ain = GetInnerRadius();
964 G4double Aout = GetOuterRadius();
965 G4double R0in = GetEndInnerRadius(0);
966 G4double R1in = GetEndInnerRadius(1);
967 G4double R0out = GetEndOuterRadius(0);
968 G4double R1out = GetEndOuterRadius(1);
969
970 // V_hyperboloid = pi*h*(2*a*a + R*R)/3
971 fCubicVolume = (2.*(Z1 - Z0)*(Aout + Ain)*(Aout - Ain)
972 + Z1*(R1out + R1in)*(R1out - R1in)
973 - Z0*(R0out + R0in)*(R0out - R0in))*DPhi/6.;
974 l.unlock();
975 }
976 return fCubicVolume;
977}
G4TemplateAutoLock< G4Mutex > G4AutoLock
G4double GetOuterRadius() const
G4double GetEndInnerRadius() const

◆ GetDPhi()

G4double G4TwistedTubs::GetDPhi ( ) const
inline

◆ GetEndInnerRadius() [1/2]

G4double G4TwistedTubs::GetEndInnerRadius ( ) const
inline

Definition at line 226 of file G4TwistedTubs.hh.

227 { return (fEndInnerRadius[0] > fEndInnerRadius[1] ?
228 fEndInnerRadius[0] : fEndInnerRadius[1]); }

Referenced by GetCubicVolume(), GetPointOnSurface(), and GetSurfaceArea().

◆ GetEndInnerRadius() [2/2]

G4double G4TwistedTubs::GetEndInnerRadius ( G4int i) const
inline

Definition at line 222 of file G4TwistedTubs.hh.

223 { return fEndInnerRadius[i]; }

◆ GetEndOuterRadius() [1/2]

G4double G4TwistedTubs::GetEndOuterRadius ( ) const
inline

Definition at line 229 of file G4TwistedTubs.hh.

230 { return (fEndOuterRadius[0] > fEndOuterRadius[1] ?
231 fEndOuterRadius[0] : fEndOuterRadius[1]); }

Referenced by BoundingLimits(), GetCubicVolume(), GetPointOnSurface(), and GetSurfaceArea().

◆ GetEndOuterRadius() [2/2]

G4double G4TwistedTubs::GetEndOuterRadius ( G4int i) const
inline

Definition at line 224 of file G4TwistedTubs.hh.

225 { return fEndOuterRadius[i]; }

◆ GetEndPhi()

G4double G4TwistedTubs::GetEndPhi ( G4int i) const
inline

Definition at line 221 of file G4TwistedTubs.hh.

221{ return fEndPhi[i]; }

Referenced by BoundingLimits().

◆ GetEndZ()

G4double G4TwistedTubs::GetEndZ ( G4int i) const
inline

Definition at line 220 of file G4TwistedTubs.hh.

220{ return fEndZ[i] ; }

Referenced by BoundingLimits(), GetCubicVolume(), GetSurfaceArea(), and G4GDMLWriteSolids::TwistedtubsWrite().

◆ GetEntityType()

G4GeometryType G4TwistedTubs::GetEntityType ( ) const
overridevirtual

Returns the type ID, "G4TwistedTubs" of the solid.

Implements G4VSolid.

Definition at line 891 of file G4TwistedTubs.cc.

892{
893 return {"G4TwistedTubs"};
894}

◆ GetExtent()

G4VisExtent G4TwistedTubs::GetExtent ( ) const
overridevirtual

Provides extent (bounding box) as possible hint to the graphics view.

Reimplemented from G4VSolid.

Definition at line 760 of file G4TwistedTubs.cc.

761{
762 // Define the sides of the box into which the G4Tubs instance would fit.
763 //
764 G4ThreeVector pmin,pmax;
765 BoundingLimits(pmin,pmax);
766 return { pmin.x(),pmax.x(),
767 pmin.y(),pmax.y(),
768 pmin.z(),pmax.z() };
769}

◆ GetInnerRadius()

G4double G4TwistedTubs::GetInnerRadius ( ) const
inline

◆ GetInnerStereo()

G4double G4TwistedTubs::GetInnerStereo ( ) const
inline

Definition at line 210 of file G4TwistedTubs.hh.

210{ return fInnerStereo; }

◆ GetKappa()

G4double G4TwistedTubs::GetKappa ( ) const
inline

Definition at line 213 of file G4TwistedTubs.hh.

213{ return fKappa ; }

◆ GetOuterRadius()

G4double G4TwistedTubs::GetOuterRadius ( ) const
inline

Definition at line 209 of file G4TwistedTubs.hh.

209{ return fOuterRadius; }

Referenced by GetCubicVolume(), G4tgbGeometryDumper::GetSolidParams(), GetSurfaceArea(), and G4GDMLWriteSolids::TwistedtubsWrite().

◆ GetOuterStereo()

G4double G4TwistedTubs::GetOuterStereo ( ) const
inline

Definition at line 211 of file G4TwistedTubs.hh.

211{ return fOuterStereo; }

◆ GetPhiTwist()

G4double G4TwistedTubs::GetPhiTwist ( ) const
inline

Definition at line 207 of file G4TwistedTubs.hh.

207{ return fPhiTwist ; }

Referenced by G4tgbGeometryDumper::GetSolidParams(), and G4GDMLWriteSolids::TwistedtubsWrite().

◆ GetPointOnSurface()

G4ThreeVector G4TwistedTubs::GetPointOnSurface ( ) const
overridevirtual

Returns a random point located and uniformly distributed on the surface of the solid.

Reimplemented from G4VSolid.

Definition at line 1027 of file G4TwistedTubs.cc.

1028{
1029
1030 G4double z = (fEndZ[1] - fEndZ[0])*G4QuickRand() + fEndZ[0] ;
1031 G4double phi , phimin, phimax ;
1032 G4double x , xmin, xmax ;
1033 G4double r , rmin, rmax ;
1034
1035 G4double a1 = fOuterHype->GetSurfaceArea() ;
1036 G4double a2 = fInnerHype->GetSurfaceArea() ;
1037 G4double a3 = fLatterTwisted->GetSurfaceArea() ;
1038 G4double a4 = fFormerTwisted->GetSurfaceArea() ;
1039 G4double a5 = fLowerEndcap->GetSurfaceArea() ;
1040 G4double a6 = fUpperEndcap->GetSurfaceArea() ;
1041
1042 G4double chose = (a1 + a2 + a3 + a4 + a5 + a6)*G4QuickRand() ;
1043
1044 if(chose < a1)
1045 {
1046
1047 phimin = fOuterHype->GetBoundaryMin(z) ;
1048 phimax = fOuterHype->GetBoundaryMax(z) ;
1049 phi = (phimax - phimin)*G4QuickRand() + phimin ;
1050
1051 return fOuterHype->SurfacePoint(phi,z,true) ;
1052 }
1053 if ( (chose >= a1) && (chose < a1 + a2 ) )
1054 {
1055
1056 phimin = fInnerHype->GetBoundaryMin(z) ;
1057 phimax = fInnerHype->GetBoundaryMax(z) ;
1058 phi = (phimax - phimin)*G4QuickRand() + phimin ;
1059
1060 return fInnerHype->SurfacePoint(phi,z,true) ;
1061 }
1062 if ( (chose >= a1 + a2 ) && (chose < a1 + a2 + a3 ) )
1063 {
1064
1065 xmin = fLatterTwisted->GetBoundaryMin(z) ;
1066 xmax = fLatterTwisted->GetBoundaryMax(z) ;
1067 x = (xmax - xmin)*G4QuickRand() + xmin ;
1068
1069 return fLatterTwisted->SurfacePoint(x,z,true) ;
1070 }
1071 if ( (chose >= a1 + a2 + a3 ) && (chose < a1 + a2 + a3 + a4 ) )
1072 {
1073
1074 xmin = fFormerTwisted->GetBoundaryMin(z) ;
1075 xmax = fFormerTwisted->GetBoundaryMax(z) ;
1076 x = (xmax - xmin)*G4QuickRand() + xmin ;
1077
1078 return fFormerTwisted->SurfacePoint(x,z,true) ;
1079 }
1080 if( (chose >= a1 + a2 + a3 + a4 )&&(chose < a1 + a2 + a3 + a4 + a5 ) )
1081 {
1082 rmin = GetEndInnerRadius(0) ;
1083 rmax = GetEndOuterRadius(0) ;
1084 r = std::sqrt((sqr(rmax)-sqr(rmin))*G4QuickRand() + sqr(rmin)) ;
1085
1086 phimin = fLowerEndcap->GetBoundaryMin(r) ;
1087 phimax = fLowerEndcap->GetBoundaryMax(r) ;
1088 phi = (phimax - phimin)*G4QuickRand() + phimin ;
1089
1090 return fLowerEndcap->SurfacePoint(phi,r,true) ;
1091 }
1092
1093 rmin = GetEndInnerRadius(1) ;
1094 rmax = GetEndOuterRadius(1) ;
1095 r = rmin + (rmax-rmin)*std::sqrt(G4QuickRand()) ;
1096
1097 phimin = fUpperEndcap->GetBoundaryMin(r) ;
1098 phimax = fUpperEndcap->GetBoundaryMax(r) ;
1099 phi = (phimax - phimin)*G4QuickRand() + phimin ;
1100
1101 return fUpperEndcap->SurfacePoint(phi,r,true) ;
1102}
G4double G4QuickRand(uint32_t seed=0)
T sqr(const T &x)
Definition templates.hh:128

◆ GetPolyhedron()

G4Polyhedron * G4TwistedTubs::GetPolyhedron ( ) const
overridevirtual

Smart access function - creates on request and stores for future access. A null pointer means "not available".

Reimplemented from G4VSolid.

Definition at line 811 of file G4TwistedTubs.cc.

812{
813 if (fpPolyhedron == nullptr ||
814 fRebuildPolyhedron ||
815 fpPolyhedron->GetNumberOfRotationStepsAtTimeOfCreation() !=
816 fpPolyhedron->GetNumberOfRotationSteps())
817 {
818 G4AutoLock l(&polyhedronMutex);
819 delete fpPolyhedron;
820 fpPolyhedron = CreatePolyhedron();
821 fRebuildPolyhedron = false;
822 l.unlock();
823 }
824 return fpPolyhedron;
825}
G4Polyhedron * CreatePolyhedron() const override

◆ GetSurfaceArea()

G4double G4TwistedTubs::GetSurfaceArea ( )
overridevirtual

Returns an estimation of the solid surface area in internal units. This method may be overloaded by derived classes to compute the exact geometrical quantity for solids where this is possible, or anyway to cache the computed value. Note: the computed value is NOT cached.

Reimplemented from G4VSolid.

Definition at line 982 of file G4TwistedTubs.cc.

983{
984 if (fSurfaceArea == 0)
985 {
986 G4AutoLock l(&twtubsMutex);
987 G4double dphi = GetDPhi();
988 G4double Ainn = GetInnerRadius();
989 G4double Aout = GetOuterRadius();
990 G4double Rinn0 = GetEndInnerRadius(0);
991 G4double Rout0 = GetEndOuterRadius(0);
992 G4double Rinn1 = GetEndInnerRadius(1);
993 G4double Rout1 = GetEndOuterRadius(1);
994 G4double z0 = GetEndZ(0);
995 G4double z1 = GetEndZ(1);
996
997 G4double base0 = 0.5*dphi*(Rout0*Rout0 - Rinn0*Rinn0); // lower base
998 G4double inner0 = GetLateralArea(Ainn, Rinn0, z0); // lower inner surface
999 G4double outer0 = GetLateralArea(Aout, Rout0, z0); // lower outer surface
1000 G4double cut0 = // lower phi cut
1001 GetPhiCutArea(Aout, Rout0, z0) - GetPhiCutArea(Ainn, Rinn0, z0);
1002
1003 G4double base1 = base0;
1004 G4double inner1 = inner0;
1005 G4double outer1 = outer0;
1006 G4double cut1 = cut0;
1007 if (std::abs(z0) != std::abs(z1))
1008 {
1009 base1 = 0.5*dphi*(Rout1*Rout1 - Rinn1*Rinn1); // upper base
1010 inner1 = GetLateralArea(Ainn, Rinn1, z1); // upper inner surface
1011 outer1 = GetLateralArea(Aout, Rout1, z1); // upper outer surface
1012 cut1 = // upper phi cut
1013 GetPhiCutArea(Aout, Rout1, z1) - GetPhiCutArea(Ainn, Rinn1, z1);
1014 }
1015 fSurfaceArea = base0 + base1 +
1016 ((z0*z1 < 0) ?
1017 (inner0 + inner1 + outer0 + outer1 + 2.*(cut0 + cut1)) :
1018 std::abs(inner0 - inner1 + outer0 - outer1 + 2.*(cut0 - cut1)));
1019 l.unlock();
1020 }
1021 return fSurfaceArea;
1022}

◆ GetTanInnerStereo()

G4double G4TwistedTubs::GetTanInnerStereo ( ) const
inline

Definition at line 215 of file G4TwistedTubs.hh.

215{ return fTanInnerStereo ; }

◆ GetTanInnerStereo2()

G4double G4TwistedTubs::GetTanInnerStereo2 ( ) const
inline

Definition at line 216 of file G4TwistedTubs.hh.

216{ return fTanInnerStereo2 ; }

◆ GetTanOuterStereo()

G4double G4TwistedTubs::GetTanOuterStereo ( ) const
inline

Definition at line 217 of file G4TwistedTubs.hh.

217{ return fTanOuterStereo ; }

◆ GetTanOuterStereo2()

G4double G4TwistedTubs::GetTanOuterStereo2 ( ) const
inline

Definition at line 218 of file G4TwistedTubs.hh.

218{ return fTanOuterStereo2 ; }

◆ GetZHalfLength()

G4double G4TwistedTubs::GetZHalfLength ( ) const
inline

Definition at line 212 of file G4TwistedTubs.hh.

212{ return fZHalfLength; }

Referenced by G4tgbGeometryDumper::GetSolidParams().

◆ Inside()

EInside G4TwistedTubs::Inside ( const G4ThreeVector & p) const
overridevirtual

Returns the characterisation of a point at offset 'p' respect to the shape.

Parameters
[in]pThe point at offset p.
Returns
kOutside if the point is outside the shapes boundaries plus Tolerance/2; kSurface if the point is less than Tolerance/2 from a surface; kInside otherwise.

Implements G4VSolid.

Definition at line 365 of file G4TwistedTubs.cc.

366{
367
368 const G4double halftol
370 // static G4int timerid = -1;
371 // G4Timer timer(timerid, "G4TwistedTubs", "Inside");
372 // timer.Start();
373
374
375 EInside outerhypearea = ((G4TwistTubsHypeSide *)fOuterHype)->Inside(p);
376 G4double innerhyperho = ((G4TwistTubsHypeSide *)fInnerHype)->GetRhoAtPZ(p);
377 G4double distanceToOut = p.getRho() - innerhyperho; // +ve: inside
378 EInside tmpinside;
379 if ((outerhypearea == kOutside) || (distanceToOut < -halftol))
380 {
381 tmpinside = kOutside;
382 }
383 else if (outerhypearea == kSurface)
384 {
385 tmpinside = kSurface;
386 }
387 else
388 {
389 if (distanceToOut <= halftol)
390 {
391 tmpinside = kSurface;
392 }
393 else
394 {
395 tmpinside = kInside;
396 }
397 }
398
399 return tmpinside;
400}
double getRho() const
G4double GetRadialTolerance() const
static G4GeometryTolerance * GetInstance()

Referenced by DistanceToIn(), DistanceToIn(), DistanceToOut(), and DistanceToOut().

◆ operator=()

G4TwistedTubs & G4TwistedTubs::operator= ( const G4TwistedTubs & rhs)

Definition at line 243 of file G4TwistedTubs.cc.

244{
245 // Check assignment to self
246 //
247 if (this == &rhs) { return *this; }
248
249 // Copy base class data
250 //
252
253 // Copy data
254 //
255 fPhiTwist= rhs.fPhiTwist;
256 fInnerRadius= rhs.fInnerRadius; fOuterRadius= rhs.fOuterRadius;
257 fDPhi= rhs.fDPhi; fZHalfLength= rhs.fZHalfLength;
258 fInnerStereo= rhs.fInnerStereo; fOuterStereo= rhs.fOuterStereo;
259 fTanInnerStereo= rhs.fTanInnerStereo; fTanOuterStereo= rhs.fTanOuterStereo;
260 fKappa= rhs.fKappa; fInnerRadius2= rhs.fInnerRadius2;
261 fOuterRadius2= rhs.fOuterRadius2; fTanInnerStereo2= rhs.fTanInnerStereo2;
262 fTanOuterStereo2= rhs.fTanOuterStereo2;
263 fLowerEndcap= fUpperEndcap= fLatterTwisted= fFormerTwisted= nullptr;
264 fInnerHype= fOuterHype= nullptr;
265 fCubicVolume= rhs.fCubicVolume; fSurfaceArea= rhs.fSurfaceArea;
266
267 for (auto i=0; i<2; ++i)
268 {
269 fEndZ[i] = rhs.fEndZ[i];
270 fEndInnerRadius[i] = rhs.fEndInnerRadius[i];
271 fEndOuterRadius[i] = rhs.fEndOuterRadius[i];
272 fEndPhi[i] = rhs.fEndPhi[i];
273 fEndZ2[i] = rhs.fEndZ2[i];
274 }
275
276 CreateSurfaces();
277 fRebuildPolyhedron = false;
278 delete fpPolyhedron; fpPolyhedron = nullptr;
279
280 return *this;
281}
G4VSolid & operator=(const G4VSolid &rhs)
Definition G4VSolid.cc:108

◆ StreamInfo()

std::ostream & G4TwistedTubs::StreamInfo ( std::ostream & os) const
overridevirtual

Streams the object contents to an output stream.

Implements G4VSolid.

Definition at line 719 of file G4TwistedTubs.cc.

720{
721 //
722 // Stream object contents to an output stream
723 //
724 G4long oldprc = os.precision(16);
725 os << "-----------------------------------------------------------\n"
726 << " *** Dump for solid - " << GetName() << " ***\n"
727 << " ===================================================\n"
728 << " Solid type: G4TwistedTubs\n"
729 << " Parameters: \n"
730 << " -ve end Z : " << fEndZ[0]/mm << " mm \n"
731 << " +ve end Z : " << fEndZ[1]/mm << " mm \n"
732 << " inner end radius(-ve z): " << fEndInnerRadius[0]/mm << " mm \n"
733 << " inner end radius(+ve z): " << fEndInnerRadius[1]/mm << " mm \n"
734 << " outer end radius(-ve z): " << fEndOuterRadius[0]/mm << " mm \n"
735 << " outer end radius(+ve z): " << fEndOuterRadius[1]/mm << " mm \n"
736 << " inner radius (z=0) : " << fInnerRadius/mm << " mm \n"
737 << " outer radius (z=0) : " << fOuterRadius/mm << " mm \n"
738 << " twisted angle : " << fPhiTwist/degree << " degrees \n"
739 << " inner stereo angle : " << fInnerStereo/degree << " degrees \n"
740 << " outer stereo angle : " << fOuterStereo/degree << " degrees \n"
741 << " phi-width of a piece : " << fDPhi/degree << " degrees \n"
742 << "-----------------------------------------------------------\n";
743 os.precision(oldprc);
744
745 return os;
746}
long G4long
Definition G4Types.hh:87

◆ SurfaceNormal()

G4ThreeVector G4TwistedTubs::SurfaceNormal ( const G4ThreeVector & p) const
overridevirtual

Returns the outwards pointing unit normal of the shape for the surface closest to the point at offset 'p'.

Parameters
[in]pThe point at offset p.
Returns
The outwards pointing unit normal.

Implements G4VSolid.

Definition at line 405 of file G4TwistedTubs.cc.

406{
407 //
408 // return the normal unit vector to the Hyperbolical Surface at a point
409 // p on (or nearly on) the surface
410 //
411 // Which of the three or four surfaces are we closest to?
412 //
413
414
415 G4double distance = kInfinity;
416
417 G4VTwistSurface *surfaces[6];
418 surfaces[0] = fLatterTwisted;
419 surfaces[1] = fFormerTwisted;
420 surfaces[2] = fInnerHype;
421 surfaces[3] = fOuterHype;
422 surfaces[4] = fLowerEndcap;
423 surfaces[5] = fUpperEndcap;
424
425 G4ThreeVector xx;
426 G4ThreeVector bestxx;
427 G4int besti = -1;
428 for (auto i=0; i<6; ++i)
429 {
430 G4double tmpdistance = surfaces[i]->DistanceTo(p, xx);
431 if (tmpdistance < distance)
432 {
433 distance = tmpdistance;
434 bestxx = xx;
435 besti = i;
436 }
437 }
438
439 return surfaces[besti]->GetNormal(bestxx, true);
440}
virtual G4double DistanceTo(const G4ThreeVector &gp, G4ThreeVector &gxx)

Referenced by DistanceToIn(), and DistanceToOut().


The documentation for this class was generated from the following files: