00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // 00027 // $Id$ 00028 // 00029 // ---------------------------------------------------------------------- 00030 // Class G4CylindricalSurface 00031 // 00032 // Class Description: 00033 // 00034 // Definition of a generic cylindrical surface. 00035 00036 // The code for G4CylindricalSurface has been derived from the original 00037 // implementation in the "Gismo" package. 00038 // 00039 // Author: A.Breakstone 00040 // Adaptation: J.Sulkimo, P.Urban. 00041 // Revisions by: L.Broglia, G.Cosmo. 00042 // ---------------------------------------------------------------------- 00043 #ifndef __G4CYLINDERSURFACE_H 00044 #define __G4CYLINDERSURFACE_H 00045 00046 #include "G4Surface.hh" 00047 00048 class G4CylindricalSurface : public G4Surface 00049 { 00050 00051 public: // with description 00052 00053 G4CylindricalSurface(); 00054 // Default constructor. 00055 00056 G4CylindricalSurface( const G4Vector3D& o, const G4Vector3D& a, G4double r ); 00057 // Normal constructor: 00058 // - first argument is the origin of the G4CylindricalSurface 00059 // - second argument is the axis of the G4CylindricalSurface 00060 // - third argument is the radius of the G4CylindricalSurface. 00061 00062 virtual ~G4CylindricalSurface(); 00063 // Destructor. 00064 00065 inline G4int operator==( const G4CylindricalSurface& c ) const; 00066 // Equality operator. 00067 00068 inline G4String GetEntityType() const; 00069 // Returns the shape identifier. 00070 00071 virtual const char* NameOf() const; 00072 // Returns the class name. 00073 00074 virtual void PrintOn( std::ostream& os = G4cout ) const; 00075 // Printing function, streaming surface's attributes. 00076 00077 virtual G4double HowNear( const G4Vector3D& x ) const; 00078 // Returns the distance from a point to a G4CylindricalSurface. 00079 // The point x is the (input) argument. 00080 // The distance is positive if the point is Inside, negative otherwise. 00081 00082 virtual G4Vector3D Normal( const G4Vector3D& p ) const; 00083 // Returns the Normal unit vector to a G4CylindricalSurface at a point p 00084 // on (or nearly on) the G4CylindricalSurface. 00085 00086 virtual G4Vector3D SurfaceNormal( const G4Point3D& p ) const; 00087 // Returns the Normal unit vector to the G4CylindricalSurface at a point 00088 // p on (or nearly on) the G4CylindricalSurface. 00089 00090 virtual G4int Inside( const G4Vector3D& x ) const; 00091 // Returns 1 if the point x is Inside the G4CylindricalSurface, 00092 // returns 0 otherwise. 00093 // Outside means that the distance to the G4CylindricalSurface would 00094 // be negative. 00095 // Uses the HowNear() function to calculate this distance. 00096 00097 virtual G4int WithinBoundary( const G4Vector3D& x ) const; 00098 // Function overwritten by finite-sized derived classes which returns 00099 // 1 if the point x is within the boundary, 0 otherwise. 00100 // Since a G4CylindricalSurface is infinite in extent, the function will 00101 // just check if the point is on the G4CylindricalSurface (to the surface 00102 // precision). 00103 00104 virtual G4double Scale() const; 00105 // Function overwritten by finite-sized derived classes which returns 00106 // the radius, unless it is zero, in which case it returns the smallest 00107 // non-zero dimension. 00108 // Used for Scale-invariant tests of surface thickness. 00109 00110 G4int Intersect(const G4Ray& ry); 00111 // Returns the distance along a Ray (straight line with G4Vector3D) to 00112 // leave or enter a G4CylindricalSurface. 00113 // If the G4Vector3D of the Ray is opposite to that of the Normal to 00114 // the G4CylindricalSurface at the intersection point, it will not leave 00115 // the G4CylindricalSurface. 00116 // Similarly, if the G4Vector3D of the Ray is along that of the Normal 00117 // to the G4CylindricalSurface at the intersection point, it will not enter 00118 // the G4CylindricalSurface. 00119 // This method is called by all finite shapes sub-classed to 00120 // G4CylindricalSurface. 00121 // A negative result means no intersection. 00122 // If no valid intersection point is found, the distance and intersection 00123 // point are set to large numbers. 00124 00125 inline G4Vector3D GetAxis() const; 00126 inline G4double GetRadius() const; 00127 // Return the axis and radius of the G4CylindricalSurface. 00128 00129 void SetRadius( G4double r ); 00130 // Changes the radius of the G4CylindricalSurface. 00131 // Requires radius to be non-negative. 00132 00133 public: // without description 00134 00135 /* 00136 virtual G4double distanceAlongRay( G4int which_way, const G4Ray* ry, 00137 G4Vector3D& p ) const; 00138 // Returns the distance along a Ray to enter or leave a 00139 // G4CylindricalSurface. Arguments: 00140 // - first (input) argument is +1 to leave or -1 to enter 00141 // - second (input) argument is a pointer to the Ray 00142 // - third (output) argument returns the intersection point. 00143 00144 virtual G4double distanceAlongHelix( G4int which_way, const Helix* hx, 00145 G4Vector3D& p ) const; 00146 // Returns the distance along a Helix to enter or leave a 00147 // G4CylindricalSurface. Arguments: 00148 // - first (input) argument is +1 to leave or -1 to enter 00149 // - second (input) argument is a pointer to the Helix 00150 // - third (output) argument returns the intersection point. 00151 00152 virtual void rotate( G4double alpha, G4double beta, 00153 G4double gamma, G4ThreeMat& m, G4int inverse ); 00154 // Rotates the G4CylindricalSurface (the angles are assumed to be given 00155 // in radians). Arguments: 00156 // - first about global x-axis by angle alpha, 00157 // - second about global y-axis by angle beta, 00158 // - third about global z-axis by angle gamma 00159 // - fourth (output) argument gives the calculated rotation matrix 00160 // - fifth (input) argument is an integer flag which if non-zero 00161 // reverses the order of the rotations 00162 00163 virtual void rotate( G4double alpha, G4double beta, 00164 G4double gamma, G4int inverse ); 00165 // Rotates the G4CylindricalSurface (the angles are assumed to be given 00166 // in radians). Arguments: 00167 // - first about global x-axis by angle alpha, 00168 // - second about global y-axis by angle beta, 00169 // - third about global z-axis by angle gamma 00170 // - fourth (input) argument is an integer flag which if non-zero 00171 // reverses the order of the rotations 00172 */ 00173 00174 00175 protected: // make available to derived classes 00176 00177 G4Vector3D axis; 00178 // Direction of axis of G4CylindricalSurface (unit vector). 00179 00180 G4double radius; 00181 // Radius of G4CylindricalSurface. 00182 00183 00184 private: 00185 00186 G4CylindricalSurface(const G4CylindricalSurface&); 00187 G4CylindricalSurface& operator=(const G4CylindricalSurface&); 00188 // Private copy constructor and assignment operator. 00189 00190 /* 00191 virtual G4double gropeAlongHelix( const Helix* hx ) const; 00192 // Private function to use a crude technique to find the intersection 00193 // of a Helix with a G4CylindricalSurface. It returns the turning angle 00194 // along the Helix at which the intersection occurs or -1.0 if no 00195 // intersection point is found. The argument to the call is the pointer 00196 // to the Helix. 00197 */ 00198 00199 }; 00200 00201 #include "G4CylindricalSurface.icc" 00202 00203 #endif 00204