Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
G4SphericalSurface.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27// $Id$
28//
29// ----------------------------------------------------------------------
30// Class G4SphericalSurface
31//
32// Class description:
33//
34// Definition of a spherical surface.
35
36// The code for G4SphericalSurface has been derived from the original
37// implementation in the "Gismo" package.
38//
39// Authors: L.Lim, A.Breakstone.
40// Adaptation: J.Sulkimo, P.Urban.
41// Revisions by: L.Broglia, G.Cosmo.
42// ----------------------------------------------------------------------
43#ifndef __G4SpheShell_H
44#define __G4SpheShell_H
45
46#include "G4Surface.hh"
47#include "G4ThreeMat.hh"
48
50{
51
52 public: // with description
53
55 // Default constructor.
56
58 const G4Vector3D& xhat, const G4Vector3D& zhat,
59 G4double r,
60 G4double ph1, G4double ph2,
61 G4double th1, G4double th2 );
62 // Normal constructor:
63 // first argument is the origin of the G4SphericalSurface
64 // second argument is the axis of the G4SphericalSurface
65 // which defines azimuthal angle equals zero
66 // third argument is the axis of the G4SphericalSurface
67 // which defines polar angle equals zero
68 // fourth argument is the radius of the G4SphericalSurface
69 // fifth argument is the lower azimuthal angle limit of the surface
70 // sixth argument is the upper azimuthal angle limit of the surface
71 // seventh argument is the lower polar angle limit of the surface
72 // eigth argument is the upper polar angle limit of the surface
73
74 virtual ~G4SphericalSurface();
75 // Destructor.
76
78 // Equality operator.
79
80 inline G4String GetEntityType() const;
81 // Returns the type identifier.
82
83 virtual const char* NameOf() const;
84 // Returns the class name.
85
86 virtual void PrintOn( std::ostream& os = G4cout ) const;
87 // Printing function, streaming surface's attributes.
88
89 G4int Intersect(const G4Ray&);
90 // Returns the distance along a Ray (straight line with G4Vector3D) to
91 // leave or enter a G4SphericalSurface.
92 // If the G4Vector3D of the Ray is opposite to that of the Normal to
93 // the G4SphericalSurface at the intersection point, it will not leave the
94 // G4SphericalSurface.
95 // Similarly, if the G4Vector3D of the Ray is along that of the Normal
96 // to the G4SphericalSurface at the intersection point, it will not enter
97 // the G4SphericalSurface.
98 // This method is called by all finite shapes sub-classed to
99 // G4SphericalSurface.
100 // A negative result means no intersection.
101 // If no valid intersection point is found, set the distance
102 // and intersection point to large numbers.
103
104 void CalcBBox();
105 // Computes the bounding-box.
106
107 inline void Comp(G4Vector3D& v, G4Point3D& min , G4Point3D& max);
108 // Compares the x,y and z values of v and min
109 // versus v and max. min/max-values are replaced if
110 // greater/smaller than v-values.
111
112 virtual G4double HowNear( const G4Vector3D& x ) const;
113 // Returns the distance from a point to a G4SphericalSurface
114 // The point x is the (input) argument.
115 // The distance is positive if the point is Inside, negative if it
116 // is outside
117
118 virtual G4Vector3D SurfaceNormal( const G4Point3D& p ) const;
119 // Returns the Normal unit vector to the G4SphericalSurface at a point p
120 // on (or nearly on) the G4SphericalSurface.
121
122 virtual G4int Inside( const G4Vector3D& x ) const;
123 // Returns 1 if the point x is Inside the G4SphericalSurface, 0 otherwise.
124
125 virtual G4int WithinBoundary( const G4Vector3D& x ) const;
126 // Returns 1 if the point x is within the boundary, 0 otherwise.
127
128 virtual G4double Scale() const;
129 // Returns the radius, unless it is zero, in which case it
130 // returns 1. Used for Scale-invariant tests of surface thickness.
131
132 virtual G4double Area() const;
133 // Calculates the area of a G4SphericalSurface.
134
135 virtual void resize( G4double r, G4double ph1, G4double ph2,
136 G4double th1, G4double th2);
137 // Resizes the G4SphericalSurface to new radius and angle limits.
138 // first argument is the radius of the G4SphericalSurface
139 // second argument is the lower azimuthal angle limit of the surface
140 // third argument is the upper azimuthal angle limit of the surface
141 // fourth argument is the lower polar angle limit of the surface
142 // fifth argument is the upper polar angle limit of the surface
143
144 inline G4Vector3D GetXAxis() const;
145 inline G4Vector3D GetZAxis() const;
146 inline G4double GetRadius() const;
147 inline G4double GetPhi1() const;
148 inline G4double GetPhi2() const;
149 inline G4double GetTheta1() const;
150 inline G4double GetTheta2() const;
151 // Accessors methodss to return the axes, radius, and angles
152 // of the G4SphericalSurface.
153
154 public: // without description
155
156 virtual G4Vector3D Normal( const G4Vector3D& p ) const;
157 // Returns the Normal unit vector as for SurfaceNormal().
158
159/*
160 virtual G4double distanceAlongRay( G4int which_way, const G4Ray* ry,
161 G4ThreeVec& p ) const;
162 // Returns the distance along a Ray to enter or leave a G4SphericalSurface.
163 // The first (input) argument is +1 to leave or -1 to enter
164 // The second (input) argument is a pointer to the Ray
165 // The third (output) argument returns the intersection point.
166
167 virtual G4double distanceAlongHelix( G4int which_way, const Helix* hx,
168 G4ThreeVec& p ) const;
169 // Returns the distance along a Helix to enter or leave a G4SphericalSurface.
170 // The first (input) argument is +1 to leave or -1 to enter
171 // The second (input) argument is a pointer to the Helix
172 // The third (output) argument returns the intersection point.
173
174 virtual G4Vector3D Normal( const G4Point3D& p ) const;
175 // Returns the Normal unit vector to a G4SphericalSurface at a point p
176 // on (or nearly on) the G4SphericalSurface.
177
178 virtual void rotate( G4double alpha, G4double beta,
179 G4double gamma, G4ThreeMat& m, G4int inverse );
180 // Rotates the G4SphericalSurface (angles are assumed to be given in
181 // radians), arguments:
182 // - first about global x_axis by angle alpha,
183 // - second about global y-axis by angle beta,
184 // - third about global z_axis by angle gamma,
185 // - fourth (output) argument gives the calculated rotation matrix,
186 // - fifth (input) argument is an integer flag which if
187 // non-zero reverses the order of the rotations.
188
189 virtual void rotate( G4double alpha, G4double beta,
190 G4double gamma, G4int inverse );
191 // Rotates the G4SphericalSurface (angles are assumed to be given in
192 // radians), arguments:
193 // - first about global x_axis by angle alpha,
194 // - second about global y-axis by angle beta,
195 // - third about global z_axis by angle gamma,
196 // - fourth (input) argument is an integer flag which if
197 // non-zero reverses the order of the rotations.
198*/
199
200 protected: // with description
201
203 // Direction (unit vector) of axis of G4SphericalSurface
204 // which defines azimuthal angle of zero.
205
207 // Direction (unit vector) of axis of G4SphericalSurface
208 // which defines polar angle of zero.
209
211 // Radius of G4SphericalSurface.
212
214 // Lower azimuthal angle limit of G4SphericalSurface
215 // (in radians). Allowed range: 0 <= phi_1 < 2*PI.
216
218 // Upper azimuthal angle limit of G4SphericalSurface
219 // (in radians). Allowed range: phi_1 < phi_2 <= phi_1 + 2*PI
220
222 // Lower polar angle limit of G4SphericalSurface
223 // (in radians). Allowed range: 0 <= theta_1 < PI.
224
226 // Upper polar angle limit of G4SphericalSurface
227 // (in radians). Allowed range: theta_1 < theta_2 <= theta_1 + PI.
228
229 private:
230
232 G4SphericalSurface& operator=(const G4SphericalSurface&);
233 // Private copy constructor and assignment operator.
234
235 // virtual G4double gropeAlongHelix( const Helix* hx ) const;
236 // Private function to use a crude technique to find the intersection
237 // of a Helix with a G4SphericalSurface. It returns the turning angle
238 // along the Helix at which the intersection occurs or -1.0 if no
239 // intersection point is found. The argument to the call is the pointer
240 // to the Helix.
241
242};
243
244#include "G4SphericalSurface.icc"
245
246#endif
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
G4DLLIMPORT std::ostream G4cout
Definition: G4Ray.hh:49
void Comp(G4Vector3D &v, G4Point3D &min, G4Point3D &max)
G4int operator==(const G4SphericalSurface &s)
virtual G4int Inside(const G4Vector3D &x) const
virtual G4double Scale() const
G4double GetRadius() const
virtual G4Vector3D Normal(const G4Vector3D &p) const
G4double GetPhi1() const
G4String GetEntityType() const
G4Vector3D GetZAxis() const
virtual void PrintOn(std::ostream &os=G4cout) const
G4double GetTheta2() const
G4double GetPhi2() const
virtual G4int WithinBoundary(const G4Vector3D &x) const
virtual const char * NameOf() const
virtual void resize(G4double r, G4double ph1, G4double ph2, G4double th1, G4double th2)
G4int Intersect(const G4Ray &)
virtual G4double HowNear(const G4Vector3D &x) const
virtual G4double Area() const
virtual G4Vector3D SurfaceNormal(const G4Point3D &p) const
G4double GetTheta1() const
G4Vector3D GetXAxis() const