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

#include <G4SphericalSurface.hh>

+ Inheritance diagram for G4SphericalSurface:

Public Member Functions

 G4SphericalSurface ()
 
 G4SphericalSurface (const G4Vector3D &o, const G4Vector3D &xhat, const G4Vector3D &zhat, G4double r, G4double ph1, G4double ph2, G4double th1, G4double th2)
 
virtual ~G4SphericalSurface ()
 
G4int operator== (const G4SphericalSurface &s)
 
G4String GetEntityType () const
 
virtual const char * NameOf () const
 
virtual void PrintOn (std::ostream &os=G4cout) const
 
G4int Intersect (const G4Ray &)
 
void CalcBBox ()
 
void Comp (G4Vector3D &v, G4Point3D &min, G4Point3D &max)
 
virtual G4double HowNear (const G4Vector3D &x) const
 
virtual G4Vector3D SurfaceNormal (const G4Point3D &p) const
 
virtual G4int Inside (const G4Vector3D &x) const
 
virtual G4int WithinBoundary (const G4Vector3D &x) const
 
virtual G4double Scale () const
 
virtual G4double Area () const
 
virtual void resize (G4double r, G4double ph1, G4double ph2, G4double th1, G4double th2)
 
G4Vector3D GetXAxis () const
 
G4Vector3D GetZAxis () const
 
G4double GetRadius () const
 
G4double GetPhi1 () const
 
G4double GetPhi2 () const
 
G4double GetTheta1 () const
 
G4double GetTheta2 () const
 
virtual G4Vector3D Normal (const G4Vector3D &p) const
 
- Public Member Functions inherited from G4Surface
 G4Surface ()
 
virtual ~G4Surface ()
 
G4int operator== (const G4Surface &s)
 
virtual G4String GetEntityType () const
 
virtual const char * Name () const
 
virtual G4int MyType () const
 
void SetBoundaries (G4CurveVector *)
 
virtual G4double HowNear (const G4Vector3D &x) const
 
virtual G4double ClosestDistanceToPoint (const G4Point3D &Pt)
 
G4Vector3D GetOrigin () const
 
G4double GetDistance () const
 
void SetDistance (G4double Dist)
 
G4int IsActive () const
 
void SetActive (G4int act)
 
void Deactivate ()
 
void SetSameSense (G4int sameSense0)
 
G4int GetSameSense () const
 
G4BoundingBox3DGetBBox ()
 
const G4Point3DGetClosestHit () const
 
void SetNextNode (G4Surface *)
 
G4SurfaceGetNextNode ()
 
virtual void Reset ()
 
virtual G4int Intersect (const G4Ray &)
 
virtual G4Vector3D Normal (const G4Vector3D &p) const
 
virtual void CalcBBox ()
 
virtual G4double GetUHit () const
 
virtual G4double GetVHit () const
 
virtual G4Point3D Evaluation (const G4Ray &G4Rayref)
 
virtual G4int Evaluate (register const G4Ray &Rayref)
 
virtual void Project ()
 
virtual void CalcNormal ()
 
virtual G4int IsConvex () const
 
virtual G4int GetConvex () const
 
virtual G4int GetNumberOfPoints () const
 
virtual const G4Point3DGetPoint (G4int Count) const
 
virtual G4RayNorm ()
 
virtual G4Vector3D SurfaceNormal (const G4Point3D &Pt) const =0
 
- Public Member Functions inherited from G4STEPEntity
 G4STEPEntity ()
 
virtual ~G4STEPEntity ()
 
virtual G4String GetEntityType () const =0
 

Protected Attributes

G4Vector3D x_axis
 
G4Vector3D z_axis
 
G4double radius
 
G4double phi_1
 
G4double phi_2
 
G4double theta_1
 
G4double theta_2
 
- Protected Attributes inherited from G4Surface
G4BoundingBox3Dbbox
 
G4Point3D closest_hit
 
G4Surfacenext
 
G4SurfaceBoundary surfaceBoundary
 
G4double kCarTolerance
 
G4double kAngTolerance
 
G4int Intersected
 
G4Vector3D origin
 
G4int Type
 
G4int AdvancedFace
 
G4int active
 
G4double distance
 
G4double uhit
 
G4double vhit
 
G4int sameSense
 

Additional Inherited Members

- Static Public Member Functions inherited from G4Surface
static void Project (G4double &Coord, const G4Point3D &Pt, const G4Plane &Pl)
 
- Protected Member Functions inherited from G4Surface
virtual void InitBounded ()
 

Detailed Description

Definition at line 49 of file G4SphericalSurface.hh.

Constructor & Destructor Documentation

◆ G4SphericalSurface() [1/2]

G4SphericalSurface::G4SphericalSurface ( )

Definition at line 39 of file G4SphericalSurface.cc.

40 : G4Surface(), radius(1.0), phi_1(0.0), phi_2(2*pi),
41 theta_1(0.0), theta_2(pi)
42{
43 // default constructor
44 // default x_axis is ( 1.0, 0.0, 0.0 ), z_axis is ( 0.0, 0.0, 1.0 ),
45 // default radius is 1.0
46 // default phi_1 is 0, phi_2 is 2*PI
47 // default theta_1 is 0, theta_2 is PI
48
49 x_axis = G4Vector3D( 1.0, 0.0, 0.0 );
50 z_axis = G4Vector3D( 0.0, 0.0, 1.0 );
51 // OuterBoundary = new G4BREPPolyline();
52}
HepGeom::Vector3D< G4double > G4Vector3D
Definition: G4Vector3D.hh:35

◆ G4SphericalSurface() [2/2]

G4SphericalSurface::G4SphericalSurface ( const G4Vector3D o,
const G4Vector3D xhat,
const G4Vector3D zhat,
G4double  r,
G4double  ph1,
G4double  ph2,
G4double  th1,
G4double  th2 
)

Definition at line 55 of file G4SphericalSurface.cc.

61 : G4Surface()
62{
63 // Require both x_axis and z_axis to be unit vectors
64
65 G4double xhatmag = xhat.mag();
66 if ( xhatmag != 0.0 )
67 {
68 x_axis = xhat * (1/ xhatmag); // this makes the x_axis a unit vector
69 }
70 else
71 {
72 std::ostringstream message;
73 message << "x_axis has zero length." << G4endl
74 << "Default x_axis of (1, 0, 0) is used.";
75 G4Exception("G4SphericalSurface::G4SphericalSurface()",
76 "GeomSolids1001", JustWarning, message);
77
78 x_axis = G4Vector3D( 1.0, 0.0, 0.0 );
79 }
80
81 G4double zhatmag = zhat.mag();
82
83 if (zhatmag != 0.0)
84 {
85 z_axis = zhat *(1/ zhatmag); // this makes the z_axis a unit vector
86 }
87 else
88 {
89 std::ostringstream message;
90 message << "z_axis has zero length." << G4endl
91 << "Default z_axis of (0, 0, 1) is used.";
92 G4Exception("G4SphericalSurface::G4SphericalSurface()",
93 "GeomSolids1001", JustWarning, message);
94
95 z_axis = G4Vector3D( 0.0, 0.0, 1.0 );
96 }
97
98 // Require radius to be non-negative
99 //
100 if ( r >= 0.0 )
101 {
102 radius = r;
103 }
104 else
105 {
106 std::ostringstream message;
107 message << "Radius cannot be less than zero." << G4endl
108 << "Default radius of 1.0 is used.";
109 G4Exception("G4SphericalSurface::G4SphericalSurface()",
110 "GeomSolids1001", JustWarning, message);
111
112 radius = 1.0;
113 }
114
115 // Require phi_1 in the range: 0 <= phi_1 < 2*PI
116 // and phi_2 in the range: phi_1 < phi_2 <= phi_1 + 2*PI
117 //
118 if ( ( ph1 >= 0.0 ) && ( ph1 < 2*pi ) )
119 {
120 phi_1 = ph1;
121 }
122 else
123 {
124 std::ostringstream message;
125 message << "Lower azimuthal limit is out of range." << G4endl
126 << "Default angle of 0 is used.";
127 G4Exception("G4SphericalSurface::G4SphericalSurface()",
128 "GeomSolids1001", JustWarning, message);
129
130 phi_1 = 0.0;
131 }
132
133 if ( ( ph2 > phi_1 ) && ( ph2 <= ( phi_1 + twopi ) ) )
134 {
135 phi_2 = ph2;
136 }
137 else
138 {
139 std::ostringstream message;
140 message << "Upper azimuthal limit is out of range." << G4endl
141 << "Default angle of 2*PI is used.";
142 G4Exception("G4SphericalSurface::G4SphericalSurface()",
143 "GeomSolids1001", JustWarning, message);
144
145 phi_2 = twopi;
146 }
147
148 // Require theta_1 in the range: 0 <= theta_1 < PI
149 // and theta-2 in the range: theta_1 < theta_2 <= theta_1 + PI
150 //
151 if ( ( th1 >= 0.0 ) && ( th1 < pi ) )
152 {
153 theta_1 = th1;
154 }
155 else
156 {
157 std::ostringstream message;
158 message << "Lower polar limit is out of range." << G4endl
159 << "Default angle of 0 is used.";
160 G4Exception("G4SphericalSurface::G4SphericalSurface()",
161 "GeomSolids1001", JustWarning, message);
162
163 theta_1 = 0.0;
164 }
165
166 if ( ( th2 > theta_1 ) && ( th2 <= ( theta_1 + pi ) ) )
167 {
168 theta_2 =th2;
169 }
170 else
171 {
172 std::ostringstream message;
173 message << "Upper polar limit is out of range." << G4endl
174 << "Default angle of PI is used.";
175 G4Exception("G4SphericalSurface::G4SphericalSurface()",
176 "GeomSolids1001", JustWarning, message);
177
178 theta_2 = pi;
179 }
180}
@ JustWarning
double G4double
Definition: G4Types.hh:64
#define G4endl
Definition: G4ios.hh:52
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
const G4double pi

◆ ~G4SphericalSurface()

G4SphericalSurface::~G4SphericalSurface ( )
virtual

Definition at line 183 of file G4SphericalSurface.cc.

184{
185}

Member Function Documentation

◆ Area()

G4double G4SphericalSurface::Area ( ) const
virtual

Definition at line 831 of file G4SphericalSurface.cc.

832{
833 // Returns the Area of a G4SphericalSurface
834
835 return ( 2.0*( theta_2 - theta_1 )*( phi_2 - phi_1)*radius*radius/pi );
836}

◆ CalcBBox()

void G4SphericalSurface::CalcBBox ( )
virtual

Reimplemented from G4Surface.

Definition at line 337 of file G4SphericalSurface.cc.

338{
339 G4double x_min = origin.x() - radius;
340 G4double y_min = origin.y() - radius;
341 G4double z_min = origin.z() - radius;
342 G4double x_max = origin.x() + radius;
343 G4double y_max = origin.y() + radius;
344 G4double z_max = origin.z() + radius;
345
346 G4Point3D Min(x_min, y_min, z_min);
347 G4Point3D Max(x_max, y_max, z_max);
348 bbox = new G4BoundingBox3D( Min, Max);
349}
G4Vector3D origin
Definition: G4Surface.hh:197
G4BoundingBox3D * bbox
Definition: G4Surface.hh:185

◆ Comp()

void G4SphericalSurface::Comp ( G4Vector3D v,
G4Point3D min,
G4Point3D max 
)
inline

◆ GetEntityType()

G4String G4SphericalSurface::GetEntityType ( ) const
inlinevirtual

Reimplemented from G4Surface.

◆ GetPhi1()

G4double G4SphericalSurface::GetPhi1 ( ) const
inline

◆ GetPhi2()

G4double G4SphericalSurface::GetPhi2 ( ) const
inline

◆ GetRadius()

G4double G4SphericalSurface::GetRadius ( ) const
inline

Referenced by Intersect().

◆ GetTheta1()

G4double G4SphericalSurface::GetTheta1 ( ) const
inline

◆ GetTheta2()

G4double G4SphericalSurface::GetTheta2 ( ) const
inline

◆ GetXAxis()

G4Vector3D G4SphericalSurface::GetXAxis ( ) const
inline

◆ GetZAxis()

G4Vector3D G4SphericalSurface::GetZAxis ( ) const
inline

◆ HowNear()

G4double G4SphericalSurface::HowNear ( const G4Vector3D x) const
virtual

Reimplemented from G4Surface.

Definition at line 233 of file G4SphericalSurface.cc.

234{
235 // Distance from the point x to the G4SphericalSurface.
236 // The distance will be positive if the point is Inside the
237 // G4SphericalSurface, negative if the point is outside.
238
239 G4Vector3D d = G4Vector3D( x - origin );
240 G4double rds = d.mag();
241
242 return (radius - rds);
243}

Referenced by Inside(), and Intersect().

◆ Inside()

G4int G4SphericalSurface::Inside ( const G4Vector3D x) const
virtual

Definition at line 756 of file G4SphericalSurface.cc.

757{
758 // Return 0 if point x is outside G4SphericalSurface, 1 if Inside.
759 // Outside means that the distance to the G4SphericalSurface would
760 // be negative.
761 // Use the HowNear function to calculate this distance.
762
763 if ( HowNear( x ) >= 0.0 ) { return 1; }
764 else { return 0; }
765}
virtual G4double HowNear(const G4Vector3D &x) const

◆ Intersect()

G4int G4SphericalSurface::Intersect ( const G4Ray ry)
virtual

Reimplemented from G4Surface.

Definition at line 352 of file G4SphericalSurface.cc.

353{
354 // Distance along a Ray (straight line with G4Vector3D) to leave or enter
355 // a G4SphericalSurface. The input variable which_way should be set to +1
356 // to indicate leaving a G4SphericalSurface, -1 to indicate entering a
357 // G4SphericalSurface.
358 // p is the point of intersection of the Ray with the G4SphericalSurface.
359 // If the G4Vector3D of the Ray is opposite to that of the Normal to
360 // the G4SphericalSurface at the intersection point, it will not leave the
361 // G4SphericalSurface.
362 // Similarly, if the G4Vector3D of the Ray is along that of the Normal
363 // to the G4SphericalSurface at the intersection point, it will not enter
364 // the G4SphericalSurface.
365 // This method is called by all finite shapes sub-classed to
366 // G4SphericalSurface.
367 // Use the virtual function table to check if the intersection point
368 // is within the boundary of the finite shape.
369 // A negative result means no intersection.
370 // If no valid intersection point is found, set the distance
371 // and intersection point to large numbers.
372
373 G4int which_way = (G4int)HowNear(ry.GetStart());
374
375 if(!which_way) { which_way =-1; }
376 distance = kInfinity;
377
378 G4Vector3D lv ( kInfinity, kInfinity, kInfinity );
379
380 // p = lv;
381 //
382 closest_hit = lv;
383
384 // Origin and G4Vector3D unit vector of Ray.
385 //
386 G4Vector3D x= G4Vector3D( ry.GetStart() );
387 G4Vector3D dhat = ry.GetDir();
388 G4int isoln = 0, maxsoln = 2;
389
390 // Array of solutions in distance along the Ray
391 //
392 G4double ss[2];
393 ss[0] = -1.0 ;
394 ss[1] = -1.0 ;
395
396 // Calculate the two solutions (quadratic equation)
397 //
398 G4Vector3D d = G4Vector3D( x - GetOrigin() );
399 G4double r = GetRadius();
400
401 // Quit with no intersection if the radius of the G4SphericalSurface is zero
402 //
403 if ( r <= 0.0 ) { return 0; }
404
405 G4double dsq = d * d;
406 G4double rsq = r * r;
407 G4double b = d * dhat;
408 G4double c = dsq - rsq;
409 G4double radical = b * b - c;
410
411 // Quit with no intersection if the radical is negative
412 //
413 if ( radical < 0.0 ) { return 0; }
414
415 G4double root = std::sqrt( radical );
416 ss[0] = -b + root;
417 ss[1] = -b - root;
418
419 // Order the possible solutions by increasing distance along the Ray
420 // G4Sort_double( ss, isoln, maxsoln-1 );
421 //
422 if(ss[0] > ss[1])
423 {
424 G4double tmp =ss[0];
425 ss[0] = ss[1];
426 ss[1] = tmp;
427 }
428
429 // Now loop over each positive solution, keeping the first one (smallest
430 // distance along the Ray) which is within the boundary of the sub-shape
431 // and which also has the correct G4Vector3D with respect to the Normal to
432 // the G4SphericalSurface at the intersection point
433 //
434 for ( isoln = 0; isoln < maxsoln; isoln++ )
435 {
436 if ( ss[isoln] >= kCarTolerance*0.5 )
437 {
438 if ( ss[isoln] >= kInfinity ) { return 0; } // quit if too large
439 distance = ss[isoln];
441 if ( ( ( dhat * Normal( closest_hit ) * which_way ) >= 0.0 ) &&
442 ( WithinBoundary( closest_hit ) == 1 ) )
443 {
445 return 1;
446 }
447 }
448 }
449
450 // Get here only if there was no solution within the boundary,
451 // reset distance and intersection point to large numbers
452 //
453 distance = kInfinity;
454 closest_hit = lv;
455
456 return 0;
457}
int G4int
Definition: G4Types.hh:66
G4Point3D GetPoint(G4double i) const
const G4Vector3D & GetDir() const
const G4Point3D & GetStart() const
G4double GetRadius() const
virtual G4Vector3D Normal(const G4Vector3D &p) const
virtual G4int WithinBoundary(const G4Vector3D &x) const
G4double distance
Definition: G4Surface.hh:203
G4Vector3D GetOrigin() const
G4Point3D closest_hit
Definition: G4Surface.hh:186
G4double kCarTolerance
Definition: G4Surface.hh:192

◆ NameOf()

const char * G4SphericalSurface::NameOf ( ) const
virtual

Definition at line 215 of file G4SphericalSurface.cc.

216{
217 return "G4SphericalSurface";
218}

◆ Normal()

G4Vector3D G4SphericalSurface::Normal ( const G4Vector3D p) const
virtual

Reimplemented from G4Surface.

Definition at line 720 of file G4SphericalSurface.cc.

721{
722 // Return the Normal unit vector to the G4SphericalSurface at a point p on
723 // (or nearly on) the G4SphericalSurface.
724
725 G4Vector3D n = G4Vector3D( p - origin );
726 G4double nmag = n.mag();
727
728 // If the point p happens to coincide with the origin (which is possible
729 // if the radius is zero), set the Normal to the z-axis unit vector.
730 //
731 if ( nmag != 0.0 ) { n = n * (1/ nmag); }
732 else { n = G4Vector3D( 0.0, 0.0, 1.0 ); }
733
734 return n;
735}

Referenced by Intersect().

◆ operator==()

G4int G4SphericalSurface::operator== ( const G4SphericalSurface s)
inline

◆ PrintOn()

void G4SphericalSurface::PrintOn ( std::ostream &  os = G4cout) const
virtual

Definition at line 220 of file G4SphericalSurface.cc.

221{
222 os << "G4SphericalSurface surface with origin: " << origin << "\t"
223 << "radius: " << radius << "\n"
224 << "\t local x_axis: " << x_axis
225 << "\t local z_axis: " << z_axis << "\n"
226 << "\t lower azimuthal limit: " << phi_1 << " radians\n"
227 << "\t upper azimuthal limit: " << phi_2 << " radians\n"
228 << "\t lower polar limit : " << theta_1 << " radians\n"
229 << "\t upper polar limit : " << theta_2 << " radians\n";
230}

◆ resize()

void G4SphericalSurface::resize ( G4double  r,
G4double  ph1,
G4double  ph2,
G4double  th1,
G4double  th2 
)
virtual

Definition at line 839 of file G4SphericalSurface.cc.

842{
843 // Resize the G4SphericalSurface to new radius r, new lower and upper
844 // azimuthal angle limits ph1 and ph2, and new lower and upper polar
845 // angle limits th1 and th2.
846
847 // Require radius to be non-negative
848 //
849 if ( r >= 0.0 ) { radius = r; }
850 else
851 {
852 std::ostringstream message;
853 message << "Radius cannot be less than zero." << G4endl
854 << "Original value of " << radius << " is retained.";
855 G4Exception("G4SphericalSurface::resize()",
856 "GeomSolids1001", JustWarning, message);
857 }
858
859 // Require azimuthal angles to be within bounds
860
861 if ( ( ph1 >= 0.0 ) && ( ph1 < twopi ) ) { phi_1 = ph1; }
862 else
863 {
864 std::ostringstream message;
865 message << "Lower azimuthal limit out of range." << G4endl
866 << "Original value of " << phi_1 << " is retained.";
867 G4Exception("G4SphericalSurface::resize()",
868 "GeomSolids1001", JustWarning, message);
869 }
870
871 if ( ( ph2 > phi_1 ) && ( ph2 <= ( phi_1 + twopi ) ) ) { phi_2 = ph2; }
872 else
873 {
874 ph2 = ( phi_2 <= phi_1 ) ? ( phi_1 + kAngTolerance ) : phi_2;
875 phi_2 = ph2;
876 std::ostringstream message;
877 message << "Upper azimuthal limit out of range." << G4endl
878 << "Value of " << phi_2 << " is used.";
879 G4Exception("G4SphericalSurface::resize()",
880 "GeomSolids1001", JustWarning, message);
881 }
882
883 // Require polar angles to be within bounds
884 //
885 if ( ( th1 >= 0.0 ) && ( th1 < pi ) ) { theta_1 = th1; }
886 else
887 {
888 std::ostringstream message;
889 message << "Lower polar limit out of range." << G4endl
890 << "Original value of " << theta_1 << " is retained.";
891 G4Exception("G4SphericalSurface::resize()",
892 "GeomSolids1001", JustWarning, message);
893 }
894
895 if ( ( th2 > theta_1 ) && ( th2 <= ( theta_1 + pi ) ) ) { theta_2 = th2; }
896 else
897 {
898 th2 = ( theta_2 <= theta_1 ) ? ( theta_1 + kAngTolerance ) : theta_2;
899 theta_2 = th2;
900 std::ostringstream message;
901 message << "Upper polar limit out of range." << G4endl
902 << "Value of " << theta_2 << " is used.";
903 G4Exception("G4SphericalSurface::resize()",
904 "GeomSolids1001", JustWarning, message);
905 }
906}
G4double kAngTolerance
Definition: G4Surface.hh:192

◆ Scale()

G4double G4SphericalSurface::Scale ( ) const
virtual

Definition at line 820 of file G4SphericalSurface.cc.

821{
822 // Returns the radius of a G4SphericalSurface unless it is zero, in which
823 // case returns the arbitrary number 1.0.
824 // Used for Scale-invariant tests of surface thickness.
825
826 if ( radius == 0.0 ) { return 1.0; }
827 else { return radius; }
828}

◆ SurfaceNormal()

G4Vector3D G4SphericalSurface::SurfaceNormal ( const G4Point3D p) const
virtual

Implements G4Surface.

Definition at line 738 of file G4SphericalSurface.cc.

739{
740 // Return the Normal unit vector to the G4SphericalSurface at a point p on
741 // (or nearly on) the G4SphericalSurface.
742
743 G4Vector3D n = G4Vector3D( p - origin );
744 G4double nmag = n.mag();
745
746 // If the point p happens to coincide with the origin (which is possible
747 // if the radius is zero), set the Normal to the z-axis unit vector.
748 //
749 if ( nmag != 0.0 ) { n = n * (1/ nmag); }
750 else { n = G4Vector3D( 0.0, 0.0, 1.0 ); }
751
752 return n;
753}

◆ WithinBoundary()

G4int G4SphericalSurface::WithinBoundary ( const G4Vector3D x) const
virtual

Definition at line 768 of file G4SphericalSurface.cc.

769{
770 // Return 1 if point x is on the G4SphericalSurface, otherwise return zero
771 // (x is assumed to lie on the surface of the G4SphericalSurface, so one
772 // only checks the angular limits)
773
774 G4Vector3D y_axis = G4Vector3D( z_axis.cross( x_axis ) );
775
776 // Components of x in the local coordinate system of the G4SphericalSurface
777 //
778 G4double px = x * x_axis;
779 G4double py = x * y_axis;
780 G4double pz = x * z_axis;
781
782 // Check if within polar angle limits
783 //
784 G4double theta = std::acos( pz / x.mag() ); // acos in range 0 to PI
785
786 // Normal case
787 //
788 if ( theta_2 <= pi )
789 {
790 if ( ( theta < theta_1 ) || ( theta > theta_2 ) ) { return 0; }
791 }
792 else
793 {
794 theta += pi;
795 if ( ( theta < theta_1 ) || ( theta > theta_2 ) ) { return 0; }
796 }
797
798 // Now check if within azimuthal angle limits
799 //
800 G4double phi = std::atan2( py, px ); // atan2 in range -PI to PI
801
802 if ( phi < 0.0 ) { phi += twopi; }
803
804 // Normal case
805 //
806 if ( ( phi >= phi_1 ) && ( phi <= phi_2 ) ) { return 1; }
807
808 // This is for the case that phi_2 is greater than 2*PI
809 //
810 phi += twopi;
811
812 if ( ( phi >= phi_1 ) && ( phi <= phi_2 ) ) { return 1; }
813
814 // Get here if not within azimuthal limits
815
816 return 0;
817}
BasicVector3D< T > cross(const BasicVector3D< T > &v) const

Referenced by Intersect().

Member Data Documentation

◆ phi_1

G4double G4SphericalSurface::phi_1
protected

Definition at line 213 of file G4SphericalSurface.hh.

Referenced by Area(), G4SphericalSurface(), PrintOn(), resize(), and WithinBoundary().

◆ phi_2

G4double G4SphericalSurface::phi_2
protected

Definition at line 217 of file G4SphericalSurface.hh.

Referenced by Area(), G4SphericalSurface(), PrintOn(), resize(), and WithinBoundary().

◆ radius

G4double G4SphericalSurface::radius
protected

Definition at line 210 of file G4SphericalSurface.hh.

Referenced by Area(), CalcBBox(), G4SphericalSurface(), HowNear(), PrintOn(), resize(), and Scale().

◆ theta_1

G4double G4SphericalSurface::theta_1
protected

Definition at line 221 of file G4SphericalSurface.hh.

Referenced by Area(), G4SphericalSurface(), PrintOn(), resize(), and WithinBoundary().

◆ theta_2

G4double G4SphericalSurface::theta_2
protected

Definition at line 225 of file G4SphericalSurface.hh.

Referenced by Area(), G4SphericalSurface(), PrintOn(), resize(), and WithinBoundary().

◆ x_axis

G4Vector3D G4SphericalSurface::x_axis
protected

Definition at line 202 of file G4SphericalSurface.hh.

Referenced by G4SphericalSurface(), PrintOn(), and WithinBoundary().

◆ z_axis

G4Vector3D G4SphericalSurface::z_axis
protected

Definition at line 206 of file G4SphericalSurface.hh.

Referenced by G4SphericalSurface(), PrintOn(), and WithinBoundary().


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