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

G4VTwistedFaceted is a base class for twisted boxoids: G4TwistedTrd, G4TwistedTrap and G4TwistedBox. More...

#include <G4VTwistedFaceted.hh>

Inheritance diagram for G4VTwistedFaceted:

Public Member Functions

 G4VTwistedFaceted (const G4String &pname, G4double PhiTwist, G4double pDz, G4double pTheta, G4double pPhi, G4double pDy1, G4double pDx1, G4double pDx2, G4double pDy2, G4double pDx3, G4double pDx4, G4double pAlph)
 ~G4VTwistedFaceted () 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
G4ThreeVector GetPointOnSurface () const override
G4double GetCubicVolume () override
G4double GetSurfaceArea () 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 GetTwistAngle () const
G4double GetDx1 () const
G4double GetDx2 () const
G4double GetDx3 () const
G4double GetDx4 () const
G4double GetDy1 () const
G4double GetDy2 () const
G4double GetDz () const
G4double GetPhi () const
G4double GetTheta () const
G4double GetAlpha () const
G4double Xcoef (G4double u, G4double phi, G4double ftg) const
G4double GetValueA (G4double phi) const
G4double GetValueB (G4double phi) const
G4double GetValueD (G4double phi) const
G4GeometryType GetEntityType () const override
 G4VTwistedFaceted (__void__ &)
 G4VTwistedFaceted (const G4VTwistedFaceted &rhs)
G4VTwistedFacetedoperator= (const G4VTwistedFaceted &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
virtual G4VSolidClone () 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

Protected Attributes

G4bool fRebuildPolyhedron = false
G4PolyhedronfpPolyhedron = nullptr
G4double fCubicVolume = 0.0
G4double fSurfaceArea = 0.0
Protected Attributes inherited from G4VSolid
G4double kCarTolerance

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

Detailed Description

G4VTwistedFaceted is a base class for twisted boxoids: G4TwistedTrd, G4TwistedTrap and G4TwistedBox.

Definition at line 53 of file G4VTwistedFaceted.hh.

Constructor & Destructor Documentation

◆ G4VTwistedFaceted() [1/3]

G4VTwistedFaceted::G4VTwistedFaceted ( const G4String & pname,
G4double PhiTwist,
G4double pDz,
G4double pTheta,
G4double pPhi,
G4double pDy1,
G4double pDx1,
G4double pDx2,
G4double pDy2,
G4double pDx3,
G4double pDx4,
G4double pAlph )

Constructs a faceted solid, given its parameters.

Parameters
[in]pNameThe solid name.
[in]pPhiTwistTwist angle.
[in]pDzHalf-length along Z axis.
[in]pThetaPolar angle of the line joining the centres of the faces at -/+pDz.
[in]pPhiAzimuthal angle of the line joining the centres of the faces at -/+pDz.
[in]pDy1Half Y length at -pDz.
[in]pDx1Half X length at -pDz, y=-pDy1.
[in]pDx2Half X length at -pDz, y=+pDy1.
[in]pDy2Half Y length at +pDz.
[in]pDx3Half X length at +pDz, y=-pDy2.
[in]pDx4Half X length at +pDz, y=+pDy2.
[in]pAlphAngle with respect to the Y axis from centre of side.

Definition at line 61 of file G4VTwistedFaceted.cc.

74 : G4VSolid(pname),
75 fLowerEndcap(nullptr), fUpperEndcap(nullptr), fSide0(nullptr),
76 fSide90(nullptr), fSide180(nullptr), fSide270(nullptr)
77{
78
79 G4double pDytmp ;
80 G4double fDxUp ;
81 G4double fDxDown ;
82
83 fDx1 = pDx1 ;
84 fDx2 = pDx2 ;
85 fDx3 = pDx3 ;
86 fDx4 = pDx4 ;
87 fDy1 = pDy1 ;
88 fDy2 = pDy2 ;
89 fDz = pDz ;
90
91 G4double kAngTolerance
93
94 // maximum values
95 //
96 fDxDown = ( fDx1 > fDx2 ? fDx1 : fDx2 ) ;
97 fDxUp = ( fDx3 > fDx4 ? fDx3 : fDx4 ) ;
98 fDx = ( fDxUp > fDxDown ? fDxUp : fDxDown ) ;
99 fDy = ( fDy1 > fDy2 ? fDy1 : fDy2 ) ;
100
101 // planarity check
102 //
103 if ( fDx1 != fDx2 && fDx3 != fDx4 )
104 {
105 pDytmp = fDy1 * ( fDx3 - fDx4 ) / ( fDx1 - fDx2 ) ;
106 if ( std::fabs(pDytmp - fDy2) > kCarTolerance )
107 {
108 std::ostringstream message;
109 message << "Not planar surface in untwisted Trapezoid: "
110 << GetName() << G4endl
111 << "fDy2 is " << fDy2 << " but should be "
112 << pDytmp << ".";
113 G4Exception("G4VTwistedFaceted::G4VTwistedFaceted()", "GeomSolids0002",
114 FatalErrorInArgument, message);
115 }
116 }
117
118#ifdef G4TWISTDEBUG
119 if ( fDx1 == fDx2 && fDx3 == fDx4 )
120 {
121 G4cout << "Trapezoid is a box" << G4endl ;
122 }
123
124#endif
125
126 if ( ( fDx1 == fDx2 && fDx3 != fDx4 ) || ( fDx1 != fDx2 && fDx3 == fDx4 ) )
127 {
128 std::ostringstream message;
129 message << "Not planar surface in untwisted Trapezoid: "
130 << GetName() << G4endl
131 << "One endcap is rectangular, the other is a trapezoid." << G4endl
132 << "For planarity reasons they have to be rectangles or trapezoids "
133 << "on both sides.";
134 G4Exception("G4VTwistedFaceted::G4VTwistedFaceted()", "GeomSolids0002",
135 FatalErrorInArgument, message);
136 }
137
138 // twist angle
139 //
140 fPhiTwist = PhiTwist ;
141
142 // tilt angle
143 //
144 fAlph = pAlph ;
145 fTAlph = std::tan(fAlph) ;
146
147 fTheta = pTheta ;
148 fPhi = pPhi ;
149
150 // dx in surface equation
151 //
152 fdeltaX = 2 * fDz * std::tan(fTheta) * std::cos(fPhi) ;
153
154 // dy in surface equation
155 //
156 fdeltaY = 2 * fDz * std::tan(fTheta) * std::sin(fPhi) ;
157
158 if ( ( fDx1 <= 2*kCarTolerance)
159 || ( fDx2 <= 2*kCarTolerance)
160 || ( fDx3 <= 2*kCarTolerance)
161 || ( fDx4 <= 2*kCarTolerance)
162 || ( fDy1 <= 2*kCarTolerance)
163 || ( fDy2 <= 2*kCarTolerance)
164 || ( fDz <= 2*kCarTolerance)
165 || ( std::fabs(fPhiTwist) <= 2*kAngTolerance )
166 || ( std::fabs(fPhiTwist) >= pi/2 )
167 || ( std::fabs(fAlph) >= pi/2 )
168 || fTheta >= pi/2 || fTheta < 0
169 )
170 {
171 std::ostringstream message;
172 message << "Invalid dimensions. Too small, or twist angle too big: "
173 << GetName() << G4endl
174 << "fDx 1-4 = " << fDx1/cm << ", " << fDx2/cm << ", "
175 << fDx3/cm << ", " << fDx4/cm << " cm" << G4endl
176 << "fDy 1-2 = " << fDy1/cm << ", " << fDy2/cm << ", "
177 << " cm" << G4endl
178 << "fDz = " << fDz/cm << " cm" << G4endl
179 << " twistangle " << fPhiTwist/deg << " deg" << G4endl
180 << " phi,theta = " << fPhi/deg << ", " << fTheta/deg << " deg";
181 G4Exception("G4TwistedTrap::G4VTwistedFaceted()",
182 "GeomSolids0002", FatalErrorInArgument, message);
183 }
184 CreateSurfaces();
185}
@ FatalErrorInArgument
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
double G4double
Definition G4Types.hh:83
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
static G4GeometryTolerance * GetInstance()
G4double GetAngularTolerance() const
G4String GetName() const
G4VSolid(const G4String &name)
Definition G4VSolid.cc:59
G4double kCarTolerance
Definition G4VSolid.hh:418

Referenced by G4TwistedBox::G4TwistedBox(), G4TwistedBox::G4TwistedBox(), G4TwistedBox::G4TwistedBox(), G4TwistedTrap::G4TwistedTrap(), G4TwistedTrap::G4TwistedTrap(), G4TwistedTrap::G4TwistedTrap(), G4TwistedTrap::G4TwistedTrap(), G4TwistedTrd::G4TwistedTrd(), G4TwistedTrd::G4TwistedTrd(), G4TwistedTrd::G4TwistedTrd(), G4VTwistedFaceted(), and operator=().

◆ ~G4VTwistedFaceted()

G4VTwistedFaceted::~G4VTwistedFaceted ( )
override

Destructor.

Definition at line 202 of file G4VTwistedFaceted.cc.

203{
204 delete fLowerEndcap ;
205 delete fUpperEndcap ;
206
207 delete fSide0 ;
208 delete fSide90 ;
209 delete fSide180 ;
210 delete fSide270 ;
211 delete fpPolyhedron; fpPolyhedron = nullptr;
212}
G4Polyhedron * fpPolyhedron

◆ G4VTwistedFaceted() [2/3]

G4VTwistedFaceted::G4VTwistedFaceted ( __void__ & a)

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

Definition at line 191 of file G4VTwistedFaceted.cc.

192 : G4VSolid(a),
193 fLowerEndcap(nullptr), fUpperEndcap(nullptr),
194 fSide0(nullptr), fSide90(nullptr), fSide180(nullptr), fSide270(nullptr)
195{
196}

◆ G4VTwistedFaceted() [3/3]

G4VTwistedFaceted::G4VTwistedFaceted ( const G4VTwistedFaceted & rhs)

Copy constructor and assignment operator.

Definition at line 218 of file G4VTwistedFaceted.cc.

219 : G4VSolid(rhs),
221 fTheta(rhs.fTheta), fPhi(rhs.fPhi),
222 fDy1(rhs.fDy1), fDx1(rhs.fDx1), fDx2(rhs.fDx2), fDy2(rhs.fDy2),
223 fDx3(rhs.fDx3), fDx4(rhs.fDx4), fDz(rhs.fDz), fDx(rhs.fDx), fDy(rhs.fDy),
224 fAlph(rhs.fAlph), fTAlph(rhs.fTAlph), fdeltaX(rhs.fdeltaX),
225 fdeltaY(rhs.fdeltaY), fPhiTwist(rhs.fPhiTwist), fLowerEndcap(nullptr),
226 fUpperEndcap(nullptr), fSide0(nullptr), fSide90(nullptr), fSide180(nullptr), fSide270(nullptr)
227{
228 CreateSurfaces();
229}

Member Function Documentation

◆ BoundingLimits()

void G4VTwistedFaceted::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 279 of file G4VTwistedFaceted.cc.

281{
282 G4double cosPhi = std::cos(fPhi);
283 G4double sinPhi = std::sin(fPhi);
284 G4double tanTheta = std::tan(fTheta);
285 G4double tanAlpha = fTAlph;
286
287 G4double xmid1 = fDy1*tanAlpha;
288 G4double x1 = std::abs(xmid1 + fDx1);
289 G4double x2 = std::abs(xmid1 - fDx1);
290 G4double x3 = std::abs(xmid1 + fDx2);
291 G4double x4 = std::abs(xmid1 - fDx2);
292 G4double xmax1 = std::max(std::max(std::max(x1, x2), x3), x4);
293 G4double rmax1 = std::sqrt(xmax1*xmax1 + fDy1*fDy1);
294
295 G4double xmid2 = fDy2*tanAlpha;
296 G4double x5 = std::abs(xmid2 + fDx3);
297 G4double x6 = std::abs(xmid2 - fDx3);
298 G4double x7 = std::abs(xmid2 + fDx4);
299 G4double x8 = std::abs(xmid2 - fDx4);
300 G4double xmax2 = std::max(std::max(std::max(x5, x6), x7), x8);
301 G4double rmax2 = std::sqrt(xmax2*xmax2 + fDy2*fDy2);
302
303 G4double x0 = fDz*tanTheta*cosPhi;
304 G4double y0 = fDz*tanTheta*sinPhi;
305 G4double xmin = std::min(-x0 - rmax1, x0 - rmax2);
306 G4double ymin = std::min(-y0 - rmax1, y0 - rmax2);
307 G4double xmax = std::max(-x0 + rmax1, x0 + rmax2);
308 G4double ymax = std::max(-y0 + rmax1, y0 + rmax2);
309 pMin.set(xmin, ymin,-fDz);
310 pMax.set(xmax, ymax, fDz);
311}
void set(double x, double y, double z)

Referenced by CalculateExtent().

◆ CalculateExtent()

G4bool G4VTwistedFaceted::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 318 of file G4VTwistedFaceted.cc.

323{
324 G4ThreeVector bmin, bmax;
325
326 // Get bounding box
327 BoundingLimits(bmin,bmax);
328
329 // Find extent
330 G4BoundingEnvelope bbox(bmin,bmax);
331 return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
332}
CLHEP::Hep3Vector G4ThreeVector
void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const override

◆ ComputeDimensions()

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

Dispatch method for parameterisation replication mechanism and dimension computation.

Reimplemented from G4VSolid.

Definition at line 266 of file G4VTwistedFaceted.cc.

269{
270 G4Exception("G4VTwistedFaceted::ComputeDimensions()",
271 "GeomSolids0001", FatalException,
272 "G4VTwistedFaceted does not support Parameterisation.");
273}
@ FatalException

◆ CreatePolyhedron()

G4Polyhedron * G4VTwistedFaceted::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 1123 of file G4VTwistedFaceted.cc.

1124{
1125 // number of meshes
1126 const G4int k =
1128 std::abs(fPhiTwist) / twopi) + 2;
1129 const G4int n = k;
1130
1131 const G4int nnodes = 4*(k-1)*(n-2) + 2*k*k ;
1132 const G4int nfaces = 4*(k-1)*(n-1) + 2*(k-1)*(k-1) ;
1133
1134 auto ph = new G4Polyhedron;
1135 typedef G4double G4double3[3];
1136 typedef G4int G4int4[4];
1137 auto xyz = new G4double3[nnodes]; // number of nodes
1138 auto faces = new G4int4[nfaces] ; // number of faces
1139
1140 fLowerEndcap->GetFacets(k,k,xyz,faces,0) ;
1141 fUpperEndcap->GetFacets(k,k,xyz,faces,1) ;
1142 fSide270->GetFacets(k,n,xyz,faces,2) ;
1143 fSide0->GetFacets(k,n,xyz,faces,3) ;
1144 fSide90->GetFacets(k,n,xyz,faces,4) ;
1145 fSide180->GetFacets(k,n,xyz,faces,5) ;
1146
1147 ph->createPolyhedron(nnodes,nfaces,xyz,faces);
1148
1149 return ph;
1150}
int G4int
Definition G4Types.hh:85
static G4int GetNumberOfRotationSteps()

Referenced by GetPolyhedron().

◆ DescribeYourselfTo()

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

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

Implements G4VSolid.

Definition at line 829 of file G4VTwistedFaceted.cc.

830{
831 scene.AddSolid (*this);
832}
virtual void AddSolid(const G4Box &)=0

◆ DistanceToIn() [1/2]

G4double G4VTwistedFaceted::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 554 of file G4VTwistedFaceted.cc.

555{
556 // DistanceToIn(p):
557 // Calculate distance to surface of shape from `outside',
558 // allowing for tolerance
559 //
560
561 //
562 // Calculate DistanceToIn(p)
563 //
564
565 EInside currentside = Inside(p);
566
567 switch (currentside)
568 {
569 case (kInside) :
570 {
571 }
572
573 case (kSurface) :
574 {
575 return 0;
576 }
577
578 case (kOutside) :
579 {
580 // Initialize
581 //
582 G4double distance = kInfinity;
583
584 // Find intersections and choose nearest one
585 //
586 G4VTwistSurface* surfaces[6];
587
588 surfaces[0] = fSide0;
589 surfaces[1] = fSide90 ;
590 surfaces[2] = fSide180 ;
591 surfaces[3] = fSide270 ;
592 surfaces[4] = fLowerEndcap;
593 surfaces[5] = fUpperEndcap;
594
595 G4ThreeVector xx;
596 G4ThreeVector bestxx;
597 for (const auto & surface : surfaces)
598 {
599 G4double tmpdistance = surface->DistanceTo(p, xx);
600 if (tmpdistance < distance)
601 {
602 distance = tmpdistance;
603 bestxx = xx;
604 }
605 }
606 return distance;
607 }
608
609 default:
610 {
611 G4Exception("G4VTwistedFaceted::DistanceToIn(p)", "GeomSolids0003",
612 FatalException, "Unknown point location!");
613 }
614 } // switch end
615
616 return 0.;
617}
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 G4VTwistedFaceted::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 475 of file G4VTwistedFaceted.cc.

477{
478
479 // DistanceToIn (p, v):
480 // Calculate distance to surface of shape from `outside'
481 // along with the v, allowing for tolerance.
482 // The function returns kInfinity if no intersection or
483 // just grazing within tolerance.
484
485 //
486 // Calculate DistanceToIn(p,v)
487 //
488
489 EInside currentside = Inside(p);
490
491 if (currentside == kInside)
492 {
493 }
494 else if (currentside == kSurface)
495 {
496 // particle is just on a boundary.
497 // if the particle is entering to the volume, return 0
498 //
499 G4ThreeVector normal = SurfaceNormal(p);
500 if (normal*v < 0)
501 {
502 return 0;
503 }
504 }
505
506 // now, we can take smallest positive distance.
507
508 // Initialize
509 //
510 G4double distance = kInfinity;
511
512 // Find intersections and choose nearest one
513 //
514 G4VTwistSurface *surfaces[6];
515
516 surfaces[0] = fSide0;
517 surfaces[1] = fSide90 ;
518 surfaces[2] = fSide180 ;
519 surfaces[3] = fSide270 ;
520 surfaces[4] = fLowerEndcap;
521 surfaces[5] = fUpperEndcap;
522
523 G4ThreeVector xx;
524 G4ThreeVector bestxx;
525 for (const auto & surface : surfaces)
526 {
527#ifdef G4TWISTDEBUG
528 G4cout << G4endl << "surface " << &surface - &*surfaces << ": " << G4endl << G4endl ;
529#endif
530 G4double tmpdistance = surface->DistanceToIn(p, v, xx);
531#ifdef G4TWISTDEBUG
532 G4cout << "Solid DistanceToIn : distance = " << tmpdistance << G4endl ;
533 G4cout << "intersection point = " << xx << G4endl ;
534#endif
535 if (tmpdistance < distance)
536 {
537 distance = tmpdistance;
538 bestxx = xx;
539 }
540 }
541
542#ifdef G4TWISTDEBUG
543 G4cout << "best distance = " << distance << G4endl ;
544#endif
545
546 // timer.Stop();
547 return distance;
548}
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const override

◆ DistanceToOut() [1/2]

G4double G4VTwistedFaceted::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 708 of file G4VTwistedFaceted.cc.

709{
710 // DistanceToOut(p):
711 // Calculate distance to surface of shape from `inside',
712 // allowing for tolerance
713
714 //
715 // Calculate DistanceToOut(p)
716 //
717
718 EInside currentside = Inside(p);
719 G4double retval = kInfinity;
720
721 switch (currentside)
722 {
723 case (kOutside) :
724 {
725#ifdef G4SPECSDEBUG
726 G4int oldprc = G4cout.precision(16) ;
727 G4cout << G4endl ;
728 DumpInfo();
729 G4cout << "Position:" << G4endl << G4endl ;
730 G4cout << "p.x() = " << p.x()/mm << " mm" << G4endl ;
731 G4cout << "p.y() = " << p.y()/mm << " mm" << G4endl ;
732 G4cout << "p.z() = " << p.z()/mm << " mm" << G4endl << G4endl ;
733 G4cout.precision(oldprc) ;
734 G4Exception("G4VTwistedFaceted::DistanceToOut(p)", "GeomSolids1002",
735 JustWarning, "Point p is outside !?" );
736#endif
737 break;
738 }
739 case (kSurface) :
740 {
741 retval = 0;
742 break;
743 }
744
745 case (kInside) :
746 {
747 // Initialize
748 //
749 G4double distance = kInfinity;
750
751 // find intersections and choose nearest one
752 //
753 G4VTwistSurface* surfaces[6];
754
755 surfaces[0] = fSide0;
756 surfaces[1] = fSide90 ;
757 surfaces[2] = fSide180 ;
758 surfaces[3] = fSide270 ;
759 surfaces[4] = fLowerEndcap;
760 surfaces[5] = fUpperEndcap;
761
762 G4ThreeVector xx;
763 G4ThreeVector bestxx;
764 for (const auto & surface : surfaces)
765 {
766 G4double tmpdistance = surface->DistanceTo(p, xx);
767 if (tmpdistance < distance)
768 {
769 distance = tmpdistance;
770 bestxx = xx;
771 }
772 }
773 retval = distance;
774 break;
775 }
776
777 default :
778 {
779 G4Exception("G4VTwistedFaceted::DistanceToOut(p)", "GeomSolids0003",
780 FatalException, "Unknown point location!");
781 break;
782 }
783 } // switch end
784
785 return retval;
786}
@ JustWarning
double z() const
double x() const
double y() const
void DumpInfo() const

◆ DistanceToOut() [2/2]

G4double G4VTwistedFaceted::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 624 of file G4VTwistedFaceted.cc.

629{
630 // DistanceToOut (p, v):
631 // Calculate distance to surface of shape from `inside'
632 // along with the v, allowing for tolerance.
633 // The function returns kInfinity if no intersection or
634 // just grazing within tolerance.
635
636 //
637 // Calculate DistanceToOut(p,v)
638 //
639
640 EInside currentside = Inside(p);
641
642 if (currentside == kOutside)
643 {
644 }
645 else if (currentside == kSurface)
646 {
647 // particle is just on a boundary.
648 // if the particle is exiting from the volume, return 0
649 //
650 G4ThreeVector normal = SurfaceNormal(p);
651 if (normal*v > 0)
652 {
653 if (calcNorm)
654 {
655 *norm = normal;
656 *validNorm = true;
657 }
658 // timer.Stop();
659 return 0;
660 }
661 }
662
663 // now, we can take smallest positive distance.
664
665 // Initialize
666 G4double distance = kInfinity;
667
668 // find intersections and choose nearest one.
669 G4VTwistSurface *surfaces[6];
670
671 surfaces[0] = fSide0;
672 surfaces[1] = fSide90 ;
673 surfaces[2] = fSide180 ;
674 surfaces[3] = fSide270 ;
675 surfaces[4] = fLowerEndcap;
676 surfaces[5] = fUpperEndcap;
677
678 G4int besti = -1;
679 G4ThreeVector xx;
680 G4ThreeVector bestxx;
681 for (auto i=0; i<6 ; ++i)
682 {
683 G4double tmpdistance = surfaces[i]->DistanceToOut(p, v, xx);
684 if (tmpdistance < distance)
685 {
686 distance = tmpdistance;
687 bestxx = xx;
688 besti = i;
689 }
690 }
691
692 if (calcNorm)
693 {
694 if (besti != -1)
695 {
696 *norm = (surfaces[besti]->GetNormal(p, true));
697 *validNorm = surfaces[besti]->IsValidNorm();
698 }
699 }
700
701 return distance;
702}
virtual G4ThreeVector GetNormal(const G4ThreeVector &p, G4bool isGlobal)=0
G4bool IsValidNorm() const
virtual G4double DistanceToOut(const G4ThreeVector &gp, const G4ThreeVector &gv, G4ThreeVector &gxxbest)

◆ GetAlpha()

G4double G4VTwistedFaceted::GetAlpha ( ) const
inline

Definition at line 178 of file G4VTwistedFaceted.hh.

178{ return fAlph ; }

Referenced by G4TwistedTrap::GetTiltAngleAlpha().

◆ GetCubicVolume()

G4double G4VTwistedFaceted::GetCubicVolume ( )
overridevirtual

Returning an estimation of the solid volume (capacity) and surface area, in internal units.

Reimplemented from G4VSolid.

Definition at line 974 of file G4VTwistedFaceted.cc.

975{
976 if(fCubicVolume == 0)
977 {
978 G4AutoLock l(&vtwMutex);
979 fCubicVolume = ((fDx1 + fDx2 + fDx3 + fDx4)*(fDy1 + fDy2) +
980 (fDx4 + fDx3 - fDx2 - fDx1)*(fDy2 - fDy1)/3)*fDz;
981 l.unlock();
982 }
983 return fCubicVolume;
984}
G4TemplateAutoLock< G4Mutex > G4AutoLock

◆ GetDx1()

G4double G4VTwistedFaceted::GetDx1 ( ) const
inline

◆ GetDx2()

G4double G4VTwistedFaceted::GetDx2 ( ) const
inline

Definition at line 170 of file G4VTwistedFaceted.hh.

170{ return fDx2 ; }

Referenced by G4TwistedTrap::GetX2HalfLength().

◆ GetDx3()

G4double G4VTwistedFaceted::GetDx3 ( ) const
inline

Definition at line 171 of file G4VTwistedFaceted.hh.

171{ return fDx3 ; }

Referenced by G4TwistedTrd::GetX2HalfLength(), and G4TwistedTrap::GetX3HalfLength().

◆ GetDx4()

G4double G4VTwistedFaceted::GetDx4 ( ) const
inline

Definition at line 172 of file G4VTwistedFaceted.hh.

172{ return fDx4 ; }

Referenced by G4TwistedTrap::GetX4HalfLength().

◆ GetDy1()

G4double G4VTwistedFaceted::GetDy1 ( ) const
inline

◆ GetDy2()

G4double G4VTwistedFaceted::GetDy2 ( ) const
inline

Definition at line 174 of file G4VTwistedFaceted.hh.

174{ return fDy2 ; }

Referenced by G4TwistedTrap::GetY2HalfLength(), and G4TwistedTrd::GetY2HalfLength().

◆ GetDz()

G4double G4VTwistedFaceted::GetDz ( ) const
inline

◆ GetEntityType()

G4GeometryType G4VTwistedFaceted::GetEntityType ( ) const
overridevirtual

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

Implements G4VSolid.

Definition at line 1016 of file G4VTwistedFaceted.cc.

1017{
1018 return {"G4VTwistedFaceted"};
1019}

◆ GetExtent()

G4VisExtent G4VTwistedFaceted::GetExtent ( ) const
overridevirtual

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

Reimplemented from G4VSolid.

Definition at line 838 of file G4VTwistedFaceted.cc.

839{
840 G4double maxRad = std::sqrt( fDx*fDx + fDy*fDy);
841
842 return { -maxRad, maxRad ,
843 -maxRad, maxRad ,
844 -fDz, fDz };
845}

◆ GetPhi()

G4double G4VTwistedFaceted::GetPhi ( ) const
inline

Definition at line 176 of file G4VTwistedFaceted.hh.

176{ return fPhi ; }

Referenced by G4TwistedTrap::GetAzimuthalAnglePhi().

◆ GetPointOnSurface()

G4ThreeVector G4VTwistedFaceted::GetPointOnSurface ( ) const
overridevirtual

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

Reimplemented from G4VSolid.

Definition at line 1046 of file G4VTwistedFaceted.cc.

1047{
1048
1049 G4double phi = fPhiTwist*(G4QuickRand() - 0.5);
1050 G4double u , umin, umax ; // variable for twisted surfaces
1051 G4double y ; // variable for flat surface (top and bottom)
1052
1053 // Compute the areas. Attention: Only correct for trapezoids
1054 // where the twisting is done along the z-axis. In the general case
1055 // the computed surface area is more difficult. However this simplification
1056 // does not affect the tracking through the solid.
1057
1058 G4double a1 = fSide0->GetSurfaceArea();
1059 G4double a2 = fSide90->GetSurfaceArea();
1060 G4double a3 = fSide180->GetSurfaceArea() ;
1061 G4double a4 = fSide270->GetSurfaceArea() ;
1062 G4double a5 = fLowerEndcap->GetSurfaceArea() ;
1063 G4double a6 = fUpperEndcap->GetSurfaceArea() ;
1064
1065#ifdef G4TWISTDEBUG
1066 G4cout << "Surface 0 deg = " << a1 << G4endl ;
1067 G4cout << "Surface 90 deg = " << a2 << G4endl ;
1068 G4cout << "Surface 180 deg = " << a3 << G4endl ;
1069 G4cout << "Surface 270 deg = " << a4 << G4endl ;
1070 G4cout << "Surface Lower = " << a5 << G4endl ;
1071 G4cout << "Surface Upper = " << a6 << G4endl ;
1072#endif
1073
1074 G4double chose = (a1 + a2 + a3 + a4 + a5 + a6)*G4QuickRand() ;
1075
1076 if(chose < a1)
1077 {
1078 umin = fSide0->GetBoundaryMin(phi) ;
1079 umax = fSide0->GetBoundaryMax(phi) ;
1080 u = umin + (umax - umin)*G4QuickRand();
1081 return fSide0->SurfacePoint(phi, u, true) ; // point on 0 deg surface
1082 }
1083 if( (chose >= a1) && (chose < a1 + a2 ) )
1084 {
1085 umin = fSide90->GetBoundaryMin(phi) ;
1086 umax = fSide90->GetBoundaryMax(phi) ;
1087 u = umin + (umax - umin)*G4QuickRand();
1088 return fSide90->SurfacePoint(phi, u, true); // point on 90 deg surface
1089 }
1090 if( (chose >= a1 + a2 ) && (chose < a1 + a2 + a3 ) )
1091 {
1092 umin = fSide180->GetBoundaryMin(phi) ;
1093 umax = fSide180->GetBoundaryMax(phi) ;
1094 u = umin + (umax - umin)*G4QuickRand();
1095 return fSide180->SurfacePoint(phi, u, true); // point on 180 deg surface
1096 }
1097 if( (chose >= a1 + a2 + a3 ) && (chose < a1 + a2 + a3 + a4 ) )
1098 {
1099 umin = fSide270->GetBoundaryMin(phi) ;
1100 umax = fSide270->GetBoundaryMax(phi) ;
1101 u = umin + (umax - umin)*G4QuickRand();
1102 return fSide270->SurfacePoint(phi, u, true); // point on 270 deg surface
1103 }
1104 if( (chose >= a1 + a2 + a3 + a4 ) && (chose < a1 + a2 + a3 + a4 + a5 ) )
1105 {
1106 y = fDy1*(2.*G4QuickRand() - 1.);
1107 umin = fLowerEndcap->GetBoundaryMin(y) ;
1108 umax = fLowerEndcap->GetBoundaryMax(y) ;
1109 u = umin + (umax - umin)*G4QuickRand();
1110 return fLowerEndcap->SurfacePoint(u,y,true); // point on lower endcap
1111 }
1112 y = fDy2*(2.*G4QuickRand() - 1.);
1113 umin = fUpperEndcap->GetBoundaryMin(y) ;
1114 umax = fUpperEndcap->GetBoundaryMax(y) ;
1115 u = umin + (umax - umin)*G4QuickRand();
1116 return fUpperEndcap->SurfacePoint(u,y,true); // point on upper endcap
1117}
G4double G4QuickRand(uint32_t seed=0)

◆ GetPolyhedron()

G4Polyhedron * G4VTwistedFaceted::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 1025 of file G4VTwistedFaceted.cc.

1026{
1027 if (fpPolyhedron == nullptr ||
1029 fpPolyhedron->GetNumberOfRotationStepsAtTimeOfCreation() !=
1030 fpPolyhedron->GetNumberOfRotationSteps())
1031 {
1032 G4AutoLock l(&polyhedronMutex);
1033 delete fpPolyhedron;
1035 fRebuildPolyhedron = false;
1036 l.unlock();
1037 }
1038
1039 return fpPolyhedron;
1040}
G4Polyhedron * CreatePolyhedron() const override

Referenced by G4TwistedBox::G4TwistedBox(), G4TwistedTrap::G4TwistedTrap(), G4TwistedTrd::G4TwistedTrd(), G4TwistedBox::operator=(), G4TwistedTrap::operator=(), and G4TwistedTrd::operator=().

◆ GetSurfaceArea()

G4double G4VTwistedFaceted::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 989 of file G4VTwistedFaceted.cc.

990{
991 if (fSurfaceArea == 0)
992 {
993 G4AutoLock l(&vtwMutex);
994 G4TwoVector vv[8];
995 vv[0] = G4TwoVector(-fDx1 - fDy1*fTAlph,-fDy1);
996 vv[1] = G4TwoVector( fDx1 - fDy1*fTAlph,-fDy1);
997 vv[2] = G4TwoVector(-fDx2 + fDy1*fTAlph, fDy1);
998 vv[3] = G4TwoVector( fDx2 + fDy1*fTAlph, fDy1);
999 vv[4] = G4TwoVector(-fDx3 - fDy2*fTAlph,-fDy2);
1000 vv[5] = G4TwoVector( fDx3 - fDy2*fTAlph,-fDy2);
1001 vv[6] = G4TwoVector(-fDx4 + fDy2*fTAlph, fDy2);
1002 vv[7] = G4TwoVector( fDx4 + fDy2*fTAlph, fDy2);
1003 fSurfaceArea = 2.*(fDy1*(fDx1 + fDx2) + fDy2*(fDx3 + fDx4)) +
1004 GetLateralFaceArea(vv[0], vv[1], vv[4], vv[5]) +
1005 GetLateralFaceArea(vv[1], vv[3], vv[5], vv[7]) +
1006 GetLateralFaceArea(vv[3], vv[2], vv[7], vv[6]) +
1007 GetLateralFaceArea(vv[2], vv[0], vv[6], vv[4]);
1008 l.unlock();
1009 }
1010 return fSurfaceArea;
1011}
CLHEP::Hep2Vector G4TwoVector

◆ GetTheta()

G4double G4VTwistedFaceted::GetTheta ( ) const
inline

Definition at line 177 of file G4VTwistedFaceted.hh.

177{ return fTheta ; }

Referenced by G4TwistedTrap::GetPolarAngleTheta().

◆ GetTwistAngle()

G4double G4VTwistedFaceted::GetTwistAngle ( ) const
inline

Accessors.

Definition at line 168 of file G4VTwistedFaceted.hh.

168{ return fPhiTwist; }

Referenced by G4TwistedBox::GetPhiTwist(), G4TwistedTrap::GetPhiTwist(), and G4TwistedTrd::GetPhiTwist().

◆ GetValueA()

G4double G4VTwistedFaceted::GetValueA ( G4double phi) const
inline

Definition at line 264 of file G4VTwistedFaceted.hh.

265{
266 return ( fDx4 + fDx2 + ( fDx4 - fDx2 ) * ( 2 * phi ) / fPhiTwist ) ;
267}

Referenced by Xcoef().

◆ GetValueB()

G4double G4VTwistedFaceted::GetValueB ( G4double phi) const
inline

Definition at line 276 of file G4VTwistedFaceted.hh.

277{
278 return ( fDy2 + fDy1 + ( fDy2 - fDy1 ) * ( 2 * phi ) / fPhiTwist ) ;
279}

Referenced by Inside(), and Xcoef().

◆ GetValueD()

G4double G4VTwistedFaceted::GetValueD ( G4double phi) const
inline

Definition at line 270 of file G4VTwistedFaceted.hh.

271{
272 return ( fDx3 + fDx1 + ( fDx3 - fDx1 ) * ( 2 * phi ) / fPhiTwist ) ;
273}

Referenced by Xcoef().

◆ Inside()

EInside G4VTwistedFaceted::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 338 of file G4VTwistedFaceted.cc.

339{
340
341 EInside tmpin = kOutside ;
342
343 G4double phi = p.z()/(2*fDz) * fPhiTwist ; // rotate the point to z=0
344 G4double cphi = std::cos(-phi) ;
345 G4double sphi = std::sin(-phi) ;
346
347 G4double px = p.x() + fdeltaX * ( -phi/fPhiTwist) ; // shift
348 G4double py = p.y() + fdeltaY * ( -phi/fPhiTwist) ;
349 G4double pz = p.z() ;
350
351 G4double posx = px * cphi - py * sphi ; // rotation
352 G4double posy = px * sphi + py * cphi ;
353 G4double posz = pz ;
354
355 G4double xMin = Xcoef(posy,phi,fTAlph) - 2*Xcoef(posy,phi,0.) ;
356 G4double xMax = Xcoef(posy,phi,fTAlph) ;
357
358 G4double yMax = GetValueB(phi)/2. ; // b(phi)/2 is limit
359 G4double yMin = -yMax ;
360
361#ifdef G4TWISTDEBUG
362
363 G4cout << "inside called: p = " << p << G4endl ;
364 G4cout << "fDx1 = " << fDx1 << G4endl ;
365 G4cout << "fDx2 = " << fDx2 << G4endl ;
366 G4cout << "fDx3 = " << fDx3 << G4endl ;
367 G4cout << "fDx4 = " << fDx4 << G4endl ;
368
369 G4cout << "fDy1 = " << fDy1 << G4endl ;
370 G4cout << "fDy2 = " << fDy2 << G4endl ;
371
372 G4cout << "fDz = " << fDz << G4endl ;
373
374 G4cout << "Tilt angle alpha = " << fAlph << G4endl ;
375 G4cout << "phi,theta = " << fPhi << " , " << fTheta << G4endl ;
376
377 G4cout << "Twist angle = " << fPhiTwist << G4endl ;
378
379 G4cout << "posx = " << posx << G4endl ;
380 G4cout << "posy = " << posy << G4endl ;
381 G4cout << "xMin = " << xMin << G4endl ;
382 G4cout << "xMax = " << xMax << G4endl ;
383 G4cout << "yMin = " << yMin << G4endl ;
384 G4cout << "yMax = " << yMax << G4endl ;
385
386#endif
387
388
389 if ( posx <= xMax - kCarTolerance*0.5
390 && posx >= xMin + kCarTolerance*0.5 )
391 {
392 if ( posy <= yMax - kCarTolerance*0.5
393 && posy >= yMin + kCarTolerance*0.5 )
394 {
395 if (std::fabs(posz) <= fDz - kCarTolerance*0.5 )
396 {
397 tmpin = kInside ;
398 }
399 else if (std::fabs(posz) <= fDz + kCarTolerance*0.5 )
400 {
401 tmpin = kSurface ;
402 }
403 }
404 else if ( posy <= yMax + kCarTolerance*0.5
405 && posy >= yMin - kCarTolerance*0.5 )
406 {
407 if (std::fabs(posz) <= fDz + kCarTolerance*0.5 ) { tmpin = kSurface ; }
408 }
409 }
410 else if ( posx <= xMax + kCarTolerance*0.5
411 && posx >= xMin - kCarTolerance*0.5 )
412 {
413 if ( posy <= yMax + kCarTolerance*0.5
414 && posy >= yMin - kCarTolerance*0.5 )
415 {
416 if (std::fabs(posz) <= fDz + kCarTolerance*0.5) { tmpin = kSurface ; }
417 }
418 }
419
420#ifdef G4TWISTDEBUG
421 G4cout << "inside = " << tmpin << G4endl ;
422#endif
423
424 return tmpin;
425
426}
G4double GetValueB(G4double phi) const
G4double Xcoef(G4double u, G4double phi, G4double ftg) const

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

◆ operator=()

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

Definition at line 235 of file G4VTwistedFaceted.cc.

236{
237 // Check assignment to self
238 //
239 if (this == &rhs) { return *this; }
240
241 // Copy base class data
242 //
244
245 // Copy data
246 //
247 fTheta = rhs.fTheta; fPhi = rhs.fPhi;
248 fDy1= rhs.fDy1; fDx1= rhs.fDx1; fDx2= rhs.fDx2; fDy2= rhs.fDy2;
249 fDx3= rhs.fDx3; fDx4= rhs.fDx4; fDz= rhs.fDz; fDx= rhs.fDx; fDy= rhs.fDy;
250 fAlph= rhs.fAlph; fTAlph= rhs.fTAlph; fdeltaX= rhs.fdeltaX;
251 fdeltaY= rhs.fdeltaY; fPhiTwist= rhs.fPhiTwist; fLowerEndcap= nullptr;
252 fUpperEndcap= nullptr; fSide0= nullptr; fSide90= nullptr; fSide180= nullptr; fSide270= nullptr;
254 fRebuildPolyhedron = false;
255 delete fpPolyhedron; fpPolyhedron = nullptr;
256
257 CreateSurfaces();
258
259 return *this;
260}
G4VSolid & operator=(const G4VSolid &rhs)
Definition G4VSolid.cc:108

Referenced by G4TwistedBox::operator=(), G4TwistedTrap::operator=(), and G4TwistedTrd::operator=().

◆ StreamInfo()

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

Streams the object contents to an output stream.

Implements G4VSolid.

Definition at line 792 of file G4VTwistedFaceted.cc.

793{
794 //
795 // Stream object contents to an output stream
796 //
797 G4long oldprc = os.precision(16);
798 os << "-----------------------------------------------------------\n"
799 << " *** Dump for solid - " << GetName() << " ***\n"
800 << " ===================================================\n"
801 << " Solid type: G4VTwistedFaceted\n"
802 << " Parameters: \n"
803 << " polar angle theta = " << fTheta/degree << " deg" << G4endl
804 << " azimuthal angle phi = " << fPhi/degree << " deg" << G4endl
805 << " tilt angle alpha = " << fAlph/degree << " deg" << G4endl
806 << " TWIST angle = " << fPhiTwist/degree << " deg" << G4endl
807 << " Half length along y (lower endcap) = " << fDy1/cm << " cm"
808 << G4endl
809 << " Half length along x (lower endcap, bottom) = " << fDx1/cm << " cm"
810 << G4endl
811 << " Half length along x (lower endcap, top) = " << fDx2/cm << " cm"
812 << G4endl
813 << " Half length along y (upper endcap) = " << fDy2/cm << " cm"
814 << G4endl
815 << " Half length along x (upper endcap, bottom) = " << fDx3/cm << " cm"
816 << G4endl
817 << " Half length along x (upper endcap, top) = " << fDx4/cm << " cm"
818 << G4endl
819 << "-----------------------------------------------------------\n";
820 os.precision(oldprc);
821
822 return os;
823}
long G4long
Definition G4Types.hh:87

◆ SurfaceNormal()

G4ThreeVector G4VTwistedFaceted::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 432 of file G4VTwistedFaceted.cc.

433{
434 //
435 // return the normal unit vector to the Hyperbolical Surface at a point
436 // p on (or nearly on) the surface
437 //
438 // Which of the three or four surfaces are we closest to?
439 //
440
441
442 G4double distance = kInfinity;
443
444 G4VTwistSurface* surfaces[6];
445
446 surfaces[0] = fSide0 ;
447 surfaces[1] = fSide90 ;
448 surfaces[2] = fSide180 ;
449 surfaces[3] = fSide270 ;
450 surfaces[4] = fLowerEndcap;
451 surfaces[5] = fUpperEndcap;
452
453 G4ThreeVector xx;
454 G4ThreeVector bestxx;
455 G4int i;
456 G4int besti = -1;
457 for (i=0; i< 6; i++)
458 {
459 G4double tmpdistance = surfaces[i]->DistanceTo(p, xx);
460 if (tmpdistance < distance)
461 {
462 distance = tmpdistance;
463 bestxx = xx;
464 besti = i;
465 }
466 }
467
468 return surfaces[besti]->GetNormal(bestxx, true);
469}
virtual G4double DistanceTo(const G4ThreeVector &gp, G4ThreeVector &gxx)

Referenced by DistanceToIn(), and DistanceToOut().

◆ Xcoef()

G4double G4VTwistedFaceted::Xcoef ( G4double u,
G4double phi,
G4double ftg ) const
inline

Definition at line 282 of file G4VTwistedFaceted.hh.

283{
284 return GetValueA(phi)/2. + (GetValueD(phi)-GetValueA(phi))/4.
285 - u*( ( GetValueD(phi)-GetValueA(phi) ) / ( 2 * GetValueB(phi) ) - ftg );
286}
G4double GetValueD(G4double phi) const
G4double GetValueA(G4double phi) const

Referenced by Inside().

Member Data Documentation

◆ fCubicVolume

G4double G4VTwistedFaceted::fCubicVolume = 0.0
protected

◆ fpPolyhedron

◆ fRebuildPolyhedron

G4bool G4VTwistedFaceted::fRebuildPolyhedron = false
mutableprotected

Definition at line 204 of file G4VTwistedFaceted.hh.

Referenced by GetPolyhedron(), and operator=().

◆ fSurfaceArea

G4double G4VTwistedFaceted::fSurfaceArea = 0.0
protected

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