G4Hype.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: G4Hype.hh 67011 2013-01-29 16:17:41Z gcosmo $
00028 // $Original: G4Hype.hh,v 1.0 1998/06/09 16:57:50 safai Exp $
00029 //
00030 // 
00031 // --------------------------------------------------------------------
00032 // GEANT 4 class header file
00033 //
00034 //
00035 // G4Hype
00036 //
00037 // Class description:
00038 //
00039 //   This class implements a tube with hyperbolic profile.
00040 //
00041 //   It describes an hyperbolic volume with curved sides parallel to
00042 //   the z-axis. The solid has a specified half-length along the z axis,
00043 //   about which it is centered, and a given minimum and maximum radius.
00044 //   A minimum radius of 0 signifies a filled Hype (with hyperbolical
00045 //   inner surface). To have a filled Hype the user must specify 
00046 //   inner radius = 0 AND inner stereo angle = 0.
00047 // 
00048 //   The inner and outer hyperbolical surfaces can have different
00049 //   stereo angles. A stereo angle of 0 gives a cylindrical surface.
00050 
00051 // Authors: 
00052 //      Ernesto Lamanna (Ernesto.Lamanna@roma1.infn.it) &
00053 //      Francesco Safai Tehrani (Francesco.SafaiTehrani@roma1.infn.it)
00054 //      Rome, INFN & University of Rome "La Sapienza",  9 June 1998.
00055 //
00056 // --------------------------------------------------------------------
00057 #ifndef G4HYPE_HH
00058 #define G4HYPE_HH
00059 
00060 #include "G4VSolid.hh"
00061 #include "G4ThreeVector.hh"
00062 
00063 class G4SolidExtentList;
00064 class G4ClippablePolygon;
00065 
00066 class G4Hype : public G4VSolid
00067 {
00068  public:  // with description
00069 
00070   G4Hype(const G4String& pName,
00071                G4double  newInnerRadius,
00072                G4double  newOuterRadius,
00073                G4double  newInnerStereo,
00074                G4double  newOuterStereo,
00075                G4double  newHalfLenZ);
00076 
00077   virtual ~G4Hype();
00078     
00079   void ComputeDimensions(G4VPVParameterisation* p,
00080                          const G4int n,
00081                          const G4VPhysicalVolume* pRep);
00082 
00083   G4bool CalculateExtent(const EAxis pAxis,
00084                          const G4VoxelLimits& pVoxelLimit,
00085                          const G4AffineTransform& pTransform,
00086                          G4double& pmin, G4double& pmax) const;
00087 
00088   inline G4double GetInnerRadius () const;
00089   inline G4double GetOuterRadius () const;
00090   inline G4double GetZHalfLength () const;
00091   inline G4double GetInnerStereo () const;
00092   inline G4double GetOuterStereo () const;
00093 
00094   inline void SetInnerRadius (G4double newIRad);
00095   inline void SetOuterRadius (G4double newORad);
00096   inline void SetZHalfLength (G4double newHLZ);
00097   inline void SetInnerStereo (G4double newISte);
00098   inline void SetOuterStereo (G4double newOSte);
00099 
00100   EInside Inside(const G4ThreeVector& p) const;
00101 
00102   G4ThreeVector SurfaceNormal(const G4ThreeVector& p) const;
00103 
00104   G4double DistanceToIn(const G4ThreeVector& p, const G4ThreeVector& v) const;
00105   G4double DistanceToIn(const G4ThreeVector& p) const;
00106   G4double DistanceToOut(const G4ThreeVector& p, const G4ThreeVector& v,
00107                          const G4bool calcNorm=G4bool(false),
00108                          G4bool *validNorm=0, G4ThreeVector *n=0) const;
00109   G4double DistanceToOut(const G4ThreeVector& p) const;
00110 
00111   G4GeometryType  GetEntityType() const;
00112 
00113   G4VSolid* Clone() const;
00114 
00115   std::ostream& StreamInfo(std::ostream& os) const;
00116   
00117   G4double GetCubicVolume();
00118   G4double GetSurfaceArea();
00119 
00120   G4ThreeVector GetPointOnSurface() const;
00121 
00122   void          DescribeYourselfTo (G4VGraphicsScene& scene) const;
00123   G4VisExtent   GetExtent          () const;
00124   G4Polyhedron* CreatePolyhedron   () const;
00125   G4NURBS*      CreateNURBS        () const;
00126   G4Polyhedron* GetPolyhedron      () const;
00127 
00128  public:  // without description
00129 
00130   G4Hype(__void__&);
00131     // Fake default constructor for usage restricted to direct object
00132     // persistency for clients requiring preallocation of memory for
00133     // persistifiable objects.
00134 
00135   G4Hype(const G4Hype& rhs);
00136   G4Hype& operator=(const G4Hype& rhs); 
00137     // Copy constructor and assignment operator.
00138 
00139  protected:  // without description
00140   
00141   inline G4bool InnerSurfaceExists() const;
00142     // whether we have an inner surface or not
00143 
00144   static G4double ApproxDistOutside( G4double pr, G4double pz,
00145                                      G4double r0, G4double tanPhi );
00146   static G4double ApproxDistInside( G4double pr, G4double pz,
00147                                     G4double r0, G4double tan2Phi );
00148     // approximate isotropic distance to hyperbolic surface 
00149 
00150   inline G4double HypeInnerRadius2(G4double zVal) const;
00151   inline G4double HypeOuterRadius2(G4double zVal) const;
00152     // values of hype radius at a given Z
00153 
00154   static G4int IntersectHype( const G4ThreeVector &p, const G4ThreeVector &v, 
00155                               G4double r2, G4double tan2Phi, G4double s[2] );
00156     // intersection with hyperbolic surface
00157 
00158   static void AddPolyToExtent( const G4ThreeVector &v0,
00159                                const G4ThreeVector &v1,
00160                                const G4ThreeVector &w1,
00161                                const G4ThreeVector &w0,
00162                                const G4VoxelLimits &voxelLimit,
00163                                const EAxis axis,
00164                                G4SolidExtentList &extentList );
00165 
00166  protected:
00167 
00168   G4double innerRadius;
00169   G4double outerRadius;
00170   G4double halfLenZ;
00171   G4double innerStereo;
00172   G4double outerStereo;
00173 
00174   // precalculated parameters, squared quantities
00175 
00176   G4double tanInnerStereo;
00177   G4double tanOuterStereo;
00178   G4double tanInnerStereo2; // squared tan of Inner Stereo angle
00179   G4double tanOuterStereo2; // squared tan of Outer Stereo angle
00180   G4double innerRadius2;    // squared Inner Radius
00181   G4double outerRadius2;    // squared Outer Radius
00182   G4double endInnerRadius2; // squared endcap Inner Radius
00183   G4double endOuterRadius2; // squared endcap Outer Radius
00184   G4double endInnerRadius; // endcap Inner Radius
00185   G4double endOuterRadius; // endcap Outer Radius
00186   
00187   // Used by distanceToOut
00188 
00189   enum ESide {outerFace,innerFace,leftCap, rightCap};
00190 
00191  private:
00192 
00193   G4double asinh(G4double arg);
00194 
00195  private:
00196   
00197   G4double fCubicVolume;
00198   G4double fSurfaceArea;
00199 
00200   mutable G4Polyhedron* fpPolyhedron;
00201 
00202 };
00203 
00204 #include "G4Hype.icc"
00205 
00206 #endif

Generated on Mon May 27 17:48:32 2013 for Geant4 by  doxygen 1.4.7