G4Para.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: G4Para.hh 69788 2013-05-15 12:06:57Z gcosmo $
00028 //
00029 //
00030 // --------------------------------------------------------------------
00031 // GEANT 4 class header file
00032 //
00033 // G4Para
00034 //
00035 // Class description:
00036 //
00037 //   A G4Parallepiped, essentially a box with half lengths dx,dy,dz
00038 //   `skewed' so that there are angles theta & phi of the polar line
00039 //   joining the faces at +-dz in z, and alpha formed by the y axis
00040 //   and the plane joinng the centre of the faces G4Parallel to the
00041 //   z-x plane at -dy and +dy.
00042 //
00043 //   A G4Para is defined by:
00044 //   dx,dy,dz - Half-length in x,y,z
00045 //   alpha    - Angle formed by the y axis and by the plane joining
00046 //              the centre of the faces G4Parallel to the z-x plane
00047 //              at -dy and +dy
00048 //   theta    - Polar angle of the line joining the centres of the
00049 //              faces at -dz and +dz in z
00050 //   phi      - Azimuthal angle of the line joining the centres of the
00051 //              faces at -dz and +dz in z
00052 //   Member data:
00053 //
00054 //   Note that the angles parameters are not stored - precomputed trig is
00055 //   stored instead.
00056 //
00057 //      fDx   Half-length in x
00058 //      fDy   Half-length in y
00059 //      fDz   Half-length in z
00060 //
00061 //      fTalpha       Tan of alpha
00062 //      fTthetaCphi   Tan theta * Cos phi
00063 //      fTthetaSphi   Tan theta * Sin phi
00064 
00065 // History:
00066 // 21.3.94 P.Kent Old C++ code converted to tolerant geometry
00067 // 31.10.96 V.Grichine Modifications according G4Box/Tubs before to commit
00068 // 18.11.99 V.Grichine , kUndefined was added to ESide
00069 // --------------------------------------------------------------------
00070 
00071 #ifndef G4Para_HH
00072 #define G4Para_HH
00073 
00074 #include "G4CSGSolid.hh"
00075 
00076 class G4Para : public G4CSGSolid
00077 {
00078   public:  // with description
00079 
00080     G4Para(const G4String& pName,
00081                  G4double pDx, G4double pDy, G4double pDz,
00082                  G4double pAlpha, G4double pTheta, G4double pPhi);
00083      
00084     G4Para(const G4String& pName,
00085            const G4ThreeVector pt[8]);
00086 
00087     virtual ~G4Para();
00088     
00089   // Accessors
00090 
00091     inline G4double GetZHalfLength()  const;
00092     inline G4ThreeVector GetSymAxis() const;
00093     inline G4double GetYHalfLength()  const;
00094     inline G4double GetXHalfLength()  const;
00095     inline G4double GetTanAlpha()     const;
00096     
00097   // Modifiers
00098 
00099     inline void SetXHalfLength(G4double val);
00100     inline void SetYHalfLength(G4double val);
00101     inline void SetZHalfLength(G4double val);
00102     inline void SetAlpha(G4double alpha);
00103     inline void SetTanAlpha(G4double val);
00104     inline void SetThetaAndPhi(double pTheta, double pPhi);
00105 
00106     void SetAllParameters(G4double pDx, G4double pDy, G4double pDz, 
00107                           G4double pAlpha, G4double pTheta, G4double pPhi);
00108     
00109   // Other methods of solid
00110     
00111     inline G4double GetCubicVolume();
00112     inline G4double GetSurfaceArea();
00113 
00114     void ComputeDimensions(G4VPVParameterisation* p,
00115                            const G4int n,
00116                            const G4VPhysicalVolume* pRep);
00117 
00118     G4bool CalculateExtent(const EAxis pAxis,
00119                            const G4VoxelLimits& pVoxelLimit,
00120                            const G4AffineTransform& pTransform,
00121                                  G4double& pMin, G4double& pMax) const;    
00122         
00123     EInside Inside(const G4ThreeVector& p) const;
00124 
00125     G4ThreeVector SurfaceNormal( const G4ThreeVector& p) const;
00126 
00127     G4double DistanceToIn(const G4ThreeVector& p,
00128                           const G4ThreeVector& v) const;
00129     G4double DistanceToIn(const G4ThreeVector& p) const;
00130     
00131     G4double DistanceToOut(const G4ThreeVector& p, const G4ThreeVector& v,
00132                            const G4bool calcNorm=G4bool(false),
00133                                  G4bool *validNorm=0, G4ThreeVector *n=0) const;
00134     G4double DistanceToOut(const G4ThreeVector& p) const;
00135 
00136     G4GeometryType GetEntityType() const;
00137 
00138     G4ThreeVector GetPointOnSurface() const; 
00139 
00140     G4VSolid* Clone() const;
00141 
00142     std::ostream& StreamInfo(std::ostream& os) const;
00143 
00144   // Visualisation functions
00145 
00146     void          DescribeYourselfTo (G4VGraphicsScene& scene) const;
00147     G4Polyhedron* CreatePolyhedron   () const;
00148     G4NURBS*      CreateNURBS        () const;
00149 
00150   public:  // without description
00151 
00152     G4Para(__void__&);
00153       // Fake default constructor for usage restricted to direct object
00154       // persistency for clients requiring preallocation of memory for
00155       // persistifiable objects.
00156 
00157     G4Para(const G4Para& rhs);
00158     G4Para& operator=(const G4Para& rhs); 
00159       // Copy constructor and assignment operator.
00160 
00161   protected:  // without description
00162 
00163     G4ThreeVectorList*
00164     CreateRotatedVertices(const G4AffineTransform& pTransform) const;
00165 
00166   private:
00167 
00168     G4ThreeVector ApproxSurfaceNormal( const G4ThreeVector& p) const;
00169       // Algorithm for SurfaceNormal() following the original
00170       // specification for points not on the surface
00171 
00172     G4ThreeVector GetPointOnPlane(G4ThreeVector p0, G4ThreeVector p1, 
00173                                   G4ThreeVector p2, G4ThreeVector p3, 
00174                                   G4double& area) const;
00175       // Returns a random point on the surface of one of the faces.
00176 
00177  private:
00178 
00179     G4double fDx,fDy,fDz;
00180     G4double fTalpha,fTthetaCphi,fTthetaSphi;
00181 };
00182 
00183 #include "G4Para.icc"
00184 
00185 #endif

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