Geant4-11
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes
G4Paraboloid Class Reference

#include <G4Paraboloid.hh>

Inheritance diagram for G4Paraboloid:
G4VSolid

Public Member Functions

void BoundingLimits (G4ThreeVector &pMin, G4ThreeVector &pMax) const
 
G4bool CalculateExtent (const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pmin, G4double &pmax) const
 
G4double CalculateSurfaceArea () const
 
G4VSolidClone () const
 
virtual void ComputeDimensions (G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
 
G4PolyhedronCreatePolyhedron () const
 
void DescribeYourselfTo (G4VGraphicsScene &scene) const
 
G4double DistanceToIn (const G4ThreeVector &p) const
 
G4double DistanceToIn (const G4ThreeVector &p, const G4ThreeVector &v) const
 
G4double DistanceToOut (const G4ThreeVector &p) const
 
G4double DistanceToOut (const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=nullptr, G4ThreeVector *n=nullptr) const
 
void DumpInfo () const
 
G4double EstimateCubicVolume (G4int nStat, G4double epsilon) const
 
G4double EstimateSurfaceArea (G4int nStat, G4double ell) const
 
 G4Paraboloid (__void__ &)
 
 G4Paraboloid (const G4Paraboloid &rhs)
 
 G4Paraboloid (const G4String &pName, G4double pDz, G4double pR1, G4double pR2)
 
virtual G4VSolidGetConstituentSolid (G4int no)
 
virtual const G4VSolidGetConstituentSolid (G4int no) const
 
G4double GetCubicVolume ()
 
virtual G4DisplacedSolidGetDisplacedSolidPtr ()
 
virtual const G4DisplacedSolidGetDisplacedSolidPtr () const
 
G4GeometryType GetEntityType () const
 
virtual G4VisExtent GetExtent () const
 
G4String GetName () const
 
G4ThreeVector GetPointOnSurface () const
 
G4PolyhedronGetPolyhedron () const
 
G4double GetRadiusMinusZ () const
 
G4double GetRadiusPlusZ () const
 
G4double GetSurfaceArea ()
 
G4double GetTolerance () const
 
G4double GetZHalfLength () const
 
EInside Inside (const G4ThreeVector &p) const
 
G4Paraboloidoperator= (const G4Paraboloid &rhs)
 
G4bool operator== (const G4VSolid &s) const
 
void SetName (const G4String &name)
 
void SetRadiusMinusZ (G4double R1)
 
void SetRadiusPlusZ (G4double R2)
 
void SetZHalfLength (G4double dz)
 
std::ostream & StreamInfo (std::ostream &os) const
 
G4ThreeVector SurfaceNormal (const G4ThreeVector &p) const
 
virtual ~G4Paraboloid ()
 

Protected Member Functions

void CalculateClippedPolygonExtent (G4ThreeVectorList &pPolygon, 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 ClipCrossSection (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

G4PolyhedronfpPolyhedron = nullptr
 
G4bool fRebuildPolyhedron = false
 
G4double kCarTolerance
 

Private Member Functions

void ClipPolygonToSimpleLimits (G4ThreeVectorList &pPolygon, G4ThreeVectorList &outputPolygon, const G4VoxelLimits &pVoxelLimit) const
 

Private Attributes

G4double dz
 
G4double fCubicVolume = 0.0
 
G4String fshapeName
 
G4double fSurfaceArea = 0.0
 
G4double k1
 
G4double k2
 
G4double r1
 
G4double r2
 

Detailed Description

Definition at line 67 of file G4Paraboloid.hh.

Constructor & Destructor Documentation

◆ G4Paraboloid() [1/3]

G4Paraboloid::G4Paraboloid ( const G4String pName,
G4double  pDz,
G4double  pR1,
G4double  pR2 
)

Definition at line 62 of file G4Paraboloid.cc.

66 : G4VSolid(pName)
67{
68 if( (pDz <= 0.) || (pR2 <= pR1) || (pR1 < 0.) )
69 {
70 std::ostringstream message;
71 message << "Invalid dimensions. Negative Input Values or R1>=R2 - "
72 << GetName();
73 G4Exception("G4Paraboloid::G4Paraboloid()", "GeomSolids0002",
74 FatalErrorInArgument, message,
75 "Z half-length must be larger than zero or R1>=R2.");
76 }
77
78 r1 = pR1;
79 r2 = pR2;
80 dz = pDz;
81
82 // r1^2 = k1 * (-dz) + k2
83 // r2^2 = k1 * ( dz) + k2
84 // => r1^2 + r2^2 = k2 + k2 => k2 = (r2^2 + r1^2) / 2
85 // and r2^2 - r1^2 = k1 * dz - k1 * (-dz) => k1 = (r2^2 - r1^2) / 2 / dz
86
87 k1 = (r2 * r2 - r1 * r1) / 2 / dz;
88 k2 = (r2 * r2 + r1 * r1) / 2;
89}
@ FatalErrorInArgument
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
G4String GetName() const
G4VSolid(const G4String &name)
Definition: G4VSolid.cc:57

References dz, FatalErrorInArgument, G4Exception(), G4VSolid::GetName(), k1, k2, r1, and r2.

Referenced by Clone().

◆ ~G4Paraboloid()

G4Paraboloid::~G4Paraboloid ( )
virtual

Definition at line 105 of file G4Paraboloid.cc.

106{
107 delete fpPolyhedron; fpPolyhedron = nullptr;
108}
G4Polyhedron * fpPolyhedron

References fpPolyhedron.

◆ G4Paraboloid() [2/3]

G4Paraboloid::G4Paraboloid ( __void__ &  a)

Definition at line 96 of file G4Paraboloid.cc.

97 : G4VSolid(a), dz(0.), r1(0.), r2(0.), k1(0.), k2(0.)
98{
99}

◆ G4Paraboloid() [3/3]

G4Paraboloid::G4Paraboloid ( const G4Paraboloid rhs)

Definition at line 114 of file G4Paraboloid.cc.

115 : G4VSolid(rhs),
117 dz(rhs.dz), r1(rhs.r1), r2(rhs.r2), k1(rhs.k1), k2(rhs.k2)
118{
119}
G4double fSurfaceArea
G4double fCubicVolume

Member Function Documentation

◆ BoundingLimits()

void G4Paraboloid::BoundingLimits ( G4ThreeVector pMin,
G4ThreeVector pMax 
) const
virtual

Reimplemented from G4VSolid.

Definition at line 149 of file G4Paraboloid.cc.

151{
152 pMin.set(-r2,-r2,-dz);
153 pMax.set( r2, r2, dz);
154
155 // Check correctness of the bounding box
156 //
157 if (pMin.x() >= pMax.x() || pMin.y() >= pMax.y() || pMin.z() >= pMax.z())
158 {
159 std::ostringstream message;
160 message << "Bad bounding box (min >= max) for solid: "
161 << GetName() << " !"
162 << "\npMin = " << pMin
163 << "\npMax = " << pMax;
164 G4Exception("G4Paraboloid::BoundingLimits()", "GeomMgt0001",
165 JustWarning, message);
166 DumpInfo();
167 }
168}
@ JustWarning
static const G4double pMax
static const G4double pMin
void DumpInfo() const

References G4VSolid::DumpInfo(), dz, G4Exception(), G4VSolid::GetName(), JustWarning, pMax, pMin, and r2.

Referenced by CalculateExtent().

◆ CalculateClippedPolygonExtent()

void G4VSolid::CalculateClippedPolygonExtent ( G4ThreeVectorList pPolygon,
const G4VoxelLimits pVoxelLimit,
const EAxis  pAxis,
G4double pMin,
G4double pMax 
) const
protectedinherited

Definition at line 489 of file G4VSolid.cc.

494{
495 G4int noLeft,i;
496 G4double component;
497
498 ClipPolygon(pPolygon,pVoxelLimit,pAxis);
499 noLeft = pPolygon.size();
500
501 if ( noLeft )
502 {
503 for (i=0; i<noLeft; ++i)
504 {
505 component = pPolygon[i].operator()(pAxis);
506
507 if (component < pMin)
508 {
509 pMin = component;
510 }
511 if (component > pMax)
512 {
513 pMax = component;
514 }
515 }
516 }
517}
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
void ClipPolygon(G4ThreeVectorList &pPolygon, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis) const
Definition: G4VSolid.cc:539

References G4VSolid::ClipPolygon(), pMax, and pMin.

Referenced by G4VSolid::ClipBetweenSections(), and G4VSolid::ClipCrossSection().

◆ CalculateExtent()

G4bool G4Paraboloid::CalculateExtent ( const EAxis  pAxis,
const G4VoxelLimits pVoxelLimit,
const G4AffineTransform pTransform,
G4double pmin,
G4double pmax 
) const
virtual

Implements G4VSolid.

Definition at line 175 of file G4Paraboloid.cc.

179{
180 G4ThreeVector bmin, bmax;
181
182 // Get bounding box
183 BoundingLimits(bmin,bmax);
184
185 // Find extent
186 G4BoundingEnvelope bbox(bmin,bmax);
187 return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
188}
void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const

References BoundingLimits(), G4BoundingEnvelope::CalculateExtent(), pMax, and pMin.

◆ CalculateSurfaceArea()

G4double G4Paraboloid::CalculateSurfaceArea ( ) const
inline

Referenced by GetPointOnSurface().

◆ ClipBetweenSections()

void G4VSolid::ClipBetweenSections ( G4ThreeVectorList pVertices,
const G4int  pSectionIndex,
const G4VoxelLimits pVoxelLimit,
const EAxis  pAxis,
G4double pMin,
G4double pMax 
) const
protectedinherited

Definition at line 444 of file G4VSolid.cc.

449{
450 G4ThreeVectorList polygon;
451 polygon.reserve(4);
452 polygon.push_back((*pVertices)[pSectionIndex]);
453 polygon.push_back((*pVertices)[pSectionIndex+4]);
454 polygon.push_back((*pVertices)[pSectionIndex+5]);
455 polygon.push_back((*pVertices)[pSectionIndex+1]);
456 CalculateClippedPolygonExtent(polygon,pVoxelLimit,pAxis,pMin,pMax);
457 polygon.clear();
458
459 polygon.push_back((*pVertices)[pSectionIndex+1]);
460 polygon.push_back((*pVertices)[pSectionIndex+5]);
461 polygon.push_back((*pVertices)[pSectionIndex+6]);
462 polygon.push_back((*pVertices)[pSectionIndex+2]);
463 CalculateClippedPolygonExtent(polygon,pVoxelLimit,pAxis,pMin,pMax);
464 polygon.clear();
465
466 polygon.push_back((*pVertices)[pSectionIndex+2]);
467 polygon.push_back((*pVertices)[pSectionIndex+6]);
468 polygon.push_back((*pVertices)[pSectionIndex+7]);
469 polygon.push_back((*pVertices)[pSectionIndex+3]);
470 CalculateClippedPolygonExtent(polygon,pVoxelLimit,pAxis,pMin,pMax);
471 polygon.clear();
472
473 polygon.push_back((*pVertices)[pSectionIndex+3]);
474 polygon.push_back((*pVertices)[pSectionIndex+7]);
475 polygon.push_back((*pVertices)[pSectionIndex+4]);
476 polygon.push_back((*pVertices)[pSectionIndex]);
477 CalculateClippedPolygonExtent(polygon,pVoxelLimit,pAxis,pMin,pMax);
478 return;
479}
std::vector< G4ThreeVector > G4ThreeVectorList
void CalculateClippedPolygonExtent(G4ThreeVectorList &pPolygon, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis, G4double &pMin, G4double &pMax) const
Definition: G4VSolid.cc:489

References G4VSolid::CalculateClippedPolygonExtent(), pMax, and pMin.

◆ ClipCrossSection()

void G4VSolid::ClipCrossSection ( G4ThreeVectorList pVertices,
const G4int  pSectionIndex,
const G4VoxelLimits pVoxelLimit,
const EAxis  pAxis,
G4double pMin,
G4double pMax 
) const
protectedinherited

Definition at line 414 of file G4VSolid.cc.

419{
420
421 G4ThreeVectorList polygon;
422 polygon.reserve(4);
423 polygon.push_back((*pVertices)[pSectionIndex]);
424 polygon.push_back((*pVertices)[pSectionIndex+1]);
425 polygon.push_back((*pVertices)[pSectionIndex+2]);
426 polygon.push_back((*pVertices)[pSectionIndex+3]);
427 CalculateClippedPolygonExtent(polygon,pVoxelLimit,pAxis,pMin,pMax);
428 return;
429}

References G4VSolid::CalculateClippedPolygonExtent(), pMax, and pMin.

◆ ClipPolygon()

void G4VSolid::ClipPolygon ( G4ThreeVectorList pPolygon,
const G4VoxelLimits pVoxelLimit,
const EAxis  pAxis 
) const
protectedinherited

Definition at line 539 of file G4VSolid.cc.

542{
543 G4ThreeVectorList outputPolygon;
544
545 if ( pVoxelLimit.IsLimited() )
546 {
547 if (pVoxelLimit.IsXLimited() ) // && pAxis != kXAxis)
548 {
549 G4VoxelLimits simpleLimit1;
550 simpleLimit1.AddLimit(kXAxis,pVoxelLimit.GetMinXExtent(),kInfinity);
551 ClipPolygonToSimpleLimits(pPolygon,outputPolygon,simpleLimit1);
552
553 pPolygon.clear();
554
555 if ( !outputPolygon.size() ) return;
556
557 G4VoxelLimits simpleLimit2;
558 simpleLimit2.AddLimit(kXAxis,-kInfinity,pVoxelLimit.GetMaxXExtent());
559 ClipPolygonToSimpleLimits(outputPolygon,pPolygon,simpleLimit2);
560
561 if ( !pPolygon.size() ) return;
562 else outputPolygon.clear();
563 }
564 if ( pVoxelLimit.IsYLimited() ) // && pAxis != kYAxis)
565 {
566 G4VoxelLimits simpleLimit1;
567 simpleLimit1.AddLimit(kYAxis,pVoxelLimit.GetMinYExtent(),kInfinity);
568 ClipPolygonToSimpleLimits(pPolygon,outputPolygon,simpleLimit1);
569
570 // Must always clear pPolygon - for clip to simpleLimit2 and in case of
571 // early exit
572
573 pPolygon.clear();
574
575 if ( !outputPolygon.size() ) return;
576
577 G4VoxelLimits simpleLimit2;
578 simpleLimit2.AddLimit(kYAxis,-kInfinity,pVoxelLimit.GetMaxYExtent());
579 ClipPolygonToSimpleLimits(outputPolygon,pPolygon,simpleLimit2);
580
581 if ( !pPolygon.size() ) return;
582 else outputPolygon.clear();
583 }
584 if ( pVoxelLimit.IsZLimited() ) // && pAxis != kZAxis)
585 {
586 G4VoxelLimits simpleLimit1;
587 simpleLimit1.AddLimit(kZAxis,pVoxelLimit.GetMinZExtent(),kInfinity);
588 ClipPolygonToSimpleLimits(pPolygon,outputPolygon,simpleLimit1);
589
590 // Must always clear pPolygon - for clip to simpleLimit2 and in case of
591 // early exit
592
593 pPolygon.clear();
594
595 if ( !outputPolygon.size() ) return;
596
597 G4VoxelLimits simpleLimit2;
598 simpleLimit2.AddLimit(kZAxis,-kInfinity,pVoxelLimit.GetMaxZExtent());
599 ClipPolygonToSimpleLimits(outputPolygon,pPolygon,simpleLimit2);
600
601 // Return after final clip - no cleanup
602 }
603 }
604}
void ClipPolygonToSimpleLimits(G4ThreeVectorList &pPolygon, G4ThreeVectorList &outputPolygon, const G4VoxelLimits &pVoxelLimit) const
Definition: G4VSolid.cc:612
G4bool IsYLimited() const
G4double GetMinZExtent() const
void AddLimit(const EAxis pAxis, const G4double pMin, const G4double pMax)
G4bool IsXLimited() const
G4double GetMaxYExtent() const
G4double GetMaxZExtent() const
G4double GetMinYExtent() const
G4double GetMinXExtent() const
G4bool IsZLimited() const
G4bool IsLimited() const
G4double GetMaxXExtent() const
@ kYAxis
Definition: geomdefs.hh:56
@ kXAxis
Definition: geomdefs.hh:55
@ kZAxis
Definition: geomdefs.hh:57
static const G4double kInfinity
Definition: geomdefs.hh:41

References G4VoxelLimits::AddLimit(), G4VSolid::ClipPolygonToSimpleLimits(), G4VoxelLimits::GetMaxXExtent(), G4VoxelLimits::GetMaxYExtent(), G4VoxelLimits::GetMaxZExtent(), G4VoxelLimits::GetMinXExtent(), G4VoxelLimits::GetMinYExtent(), G4VoxelLimits::GetMinZExtent(), G4VoxelLimits::IsLimited(), G4VoxelLimits::IsXLimited(), G4VoxelLimits::IsYLimited(), G4VoxelLimits::IsZLimited(), kInfinity, kXAxis, kYAxis, and kZAxis.

Referenced by G4VSolid::CalculateClippedPolygonExtent().

◆ ClipPolygonToSimpleLimits()

void G4VSolid::ClipPolygonToSimpleLimits ( G4ThreeVectorList pPolygon,
G4ThreeVectorList outputPolygon,
const G4VoxelLimits pVoxelLimit 
) const
privateinherited

Definition at line 612 of file G4VSolid.cc.

615{
616 G4int i;
617 G4int noVertices=pPolygon.size();
618 G4ThreeVector vEnd,vStart;
619
620 for (i = 0 ; i < noVertices ; ++i )
621 {
622 vStart = pPolygon[i];
623 if ( i == noVertices-1 ) vEnd = pPolygon[0];
624 else vEnd = pPolygon[i+1];
625
626 if ( pVoxelLimit.Inside(vStart) )
627 {
628 if (pVoxelLimit.Inside(vEnd))
629 {
630 // vStart and vEnd inside -> output end point
631 //
632 outputPolygon.push_back(vEnd);
633 }
634 else
635 {
636 // vStart inside, vEnd outside -> output crossing point
637 //
638 pVoxelLimit.ClipToLimits(vStart,vEnd);
639 outputPolygon.push_back(vEnd);
640 }
641 }
642 else
643 {
644 if (pVoxelLimit.Inside(vEnd))
645 {
646 // vStart outside, vEnd inside -> output inside section
647 //
648 pVoxelLimit.ClipToLimits(vStart,vEnd);
649 outputPolygon.push_back(vStart);
650 outputPolygon.push_back(vEnd);
651 }
652 else // Both point outside -> no output
653 {
654 // outputPolygon.push_back(vStart);
655 // outputPolygon.push_back(vEnd);
656 }
657 }
658 }
659}
G4bool ClipToLimits(G4ThreeVector &pStart, G4ThreeVector &pEnd) const
G4bool Inside(const G4ThreeVector &pVec) const

References G4VoxelLimits::ClipToLimits(), and G4VoxelLimits::Inside().

Referenced by G4VSolid::ClipPolygon().

◆ Clone()

G4VSolid * G4Paraboloid::Clone ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 861 of file G4Paraboloid.cc.

862{
863 return new G4Paraboloid(*this);
864}
G4Paraboloid(const G4String &pName, G4double pDz, G4double pR1, G4double pR2)
Definition: G4Paraboloid.cc:62

References G4Paraboloid().

◆ ComputeDimensions()

void G4VSolid::ComputeDimensions ( G4VPVParameterisation p,
const G4int  n,
const G4VPhysicalVolume pRep 
)
virtualinherited

Reimplemented in G4TwistedTubs, G4VTwistedFaceted, G4ReflectedSolid, G4DisplacedSolid, G4IntersectionSolid, G4ScaledSolid, G4SubtractionSolid, G4UnionSolid, G4Box, G4Cons, G4Orb, G4Para, G4Sphere, G4Torus, G4Trap, G4Trd, G4Tubs, G4Ellipsoid, G4Hype, G4Polycone, G4Polyhedra, and G4Tet.

Definition at line 137 of file G4VSolid.cc.

140{
141 std::ostringstream message;
142 message << "Illegal call to G4VSolid::ComputeDimensions()" << G4endl
143 << "Method not overloaded by derived class !";
144 G4Exception("G4VSolid::ComputeDimensions()", "GeomMgt0003",
145 FatalException, message);
146}
@ FatalException
#define G4endl
Definition: G4ios.hh:57

References FatalException, G4endl, and G4Exception().

Referenced by G4SmartVoxelHeader::BuildNodes(), G4PVParameterised::CheckOverlaps(), G4VPrimitiveScorer::ComputeSolid(), G4ScoreSplittingProcess::CreateTouchableForSubStep(), G4LogicalVolumeModel::DescribeYourselfTo(), G4VFieldModel::DescribeYourselfTo(), G4LogicalVolume::GetMass(), G4Navigator::GetMotherToDaughterTransform(), G4ITNavigator1::GetMotherToDaughterTransform(), G4ITNavigator2::GetMotherToDaughterTransform(), G4ITNavigator1::LocateGlobalPointAndSetup(), G4ITNavigator2::LocateGlobalPointAndSetup(), G4Navigator::LocateGlobalPointAndSetup(), G4PSFlatSurfaceCurrent::ProcessHits(), G4PSFlatSurfaceFlux::ProcessHits(), G4PSSphereSurfaceFlux::ProcessHits(), G4PSVolumeFlux::ProcessHits(), G4Navigator::SetupHierarchy(), G4ITNavigator1::SetupHierarchy(), and G4ITNavigator2::SetupHierarchy().

◆ CreatePolyhedron()

G4Polyhedron * G4Paraboloid::CreatePolyhedron ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 927 of file G4Paraboloid.cc.

928{
929 return new G4PolyhedronParaboloid(r1, r2, dz, 0., twopi);
930}
static constexpr double twopi
Definition: G4SIunits.hh:56

References dz, r1, r2, and twopi.

Referenced by GetPolyhedron().

◆ DescribeYourselfTo()

void G4Paraboloid::DescribeYourselfTo ( G4VGraphicsScene scene) const
virtual

Implements G4VSolid.

Definition at line 922 of file G4Paraboloid.cc.

923{
924 scene.AddSolid(*this);
925}
virtual void AddSolid(const G4Box &)=0

References G4VGraphicsScene::AddSolid().

◆ DistanceToIn() [1/2]

G4double G4Paraboloid::DistanceToIn ( const G4ThreeVector p) const
virtual

Implements G4VSolid.

Definition at line 464 of file G4Paraboloid.cc.

465{
466 G4double safz = -dz+std::fabs(p.z());
467 if(safz<0.) { safz=0.; }
468 G4double safr = kInfinity;
469
470 G4double rho = p.x()*p.x()+p.y()*p.y();
471 G4double paraRho = (p.z()-k2)/k1;
472 G4double sqrho = std::sqrt(rho);
473
474 if(paraRho<0.)
475 {
476 safr=sqrho-r2;
477 if(safr>safz) { safz=safr; }
478 return safz;
479 }
480
481 G4double sqprho = std::sqrt(paraRho);
482 G4double dRho = sqrho-sqprho;
483 if(dRho<0.) { return safz; }
484
485 G4double talf = -2.*k1*sqprho;
486 G4double tmp = 1+talf*talf;
487 if(tmp<0.) { return safz; }
488
489 G4double salf = talf/std::sqrt(tmp);
490 safr = std::fabs(dRho*salf);
491 if(safr>safz) { safz=safr; }
492
493 return safz;
494}
double z() const
double x() const
double y() const

References dz, k1, k2, kInfinity, r2, CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

◆ DistanceToIn() [2/2]

G4double G4Paraboloid::DistanceToIn ( const G4ThreeVector p,
const G4ThreeVector v 
) const
virtual

Implements G4VSolid.

Definition at line 331 of file G4Paraboloid.cc.

333{
334 G4double rho2 = p.perp2(), paraRho2 = std::fabs(k1 * p.z() + k2);
336 G4double tolh = 0.5*kCarTolerance;
337
338 if(r2 && p.z() > - tolh + dz)
339 {
340 // If the points is above check for intersection with upper edge.
341
342 if(v.z() < 0)
343 {
344 G4double intersection = (dz - p.z()) / v.z(); // With plane z = dz.
345 if(sqr(p.x() + v.x()*intersection)
346 + sqr(p.y() + v.y()*intersection) < sqr(r2 + 0.5 * kCarTolerance))
347 {
348 if(p.z() < tolh + dz)
349 { return 0; }
350 else
351 { return intersection; }
352 }
353 }
354 else // Direction away, no possibility of intersection
355 {
356 return kInfinity;
357 }
358 }
359 else if(r1 && p.z() < tolh - dz)
360 {
361 // If the points is belove check for intersection with lower edge.
362
363 if(v.z() > 0)
364 {
365 G4double intersection = (-dz - p.z()) / v.z(); // With plane z = -dz.
366 if(sqr(p.x() + v.x()*intersection)
367 + sqr(p.y() + v.y()*intersection) < sqr(r1 + 0.5 * kCarTolerance))
368 {
369 if(p.z() > -tolh - dz)
370 {
371 return 0;
372 }
373 else
374 {
375 return intersection;
376 }
377 }
378 }
379 else // Direction away, no possibility of intersection
380 {
381 return kInfinity;
382 }
383 }
384
385 G4double A = k1 / 2 * v.z() - p.x() * v.x() - p.y() * v.y(),
386 vRho2 = v.perp2(), intersection,
387 B = (k1 * p.z() + k2 - rho2) * vRho2;
388
389 if ( ( (rho2 > paraRho2) && (sqr(rho2-paraRho2-0.25*tol2) > tol2*paraRho2) )
390 || (p.z() < - dz+kCarTolerance)
391 || (p.z() > dz-kCarTolerance) ) // Make sure it's safely outside.
392 {
393 // Is there a problem with squaring rho twice?
394
395 if(vRho2<tol2) // Needs to be treated seperately.
396 {
397 intersection = ((rho2 - k2)/k1 - p.z())/v.z();
398 if(intersection < 0) { return kInfinity; }
399 else if(std::fabs(p.z() + v.z() * intersection) <= dz)
400 {
401 return intersection;
402 }
403 else
404 {
405 return kInfinity;
406 }
407 }
408 else if(A*A + B < 0) // No real intersections.
409 {
410 return kInfinity;
411 }
412 else
413 {
414 intersection = (A - std::sqrt(B + sqr(A))) / vRho2;
415 if(intersection < 0)
416 {
417 return kInfinity;
418 }
419 else if(std::fabs(p.z() + intersection * v.z()) < dz + tolh)
420 {
421 return intersection;
422 }
423 else
424 {
425 return kInfinity;
426 }
427 }
428 }
429 else if(sqr(rho2 - paraRho2 - .25 * tol2) <= tol2 * paraRho2)
430 {
431 // If this is true we're somewhere in the border.
432
433 G4ThreeVector normal(p.x(), p.y(), -k1/2);
434 if(normal.dot(v) <= 0)
435 { return 0; }
436 else
437 { return kInfinity; }
438 }
439 else
440 {
441 std::ostringstream message;
442 if(Inside(p) == kInside)
443 {
444 message << "Point p is inside! - " << GetName() << G4endl;
445 }
446 else
447 {
448 message << "Likely a problem in this function, for solid: " << GetName()
449 << G4endl;
450 }
451 message << " p = " << p * (1/mm) << " mm" << G4endl
452 << " v = " << v * (1/mm) << " mm";
453 G4Exception("G4Paraboloid::DistanceToIn(p,v)", "GeomSolids1002",
454 JustWarning, message);
455 return 0;
456 }
457}
G4double B(G4double temperature)
static constexpr double mm
Definition: G4SIunits.hh:95
const G4double A[17]
double perp2() const
EInside Inside(const G4ThreeVector &p) const
G4double kCarTolerance
Definition: G4VSolid.hh:299
@ kInside
Definition: geomdefs.hh:70
static double normal(HepRandomEngine *eptr)
Definition: RandPoisson.cc:79
T sqr(const T &x)
Definition: templates.hh:128

References A, B(), dz, G4endl, G4Exception(), G4VSolid::GetName(), Inside(), JustWarning, k1, k2, G4VSolid::kCarTolerance, kInfinity, kInside, mm, CLHEP::normal(), CLHEP::Hep3Vector::perp2(), r1, r2, sqr(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

◆ DistanceToOut() [1/2]

G4double G4Paraboloid::DistanceToOut ( const G4ThreeVector p) const
virtual

Implements G4VSolid.

Definition at line 811 of file G4Paraboloid.cc.

812{
813 G4double safe=0.0,rho,safeR,safeZ ;
814 G4double tanRMax,secRMax,pRMax ;
815
816#ifdef G4SPECSDEBUG
817 if( Inside(p) == kOutside )
818 {
819 G4cout << G4endl ;
820 DumpInfo();
821 std::ostringstream message;
822 G4int oldprc = message.precision(16);
823 message << "Point p is outside !?" << G4endl
824 << "Position:" << G4endl
825 << " p.x() = " << p.x()/mm << " mm" << G4endl
826 << " p.y() = " << p.y()/mm << " mm" << G4endl
827 << " p.z() = " << p.z()/mm << " mm";
828 message.precision(oldprc) ;
829 G4Exception("G4Paraboloid::DistanceToOut(p)", "GeomSolids1002",
830 JustWarning, message);
831 }
832#endif
833
834 rho = p.perp();
835 safeZ = dz - std::fabs(p.z()) ;
836
837 tanRMax = (r2 - r1)*0.5/dz ;
838 secRMax = std::sqrt(1.0 + tanRMax*tanRMax) ;
839 pRMax = tanRMax*p.z() + (r1+r2)*0.5 ;
840 safeR = (pRMax - rho)/secRMax ;
841
842 if (safeZ < safeR) { safe = safeZ; }
843 else { safe = safeR; }
844 if ( safe < 0.5 * kCarTolerance ) { safe = 0; }
845 return safe ;
846}
G4GLOB_DLL std::ostream G4cout
double perp() const
@ kOutside
Definition: geomdefs.hh:68

References G4VSolid::DumpInfo(), dz, G4cout, G4endl, G4Exception(), Inside(), JustWarning, G4VSolid::kCarTolerance, kOutside, mm, CLHEP::Hep3Vector::perp(), r1, r2, CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

◆ DistanceToOut() [2/2]

G4double G4Paraboloid::DistanceToOut ( const G4ThreeVector p,
const G4ThreeVector v,
const G4bool  calcNorm = false,
G4bool validNorm = nullptr,
G4ThreeVector n = nullptr 
) const
virtual

Implements G4VSolid.

Definition at line 500 of file G4Paraboloid.cc.

505{
506 G4double rho2 = p.perp2(), paraRho2 = std::fabs(k1 * p.z() + k2);
507 G4double vRho2 = v.perp2(), intersection;
509 G4double tolh = 0.5*kCarTolerance;
510
511 if(calcNorm) { *validNorm = false; }
512
513 // We have that the particle p follows the line x = p + s * v
514 // meaning x = p.x() + s * v.x(), y = p.y() + s * v.y() and
515 // z = p.z() + s * v.z()
516 // The equation for all points on the surface (surface expanded for
517 // to include all z) x^2 + y^2 = k1 * z + k2 => .. =>
518 // => s = (A +- std::sqrt(A^2 + B)) / vRho2
519 // where:
520 //
521 G4double A = k1 / 2 * v.z() - p.x() * v.x() - p.y() * v.y();
522 //
523 // and:
524 //
525 G4double B = (-rho2 + paraRho2) * vRho2;
526
527 if ( rho2 < paraRho2 && sqr(rho2 - paraRho2 - 0.25 * tol2) > tol2 * paraRho2
528 && std::fabs(p.z()) < dz - kCarTolerance)
529 {
530 // Make sure it's safely inside.
531
532 if(v.z() > 0)
533 {
534 // It's heading upwards, check where it colides with the plane z = dz.
535 // When it does, is that in the surface of the paraboloid.
536 // z = p.z() + variable * v.z() for all points the particle can go.
537 // => variable = (z - p.z()) / v.z() so intersection must be:
538
539 intersection = (dz - p.z()) / v.z();
540 G4ThreeVector ip = p + intersection * v; // Point of intersection.
541
542 if(ip.perp2() < sqr(r2 + kCarTolerance))
543 {
544 if(calcNorm)
545 {
546 *n = G4ThreeVector(0, 0, 1);
547 if(r2 < tolh || ip.perp2() > sqr(r2 - tolh))
548 {
549 *n += G4ThreeVector(ip.x(), ip.y(), - k1 / 2).unit();
550 *n = n->unit();
551 }
552 *validNorm = true;
553 }
554 return intersection;
555 }
556 }
557 else if(v.z() < 0)
558 {
559 // It's heading downwards, check were it colides with the plane z = -dz.
560 // When it does, is that in the surface of the paraboloid.
561 // z = p.z() + variable * v.z() for all points the particle can go.
562 // => variable = (z - p.z()) / v.z() so intersection must be:
563
564 intersection = (-dz - p.z()) / v.z();
565 G4ThreeVector ip = p + intersection * v; // Point of intersection.
566
567 if(ip.perp2() < sqr(r1 + tolh))
568 {
569 if(calcNorm)
570 {
571 *n = G4ThreeVector(0, 0, -1);
572 if(r1 < tolh || ip.perp2() > sqr(r1 - tolh))
573 {
574 *n += G4ThreeVector(ip.x(), ip.y(), - k1 / 2).unit();
575 *n = n->unit();
576 }
577 *validNorm = true;
578 }
579 return intersection;
580 }
581 }
582
583 // Now check for collisions with paraboloid surface.
584
585 if(vRho2 == 0) // Needs to be treated seperately.
586 {
587 intersection = ((rho2 - k2)/k1 - p.z())/v.z();
588 if(calcNorm)
589 {
590 G4ThreeVector intersectionP = p + v * intersection;
591 *n = G4ThreeVector(intersectionP.x(), intersectionP.y(), -k1/2);
592 *n = n->unit();
593
594 *validNorm = true;
595 }
596 return intersection;
597 }
598 else if( ((A <= 0) && (B >= sqr(A) * (sqr(vRho2) - 1))) || (A >= 0))
599 {
600 // intersection = (A + std::sqrt(B + sqr(A))) / vRho2;
601 // The above calculation has a precision problem:
602 // known problem of solving quadratic equation with small A
603
604 A = A/vRho2;
605 B = (k1 * p.z() + k2 - rho2)/vRho2;
606 intersection = B/(-A + std::sqrt(B + sqr(A)));
607 if(calcNorm)
608 {
609 G4ThreeVector intersectionP = p + v * intersection;
610 *n = G4ThreeVector(intersectionP.x(), intersectionP.y(), -k1/2);
611 *n = n->unit();
612 *validNorm = true;
613 }
614 return intersection;
615 }
616 std::ostringstream message;
617 message << "There is no intersection between given line and solid!"
618 << G4endl
619 << " p = " << p << G4endl
620 << " v = " << v;
621 G4Exception("G4Paraboloid::DistanceToOut(p,v,...)", "GeomSolids1002",
622 JustWarning, message);
623
624 return kInfinity;
625 }
626 else if ( (rho2 < paraRho2 + kCarTolerance
627 || sqr(rho2 - paraRho2 - 0.25 * tol2) < tol2 * paraRho2 )
628 && std::fabs(p.z()) < dz + tolh)
629 {
630 // If this is true we're somewhere in the border.
631
632 G4ThreeVector normal = G4ThreeVector (p.x(), p.y(), -k1/2);
633
634 if(std::fabs(p.z()) > dz - tolh)
635 {
636 // We're in the lower or upper edge
637 //
638 if( ((v.z() > 0) && (p.z() > 0)) || ((v.z() < 0) && (p.z() < 0)) )
639 { // If we're heading out of the object that is treated here
640 if(calcNorm)
641 {
642 *validNorm = true;
643 if(p.z() > 0)
644 { *n = G4ThreeVector(0, 0, 1); }
645 else
646 { *n = G4ThreeVector(0, 0, -1); }
647 }
648 return 0;
649 }
650
651 if(v.z() == 0)
652 {
653 // Case where we're moving inside the surface needs to be
654 // treated separately.
655 // Distance until it goes out through a side is returned.
656
657 G4double r = (p.z() > 0)? r2 : r1;
658 G4double pDotV = p.dot(v);
659 A = vRho2 * ( sqr(r) - sqr(p.x()) - sqr(p.y()));
660 intersection = (-pDotV + std::sqrt(A + sqr(pDotV))) / vRho2;
661
662 if(calcNorm)
663 {
664 *validNorm = true;
665
666 *n = (G4ThreeVector(0, 0, p.z()/std::fabs(p.z()))
667 + G4ThreeVector(p.x() + v.x() * intersection, p.y() + v.y()
668 * intersection, -k1/2).unit()).unit();
669 }
670 return intersection;
671 }
672 }
673 //
674 // Problem in the Logic :: Following condition for point on upper surface
675 // and Vz<0 will return 0 (Problem #1015), but
676 // it has to return intersection with parabolic
677 // surface or with lower plane surface (z = -dz)
678 // The logic has to be :: If not found intersection until now,
679 // do not exit but continue to search for possible intersection.
680 // Only for point situated on both borders (Z and parabolic)
681 // this condition has to be taken into account and done later
682 //
683 //
684 // else if(normal.dot(v) >= 0)
685 // {
686 // if(calcNorm)
687 // {
688 // *validNorm = true;
689 // *n = normal.unit();
690 // }
691 // return 0;
692 // }
693
694 if(v.z() > 0)
695 {
696 // Check for collision with upper edge.
697
698 intersection = (dz - p.z()) / v.z();
699 G4ThreeVector ip = p + intersection * v;
700
701 if(ip.perp2() < sqr(r2 - tolh))
702 {
703 if(calcNorm)
704 {
705 *validNorm = true;
706 *n = G4ThreeVector(0, 0, 1);
707 }
708 return intersection;
709 }
710 else if(ip.perp2() < sqr(r2 + tolh))
711 {
712 if(calcNorm)
713 {
714 *validNorm = true;
715 *n = G4ThreeVector(0, 0, 1)
716 + G4ThreeVector(ip.x(), ip.y(), - k1 / 2).unit();
717 *n = n->unit();
718 }
719 return intersection;
720 }
721 }
722 if( v.z() < 0)
723 {
724 // Check for collision with lower edge.
725
726 intersection = (-dz - p.z()) / v.z();
727 G4ThreeVector ip = p + intersection * v;
728
729 if(ip.perp2() < sqr(r1 - tolh))
730 {
731 if(calcNorm)
732 {
733 *validNorm = true;
734 *n = G4ThreeVector(0, 0, -1);
735 }
736 return intersection;
737 }
738 else if(ip.perp2() < sqr(r1 + tolh))
739 {
740 if(calcNorm)
741 {
742 *validNorm = true;
743 *n = G4ThreeVector(0, 0, -1)
744 + G4ThreeVector(ip.x(), ip.y(), - k1 / 2).unit();
745 *n = n->unit();
746 }
747 return intersection;
748 }
749 }
750
751 // Note: comparison with zero below would not be correct !
752 //
753 if(std::fabs(vRho2) > tol2) // precision error in the calculation of
754 { // intersection = (A+std::sqrt(B+sqr(A)))/vRho2
755 A = A/vRho2;
756 B = (k1 * p.z() + k2 - rho2);
757 if(std::fabs(B)>kCarTolerance)
758 {
759 B = (B)/vRho2;
760 intersection = B/(-A + std::sqrt(B + sqr(A)));
761 }
762 else // Point is On both borders: Z and parabolic
763 { // solution depends on normal.dot(v) sign
764 if(normal.dot(v) >= 0)
765 {
766 if(calcNorm)
767 {
768 *validNorm = true;
769 *n = normal.unit();
770 }
771 return 0;
772 }
773 intersection = 2.*A;
774 }
775 }
776 else
777 {
778 intersection = ((rho2 - k2) / k1 - p.z()) / v.z();
779 }
780
781 if(calcNorm)
782 {
783 *validNorm = true;
784 *n = G4ThreeVector(p.x() + intersection * v.x(), p.y()
785 + intersection * v.y(), - k1 / 2);
786 *n = n->unit();
787 }
788 return intersection;
789 }
790 else
791 {
792#ifdef G4SPECSDEBUG
793 if(kOutside == Inside(p))
794 {
795 G4Exception("G4Paraboloid::DistanceToOut(p,v,...)", "GeomSolids1002",
796 JustWarning, "Point p is outside!");
797 }
798 else
799 G4Exception("G4Paraboloid::DistanceToOut(p,v,...)", "GeomSolids1002",
800 JustWarning, "There's an error in this functions code.");
801#endif
802 return kInfinity;
803 }
804 return 0;
805}
CLHEP::Hep3Vector G4ThreeVector
Hep3Vector unit() const
double dot(const Hep3Vector &) const

References A, B(), CLHEP::Hep3Vector::dot(), dz, G4endl, G4Exception(), Inside(), JustWarning, k1, k2, G4VSolid::kCarTolerance, kInfinity, kOutside, CLHEP::detail::n, CLHEP::normal(), CLHEP::Hep3Vector::perp2(), r1, r2, sqr(), CLHEP::Hep3Vector::unit(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

◆ DumpInfo()

void G4VSolid::DumpInfo ( ) const
inlineinherited

Referenced by G4Cons::ApproxSurfaceNormal(), G4CutTubs::ApproxSurfaceNormal(), G4Sphere::ApproxSurfaceNormal(), G4Torus::ApproxSurfaceNormal(), G4Tubs::ApproxSurfaceNormal(), G4ReflectedSolid::BoundingLimits(), G4DisplacedSolid::BoundingLimits(), G4IntersectionSolid::BoundingLimits(), G4ScaledSolid::BoundingLimits(), G4SubtractionSolid::BoundingLimits(), G4UnionSolid::BoundingLimits(), G4Box::BoundingLimits(), G4Cons::BoundingLimits(), G4CutTubs::BoundingLimits(), G4Orb::BoundingLimits(), G4Para::BoundingLimits(), G4Sphere::BoundingLimits(), G4Torus::BoundingLimits(), G4Trap::BoundingLimits(), G4Trd::BoundingLimits(), G4Tubs::BoundingLimits(), G4EllipticalCone::BoundingLimits(), G4ExtrudedSolid::BoundingLimits(), G4GenericPolycone::BoundingLimits(), G4GenericTrap::BoundingLimits(), G4Hype::BoundingLimits(), BoundingLimits(), G4Polycone::BoundingLimits(), G4Polyhedra::BoundingLimits(), G4TessellatedSolid::BoundingLimits(), G4TwistedTubs::BoundingLimits(), G4ParameterisationBoxX::ComputeDimensions(), G4ParameterisationBoxY::ComputeDimensions(), G4ParameterisationBoxZ::ComputeDimensions(), G4ParameterisationConsRho::ComputeDimensions(), G4ParameterisationConsPhi::ComputeDimensions(), G4ParameterisationConsZ::ComputeDimensions(), G4ParameterisationParaX::ComputeDimensions(), G4ParameterisationParaY::ComputeDimensions(), G4ParameterisationParaZ::ComputeDimensions(), G4ParameterisationPolyconeRho::ComputeDimensions(), G4ParameterisationPolyconePhi::ComputeDimensions(), G4ParameterisationPolyconeZ::ComputeDimensions(), G4ParameterisationPolyhedraRho::ComputeDimensions(), G4ParameterisationPolyhedraPhi::ComputeDimensions(), G4ParameterisationPolyhedraZ::ComputeDimensions(), G4ParameterisationTrdX::ComputeDimensions(), G4ParameterisationTrdY::ComputeDimensions(), G4ParameterisationTrdZ::ComputeDimensions(), G4ParameterisationTubsRho::ComputeDimensions(), G4ParameterisationTubsPhi::ComputeDimensions(), G4ParameterisationTubsZ::ComputeDimensions(), G4ReflectedSolid::ComputeDimensions(), G4DisplacedSolid::ComputeDimensions(), G4ScaledSolid::ComputeDimensions(), G4ParameterisedNavigation::ComputeStep(), G4ReplicaNavigation::ComputeStep(), G4DisplacedSolid::CreatePolyhedron(), G4ScaledSolid::CreatePolyhedron(), G4SubtractionSolid::DistanceToIn(), G4Box::DistanceToOut(), G4Orb::DistanceToOut(), G4Para::DistanceToOut(), G4Trap::DistanceToOut(), G4Trd::DistanceToOut(), DistanceToOut(), G4VTwistedFaceted::DistanceToOut(), G4Cons::DistanceToOut(), G4CutTubs::DistanceToOut(), G4Sphere::DistanceToOut(), G4Torus::DistanceToOut(), G4Tubs::DistanceToOut(), G4Ellipsoid::DistanceToOut(), G4EllipticalCone::DistanceToOut(), G4EllipticalTube::DistanceToOut(), G4GenericTrap::DistanceToOut(), export_G4VSolid(), G4Polycone::G4Polycone(), G4Polyhedra::G4Polyhedra(), G4BooleanSolid::GetConstituentSolid(), G4NavigationLogger::PostComputeStepLog(), G4Box::SurfaceNormal(), G4Para::SurfaceNormal(), G4Trap::SurfaceNormal(), G4Trd::SurfaceNormal(), G4Ellipsoid::SurfaceNormal(), G4EllipticalCone::SurfaceNormal(), G4EllipticalTube::SurfaceNormal(), G4ExtrudedSolid::SurfaceNormal(), and G4Tet::SurfaceNormal().

◆ EstimateCubicVolume()

G4double G4VSolid::EstimateCubicVolume ( G4int  nStat,
G4double  epsilon 
) const
inherited

Definition at line 203 of file G4VSolid.cc.

204{
205 G4int iInside=0;
206 G4double px,py,pz,minX,maxX,minY,maxY,minZ,maxZ,volume,halfepsilon;
208 EInside in;
209
210 // values needed for CalculateExtent signature
211
212 G4VoxelLimits limit; // Unlimited
213 G4AffineTransform origin;
214
215 // min max extents of pSolid along X,Y,Z
216
217 CalculateExtent(kXAxis,limit,origin,minX,maxX);
218 CalculateExtent(kYAxis,limit,origin,minY,maxY);
219 CalculateExtent(kZAxis,limit,origin,minZ,maxZ);
220
221 // limits
222
223 if(nStat < 100) nStat = 100;
224 if(epsilon > 0.01) epsilon = 0.01;
225 halfepsilon = 0.5*epsilon;
226
227 for(auto i = 0; i < nStat; ++i )
228 {
229 px = minX-halfepsilon+(maxX-minX+epsilon)*G4QuickRand();
230 py = minY-halfepsilon+(maxY-minY+epsilon)*G4QuickRand();
231 pz = minZ-halfepsilon+(maxZ-minZ+epsilon)*G4QuickRand();
232 p = G4ThreeVector(px,py,pz);
233 in = Inside(p);
234 if(in != kOutside) ++iInside;
235 }
236 volume = (maxX-minX+epsilon)*(maxY-minY+epsilon)
237 * (maxZ-minZ+epsilon)*iInside/nStat;
238 return volume;
239}
G4double epsilon(G4double density, G4double temperature)
static const G4int maxZ
G4double G4QuickRand()
Definition: G4QuickRand.hh:34
virtual G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const =0
virtual EInside Inside(const G4ThreeVector &p) const =0
EInside
Definition: geomdefs.hh:67

References G4VSolid::CalculateExtent(), epsilon(), G4QuickRand(), G4VSolid::Inside(), kOutside, kXAxis, kYAxis, kZAxis, and maxZ.

Referenced by G4VSolid::GetCubicVolume(), G4BooleanSolid::GetCubicVolume(), and G4VCSGfaceted::GetCubicVolume().

◆ EstimateSurfaceArea()

G4double G4VSolid::EstimateSurfaceArea ( G4int  nStat,
G4double  ell 
) const
inherited

Definition at line 265 of file G4VSolid.cc.

266{
267 static const G4double s2 = 1./std::sqrt(2.);
268 static const G4double s3 = 1./std::sqrt(3.);
269 static const G4ThreeVector directions[64] =
270 {
271 G4ThreeVector( 0, 0, 0), G4ThreeVector( -1, 0, 0), // ( , , ) ( -, , )
272 G4ThreeVector( 1, 0, 0), G4ThreeVector( -1, 0, 0), // ( +, , ) (-+, , )
273 G4ThreeVector( 0, -1, 0), G4ThreeVector(-s2,-s2, 0), // ( , -, ) ( -, -, )
274 G4ThreeVector( s2, -s2, 0), G4ThreeVector( 0, -1, 0), // ( +, -, ) (-+, -, )
275
276 G4ThreeVector( 0, 1, 0), G4ThreeVector( -s2, s2, 0), // ( , +, ) ( -, +, )
277 G4ThreeVector( s2, s2, 0), G4ThreeVector( 0, 1, 0), // ( +, +, ) (-+, +, )
278 G4ThreeVector( 0, -1, 0), G4ThreeVector( -1, 0, 0), // ( ,-+, ) ( -,-+, )
279 G4ThreeVector( 1, 0, 0), G4ThreeVector( -1, 0, 0), // ( +,-+, ) (-+,-+, )
280
281 G4ThreeVector( 0, 0, -1), G4ThreeVector(-s2, 0,-s2), // ( , , -) ( -, , -)
282 G4ThreeVector( s2, 0,-s2), G4ThreeVector( 0, 0, -1), // ( +, , -) (-+, , -)
283 G4ThreeVector( 0,-s2,-s2), G4ThreeVector(-s3,-s3,-s3), // ( , -, -) ( -, -, -)
284 G4ThreeVector( s3,-s3,-s3), G4ThreeVector( 0,-s2,-s2), // ( +, -, -) (-+, -, -)
285
286 G4ThreeVector( 0, s2,-s2), G4ThreeVector(-s3, s3,-s3), // ( , +, -) ( -, +, -)
287 G4ThreeVector( s3, s3,-s3), G4ThreeVector( 0, s2,-s2), // ( +, +, -) (-+, +, -)
288 G4ThreeVector( 0, 0, -1), G4ThreeVector(-s2, 0,-s2), // ( ,-+, -) ( -,-+, -)
289 G4ThreeVector( s2, 0,-s2), G4ThreeVector( 0, 0, -1), // ( +,-+, -) (-+,-+, -)
290
291 G4ThreeVector( 0, 0, 1), G4ThreeVector(-s2, 0, s2), // ( , , +) ( -, , +)
292 G4ThreeVector( s2, 0, s2), G4ThreeVector( 0, 0, 1), // ( +, , +) (-+, , +)
293 G4ThreeVector( 0,-s2, s2), G4ThreeVector(-s3,-s3, s3), // ( , -, +) ( -, -, +)
294 G4ThreeVector( s3,-s3, s3), G4ThreeVector( 0,-s2, s2), // ( +, -, +) (-+, -, +)
295
296 G4ThreeVector( 0, s2, s2), G4ThreeVector(-s3, s3, s3), // ( , +, +) ( -, +, +)
297 G4ThreeVector( s3, s3, s3), G4ThreeVector( 0, s2, s2), // ( +, +, +) (-+, +, +)
298 G4ThreeVector( 0, 0, 1), G4ThreeVector(-s2, 0, s2), // ( ,-+, +) ( -,-+, +)
299 G4ThreeVector( s2, 0, s2), G4ThreeVector( 0, 0, 1), // ( +,-+, +) (-+,-+, +)
300
301 G4ThreeVector( 0, 0, -1), G4ThreeVector( -1, 0, 0), // ( , ,-+) ( -, ,-+)
302 G4ThreeVector( 1, 0, 0), G4ThreeVector( -1, 0, 0), // ( +, ,-+) (-+, ,-+)
303 G4ThreeVector( 0, -1, 0), G4ThreeVector(-s2,-s2, 0), // ( , -,-+) ( -, -,-+)
304 G4ThreeVector( s2, -s2, 0), G4ThreeVector( 0, -1, 0), // ( +, -,-+) (-+, -,-+)
305
306 G4ThreeVector( 0, 1, 0), G4ThreeVector( -s2, s2, 0), // ( , +,-+) ( -, +,-+)
307 G4ThreeVector( s2, s2, 0), G4ThreeVector( 0, 1, 0), // ( +, +,-+) (-+, +,-+)
308 G4ThreeVector( 0, -1, 0), G4ThreeVector( -1, 0, 0), // ( ,-+,-+) ( -,-+,-+)
309 G4ThreeVector( 1, 0, 0), G4ThreeVector( -1, 0, 0), // ( +,-+,-+) (-+,-+,-+)
310 };
311
312 G4ThreeVector bmin, bmax;
313 BoundingLimits(bmin, bmax);
314
315 G4double dX = bmax.x() - bmin.x();
316 G4double dY = bmax.y() - bmin.y();
317 G4double dZ = bmax.z() - bmin.z();
318
319 // Define statistics and shell thickness
320 //
321 G4int npoints = (nstat < 1000) ? 1000 : nstat;
322 G4double coeff = 0.5 / std::cbrt(G4double(npoints));
323 G4double eps = (ell > 0) ? ell : coeff * std::min(std::min(dX, dY), dZ);
324 G4double del = 1.8 * eps; // shold be more than sqrt(3.)
325
326 G4double minX = bmin.x() - eps;
327 G4double minY = bmin.y() - eps;
328 G4double minZ = bmin.z() - eps;
329
330 G4double dd = 2. * eps;
331 dX += dd;
332 dY += dd;
333 dZ += dd;
334
335 // Calculate surface area
336 //
337 G4int icount = 0;
338 for(auto i = 0; i < npoints; ++i)
339 {
340 G4double px = minX + dX*G4QuickRand();
341 G4double py = minY + dY*G4QuickRand();
342 G4double pz = minZ + dZ*G4QuickRand();
343 G4ThreeVector p = G4ThreeVector(px, py, pz);
344 EInside in = Inside(p);
345 G4double dist = 0;
346 if (in == kInside)
347 {
348 if (DistanceToOut(p) >= eps) continue;
349 G4int icase = 0;
350 if (Inside(G4ThreeVector(px-del, py, pz)) != kInside) icase += 1;
351 if (Inside(G4ThreeVector(px+del, py, pz)) != kInside) icase += 2;
352 if (Inside(G4ThreeVector(px, py-del, pz)) != kInside) icase += 4;
353 if (Inside(G4ThreeVector(px, py+del, pz)) != kInside) icase += 8;
354 if (Inside(G4ThreeVector(px, py, pz-del)) != kInside) icase += 16;
355 if (Inside(G4ThreeVector(px, py, pz+del)) != kInside) icase += 32;
356 if (icase == 0) continue;
357 G4ThreeVector v = directions[icase];
358 dist = DistanceToOut(p, v);
359 G4ThreeVector n = SurfaceNormal(p + v*dist);
360 dist *= v.dot(n);
361 }
362 else if (in == kOutside)
363 {
364 if (DistanceToIn(p) >= eps) continue;
365 G4int icase = 0;
366 if (Inside(G4ThreeVector(px-del, py, pz)) != kOutside) icase += 1;
367 if (Inside(G4ThreeVector(px+del, py, pz)) != kOutside) icase += 2;
368 if (Inside(G4ThreeVector(px, py-del, pz)) != kOutside) icase += 4;
369 if (Inside(G4ThreeVector(px, py+del, pz)) != kOutside) icase += 8;
370 if (Inside(G4ThreeVector(px, py, pz-del)) != kOutside) icase += 16;
371 if (Inside(G4ThreeVector(px, py, pz+del)) != kOutside) icase += 32;
372 if (icase == 0) continue;
373 G4ThreeVector v = directions[icase];
374 dist = DistanceToIn(p, v);
375 if (dist == kInfinity) continue;
376 G4ThreeVector n = SurfaceNormal(p + v*dist);
377 dist *= -(v.dot(n));
378 }
379 if (dist < eps) ++icount;
380 }
381 return dX*dY*dZ*icount/npoints/dd;
382}
static const G4double eps
virtual G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=nullptr, G4ThreeVector *n=nullptr) const =0
virtual G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const =0
virtual void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const
Definition: G4VSolid.cc:665
virtual G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const =0
T min(const T t1, const T t2)
brief Return the smallest of the two arguments

References G4VSolid::BoundingLimits(), G4VSolid::DistanceToIn(), G4VSolid::DistanceToOut(), CLHEP::Hep3Vector::dot(), eps, G4QuickRand(), G4VSolid::Inside(), kInfinity, kInside, kOutside, G4INCL::Math::min(), CLHEP::detail::n, G4VSolid::SurfaceNormal(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

Referenced by G4VSolid::GetSurfaceArea(), G4MultiUnion::GetSurfaceArea(), and G4VCSGfaceted::GetSurfaceArea().

◆ GetConstituentSolid() [1/2]

G4VSolid * G4VSolid::GetConstituentSolid ( G4int  no)
virtualinherited

Reimplemented in G4BooleanSolid.

Definition at line 170 of file G4VSolid.cc.

171{ return nullptr; }

◆ GetConstituentSolid() [2/2]

const G4VSolid * G4VSolid::GetConstituentSolid ( G4int  no) const
virtualinherited

Reimplemented in G4BooleanSolid.

Definition at line 167 of file G4VSolid.cc.

168{ return nullptr; }

Referenced by G4BooleanSolid::StackPolyhedron().

◆ GetCubicVolume()

G4double G4Paraboloid::GetCubicVolume ( )
inlinevirtual

Reimplemented from G4VSolid.

◆ GetDisplacedSolidPtr() [1/2]

G4DisplacedSolid * G4VSolid::GetDisplacedSolidPtr ( )
virtualinherited

Reimplemented in G4DisplacedSolid.

Definition at line 176 of file G4VSolid.cc.

177{ return nullptr; }

◆ GetDisplacedSolidPtr() [2/2]

const G4DisplacedSolid * G4VSolid::GetDisplacedSolidPtr ( ) const
virtualinherited

Reimplemented in G4DisplacedSolid.

Definition at line 173 of file G4VSolid.cc.

174{ return nullptr; }

◆ GetEntityType()

G4GeometryType G4Paraboloid::GetEntityType ( ) const
virtual

Implements G4VSolid.

Definition at line 852 of file G4Paraboloid.cc.

853{
854 return G4String("G4Paraboloid");
855}

◆ GetExtent()

G4VisExtent G4VSolid::GetExtent ( ) const
virtualinherited

Reimplemented in G4Box, G4Orb, G4Sphere, G4Ellipsoid, G4EllipticalCone, G4EllipticalTube, G4GenericTrap, G4Hype, G4TessellatedSolid, G4Tet, G4TwistedTubs, G4VCSGfaceted, and G4VTwistedFaceted.

Definition at line 682 of file G4VSolid.cc.

683{
684 G4VisExtent extent;
685 G4VoxelLimits voxelLimits; // Defaults to "infinite" limits.
686 G4AffineTransform affineTransform;
687 G4double vmin, vmax;
688 CalculateExtent(kXAxis,voxelLimits,affineTransform,vmin,vmax);
689 extent.SetXmin (vmin);
690 extent.SetXmax (vmax);
691 CalculateExtent(kYAxis,voxelLimits,affineTransform,vmin,vmax);
692 extent.SetYmin (vmin);
693 extent.SetYmax (vmax);
694 CalculateExtent(kZAxis,voxelLimits,affineTransform,vmin,vmax);
695 extent.SetZmin (vmin);
696 extent.SetZmax (vmax);
697 return extent;
698}
void SetYmin(G4double ymin)
Definition: G4VisExtent.hh:114
void SetYmax(G4double ymax)
Definition: G4VisExtent.hh:116
void SetXmax(G4double xmax)
Definition: G4VisExtent.hh:112
void SetXmin(G4double xmin)
Definition: G4VisExtent.hh:110
void SetZmax(G4double zmax)
Definition: G4VisExtent.hh:120
void SetZmin(G4double zmin)
Definition: G4VisExtent.hh:118

References G4VSolid::CalculateExtent(), kXAxis, kYAxis, kZAxis, G4VisExtent::SetXmax(), G4VisExtent::SetXmin(), G4VisExtent::SetYmax(), G4VisExtent::SetYmin(), G4VisExtent::SetZmax(), and G4VisExtent::SetZmin().

Referenced by G4tgbVolume::BuildSolidForDivision(), G4BoundingExtentScene::ProcessVolume(), G4BoundingSphereScene::ProcessVolume(), and G4VisCommandsTouchable::SetNewValue().

◆ GetName()

G4String G4VSolid::GetName ( ) const
inlineinherited

Referenced by G4GMocrenFileSceneHandler::AddDetector(), G4HepRepFileSceneHandler::AddHepRepInstance(), G4GMocrenFileSceneHandler::AddPrimitive(), G4HepRepFileSceneHandler::AddSolid(), G4GMocrenFileSceneHandler::AddSolid(), G4VtkSceneHandler::AddSolid(), G4GDMLWriteSolids::AddSolid(), G4NavigationLogger::AlongComputeStepLog(), G4GDMLWriteSolids::BooleanWrite(), G4ReflectedSolid::BoundingLimits(), G4DisplacedSolid::BoundingLimits(), G4IntersectionSolid::BoundingLimits(), G4ScaledSolid::BoundingLimits(), G4SubtractionSolid::BoundingLimits(), G4UnionSolid::BoundingLimits(), G4Box::BoundingLimits(), G4Cons::BoundingLimits(), G4CutTubs::BoundingLimits(), G4Orb::BoundingLimits(), G4Para::BoundingLimits(), G4Sphere::BoundingLimits(), G4Torus::BoundingLimits(), G4Trap::BoundingLimits(), G4Trd::BoundingLimits(), G4Tubs::BoundingLimits(), G4EllipticalCone::BoundingLimits(), G4ExtrudedSolid::BoundingLimits(), G4GenericPolycone::BoundingLimits(), G4GenericTrap::BoundingLimits(), G4Hype::BoundingLimits(), BoundingLimits(), G4Polycone::BoundingLimits(), G4Polyhedra::BoundingLimits(), G4TessellatedSolid::BoundingLimits(), G4TwistedTubs::BoundingLimits(), G4GDMLWriteSolids::BoxWrite(), G4ExtrudedSolid::CalculateExtent(), G4GenericPolycone::CalculateExtent(), G4Polycone::CalculateExtent(), G4Polyhedra::CalculateExtent(), G4NavigationLogger::CheckDaughterEntryPoint(), G4VDivisionParameterisation::CheckNDivAndWidth(), G4VDivisionParameterisation::CheckOffset(), G4GenericTrap::CheckOrder(), G4Para::CheckParameters(), G4Trap::CheckParameters(), G4Trd::CheckParameters(), G4Ellipsoid::CheckParameters(), G4EllipticalTube::CheckParameters(), G4ParameterisationPolyconeRho::CheckParametersValidity(), G4ParameterisationPolyconeZ::CheckParametersValidity(), G4ParameterisationPolyhedraRho::CheckParametersValidity(), G4ParameterisationPolyhedraPhi::CheckParametersValidity(), G4ParameterisationPolyhedraZ::CheckParametersValidity(), G4PhantomParameterisation::CheckVoxelsFillContainer(), G4GenericTrap::ComputeIsTwisted(), G4VoxelNavigation::ComputeSafety(), G4VoxelSafety::ComputeSafety(), G4NavigationLogger::ComputeSafetyLog(), G4ParameterisedNavigation::ComputeStep(), G4ReplicaNavigation::ComputeStep(), G4GDMLWriteSolids::ConeWrite(), G4Polyhedra::Create(), G4GenericPolycone::Create(), G4Polycone::Create(), G4PhysicalVolumeModel::CreateCurrentAttValues(), G4ReflectedSolid::CreatePolyhedron(), G4ReflectionFactory::CreateReflectedLV(), G4GenericTrap::CreateTessellatedSolid(), G4GDMLWriteSolids::CutTubeWrite(), G4SolidStore::DeRegister(), G4PhysicalVolumeModel::DescribeSolid(), G4SubtractionSolid::DistanceToIn(), DistanceToIn(), G4TessellatedSolid::DistanceToIn(), G4Box::DistanceToOut(), G4Orb::DistanceToOut(), G4Para::DistanceToOut(), G4Trap::DistanceToOut(), G4Trd::DistanceToOut(), G4EllipticalCone::DistanceToOut(), G4TessellatedSolid::DistanceToOut(), G4Ellipsoid::DistanceToOut(), G4EllipticalTube::DistanceToOut(), G4tgbGeometryDumper::DumpMultiUnionVolume(), G4tgbGeometryDumper::DumpScaledVolume(), G4tgbGeometryDumper::DumpSolid(), G4GDMLWriteSolids::ElconeWrite(), G4GDMLWriteSolids::EllipsoidWrite(), G4GDMLWriteSolids::EltubeWrite(), G4PVDivision::ErrorInAxis(), G4ReplicatedSlice::ErrorInAxis(), export_G4VSolid(), G4Box::G4Box(), G4Cons::G4Cons(), G4CutTubs::G4CutTubs(), G4EllipticalCone::G4EllipticalCone(), G4Hype::G4Hype(), G4Para::G4Para(), G4Paraboloid(), G4Polycone::G4Polycone(), G4Polyhedra::G4Polyhedra(), G4Sphere::G4Sphere(), G4Tet::G4Tet(), G4Trap::G4Trap(), G4Tubs::G4Tubs(), G4VParameterisationCons::G4VParameterisationCons(), G4VParameterisationPara::G4VParameterisationPara(), G4VParameterisationPolycone::G4VParameterisationPolycone(), G4VParameterisationPolyhedra::G4VParameterisationPolyhedra(), G4VParameterisationTrd::G4VParameterisationTrd(), G4VTwistedFaceted::G4VTwistedFaceted(), G4GDMLWriteSolids::GenericPolyconeWrite(), G4GDMLWriteSolids::GenTrapWrite(), G4Navigator::GetGlobalExitNormal(), G4Navigator::GetLocalExitNormal(), G4ITNavigator1::GetLocalExitNormal(), G4ITNavigator2::GetLocalExitNormal(), G4BooleanSolid::GetPointOnSurface(), G4PhantomParameterisation::GetReplicaNo(), G4GDMLWriteSolids::HypeWrite(), G4TessellatedSolid::InsideNoVoxels(), G4TessellatedSolid::InsideVoxels(), G4ITNavigator1::LocateGlobalPointAndSetup(), G4ITNavigator2::LocateGlobalPointAndSetup(), G4Navigator::LocateGlobalPointAndSetup(), G4GenericTrap::MakeDownFacet(), G4Trap::MakePlanes(), G4GenericTrap::MakeUpFacet(), G4GDMLWriteSolids::MultiUnionWrite(), G4GDMLWriteSolids::OrbWrite(), G4GDMLWriteSolids::ParaboloidWrite(), G4GDMLWriteParamvol::ParametersWrite(), G4GDMLWriteSolids::ParaWrite(), G4GDMLWriteSolids::PolyconeWrite(), G4GDMLWriteSolids::PolyhedraWrite(), G4NavigationLogger::PostComputeStepLog(), G4NavigationLogger::PreComputeStepLog(), G4NavigationLogger::PrintDaughterLog(), G4PseudoScene::ProcessVolume(), G4SolidStore::Register(), G4tgbVolumeMgr::RegisterMe(), G4NavigationLogger::ReportOutsideMother(), G4ASCIITreeSceneHandler::RequestPrimitives(), G4VSceneHandler::RequestPrimitives(), G4GenericPolycone::Reset(), G4Polyhedra::Reset(), G4VoxelSafety::SafetyForVoxelNode(), G4GDMLWriteSolids::ScaledWrite(), G4Torus::SetAllParameters(), G4Tet::SetBoundingLimits(), G4Polycone::SetOriginalParameters(), G4Polyhedra::SetOriginalParameters(), G4TessellatedSolid::SetSolidClosed(), G4Tet::SetVertices(), G4Box::SetXHalfLength(), G4Box::SetYHalfLength(), G4Box::SetZHalfLength(), G4GDMLWriteSolids::SphereWrite(), G4BooleanSolid::StackPolyhedron(), G4ReflectedSolid::StreamInfo(), G4BooleanSolid::StreamInfo(), G4DisplacedSolid::StreamInfo(), G4MultiUnion::StreamInfo(), G4ScaledSolid::StreamInfo(), G4Box::StreamInfo(), G4Cons::StreamInfo(), G4CSGSolid::StreamInfo(), G4CutTubs::StreamInfo(), G4Orb::StreamInfo(), G4Para::StreamInfo(), G4Sphere::StreamInfo(), G4Torus::StreamInfo(), G4Trap::StreamInfo(), G4Trd::StreamInfo(), G4Tubs::StreamInfo(), G4Ellipsoid::StreamInfo(), G4EllipticalCone::StreamInfo(), G4EllipticalTube::StreamInfo(), G4ExtrudedSolid::StreamInfo(), G4GenericPolycone::StreamInfo(), G4GenericTrap::StreamInfo(), G4Hype::StreamInfo(), StreamInfo(), G4Polycone::StreamInfo(), G4Polyhedra::StreamInfo(), G4TessellatedSolid::StreamInfo(), G4Tet::StreamInfo(), G4TwistedBox::StreamInfo(), G4TwistedTrap::StreamInfo(), G4TwistedTrd::StreamInfo(), G4TwistedTubs::StreamInfo(), G4VCSGfaceted::StreamInfo(), G4VTwistedFaceted::StreamInfo(), G4GDMLRead::StripNames(), SubstractSolids(), G4UnionSolid::SurfaceNormal(), G4Box::SurfaceNormal(), G4Para::SurfaceNormal(), G4Trap::SurfaceNormal(), G4Trd::SurfaceNormal(), G4Ellipsoid::SurfaceNormal(), G4EllipticalCone::SurfaceNormal(), G4EllipticalTube::SurfaceNormal(), G4ExtrudedSolid::SurfaceNormal(), G4Tet::SurfaceNormal(), G4GDMLWriteSolids::TessellatedWrite(), G4GDMLWriteSolids::TetWrite(), G4GDMLWriteSolids::TorusWrite(), G4GDMLWriteSolids::TrapWrite(), G4GDMLWriteStructure::TraverseVolumeTree(), G4GDMLWriteSolids::TrdWrite(), G4GDMLWriteSolids::TubeWrite(), G4GDMLWriteSolids::TwistedboxWrite(), G4GDMLWriteSolids::TwistedtrapWrite(), G4GDMLWriteSolids::TwistedtrdWrite(), G4GDMLWriteSolids::TwistedtubsWrite(), G4PhysicalVolumeModel::VisitGeometryAndGetVisReps(), and G4GDMLWriteSolids::XtruWrite().

◆ GetPointOnSurface()

G4ThreeVector G4Paraboloid::GetPointOnSurface ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 891 of file G4Paraboloid.cc.

892{
894 G4double z = G4RandFlat::shoot(0.,1.);
896 if(pi*(sqr(r1) + sqr(r2))/A >= z)
897 {
898 G4double rho;
899 if(pi * sqr(r1) / A > z)
900 {
901 rho = r1 * std::sqrt(G4RandFlat::shoot(0., 1.));
902 return G4ThreeVector(rho * std::cos(phi), rho * std::sin(phi), -dz);
903 }
904 else
905 {
906 rho = r2 * std::sqrt(G4RandFlat::shoot(0., 1));
907 return G4ThreeVector(rho * std::cos(phi), rho * std::sin(phi), dz);
908 }
909 }
910 else
911 {
912 z = G4RandFlat::shoot(0., 1.)*2*dz - dz;
913 return G4ThreeVector(std::sqrt(z*k1 + k2)*std::cos(phi),
914 std::sqrt(z*k1 + k2)*std::sin(phi), z);
915 }
916}
static constexpr double pi
Definition: G4SIunits.hh:55
G4double CalculateSurfaceArea() const
ThreeVector shoot(const G4int Ap, const G4int Af)

References A, CalculateSurfaceArea(), dz, fSurfaceArea, k1, k2, pi, r1, r2, G4INCL::DeJongSpin::shoot(), sqr(), and twopi.

◆ GetPolyhedron()

G4Polyhedron * G4Paraboloid::GetPolyhedron ( ) const
virtual

◆ GetRadiusMinusZ()

G4double G4Paraboloid::GetRadiusMinusZ ( ) const
inline

◆ GetRadiusPlusZ()

G4double G4Paraboloid::GetRadiusPlusZ ( ) const
inline

◆ GetSurfaceArea()

G4double G4Paraboloid::GetSurfaceArea ( )
inlinevirtual

Reimplemented from G4VSolid.

◆ GetTolerance()

G4double G4VSolid::GetTolerance ( ) const
inlineinherited

◆ GetZHalfLength()

G4double G4Paraboloid::GetZHalfLength ( ) const
inline

◆ Inside()

EInside G4Paraboloid::Inside ( const G4ThreeVector p) const
virtual

Implements G4VSolid.

Definition at line 194 of file G4Paraboloid.cc.

195{
196 // First check is the point is above or below the solid.
197 //
198 if(std::fabs(p.z()) > dz + 0.5 * kCarTolerance) { return kOutside; }
199
200 G4double rho2 = p.perp2(),
201 rhoSurfTimesTol2 = (k1 * p.z() + k2) * sqr(kCarTolerance),
202 A = rho2 - ((k1 *p.z() + k2) + 0.25 * kCarTolerance * kCarTolerance);
203
204 if(A < 0 && sqr(A) > rhoSurfTimesTol2)
205 {
206 // Actually checking rho < radius of paraboloid at z = p.z().
207 // We're either inside or in lower/upper cutoff area.
208
209 if(std::fabs(p.z()) > dz - 0.5 * kCarTolerance)
210 {
211 // We're in the upper/lower cutoff area, sides have a paraboloid shape
212 // maybe further checks should be made to make these nicer
213
214 return kSurface;
215 }
216 else
217 {
218 return kInside;
219 }
220 }
221 else if(A <= 0 || sqr(A) < rhoSurfTimesTol2)
222 {
223 // We're in the parabolic surface.
224
225 return kSurface;
226 }
227 else
228 {
229 return kOutside;
230 }
231}
@ kSurface
Definition: geomdefs.hh:69

References A, dz, k1, k2, G4VSolid::kCarTolerance, kInside, kOutside, kSurface, CLHEP::Hep3Vector::perp2(), sqr(), and CLHEP::Hep3Vector::z().

Referenced by DistanceToIn(), and DistanceToOut().

◆ operator=()

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

Definition at line 125 of file G4Paraboloid.cc.

126{
127 // Check assignment to self
128 //
129 if (this == &rhs) { return *this; }
130
131 // Copy base class data
132 //
134
135 // Copy data
136 //
138 dz = rhs.dz; r1 = rhs.r1; r2 = rhs.r2; k1 = rhs.k1; k2 = rhs.k2;
139 fRebuildPolyhedron = false;
140 delete fpPolyhedron; fpPolyhedron = nullptr;
141
142 return *this;
143}
G4VSolid & operator=(const G4VSolid &rhs)
Definition: G4VSolid.cc:107

References dz, fCubicVolume, fpPolyhedron, fRebuildPolyhedron, fSurfaceArea, k1, k2, G4VSolid::operator=(), r1, and r2.

◆ operator==()

G4bool G4VSolid::operator== ( const G4VSolid s) const
inlineinherited

◆ SetName()

void G4VSolid::SetName ( const G4String name)
inherited

Definition at line 127 of file G4VSolid.cc.

128{
131}
void SetMapValid(G4bool val)
Definition: G4SolidStore.hh:76
static G4SolidStore * GetInstance()
G4String fshapeName
Definition: G4VSolid.hh:312
const char * name(G4int ptype)

References G4VSolid::fshapeName, G4SolidStore::GetInstance(), G4InuclParticleNames::name(), and G4SolidStore::SetMapValid().

Referenced by export_G4VSolid(), G4MultiUnion::G4MultiUnion(), and G4GDMLRead::StripNames().

◆ SetRadiusMinusZ()

void G4Paraboloid::SetRadiusMinusZ ( G4double  R1)
inline

◆ SetRadiusPlusZ()

void G4Paraboloid::SetRadiusPlusZ ( G4double  R2)
inline

◆ SetZHalfLength()

void G4Paraboloid::SetZHalfLength ( G4double  dz)
inline

◆ StreamInfo()

std::ostream & G4Paraboloid::StreamInfo ( std::ostream &  os) const
virtual

Implements G4VSolid.

Definition at line 870 of file G4Paraboloid.cc.

871{
872 G4int oldprc = os.precision(16);
873 os << "-----------------------------------------------------------\n"
874 << " *** Dump for solid - " << GetName() << " ***\n"
875 << " ===================================================\n"
876 << " Solid type: G4Paraboloid\n"
877 << " Parameters: \n"
878 << " z half-axis: " << dz/mm << " mm \n"
879 << " radius at -dz: " << r1/mm << " mm \n"
880 << " radius at dz: " << r2/mm << " mm \n"
881 << "-----------------------------------------------------------\n";
882 os.precision(oldprc);
883
884 return os;
885}

References dz, G4VSolid::GetName(), mm, r1, and r2.

◆ SurfaceNormal()

G4ThreeVector G4Paraboloid::SurfaceNormal ( const G4ThreeVector p) const
virtual

Implements G4VSolid.

Definition at line 237 of file G4Paraboloid.cc.

238{
239 G4ThreeVector n(0, 0, 0);
240 if(std::fabs(p.z()) > dz + 0.5 * kCarTolerance)
241 {
242 // If above or below just return normal vector for the cutoff plane.
243
244 n = G4ThreeVector(0, 0, p.z()/std::fabs(p.z()));
245 }
246 else if(std::fabs(p.z()) > dz - 0.5 * kCarTolerance)
247 {
248 // This means we're somewhere in the plane z = dz or z = -dz.
249 // (As far as the program is concerned anyway.
250
251 if(p.z() < 0) // Are we in upper or lower plane?
252 {
253 if(p.perp2() > sqr(r1 + 0.5 * kCarTolerance))
254 {
255 n = G4ThreeVector(p.x(), p.y(), -k1 / 2).unit();
256 }
257 else if(r1 < 0.5 * kCarTolerance
258 || p.perp2() > sqr(r1 - 0.5 * kCarTolerance))
259 {
260 n = G4ThreeVector(p.x(), p.y(), 0.).unit()
261 + G4ThreeVector(0., 0., -1.).unit();
262 n = n.unit();
263 }
264 else
265 {
266 n = G4ThreeVector(0., 0., -1.);
267 }
268 }
269 else
270 {
271 if(p.perp2() > sqr(r2 + 0.5 * kCarTolerance))
272 {
273 n = G4ThreeVector(p.x(), p.y(), 0.).unit();
274 }
275 else if(r2 < 0.5 * kCarTolerance
276 || p.perp2() > sqr(r2 - 0.5 * kCarTolerance))
277 {
278 n = G4ThreeVector(p.x(), p.y(), 0.).unit()
279 + G4ThreeVector(0., 0., 1.).unit();
280 n = n.unit();
281 }
282 else
283 {
284 n = G4ThreeVector(0., 0., 1.);
285 }
286 }
287 }
288 else
289 {
290 G4double rho2 = p.perp2();
291 G4double rhoSurfTimesTol2 = (k1 * p.z() + k2) * sqr(kCarTolerance);
292 G4double A = rho2 - ((k1 *p.z() + k2)
293 + 0.25 * kCarTolerance * kCarTolerance);
294
295 if(A < 0 && sqr(A) > rhoSurfTimesTol2)
296 {
297 // Actually checking rho < radius of paraboloid at z = p.z().
298 // We're inside.
299
300 if(p.mag2() != 0) { n = p.unit(); }
301 }
302 else if(A <= 0 || sqr(A) < rhoSurfTimesTol2)
303 {
304 // We're in the parabolic surface.
305
306 n = G4ThreeVector(p.x(), p.y(), - k1 / 2).unit();
307 }
308 else
309 {
310 n = G4ThreeVector(p.x(), p.y(), - k1 / 2).unit();
311 }
312 }
313
314 if(n.mag2() == 0)
315 {
316 std::ostringstream message;
317 message << "No normal defined for this point p." << G4endl
318 << " p = " << 1 / mm * p << " mm";
319 G4Exception("G4Paraboloid::SurfaceNormal(p)", "GeomSolids1002",
320 JustWarning, message);
321 }
322 return n;
323}
double mag2() const

References A, dz, G4endl, G4Exception(), JustWarning, k1, k2, G4VSolid::kCarTolerance, CLHEP::Hep3Vector::mag2(), mm, CLHEP::detail::n, CLHEP::Hep3Vector::perp2(), r1, r2, sqr(), CLHEP::Hep3Vector::unit(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

Field Documentation

◆ dz

G4double G4Paraboloid::dz
private

◆ fCubicVolume

G4double G4Paraboloid::fCubicVolume = 0.0
private

Definition at line 148 of file G4Paraboloid.hh.

Referenced by operator=().

◆ fpPolyhedron

G4Polyhedron* G4Paraboloid::fpPolyhedron = nullptr
mutableprotected

Definition at line 141 of file G4Paraboloid.hh.

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

◆ fRebuildPolyhedron

G4bool G4Paraboloid::fRebuildPolyhedron = false
mutableprotected

Definition at line 140 of file G4Paraboloid.hh.

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

◆ fshapeName

G4String G4VSolid::fshapeName
privateinherited

Definition at line 312 of file G4VSolid.hh.

Referenced by G4VSolid::operator=(), and G4VSolid::SetName().

◆ fSurfaceArea

G4double G4Paraboloid::fSurfaceArea = 0.0
mutableprivate

Definition at line 147 of file G4Paraboloid.hh.

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

◆ k1

G4double G4Paraboloid::k1
private

◆ k2

G4double G4Paraboloid::k2
private

◆ kCarTolerance

G4double G4VSolid::kCarTolerance
protectedinherited

Definition at line 299 of file G4VSolid.hh.

Referenced by G4TessellatedSolid::AddFacet(), G4Polycone::CalculateExtent(), G4Polyhedra::CalculateExtent(), G4Tet::CheckDegeneracy(), G4Para::CheckParameters(), G4Trd::CheckParameters(), G4Ellipsoid::CheckParameters(), G4EllipticalTube::CheckParameters(), G4GenericTrap::ComputeIsTwisted(), G4Polyhedra::Create(), G4GenericPolycone::Create(), G4Polycone::Create(), G4CutTubs::CreatePolyhedron(), G4TessellatedSolid::CreateVertexList(), G4VCSGfaceted::DistanceTo(), G4Sphere::DistanceToIn(), G4Ellipsoid::DistanceToIn(), G4Hype::DistanceToIn(), DistanceToIn(), G4VCSGfaceted::DistanceToIn(), G4TessellatedSolid::DistanceToInCore(), G4Cons::DistanceToOut(), G4CutTubs::DistanceToOut(), G4Sphere::DistanceToOut(), G4Torus::DistanceToOut(), G4Tubs::DistanceToOut(), G4GenericTrap::DistanceToOut(), G4Hype::DistanceToOut(), DistanceToOut(), G4VCSGfaceted::DistanceToOut(), G4TessellatedSolid::DistanceToOutCandidates(), G4TessellatedSolid::DistanceToOutCore(), G4TessellatedSolid::DistanceToOutNoVoxels(), G4GenericTrap::DistToPlane(), G4GenericTrap::DistToTriangle(), G4Box::G4Box(), G4Cons::G4Cons(), G4CutTubs::G4CutTubs(), G4EllipticalCone::G4EllipticalCone(), G4ExtrudedSolid::G4ExtrudedSolid(), G4GenericTrap::G4GenericTrap(), G4Hype::G4Hype(), G4Para::G4Para(), G4Sphere::G4Sphere(), G4Tet::G4Tet(), G4Trap::G4Trap(), G4Tubs::G4Tubs(), G4UnionSolid::G4UnionSolid(), G4VSolid::G4VSolid(), G4VTwistedFaceted::G4VTwistedFaceted(), G4GenericPolycone::GetPointOnSurface(), G4Polycone::GetPointOnSurface(), G4UnionSolid::Init(), G4Orb::Initialize(), G4TessellatedSolid::Initialize(), G4SubtractionSolid::Inside(), G4Hype::Inside(), Inside(), G4VCSGfaceted::Inside(), G4VTwistedFaceted::Inside(), G4TessellatedSolid::InsideNoVoxels(), G4GenericTrap::InsidePolygone(), G4TessellatedSolid::InsideVoxels(), G4CutTubs::IsCrossingCutPlanes(), G4GenericTrap::IsSegCrossingZ(), G4Trap::MakePlane(), G4GenericTrap::NormalToPlane(), G4VSolid::operator=(), G4TessellatedSolid::SafetyFromInside(), G4TessellatedSolid::SafetyFromOutside(), G4Torus::SetAllParameters(), G4Polycone::SetOriginalParameters(), G4Polyhedra::SetOriginalParameters(), G4Box::SetXHalfLength(), G4Box::SetYHalfLength(), G4Box::SetZHalfLength(), G4Torus::SurfaceNormal(), G4GenericTrap::SurfaceNormal(), and SurfaceNormal().

◆ r1

G4double G4Paraboloid::r1
private

◆ r2

G4double G4Paraboloid::r2
private

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