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
G4CylindricalSurface.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 G4CylindricalSurface
31//
32// Class Description:
33//
34// Definition of a generic cylindrical surface.
35
36// The code for G4CylindricalSurface has been derived from the original
37// implementation in the "Gismo" package.
38//
39// Author: A.Breakstone
40// Adaptation: J.Sulkimo, P.Urban.
41// Revisions by: L.Broglia, G.Cosmo.
42// ----------------------------------------------------------------------
43#ifndef __G4CYLINDERSURFACE_H
44#define __G4CYLINDERSURFACE_H
45
46#include "G4Surface.hh"
47
49{
50
51 public: // with description
52
54 // Default constructor.
55
56 G4CylindricalSurface( const G4Vector3D& o, const G4Vector3D& a, G4double r );
57 // Normal constructor:
58 // - first argument is the origin of the G4CylindricalSurface
59 // - second argument is the axis of the G4CylindricalSurface
60 // - third argument is the radius of the G4CylindricalSurface.
61
62 virtual ~G4CylindricalSurface();
63 // Destructor.
64
65 inline G4int operator==( const G4CylindricalSurface& c ) const;
66 // Equality operator.
67
68 inline G4String GetEntityType() const;
69 // Returns the shape identifier.
70
71 virtual const char* NameOf() const;
72 // Returns the class name.
73
74 virtual void PrintOn( std::ostream& os = G4cout ) const;
75 // Printing function, streaming surface's attributes.
76
77 virtual G4double HowNear( const G4Vector3D& x ) const;
78 // Returns the distance from a point to a G4CylindricalSurface.
79 // The point x is the (input) argument.
80 // The distance is positive if the point is Inside, negative otherwise.
81
82 virtual G4Vector3D Normal( const G4Vector3D& p ) const;
83 // Returns the Normal unit vector to a G4CylindricalSurface at a point p
84 // on (or nearly on) the G4CylindricalSurface.
85
86 virtual G4Vector3D SurfaceNormal( const G4Point3D& p ) const;
87 // Returns the Normal unit vector to the G4CylindricalSurface at a point
88 // p on (or nearly on) the G4CylindricalSurface.
89
90 virtual G4int Inside( const G4Vector3D& x ) const;
91 // Returns 1 if the point x is Inside the G4CylindricalSurface,
92 // returns 0 otherwise.
93 // Outside means that the distance to the G4CylindricalSurface would
94 // be negative.
95 // Uses the HowNear() function to calculate this distance.
96
97 virtual G4int WithinBoundary( const G4Vector3D& x ) const;
98 // Function overwritten by finite-sized derived classes which returns
99 // 1 if the point x is within the boundary, 0 otherwise.
100 // Since a G4CylindricalSurface is infinite in extent, the function will
101 // just check if the point is on the G4CylindricalSurface (to the surface
102 // precision).
103
104 virtual G4double Scale() const;
105 // Function overwritten by finite-sized derived classes which returns
106 // the radius, unless it is zero, in which case it returns the smallest
107 // non-zero dimension.
108 // Used for Scale-invariant tests of surface thickness.
109
110 G4int Intersect(const G4Ray& ry);
111 // Returns the distance along a Ray (straight line with G4Vector3D) to
112 // leave or enter a G4CylindricalSurface.
113 // If the G4Vector3D of the Ray is opposite to that of the Normal to
114 // the G4CylindricalSurface at the intersection point, it will not leave
115 // the G4CylindricalSurface.
116 // Similarly, if the G4Vector3D of the Ray is along that of the Normal
117 // to the G4CylindricalSurface at the intersection point, it will not enter
118 // the G4CylindricalSurface.
119 // This method is called by all finite shapes sub-classed to
120 // G4CylindricalSurface.
121 // A negative result means no intersection.
122 // If no valid intersection point is found, the distance and intersection
123 // point are set to large numbers.
124
125 inline G4Vector3D GetAxis() const;
126 inline G4double GetRadius() const;
127 // Return the axis and radius of the G4CylindricalSurface.
128
129 void SetRadius( G4double r );
130 // Changes the radius of the G4CylindricalSurface.
131 // Requires radius to be non-negative.
132
133 public: // without description
134
135/*
136 virtual G4double distanceAlongRay( G4int which_way, const G4Ray* ry,
137 G4Vector3D& p ) const;
138 // Returns the distance along a Ray to enter or leave a
139 // G4CylindricalSurface. Arguments:
140 // - first (input) argument is +1 to leave or -1 to enter
141 // - second (input) argument is a pointer to the Ray
142 // - third (output) argument returns the intersection point.
143
144 virtual G4double distanceAlongHelix( G4int which_way, const Helix* hx,
145 G4Vector3D& p ) const;
146 // Returns the distance along a Helix to enter or leave a
147 // G4CylindricalSurface. Arguments:
148 // - first (input) argument is +1 to leave or -1 to enter
149 // - second (input) argument is a pointer to the Helix
150 // - third (output) argument returns the intersection point.
151
152 virtual void rotate( G4double alpha, G4double beta,
153 G4double gamma, G4ThreeMat& m, G4int inverse );
154 // Rotates the G4CylindricalSurface (the angles are assumed to be given
155 // in radians). Arguments:
156 // - first about global x-axis by angle alpha,
157 // - second about global y-axis by angle beta,
158 // - third about global z-axis by angle gamma
159 // - fourth (output) argument gives the calculated rotation matrix
160 // - fifth (input) argument is an integer flag which if non-zero
161 // reverses the order of the rotations
162
163 virtual void rotate( G4double alpha, G4double beta,
164 G4double gamma, G4int inverse );
165 // Rotates the G4CylindricalSurface (the angles are assumed to be given
166 // in radians). Arguments:
167 // - first about global x-axis by angle alpha,
168 // - second about global y-axis by angle beta,
169 // - third about global z-axis by angle gamma
170 // - fourth (input) argument is an integer flag which if non-zero
171 // reverses the order of the rotations
172*/
173
174
175 protected: // make available to derived classes
176
178 // Direction of axis of G4CylindricalSurface (unit vector).
179
181 // Radius of G4CylindricalSurface.
182
183
184 private:
185
188 // Private copy constructor and assignment operator.
189
190/*
191 virtual G4double gropeAlongHelix( const Helix* hx ) const;
192 // Private function to use a crude technique to find the intersection
193 // of a Helix with a G4CylindricalSurface. It returns the turning angle
194 // along the Helix at which the intersection occurs or -1.0 if no
195 // intersection point is found. The argument to the call is the pointer
196 // to the Helix.
197*/
198
199};
200
201#include "G4CylindricalSurface.icc"
202
203#endif
204
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
G4DLLIMPORT std::ostream G4cout
G4String GetEntityType() const
G4Vector3D GetAxis() const
virtual void PrintOn(std::ostream &os=G4cout) const
virtual G4int Inside(const G4Vector3D &x) const
virtual G4double Scale() const
virtual G4Vector3D SurfaceNormal(const G4Point3D &p) const
virtual const char * NameOf() const
G4int Intersect(const G4Ray &ry)
virtual G4Vector3D Normal(const G4Vector3D &p) const
G4double GetRadius() const
virtual G4int WithinBoundary(const G4Vector3D &x) const
virtual G4double HowNear(const G4Vector3D &x) const
G4int operator==(const G4CylindricalSurface &c) const
Definition: G4Ray.hh:49