Geant4  10.02.p03
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)
 
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
 
G4VSolid * Clone () const
 
std::ostream & StreamInfo (std::ostream &os) const
 
void DescribeYourselfTo (G4VGraphicsScene &scene) const
 
G4Polyhedron * CreatePolyhedron () const
 
 G4Orb (__void__ &)
 
 G4Orb (const G4Orb &rhs)
 
G4Orb & operator= (const G4Orb &rhs)
 
- Public Member Functions inherited from G4CSGSolid
 G4CSGSolid (const G4String &pName)
 
virtual ~G4CSGSolid ()
 
virtual G4Polyhedron * GetPolyhedron () const
 
 G4CSGSolid (__void__ &)
 
 G4CSGSolid (const G4CSGSolid &rhs)
 
G4CSGSolid & operator= (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 G4VSolid * GetConstituentSolid (G4int no) const
 
virtual G4VSolid * GetConstituentSolid (G4int no)
 
virtual const G4DisplacedSolid * GetDisplacedSolidPtr () const
 
virtual G4DisplacedSolid * GetDisplacedSolidPtr ()
 
 G4VSolid (__void__ &)
 
 G4VSolid (const G4VSolid &rhs)
 
G4VSolid & operator= (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 }
 

Private Attributes

G4double fRmax
 
G4double fRmaxTolerance
 

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
 
G4Polyhedron * fpPolyhedron
 
- Protected Attributes inherited from G4VSolid
G4double kCarTolerance
 

Detailed Description

Definition at line 61 of file G4Orb.hh.

Member Enumeration Documentation

◆ ENorm

enum G4Orb::ENorm
protected
Enumerator
kNRMax 

Definition at line 140 of file G4Orb.hh.

140 {kNRMax};

◆ ESide

enum G4Orb::ESide
protected
Enumerator
kNull 
kRMax 

Definition at line 136 of file G4Orb.hh.

Constructor & Destructor Documentation

◆ G4Orb() [1/3]

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

Definition at line 72 of file G4Orb.cc.

73 : G4CSGSolid(pName), fRmax(pRmax)
74 {
75 
76  const G4double fEpsilon = 2.e-11; // relative tolerance of fRmax
77 
78  G4double kRadTolerance
80 
81  // Check radius
82  //
83  if ( pRmax < 10*kCarTolerance )
84  {
85  G4Exception("G4Orb::G4Orb()", "GeomSolids0002", FatalException,
86  "Invalid radius < 10*kCarTolerance.");
87  }
88  fRmaxTolerance = std::max( kRadTolerance, fEpsilon*fRmax);
89 
90 }
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
G4double fRmax
Definition: G4Orb.hh:144
G4double fRmaxTolerance
Definition: G4Orb.hh:145
G4double kCarTolerance
Definition: G4VSolid.hh:304
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::~G4Orb ( )
virtual

Definition at line 106 of file G4Orb.cc.

107 {
108 }

◆ G4Orb() [2/3]

G4Orb::G4Orb ( __void__ &  a)

Definition at line 97 of file G4Orb.cc.

98  : G4CSGSolid(a), fRmax(0.), fRmaxTolerance(0.)
99 {
100 }
G4CSGSolid(const G4String &pName)
Definition: G4CSGSolid.cc:49
G4double fRmax
Definition: G4Orb.hh:144
G4double fRmaxTolerance
Definition: G4Orb.hh:145

◆ G4Orb() [3/3]

G4Orb::G4Orb ( const G4Orb &  rhs)

Definition at line 114 of file G4Orb.cc.

116 {
117 }
G4CSGSolid(const G4String &pName)
Definition: G4CSGSolid.cc:49
G4double fRmax
Definition: G4Orb.hh:144
G4double fRmaxTolerance
Definition: G4Orb.hh:145

Member Function Documentation

◆ CalculateExtent()

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

Implements G4VSolid.

Definition at line 157 of file G4Orb.cc.

161 {
162  // Compute x/y/z mins and maxs for bounding box respecting limits,
163  // with early returns if outside limits. Then switch() on pAxis,
164  // and compute exact x and y limit for x/y case
165 
166  G4double xoffset,xMin,xMax;
167  G4double yoffset,yMin,yMax;
168  G4double zoffset,zMin,zMax;
169 
170  G4double diff1,diff2,delta,maxDiff,newMin,newMax;
171  G4double xoff1,xoff2,yoff1,yoff2;
172 
173  xoffset=pTransform.NetTranslation().x();
174  xMin=xoffset-fRmax;
175  xMax=xoffset+fRmax;
176 
177  if (pVoxelLimit.IsXLimited())
178  {
179  if ( (xMin>pVoxelLimit.GetMaxXExtent()+kCarTolerance)
180  || (xMax<pVoxelLimit.GetMinXExtent()-kCarTolerance) )
181  {
182  return false;
183  }
184  else
185  {
186  if (xMin<pVoxelLimit.GetMinXExtent())
187  {
188  xMin=pVoxelLimit.GetMinXExtent();
189  }
190  if (xMax>pVoxelLimit.GetMaxXExtent())
191  {
192  xMax=pVoxelLimit.GetMaxXExtent();
193  }
194  }
195  }
196  yoffset=pTransform.NetTranslation().y();
197  yMin=yoffset-fRmax;
198  yMax=yoffset+fRmax;
199 
200  if (pVoxelLimit.IsYLimited())
201  {
202  if ( (yMin>pVoxelLimit.GetMaxYExtent()+kCarTolerance)
203  || (yMax<pVoxelLimit.GetMinYExtent()-kCarTolerance) )
204  {
205  return false;
206  }
207  else
208  {
209  if (yMin<pVoxelLimit.GetMinYExtent())
210  {
211  yMin=pVoxelLimit.GetMinYExtent();
212  }
213  if (yMax>pVoxelLimit.GetMaxYExtent())
214  {
215  yMax=pVoxelLimit.GetMaxYExtent();
216  }
217  }
218  }
219  zoffset=pTransform.NetTranslation().z();
220  zMin=zoffset-fRmax;
221  zMax=zoffset+fRmax;
222 
223  if (pVoxelLimit.IsZLimited())
224  {
225  if ( (zMin>pVoxelLimit.GetMaxZExtent()+kCarTolerance)
226  || (zMax<pVoxelLimit.GetMinZExtent()-kCarTolerance) )
227  {
228  return false;
229  }
230  else
231  {
232  if (zMin<pVoxelLimit.GetMinZExtent())
233  {
234  zMin=pVoxelLimit.GetMinZExtent();
235  }
236  if (zMax>pVoxelLimit.GetMaxZExtent())
237  {
238  zMax=pVoxelLimit.GetMaxZExtent();
239  }
240  }
241  }
242 
243  // Known to cut sphere
244 
245  switch (pAxis)
246  {
247  case kXAxis:
248  yoff1=yoffset-yMin;
249  yoff2=yMax-yoffset;
250 
251  if ( yoff1 >= 0 && yoff2 >= 0 )
252  {
253  // Y limits cross max/min x => no change
254  //
255  pMin=xMin;
256  pMax=xMax;
257  }
258  else
259  {
260  // Y limits don't cross max/min x => compute max delta x,
261  // hence new mins/maxs
262  //
263  delta=fRmax*fRmax-yoff1*yoff1;
264  diff1=(delta>0.) ? std::sqrt(delta) : 0.;
265  delta=fRmax*fRmax-yoff2*yoff2;
266  diff2=(delta>0.) ? std::sqrt(delta) : 0.;
267  maxDiff=(diff1>diff2) ? diff1:diff2;
268  newMin=xoffset-maxDiff;
269  newMax=xoffset+maxDiff;
270  pMin=(newMin<xMin) ? xMin : newMin;
271  pMax=(newMax>xMax) ? xMax : newMax;
272  }
273  break;
274  case kYAxis:
275  xoff1=xoffset-xMin;
276  xoff2=xMax-xoffset;
277  if (xoff1>=0&&xoff2>=0)
278  {
279  // X limits cross max/min y => no change
280  //
281  pMin=yMin;
282  pMax=yMax;
283  }
284  else
285  {
286  // X limits don't cross max/min y => compute max delta y,
287  // hence new mins/maxs
288  //
289  delta=fRmax*fRmax-xoff1*xoff1;
290  diff1=(delta>0.) ? std::sqrt(delta) : 0.;
291  delta=fRmax*fRmax-xoff2*xoff2;
292  diff2=(delta>0.) ? std::sqrt(delta) : 0.;
293  maxDiff=(diff1>diff2) ? diff1:diff2;
294  newMin=yoffset-maxDiff;
295  newMax=yoffset+maxDiff;
296  pMin=(newMin<yMin) ? yMin : newMin;
297  pMax=(newMax>yMax) ? yMax : newMax;
298  }
299  break;
300  case kZAxis:
301  pMin=zMin;
302  pMax=zMax;
303  break;
304  default:
305  break;
306  }
307  pMin -= fRmaxTolerance;
308  pMax += fRmaxTolerance;
309 
310  return true;
311 
312 }
G4double GetMinXExtent() const
G4double GetMinYExtent() const
G4double GetMinZExtent() const
G4bool IsYLimited() const
G4bool IsXLimited() const
G4double GetMaxZExtent() const
G4double GetMaxXExtent() const
G4ThreeVector NetTranslation() const
double x() const
G4double fRmax
Definition: G4Orb.hh:144
G4bool IsZLimited() const
double y() const
double z() const
G4double fRmaxTolerance
Definition: G4Orb.hh:145
G4double kCarTolerance
Definition: G4VSolid.hh:304
double G4double
Definition: G4Types.hh:76
G4double GetMaxYExtent() const
Here is the call graph for this function:

◆ Clone()

G4VSolid * G4Orb::Clone ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 664 of file G4Orb.cc.

665 {
666  return new G4Orb(*this);
667 }
G4Orb(const G4String &pName, G4double pRmax)
Definition: G4Orb.cc:72
Here is the call graph for this function:

◆ ComputeDimensions()

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

Reimplemented from G4VSolid.

Definition at line 146 of file G4Orb.cc.

149 {
150  p->ComputeDimensions(*this,n,pRep);
151 }
Char_t n[5]
virtual void ComputeDimensions(G4Box &, const G4int, const G4VPhysicalVolume *) const
Here is the call graph for this function:

◆ CreatePolyhedron()

G4Polyhedron * G4Orb::CreatePolyhedron ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 718 of file G4Orb.cc.

719 {
720  return new G4PolyhedronSphere (0., fRmax, 0., 2*pi, 0., pi);
721 }
G4double fRmax
Definition: G4Orb.hh:144
static const double pi
Definition: G4SIunits.hh:74

◆ DescribeYourselfTo()

void G4Orb::DescribeYourselfTo ( G4VGraphicsScene &  scene) const
virtual

Implements G4VSolid.

Definition at line 713 of file G4Orb.cc.

714 {
715  scene.AddSolid (*this);
716 }
virtual void AddSolid(const G4Box &)=0
Here is the call graph for this function:

◆ DistanceToIn() [1/2]

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

Implements G4VSolid.

Definition at line 382 of file G4Orb.cc.

384 {
385  G4double snxt = kInfinity; // snxt = default return value
386 
387  G4double radius, pDotV3d; // , tolORMax2, tolIRMax2;
388  G4double c, d2, sd = kInfinity;
389 
390  const G4double dRmax = 100.*fRmax;
391 
392  // General Precalcs
393 
394  radius = std::sqrt(p.x()*p.x() + p.y()*p.y() + p.z()*p.z());
395  pDotV3d = p.x()*v.x() + p.y()*v.y() + p.z()*v.z();
396 
397  // Radial Precalcs
398 
399  // tolORMax2 = (fRmax+fRmaxTolerance*0.5)*(fRmax+fRmaxTolerance*0.5);
400  // tolIRMax2 = (fRmax-fRmaxTolerance*0.5)*(fRmax-fRmaxTolerance*0.5);
401 
402  // Outer spherical shell intersection
403  // - Only if outside tolerant fRmax
404  // - Check for if inside and outer G4Orb heading through solid (-> 0)
405  // - No intersect -> no intersection with G4Orb
406  //
407  // Shell eqn: x^2+y^2+z^2 = RSPH^2
408  //
409  // => (px+svx)^2+(py+svy)^2+(pz+svz)^2=R^2
410  //
411  // => (px^2+py^2+pz^2) +2sd(pxvx+pyvy+pzvz)+sd^2(vx^2+vy^2+vz^2)=R^2
412  // => rad2 +2sd(pDotV3d) +sd^2 =R^2
413  //
414  // => sd=-pDotV3d+-std::sqrt(pDotV3d^2-(rad2-R^2))
415 
416  c = (radius - fRmax)*(radius + fRmax);
417 
418  if( radius > fRmax-fRmaxTolerance*0.5 ) // not inside in terms of Inside(p)
419  {
420  if ( c > fRmaxTolerance*fRmax )
421  {
422  // If outside tolerant boundary of outer G4Orb in terms of c
423  // [ should be std::sqrt(rad2) - fRmax > fRmaxTolerance*0.5 ]
424 
425  d2 = pDotV3d*pDotV3d - c;
426 
427  if ( d2 >= 0 )
428  {
429  sd = -pDotV3d - std::sqrt(d2);
430  if ( sd >= 0 )
431  {
432  if ( sd > dRmax ) // Avoid rounding errors due to precision issues seen on
433  { // 64 bits systems. Split long distances and recompute
434  G4double fTerm = sd - std::fmod(sd,dRmax);
435  sd = fTerm + DistanceToIn(p+fTerm*v,v);
436  }
437  return snxt = sd;
438  }
439  }
440  else // No intersection with G4Orb
441  {
442  return snxt = kInfinity;
443  }
444  }
445  else // not outside in terms of c
446  {
447  if ( c > -fRmaxTolerance*fRmax ) // on surface
448  {
449  d2 = pDotV3d*pDotV3d - c;
450  if ( (d2 < fRmaxTolerance*fRmax) || (pDotV3d >= 0) )
451  {
452  return snxt = kInfinity;
453  }
454  else
455  {
456  return snxt = 0.;
457  }
458  }
459  }
460  }
461 #ifdef G4CSGDEBUG
462  else // inside ???
463  {
464  G4Exception("G4Orb::DistanceToIn(p,v)", "GeomSolids1002",
465  JustWarning, "Point p is inside !?");
466  }
467 #endif
468 
469  return snxt;
470 }
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const
Definition: G4Orb.cc:382
static const G4double kInfinity
Definition: geomdefs.hh:42
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
double x() const
G4double fRmax
Definition: G4Orb.hh:144
double y() const
double z() const
G4double fRmaxTolerance
Definition: G4Orb.hh:145
double G4double
Definition: G4Types.hh:76
static const G4double d2
Here is the call graph for this function:

◆ DistanceToIn() [2/2]

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

Implements G4VSolid.

Definition at line 478 of file G4Orb.cc.

479 {
480  G4double safe = 0.0,
481  radius = std::sqrt(p.x()*p.x()+p.y()*p.y()+p.z()*p.z());
482  safe = radius - fRmax;
483  if( safe < 0 ) { safe = 0.; }
484  return safe;
485 }
double x() const
G4double fRmax
Definition: G4Orb.hh:144
double y() const
double z() const
double G4double
Definition: G4Types.hh:76
Here is the call graph for this function:

◆ DistanceToOut() [1/2]

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 492 of file G4Orb.cc.

497 {
498  G4double snxt = kInfinity; // ??? snxt is default return value
499  ESide side = kNull;
500 
501  G4double rad2,pDotV3d;
502  G4double xi,yi,zi; // Intersection point
503  G4double c,d2;
504 
505  rad2 = p.x()*p.x() + p.y()*p.y() + p.z()*p.z();
506  pDotV3d = p.x()*v.x() + p.y()*v.y() + p.z()*v.z();
507 
508  // Radial Intersection from G4Orb::DistanceToIn
509  //
510  // Outer spherical shell intersection
511  // - Only if outside tolerant fRmax
512  // - Check for if inside and outer G4Orb heading through solid (-> 0)
513  // - No intersect -> no intersection with G4Orb
514  //
515  // Shell eqn: x^2+y^2+z^2=RSPH^2
516  //
517  // => (px+svx)^2+(py+svy)^2+(pz+svz)^2=R^2
518  //
519  // => (px^2+py^2+pz^2) +2s(pxvx+pyvy+pzvz)+s^2(vx^2+vy^2+vz^2)=R^2
520  // => rad2 +2s(pDotV3d) +s^2 =R^2
521  //
522  // => s=-pDotV3d+-std::sqrt(pDotV3d^2-(rad2-R^2))
523 
524  const G4double Rmax_plus = fRmax + fRmaxTolerance*0.5;
525  G4double radius = std::sqrt(rad2);
526 
527  if ( radius <= Rmax_plus )
528  {
529  c = (radius - fRmax)*(radius + fRmax);
530 
531  if ( c < fRmaxTolerance*fRmax )
532  {
533  // Within tolerant Outer radius
534  //
535  // The test is
536  // radius - fRmax < 0.5*fRmaxTolerance
537  // => radius < fRmax + 0.5*kRadTol
538  // => rad2 < (fRmax + 0.5*kRadTol)^2
539  // => rad2 < fRmax^2 + 2.*0.5*fRmax*kRadTol + 0.25*kRadTol*kRadTol
540  // => rad2 - fRmax^2 <~ fRmax*kRadTol
541 
542  d2 = pDotV3d*pDotV3d - c;
543 
544  if( ( c > -fRmaxTolerance*fRmax) && // on tolerant surface
545  ( ( pDotV3d >= 0 ) || ( d2 < 0 )) ) // leaving outside from Rmax
546  // not re-entering
547  {
548  if(calcNorm)
549  {
550  *validNorm = true;
551  *n = G4ThreeVector(p.x()/fRmax,p.y()/fRmax,p.z()/fRmax);
552  }
553  return snxt = 0;
554  }
555  else
556  {
557  snxt = -pDotV3d + std::sqrt(d2); // second root since inside Rmax
558  side = kRMax;
559  }
560  }
561  }
562  else // p is outside ???
563  {
564  G4cout << G4endl;
565  DumpInfo();
566  std::ostringstream message;
567  G4int oldprc = message.precision(16);
568  message << "Logic error: snxt = kInfinity ???" << G4endl
569  << "Position:" << G4endl << G4endl
570  << "p.x() = " << p.x()/mm << " mm" << G4endl
571  << "p.y() = " << p.y()/mm << " mm" << G4endl
572  << "p.z() = " << p.z()/mm << " mm" << G4endl << G4endl
573  << "Rp = "<< std::sqrt( p.x()*p.x()+p.y()*p.y()+p.z()*p.z() )/mm
574  << " mm" << G4endl << G4endl
575  << "Direction:" << G4endl << G4endl
576  << "v.x() = " << v.x() << G4endl
577  << "v.y() = " << v.y() << G4endl
578  << "v.z() = " << v.z() << G4endl << G4endl
579  << "Proposed distance :" << G4endl << G4endl
580  << "snxt = " << snxt/mm << " mm" << G4endl;
581  message.precision(oldprc);
582  G4Exception("G4Orb::DistanceToOut(p,v,..)", "GeomSolids1002",
583  JustWarning, message);
584  }
585  if (calcNorm) // Output switch operator
586  {
587  switch( side )
588  {
589  case kRMax:
590  xi=p.x()+snxt*v.x();
591  yi=p.y()+snxt*v.y();
592  zi=p.z()+snxt*v.z();
593  *n=G4ThreeVector(xi/fRmax,yi/fRmax,zi/fRmax);
594  *validNorm=true;
595  break;
596  default:
597  G4cout << G4endl;
598  DumpInfo();
599  std::ostringstream message;
600  G4int oldprc = message.precision(16);
601  message << "Undefined side for valid surface normal to solid."
602  << G4endl
603  << "Position:" << G4endl << G4endl
604  << "p.x() = " << p.x()/mm << " mm" << G4endl
605  << "p.y() = " << p.y()/mm << " mm" << G4endl
606  << "p.z() = " << p.z()/mm << " mm" << G4endl << G4endl
607  << "Direction:" << G4endl << G4endl
608  << "v.x() = " << v.x() << G4endl
609  << "v.y() = " << v.y() << G4endl
610  << "v.z() = " << v.z() << G4endl << G4endl
611  << "Proposed distance :" << G4endl << G4endl
612  << "snxt = " << snxt/mm << " mm" << G4endl;
613  message.precision(oldprc);
614  G4Exception("G4Orb::DistanceToOut(p,v,..)","GeomSolids1002",
615  JustWarning, message);
616  break;
617  }
618  }
619  return snxt;
620 }
static const G4double kInfinity
Definition: geomdefs.hh:42
CLHEP::Hep3Vector G4ThreeVector
int G4int
Definition: G4Types.hh:78
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 x() const
G4double fRmax
Definition: G4Orb.hh:144
double y() const
double z() const
G4double fRmaxTolerance
Definition: G4Orb.hh:145
#define G4endl
Definition: G4ios.hh:61
ESide
Definition: G4Cons.cc:71
double G4double
Definition: G4Types.hh:76
static const G4double d2
static const double mm
Definition: G4SIunits.hh:114
Here is the call graph for this function:

◆ DistanceToOut() [2/2]

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

Implements G4VSolid.

Definition at line 626 of file G4Orb.cc.

627 {
628  G4double safe=0.0,radius = std::sqrt(p.x()*p.x()+p.y()*p.y()+p.z()*p.z());
629 
630 #ifdef G4CSGDEBUG
631  if( Inside(p) == kOutside )
632  {
633  G4int oldprc = G4cout.precision(16);
634  G4cout << G4endl;
635  DumpInfo();
636  G4cout << "Position:" << G4endl << G4endl;
637  G4cout << "p.x() = " << p.x()/mm << " mm" << G4endl;
638  G4cout << "p.y() = " << p.y()/mm << " mm" << G4endl;
639  G4cout << "p.z() = " << p.z()/mm << " mm" << G4endl << G4endl;
640  G4cout.precision(oldprc);
641  G4Exception("G4Orb::DistanceToOut(p)", "GeomSolids1002",
642  JustWarning, "Point p is outside !?" );
643  }
644 #endif
645 
646  safe = fRmax - radius;
647  if ( safe < 0. ) safe = 0.;
648  return safe;
649 }
int G4int
Definition: G4Types.hh:78
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 x() const
G4double fRmax
Definition: G4Orb.hh:144
double y() const
double z() const
#define G4endl
Definition: G4ios.hh:61
EInside Inside(const G4ThreeVector &p) const
Definition: G4Orb.cc:320
double G4double
Definition: G4Types.hh:76
static const double mm
Definition: G4SIunits.hh:114
Here is the call graph for this function:

◆ GetCubicVolume()

G4double G4Orb::GetCubicVolume ( )
inlinevirtual

Reimplemented from G4VSolid.

◆ GetEntityType()

G4GeometryType G4Orb::GetEntityType ( ) const
virtual

Implements G4VSolid.

Definition at line 655 of file G4Orb.cc.

◆ GetPointOnSurface()

G4ThreeVector G4Orb::GetPointOnSurface ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 693 of file G4Orb.cc.

694 {
695  // generate a random number from zero to 2pi...
696  //
697  G4double phi = G4RandFlat::shoot(0.,2.*pi);
698  G4double cosphi = std::cos(phi);
699  G4double sinphi = std::sin(phi);
700 
701  // generate a random point uniform in area
702  G4double costheta = G4RandFlat::shoot(-1.,1.);
703  G4double sintheta = std::sqrt(1.-sqr(costheta));
704 
705  return G4ThreeVector (fRmax*sintheta*cosphi,
706  fRmax*sintheta*sinphi, fRmax*costheta);
707 }
ThreeVector shoot(const G4int Ap, const G4int Af)
CLHEP::Hep3Vector G4ThreeVector
G4double fRmax
Definition: G4Orb.hh:144
static const double pi
Definition: G4SIunits.hh:74
T sqr(const T &x)
Definition: templates.hh:145
double G4double
Definition: G4Types.hh:76
Here is the call graph for this function:

◆ GetRadius()

G4double G4Orb::GetRadius ( ) const
inline
Here is the caller graph for this function:

◆ GetSurfaceArea()

G4double G4Orb::GetSurfaceArea ( )
inlinevirtual

Reimplemented from G4VSolid.

◆ Inside()

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

Implements G4VSolid.

Definition at line 320 of file G4Orb.cc.

321 {
322  G4double rad2,tolRMax;
323  EInside in;
324 
325 
326  rad2 = p.x()*p.x()+p.y()*p.y()+p.z()*p.z();
327 
328  G4double radius = std::sqrt(rad2);
329 
330  // G4double radius = std::sqrt(rad2);
331  // Check radial surface
332  // sets `in'
333 
334  tolRMax = fRmax - fRmaxTolerance*0.5;
335 
336  if ( radius <= tolRMax ) { in = kInside; }
337  else
338  {
339  tolRMax = fRmax + fRmaxTolerance*0.5;
340  if ( radius <= tolRMax ) { in = kSurface; }
341  else { in = kOutside; }
342  }
343  return in;
344 }
ifstream in
Definition: comparison.C:7
double x() const
G4double fRmax
Definition: G4Orb.hh:144
double y() const
EInside
Definition: geomdefs.hh:58
double z() const
G4double fRmaxTolerance
Definition: G4Orb.hh:145
double G4double
Definition: G4Types.hh:76
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=()

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

Definition at line 123 of file G4Orb.cc.

124 {
125  // Check assignment to self
126  //
127  if (this == &rhs) { return *this; }
128 
129  // Copy base class data
130  //
132 
133  // Copy data
134  //
135  fRmax = rhs.fRmax;
137 
138  return *this;
139 }
G4double fRmax
Definition: G4Orb.hh:144
G4double fRmaxTolerance
Definition: G4Orb.hh:145
G4CSGSolid & operator=(const G4CSGSolid &rhs)
Definition: G4CSGSolid.cc:91
Here is the call graph for this function:

◆ SetRadius()

void G4Orb::SetRadius ( G4double  newRmax)
inline
Here is the caller graph for this function:

◆ StreamInfo()

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

Reimplemented from G4CSGSolid.

Definition at line 673 of file G4Orb.cc.

674 {
675  G4int oldprc = os.precision(16);
676  os << "-----------------------------------------------------------\n"
677  << " *** Dump for solid - " << GetName() << " ***\n"
678  << " ===================================================\n"
679  << " Solid type: G4Orb\n"
680  << " Parameters: \n"
681 
682  << " outer radius: " << fRmax/mm << " mm \n"
683  << "-----------------------------------------------------------\n";
684  os.precision(oldprc);
685 
686  return os;
687 }
int G4int
Definition: G4Types.hh:78
G4String GetName() const
G4double fRmax
Definition: G4Orb.hh:144
static const double mm
Definition: G4SIunits.hh:114
Here is the call graph for this function:

◆ SurfaceNormal()

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

Implements G4VSolid.

Definition at line 352 of file G4Orb.cc.

353 {
354  ENorm side = kNRMax;
356  G4double radius = std::sqrt(p.x()*p.x()+p.y()*p.y()+p.z()*p.z());
357 
358  switch (side)
359  {
360  case kNRMax:
361  norm = G4ThreeVector(p.x()/radius,p.y()/radius,p.z()/radius);
362  break;
363  default: // Should never reach this case ...
364  DumpInfo();
365  G4Exception("G4Orb::SurfaceNormal()", "GeomSolids1002", JustWarning,
366  "Undefined side for valid surface normal to solid.");
367  break;
368  }
369 
370  return norm;
371 }
CLHEP::Hep3Vector G4ThreeVector
Float_t norm
void DumpInfo() const
ENorm
Definition: G4Cons.cc:75
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
double x() const
double y() const
double z() const
double G4double
Definition: G4Types.hh:76
Here is the call graph for this function:

Member Data Documentation

◆ fRmax

G4double G4Orb::fRmax
private

Definition at line 144 of file G4Orb.hh.

◆ fRmaxTolerance

G4double G4Orb::fRmaxTolerance
private

Definition at line 145 of file G4Orb.hh.


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