G4SphericalSurface.hh

Go to the documentation of this file.
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 G4SphericalSurface
00031 //
00032 // Class description:
00033 // 
00034 // Definition of a spherical surface.
00035 
00036 // The code for G4SphericalSurface has been derived from the original
00037 // implementation in the "Gismo" package.
00038 //
00039 // Authors: L.Lim, A.Breakstone.
00040 // Adaptation: J.Sulkimo, P.Urban.
00041 // Revisions by: L.Broglia, G.Cosmo.
00042 // ----------------------------------------------------------------------
00043 #ifndef __G4SpheShell_H
00044 #define __G4SpheShell_H
00045 
00046 #include "G4Surface.hh"
00047 #include "G4ThreeMat.hh"
00048 
00049 class G4SphericalSurface : public G4Surface
00050 {
00051 
00052  public:  // with description
00053 
00054   G4SphericalSurface();
00055     // Default constructor.
00056 
00057   G4SphericalSurface( const G4Vector3D& o, 
00058                       const G4Vector3D& xhat, const G4Vector3D& zhat,
00059                       G4double r, 
00060                       G4double ph1, G4double ph2,
00061                       G4double th1, G4double th2 ); 
00062     // Normal constructor:
00063     //   first argument is the origin of the G4SphericalSurface
00064     //   second argument is the axis of the G4SphericalSurface
00065     //          which defines azimuthal angle equals zero
00066     //   third argument is the axis of the G4SphericalSurface
00067     //          which defines polar angle equals zero
00068     //   fourth argument is the radius of the G4SphericalSurface
00069     //   fifth argument is the lower azimuthal angle limit of the surface
00070     //   sixth argument is the upper azimuthal angle limit of the surface
00071     //   seventh argument is the lower polar angle limit of the surface
00072     //   eigth argument is the upper polar angle limit of the surface
00073 
00074   virtual ~G4SphericalSurface();
00075     // Destructor.
00076 
00077   inline G4int operator==( const G4SphericalSurface& s );
00078     // Equality operator.
00079 
00080   inline G4String GetEntityType() const;
00081     // Returns the type identifier.
00082 
00083   virtual const char* NameOf() const;
00084     // Returns the class name.
00085 
00086   virtual void PrintOn( std::ostream& os = G4cout ) const;
00087     // Printing function, streaming surface's attributes.
00088 
00089   G4int Intersect(const G4Ray&);
00090     // Returns the distance along a Ray (straight line with G4Vector3D) to
00091     // leave or enter a G4SphericalSurface.
00092     // If the G4Vector3D of the Ray is opposite to that of the Normal to
00093     // the G4SphericalSurface at the intersection point, it will not leave the
00094     // G4SphericalSurface.
00095     // Similarly, if the G4Vector3D of the Ray is along that of the Normal 
00096     // to the G4SphericalSurface at the intersection point, it will not enter 
00097     // the G4SphericalSurface.
00098     // This method is called by all finite shapes sub-classed to 
00099     // G4SphericalSurface.
00100     // A negative result means no intersection.
00101     // If no valid intersection point is found, set the distance
00102     // and intersection point to large numbers.
00103 
00104   void CalcBBox();
00105     // Computes the bounding-box.
00106 
00107   inline void Comp(G4Vector3D& v, G4Point3D& min , G4Point3D& max);
00108     // Compares the x,y and z values of v and min
00109     // versus v and max. min/max-values are replaced if 
00110     // greater/smaller than v-values.
00111 
00112   virtual G4double HowNear( const G4Vector3D& x ) const;
00113     // Returns the distance from a point to a G4SphericalSurface
00114     // The point x is the (input) argument.
00115     // The distance is positive if the point is Inside, negative if it
00116     // is outside
00117   
00118   virtual G4Vector3D SurfaceNormal( const G4Point3D& p ) const;
00119     // Returns the Normal unit vector to the G4SphericalSurface at a point p 
00120     // on (or nearly on) the G4SphericalSurface.
00121 
00122   virtual G4int Inside( const G4Vector3D& x ) const;
00123     // Returns 1 if the point x is Inside the G4SphericalSurface, 0 otherwise.
00124 
00125   virtual G4int WithinBoundary( const G4Vector3D& x ) const;
00126     // Returns 1 if the point x is within the boundary, 0 otherwise.
00127 
00128   virtual G4double Scale() const;
00129     // Returns the radius, unless it is zero, in which case it
00130     // returns 1.  Used for Scale-invariant tests of surface thickness.
00131 
00132   virtual G4double Area() const; 
00133     // Calculates the area of a G4SphericalSurface.
00134 
00135   virtual void resize( G4double r, G4double ph1, G4double ph2, 
00136                        G4double th1, G4double th2);
00137     // Resizes the G4SphericalSurface to new radius and angle limits.
00138     //   first argument is the radius of the G4SphericalSurface
00139     //   second argument is the lower azimuthal angle limit of the surface
00140     //   third argument is the upper azimuthal angle limit of the surface
00141     //   fourth argument is the lower polar angle limit of the surface
00142     //   fifth argument is the upper polar angle limit of the surface
00143 
00144   inline G4Vector3D GetXAxis() const;
00145   inline G4Vector3D GetZAxis() const;
00146   inline G4double   GetRadius() const;
00147   inline G4double   GetPhi1() const;
00148   inline G4double   GetPhi2() const;
00149   inline G4double   GetTheta1() const;
00150   inline G4double   GetTheta2() const;
00151     // Accessors methodss to return the axes, radius, and angles
00152     // of the G4SphericalSurface.
00153 
00154  public:  // without description
00155 
00156   virtual G4Vector3D Normal( const G4Vector3D& p ) const;
00157     // Returns the Normal unit vector as for SurfaceNormal().
00158 
00159 /*
00160   virtual G4double distanceAlongRay( G4int which_way, const G4Ray* ry,
00161                                      G4ThreeVec& p ) const;
00162     // Returns the distance along a Ray to enter or leave a G4SphericalSurface.  
00163     //   The first (input) argument is +1 to leave or -1 to enter
00164     //   The second (input) argument is a pointer to the Ray
00165     //   The third (output) argument returns the intersection point.
00166 
00167   virtual G4double distanceAlongHelix( G4int which_way, const Helix* hx,
00168                                        G4ThreeVec& p ) const;
00169     // Returns the distance along a Helix to enter or leave a G4SphericalSurface.  
00170     //   The first (input) argument is +1 to leave or -1 to enter
00171     //   The second (input) argument is a pointer to the Helix
00172     //   The third (output) argument returns the intersection point.
00173 
00174   virtual G4Vector3D Normal( const G4Point3D& p ) const;
00175     // Returns the Normal unit vector to a G4SphericalSurface at a point p
00176     // on (or nearly on) the G4SphericalSurface.
00177 
00178   virtual void rotate( G4double alpha, G4double beta, 
00179                        G4double gamma, G4ThreeMat& m, G4int inverse );
00180     // Rotates the G4SphericalSurface (angles are assumed to be given in
00181     // radians), arguments:
00182     // - first about global x_axis by angle alpha,
00183     // - second about global y-axis by angle beta,
00184     //  - third about global z_axis by angle gamma,
00185     //  - fourth (output) argument gives the calculated rotation matrix,
00186     // - fifth (input) argument is an integer flag which if
00187     //   non-zero reverses the order of the rotations.
00188 
00189   virtual void rotate( G4double alpha, G4double beta, 
00190                        G4double gamma, G4int inverse ); 
00191     // Rotates the G4SphericalSurface (angles are assumed to be given in
00192     // radians), arguments:
00193     //  - first about global x_axis by angle alpha,
00194     // - second about global y-axis by angle beta,
00195     // - third about global z_axis by angle gamma,
00196     // - fourth (input) argument is an integer flag which if
00197     //   non-zero reverses the order of the rotations.
00198 */
00199 
00200  protected:  // with description
00201 
00202   G4Vector3D x_axis;
00203     // Direction (unit vector) of axis of G4SphericalSurface
00204     // which defines azimuthal angle of zero.
00205 
00206   G4Vector3D z_axis;
00207     // Direction (unit vector) of axis of G4SphericalSurface
00208     // which defines polar angle of zero.
00209         
00210   G4double radius;
00211     // Radius of G4SphericalSurface.
00212 
00213   G4double phi_1;
00214     // Lower azimuthal angle limit of G4SphericalSurface
00215     // (in radians).  Allowed range: 0 <= phi_1 < 2*PI.
00216   
00217   G4double phi_2;
00218     // Upper azimuthal angle limit of G4SphericalSurface
00219     // (in radians).  Allowed range: phi_1 < phi_2 <= phi_1 + 2*PI
00220 
00221   G4double theta_1;
00222     // Lower polar angle limit of G4SphericalSurface
00223     // (in radians).  Allowed range: 0 <= theta_1 < PI.
00224         
00225   G4double theta_2;
00226     // Upper polar angle limit of G4SphericalSurface
00227     // (in radians).  Allowed range: theta_1 < theta_2 <= theta_1 + PI.
00228 
00229  private:
00230 
00231   G4SphericalSurface(const G4SphericalSurface&);
00232   G4SphericalSurface& operator=(const G4SphericalSurface&);
00233     // Private copy constructor and assignment operator.
00234 
00235   // virtual G4double gropeAlongHelix( const Helix* hx ) const;
00236     // Private function to use a crude technique to find the intersection
00237     // of a Helix with a G4SphericalSurface.  It returns the turning angle 
00238     // along the Helix at which the intersection occurs or -1.0 if no
00239     // intersection point is found.  The argument to the call is the pointer
00240     // to the Helix.
00241 
00242 };
00243 
00244 #include "G4SphericalSurface.icc"
00245 
00246 #endif

Generated on Mon May 27 17:49:52 2013 for Geant4 by  doxygen 1.4.7