Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4Orb Class Reference

#include <G4Orb.hh>

Inheritance diagram for G4Orb:
Collaboration diagram for G4Orb:

Public Member Functions

 G4Orb (const G4String &pName, G4double pRmax)
 
virtual ~G4Orb ()
 
G4double GetRadius () const
 
void SetRadius (G4double newRmax)
 
G4double GetCubicVolume ()
 
G4double GetSurfaceArea ()
 
void ComputeDimensions (G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
 
void Extent (G4ThreeVector &pMin, G4ThreeVector &pMax) const
 
G4bool CalculateExtent (const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pmin, G4double &pmax) const
 
EInside Inside (const G4ThreeVector &p) const
 
G4ThreeVector SurfaceNormal (const G4ThreeVector &p) const
 
G4double DistanceToIn (const G4ThreeVector &p, const G4ThreeVector &v) const
 
G4double DistanceToIn (const G4ThreeVector &p) const
 
G4double DistanceToOut (const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=G4bool(false), G4bool *validNorm=0, G4ThreeVector *n=0) const
 
G4double DistanceToOut (const G4ThreeVector &p) const
 
G4GeometryType GetEntityType () const
 
G4ThreeVector GetPointOnSurface () const
 
G4VSolidClone () const
 
std::ostream & StreamInfo (std::ostream &os) const
 
void DescribeYourselfTo (G4VGraphicsScene &scene) const
 
G4PolyhedronCreatePolyhedron () const
 
 G4Orb (__void__ &)
 
 G4Orb (const G4Orb &rhs)
 
G4Orboperator= (const G4Orb &rhs)
 
- Public Member Functions inherited from G4CSGSolid
 G4CSGSolid (const G4String &pName)
 
virtual ~G4CSGSolid ()
 
virtual G4PolyhedronGetPolyhedron () const
 
 G4CSGSolid (__void__ &)
 
 G4CSGSolid (const G4CSGSolid &rhs)
 
G4CSGSolidoperator= (const G4CSGSolid &rhs)
 
- Public Member Functions inherited from G4VSolid
 G4VSolid (const G4String &name)
 
virtual ~G4VSolid ()
 
G4bool operator== (const G4VSolid &s) const
 
G4String GetName () const
 
void SetName (const G4String &name)
 
G4double GetTolerance () const
 
void DumpInfo () const
 
virtual G4VisExtent GetExtent () const
 
virtual const G4VSolidGetConstituentSolid (G4int no) const
 
virtual G4VSolidGetConstituentSolid (G4int no)
 
virtual const G4DisplacedSolidGetDisplacedSolidPtr () const
 
virtual G4DisplacedSolidGetDisplacedSolidPtr ()
 
 G4VSolid (__void__ &)
 
 G4VSolid (const G4VSolid &rhs)
 
G4VSolidoperator= (const G4VSolid &rhs)
 
G4double EstimateCubicVolume (G4int nStat, G4double epsilon) const
 
G4double EstimateSurfaceArea (G4int nStat, G4double ell) const
 

Protected Types

enum  ESide { kNull, kRMax }
 
enum  ENorm { kNRMax }
 

Additional Inherited Members

- Protected Member Functions inherited from G4CSGSolid
G4double GetRadiusInRing (G4double rmin, G4double rmax) const
 
- Protected Member Functions inherited from G4VSolid
void CalculateClippedPolygonExtent (G4ThreeVectorList &pPolygon, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis, G4double &pMin, G4double &pMax) const
 
void ClipCrossSection (G4ThreeVectorList *pVertices, const G4int pSectionIndex, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis, G4double &pMin, G4double &pMax) const
 
void ClipBetweenSections (G4ThreeVectorList *pVertices, const G4int pSectionIndex, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis, G4double &pMin, G4double &pMax) const
 
void ClipPolygon (G4ThreeVectorList &pPolygon, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis) const
 
- Protected Attributes inherited from G4CSGSolid
G4double fCubicVolume
 
G4double fSurfaceArea
 
G4bool fRebuildPolyhedron
 
G4PolyhedronfpPolyhedron
 
- Protected Attributes inherited from G4VSolid
G4double kCarTolerance
 

Detailed Description

Definition at line 61 of file G4Orb.hh.

Member Enumeration Documentation

enum G4Orb::ENorm
protected
Enumerator
kNRMax 

Definition at line 142 of file G4Orb.hh.

142 {kNRMax};
enum G4Orb::ESide
protected
Enumerator
kNull 
kRMax 

Definition at line 138 of file G4Orb.hh.

Constructor & Destructor Documentation

G4Orb::G4Orb ( const G4String pName,
G4double  pRmax 
)

Definition at line 75 of file G4Orb.cc.

76 : G4CSGSolid(pName), fRmax(pRmax)
77 {
78 
79  const G4double fEpsilon = 2.e-11; // relative tolerance of fRmax
80 
81  G4double kRadTolerance
83 
84  // Check radius
85  //
86  if ( pRmax < 10*kCarTolerance )
87  {
88  G4Exception("G4Orb::G4Orb()", "GeomSolids0002", FatalException,
89  "Invalid radius < 10*kCarTolerance.");
90  }
91  fRmaxTolerance = std::max( kRadTolerance, fEpsilon*fRmax);
92 
93 }
G4double GetRadialTolerance() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4CSGSolid(const G4String &pName)
Definition: G4CSGSolid.cc:49
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4double kCarTolerance
Definition: G4VSolid.hh:307
double G4double
Definition: G4Types.hh:76
static G4GeometryTolerance * GetInstance()

Here is the call graph for this function:

Here is the caller graph for this function:

G4Orb::~G4Orb ( )
virtual

Definition at line 109 of file G4Orb.cc.

110 {
111 }
G4Orb::G4Orb ( __void__ &  a)

Definition at line 100 of file G4Orb.cc.

101  : G4CSGSolid(a), fRmax(0.), fRmaxTolerance(0.)
102 {
103 }
G4CSGSolid(const G4String &pName)
Definition: G4CSGSolid.cc:49
G4Orb::G4Orb ( const G4Orb rhs)

Definition at line 117 of file G4Orb.cc.

118  : G4CSGSolid(rhs), fRmax(rhs.fRmax), fRmaxTolerance(rhs.fRmaxTolerance)
119 {
120 }
G4CSGSolid(const G4String &pName)
Definition: G4CSGSolid.cc:49

Member Function Documentation

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

Implements G4VSolid.

Definition at line 184 of file G4Orb.cc.

188 {
189  G4ThreeVector bmin, bmax;
190  G4bool exist;
191 
192  // Get bounding box
193  Extent(bmin,bmax);
194 
195  // Check bounding box
196  G4BoundingEnvelope bbox(bmin,bmax);
197 #ifdef G4BBOX_EXTENT
198  if (true) return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
199 #endif
200  if (bbox.BoundingBoxVsVoxelLimits(pAxis,pVoxelLimit,pTransform,pMin,pMax))
201  {
202  return exist = (pMin < pMax) ? true : false;
203  }
204 
205  // Find bounding envelope and calculate extent
206  //
207  static const G4int NTHETA = 8; // number of steps along Theta
208  static const G4int NPHI = 16; // number of steps along Phi
209  static const G4double sinHalfTheta = std::sin(halfpi/NTHETA);
210  static const G4double cosHalfTheta = std::cos(halfpi/NTHETA);
211  static const G4double sinHalfPhi = std::sin(pi/NPHI);
212  static const G4double cosHalfPhi = std::cos(pi/NPHI);
213  static const G4double sinStepTheta = 2.*sinHalfTheta*cosHalfTheta;
214  static const G4double cosStepTheta = 1. - 2.*sinHalfTheta*sinHalfTheta;
215  static const G4double sinStepPhi = 2.*sinHalfPhi*cosHalfPhi;
216  static const G4double cosStepPhi = 1. - 2.*sinHalfPhi*sinHalfPhi;
217 
218  G4double radius = GetRadius();
219  G4double rtheta = radius/cosHalfTheta;
220  G4double rphi = rtheta/cosHalfPhi;
221 
222  // set reference circle
223  G4TwoVector xy[NPHI];
224  G4double sinCurPhi = sinHalfPhi;
225  G4double cosCurPhi = cosHalfPhi;
226  for (G4int k=0; k<NPHI; ++k)
227  {
228  xy[k].set(cosCurPhi,sinCurPhi);
229  G4double sinTmpPhi = sinCurPhi;
230  sinCurPhi = sinCurPhi*cosStepPhi + cosCurPhi*sinStepPhi;
231  cosCurPhi = cosCurPhi*cosStepPhi - sinTmpPhi*sinStepPhi;
232  }
233 
234  // set bounding circles
235  G4ThreeVectorList circles[NTHETA];
236  for (G4int i=0; i<NTHETA; ++i) circles[i].resize(NPHI);
237 
238  G4double sinCurTheta = sinHalfTheta;
239  G4double cosCurTheta = cosHalfTheta;
240  for (G4int i=0; i<NTHETA; ++i)
241  {
242  G4double z = rtheta*cosCurTheta;
243  G4double rho = rphi*sinCurTheta;
244  for (G4int k=0; k<NPHI; ++k)
245  {
246  circles[i][k].set(rho*xy[k].x(),rho*xy[k].y(),z);
247  }
248  G4double sinTmpTheta = sinCurTheta;
249  sinCurTheta = sinCurTheta*cosStepTheta + cosCurTheta*sinStepTheta;
250  cosCurTheta = cosCurTheta*cosStepTheta - sinTmpTheta*sinStepTheta;
251  }
252 
253  // set envelope and calculate extent
254  std::vector<const G4ThreeVectorList *> polygons;
255  polygons.resize(NTHETA);
256  for (G4int i=0; i<NTHETA; ++i) polygons[i] = &circles[i];
257 
258  G4BoundingEnvelope benv(bmin,bmax,polygons);
259  exist = benv.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
260  return exist;
261 }
void Extent(G4ThreeVector &pMin, G4ThreeVector &pMax) const
Definition: G4Orb.cc:160
int G4int
Definition: G4Types.hh:78
G4double GetRadius() const
void set(double x, double y)
bool G4bool
Definition: G4Types.hh:79
std::vector< G4ThreeVector > G4ThreeVectorList
static constexpr double pi
Definition: G4SIunits.hh:75
static constexpr double halfpi
Definition: G4SIunits.hh:77
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

G4VSolid * G4Orb::Clone ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 596 of file G4Orb.cc.

597 {
598  return new G4Orb(*this);
599 }
G4Orb(const G4String &pName, G4double pRmax)
Definition: G4Orb.cc:75

Here is the call graph for this function:

void G4Orb::ComputeDimensions ( G4VPVParameterisation p,
const G4int  n,
const G4VPhysicalVolume pRep 
)
virtual

Reimplemented from G4VSolid.

Definition at line 149 of file G4Orb.cc.

152 {
153  p->ComputeDimensions(*this,n,pRep);
154 }
virtual void ComputeDimensions(G4Box &, const G4int, const G4VPhysicalVolume *) const

Here is the call graph for this function:

G4Polyhedron * G4Orb::CreatePolyhedron ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 650 of file G4Orb.cc.

651 {
652  return new G4PolyhedronSphere (0., fRmax, 0., 2*pi, 0., pi);
653 }
static constexpr double pi
Definition: G4SIunits.hh:75
void G4Orb::DescribeYourselfTo ( G4VGraphicsScene scene) const
virtual

Implements G4VSolid.

Definition at line 645 of file G4Orb.cc.

646 {
647  scene.AddSolid (*this);
648 }
virtual void AddSolid(const G4Box &)=0

Here is the call graph for this function:

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

Implements G4VSolid.

Definition at line 314 of file G4Orb.cc.

316 {
317  G4double snxt = kInfinity; // snxt = default return value
318 
319  G4double radius, pDotV3d; // , tolORMax2, tolIRMax2;
320  G4double c, d2, sd = kInfinity;
321 
322  const G4double dRmax = 100.*fRmax;
323 
324  // General Precalcs
325 
326  radius = std::sqrt(p.x()*p.x() + p.y()*p.y() + p.z()*p.z());
327  pDotV3d = p.x()*v.x() + p.y()*v.y() + p.z()*v.z();
328 
329  // Radial Precalcs
330 
331  // tolORMax2 = (fRmax+fRmaxTolerance*0.5)*(fRmax+fRmaxTolerance*0.5);
332  // tolIRMax2 = (fRmax-fRmaxTolerance*0.5)*(fRmax-fRmaxTolerance*0.5);
333 
334  // Outer spherical shell intersection
335  // - Only if outside tolerant fRmax
336  // - Check for if inside and outer G4Orb heading through solid (-> 0)
337  // - No intersect -> no intersection with G4Orb
338  //
339  // Shell eqn: x^2+y^2+z^2 = RSPH^2
340  //
341  // => (px+svx)^2+(py+svy)^2+(pz+svz)^2=R^2
342  //
343  // => (px^2+py^2+pz^2) +2sd(pxvx+pyvy+pzvz)+sd^2(vx^2+vy^2+vz^2)=R^2
344  // => rad2 +2sd(pDotV3d) +sd^2 =R^2
345  //
346  // => sd=-pDotV3d+-std::sqrt(pDotV3d^2-(rad2-R^2))
347 
348  c = (radius - fRmax)*(radius + fRmax);
349 
350  if( radius > fRmax-fRmaxTolerance*0.5 ) // not inside in terms of Inside(p)
351  {
352  if ( c > fRmaxTolerance*fRmax )
353  {
354  // If outside tolerant boundary of outer G4Orb in terms of c
355  // [ should be std::sqrt(rad2) - fRmax > fRmaxTolerance*0.5 ]
356 
357  d2 = pDotV3d*pDotV3d - c;
358 
359  if ( d2 >= 0 )
360  {
361  sd = -pDotV3d - std::sqrt(d2);
362  if ( sd >= 0 )
363  {
364  if ( sd > dRmax ) // Avoid rounding errors due to precision issues seen on
365  { // 64 bits systems. Split long distances and recompute
366  G4double fTerm = sd - std::fmod(sd,dRmax);
367  sd = fTerm + DistanceToIn(p+fTerm*v,v);
368  }
369  return snxt = sd;
370  }
371  }
372  else // No intersection with G4Orb
373  {
374  return snxt = kInfinity;
375  }
376  }
377  else // not outside in terms of c
378  {
379  if ( c > -fRmaxTolerance*fRmax ) // on surface
380  {
381  d2 = pDotV3d*pDotV3d - c;
382  if ( (d2 < fRmaxTolerance*fRmax) || (pDotV3d >= 0) )
383  {
384  return snxt = kInfinity;
385  }
386  else
387  {
388  return snxt = 0.;
389  }
390  }
391  }
392  }
393 #ifdef G4CSGDEBUG
394  else // inside ???
395  {
396  G4Exception("G4Orb::DistanceToIn(p,v)", "GeomSolids1002",
397  JustWarning, "Point p is inside !?");
398  }
399 #endif
400 
401  return snxt;
402 }
static const G4double kInfinity
Definition: geomdefs.hh:42
double x() const
static const G4double d2
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const
Definition: G4Orb.cc:314
double z() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
double y() const
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

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

Implements G4VSolid.

Definition at line 410 of file G4Orb.cc.

411 {
412  G4double safe = 0.0,
413  radius = std::sqrt(p.x()*p.x()+p.y()*p.y()+p.z()*p.z());
414  safe = radius - fRmax;
415  if( safe < 0 ) { safe = 0.; }
416  return safe;
417 }
double x() const
double z() const
double y() const
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

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

Implements G4VSolid.

Definition at line 424 of file G4Orb.cc.

429 {
430  G4double snxt = kInfinity; // ??? snxt is default return value
431  ESide side = kNull;
432 
433  G4double rad2,pDotV3d;
434  G4double xi,yi,zi; // Intersection point
435  G4double c,d2;
436 
437  rad2 = p.x()*p.x() + p.y()*p.y() + p.z()*p.z();
438  pDotV3d = p.x()*v.x() + p.y()*v.y() + p.z()*v.z();
439 
440  // Radial Intersection from G4Orb::DistanceToIn
441  //
442  // Outer spherical shell intersection
443  // - Only if outside tolerant fRmax
444  // - Check for if inside and outer G4Orb heading through solid (-> 0)
445  // - No intersect -> no intersection with G4Orb
446  //
447  // Shell eqn: x^2+y^2+z^2=RSPH^2
448  //
449  // => (px+svx)^2+(py+svy)^2+(pz+svz)^2=R^2
450  //
451  // => (px^2+py^2+pz^2) +2s(pxvx+pyvy+pzvz)+s^2(vx^2+vy^2+vz^2)=R^2
452  // => rad2 +2s(pDotV3d) +s^2 =R^2
453  //
454  // => s=-pDotV3d+-std::sqrt(pDotV3d^2-(rad2-R^2))
455 
456  const G4double Rmax_plus = fRmax + fRmaxTolerance*0.5;
457  G4double radius = std::sqrt(rad2);
458 
459  if ( radius <= Rmax_plus )
460  {
461  c = (radius - fRmax)*(radius + fRmax);
462 
463  if ( c < fRmaxTolerance*fRmax )
464  {
465  // Within tolerant Outer radius
466  //
467  // The test is
468  // radius - fRmax < 0.5*fRmaxTolerance
469  // => radius < fRmax + 0.5*kRadTol
470  // => rad2 < (fRmax + 0.5*kRadTol)^2
471  // => rad2 < fRmax^2 + 2.*0.5*fRmax*kRadTol + 0.25*kRadTol*kRadTol
472  // => rad2 - fRmax^2 <~ fRmax*kRadTol
473 
474  d2 = pDotV3d*pDotV3d - c;
475 
476  if( ( c > -fRmaxTolerance*fRmax) && // on tolerant surface
477  ( ( pDotV3d >= 0 ) || ( d2 < 0 )) ) // leaving outside from Rmax
478  // not re-entering
479  {
480  if(calcNorm)
481  {
482  *validNorm = true;
483  *n = G4ThreeVector(p.x()/fRmax,p.y()/fRmax,p.z()/fRmax);
484  }
485  return snxt = 0;
486  }
487  else
488  {
489  snxt = -pDotV3d + std::sqrt(d2); // second root since inside Rmax
490  side = kRMax;
491  }
492  }
493  }
494  else // p is outside ???
495  {
496  G4cout << G4endl;
497  DumpInfo();
498  std::ostringstream message;
499  G4int oldprc = message.precision(16);
500  message << "Logic error: snxt = kInfinity ???" << G4endl
501  << "Position:" << G4endl << G4endl
502  << "p.x() = " << p.x()/mm << " mm" << G4endl
503  << "p.y() = " << p.y()/mm << " mm" << G4endl
504  << "p.z() = " << p.z()/mm << " mm" << G4endl << G4endl
505  << "Rp = "<< std::sqrt( p.x()*p.x()+p.y()*p.y()+p.z()*p.z() )/mm
506  << " mm" << G4endl << G4endl
507  << "Direction:" << G4endl << G4endl
508  << "v.x() = " << v.x() << G4endl
509  << "v.y() = " << v.y() << G4endl
510  << "v.z() = " << v.z() << G4endl << G4endl
511  << "Proposed distance :" << G4endl << G4endl
512  << "snxt = " << snxt/mm << " mm" << G4endl;
513  message.precision(oldprc);
514  G4Exception("G4Orb::DistanceToOut(p,v,..)", "GeomSolids1002",
515  JustWarning, message);
516  }
517  if (calcNorm) // Output switch operator
518  {
519  switch( side )
520  {
521  case kRMax:
522  xi=p.x()+snxt*v.x();
523  yi=p.y()+snxt*v.y();
524  zi=p.z()+snxt*v.z();
525  *n=G4ThreeVector(xi/fRmax,yi/fRmax,zi/fRmax);
526  *validNorm=true;
527  break;
528  default:
529  G4cout << G4endl;
530  DumpInfo();
531  std::ostringstream message;
532  G4int oldprc = message.precision(16);
533  message << "Undefined side for valid surface normal to solid."
534  << G4endl
535  << "Position:" << G4endl << G4endl
536  << "p.x() = " << p.x()/mm << " mm" << G4endl
537  << "p.y() = " << p.y()/mm << " mm" << G4endl
538  << "p.z() = " << p.z()/mm << " mm" << G4endl << G4endl
539  << "Direction:" << G4endl << G4endl
540  << "v.x() = " << v.x() << G4endl
541  << "v.y() = " << v.y() << G4endl
542  << "v.z() = " << v.z() << G4endl << G4endl
543  << "Proposed distance :" << G4endl << G4endl
544  << "snxt = " << snxt/mm << " mm" << G4endl;
545  message.precision(oldprc);
546  G4Exception("G4Orb::DistanceToOut(p,v,..)","GeomSolids1002",
547  JustWarning, message);
548  break;
549  }
550  }
551  return snxt;
552 }
static constexpr double mm
Definition: G4SIunits.hh:115
static const G4double kInfinity
Definition: geomdefs.hh:42
CLHEP::Hep3Vector G4ThreeVector
double x() const
static const G4double d2
int G4int
Definition: G4Types.hh:78
double z() const
void DumpInfo() const
G4GLOB_DLL std::ostream G4cout
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
double y() const
#define G4endl
Definition: G4ios.hh:61
ESide
Definition: G4Cons.cc:76
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

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

Implements G4VSolid.

Definition at line 558 of file G4Orb.cc.

559 {
560  G4double safe=0.0,radius = std::sqrt(p.x()*p.x()+p.y()*p.y()+p.z()*p.z());
561 
562 #ifdef G4CSGDEBUG
563  if( Inside(p) == kOutside )
564  {
565  G4int oldprc = G4cout.precision(16);
566  G4cout << G4endl;
567  DumpInfo();
568  G4cout << "Position:" << G4endl << G4endl;
569  G4cout << "p.x() = " << p.x()/mm << " mm" << G4endl;
570  G4cout << "p.y() = " << p.y()/mm << " mm" << G4endl;
571  G4cout << "p.z() = " << p.z()/mm << " mm" << G4endl << G4endl;
572  G4cout.precision(oldprc);
573  G4Exception("G4Orb::DistanceToOut(p)", "GeomSolids1002",
574  JustWarning, "Point p is outside !?" );
575  }
576 #endif
577 
578  safe = fRmax - radius;
579  if ( safe < 0. ) safe = 0.;
580  return safe;
581 }
static constexpr double mm
Definition: G4SIunits.hh:115
double x() const
int G4int
Definition: G4Types.hh:78
EInside Inside(const G4ThreeVector &p) const
Definition: G4Orb.cc:269
double z() const
void DumpInfo() const
G4GLOB_DLL std::ostream G4cout
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
double y() const
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

void G4Orb::Extent ( G4ThreeVector pMin,
G4ThreeVector pMax 
) const
virtual

Reimplemented from G4VSolid.

Definition at line 160 of file G4Orb.cc.

161 {
162  G4double radius = GetRadius();
163  pMin.set(-radius,-radius,-radius);
164  pMax.set( radius, radius, radius);
165 
166  // Check correctness of the bounding box
167  //
168  if (pMin.x() >= pMax.x() || pMin.y() >= pMax.y() || pMin.z() >= pMax.z())
169  {
170  std::ostringstream message;
171  message << "Bad bounding box (min >= max) for solid: "
172  << GetName() << " !"
173  << "\npMin = " << pMin
174  << "\npMax = " << pMax;
175  G4Exception("G4Orb::Extent()", "GeomMgt0001", JustWarning, message);
176  DumpInfo();
177  }
178 }
void set(double x, double y, double z)
G4String GetName() const
double x() const
double z() const
void DumpInfo() const
G4double GetRadius() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
double y() const
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

Here is the caller graph for this function:

G4double G4Orb::GetCubicVolume ( )
inlinevirtual

Reimplemented from G4VSolid.

G4GeometryType G4Orb::GetEntityType ( ) const
virtual

Implements G4VSolid.

Definition at line 587 of file G4Orb.cc.

588 {
589  return G4String("G4Orb");
590 }
G4ThreeVector G4Orb::GetPointOnSurface ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 625 of file G4Orb.cc.

626 {
627  // generate a random number from zero to 2pi...
628  //
629  G4double phi = G4RandFlat::shoot(0.,2.*pi);
630  G4double cosphi = std::cos(phi);
631  G4double sinphi = std::sin(phi);
632 
633  // generate a random point uniform in area
634  G4double costheta = G4RandFlat::shoot(-1.,1.);
635  G4double sintheta = std::sqrt(1.-sqr(costheta));
636 
637  return G4ThreeVector (fRmax*sintheta*cosphi,
638  fRmax*sintheta*sinphi, fRmax*costheta);
639 }
ThreeVector shoot(const G4int Ap, const G4int Af)
CLHEP::Hep3Vector G4ThreeVector
static constexpr double pi
Definition: G4SIunits.hh:75
T sqr(const T &x)
Definition: templates.hh:145
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

G4double G4Orb::GetRadius ( ) const
inline

Here is the caller graph for this function:

G4double G4Orb::GetSurfaceArea ( )
inlinevirtual

Reimplemented from G4VSolid.

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

Implements G4VSolid.

Definition at line 269 of file G4Orb.cc.

270 {
271  G4double rad2,tolRMax;
272  EInside in;
273 
274 
275  rad2 = p.x()*p.x()+p.y()*p.y()+p.z()*p.z();
276 
277  G4double radius = std::sqrt(rad2);
278 
279  // G4double radius = std::sqrt(rad2);
280  // Check radial surface
281  // sets `in'
282 
283  tolRMax = fRmax - fRmaxTolerance*0.5;
284 
285  if ( radius <= tolRMax ) { in = kInside; }
286  else
287  {
288  tolRMax = fRmax + fRmaxTolerance*0.5;
289  if ( radius <= tolRMax ) { in = kSurface; }
290  else { in = kOutside; }
291  }
292  return in;
293 }
double x() const
double z() const
EInside
Definition: geomdefs.hh:58
double y() const
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 126 of file G4Orb.cc.

127 {
128  // Check assignment to self
129  //
130  if (this == &rhs) { return *this; }
131 
132  // Copy base class data
133  //
135 
136  // Copy data
137  //
138  fRmax = rhs.fRmax;
139  fRmaxTolerance = rhs.fRmaxTolerance;
140 
141  return *this;
142 }
G4CSGSolid & operator=(const G4CSGSolid &rhs)
Definition: G4CSGSolid.cc:91

Here is the call graph for this function:

void G4Orb::SetRadius ( G4double  newRmax)
inline
std::ostream & G4Orb::StreamInfo ( std::ostream &  os) const
virtual

Reimplemented from G4CSGSolid.

Definition at line 605 of file G4Orb.cc.

606 {
607  G4int oldprc = os.precision(16);
608  os << "-----------------------------------------------------------\n"
609  << " *** Dump for solid - " << GetName() << " ***\n"
610  << " ===================================================\n"
611  << " Solid type: G4Orb\n"
612  << " Parameters: \n"
613 
614  << " outer radius: " << fRmax/mm << " mm \n"
615  << "-----------------------------------------------------------\n";
616  os.precision(oldprc);
617 
618  return os;
619 }
G4String GetName() const
static constexpr double mm
Definition: G4SIunits.hh:115
int G4int
Definition: G4Types.hh:78

Here is the call graph for this function:

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

Implements G4VSolid.

Definition at line 299 of file G4Orb.cc.

300 {
301  G4double radius = std::sqrt(p.x()*p.x()+p.y()*p.y()+p.z()*p.z());
302  return G4ThreeVector(p.x()/radius,p.y()/radius,p.z()/radius);
303 }
CLHEP::Hep3Vector G4ThreeVector
double x() const
double z() const
double y() const
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:


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