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: G4CutTubs.hh 69788 2013-05-15 12:06:57Z gcosmo $ 00028 // GEANT4 tag $Name: not supported by cvs2svn $ 00029 // 00030 // 00031 // -------------------------------------------------------------------- 00032 // GEANT 4 class header file 00033 // 00034 // 00035 // G4CutTubs is a tube with possible cuts in +-Z. 00036 // Implementation adapted from G4Tubs (subclass of G4Tubs) and 00037 // from TGEo Ctube implementation (by A.Gheata, CERN) 00038 // 00039 // G4CutTubs(pName,pRMin,pRMax,pDZ,pSPhi,pEPhi,pLowNorm,pHighNorm) 00040 // pName,pRMin,pRMax,pDZ,pSPhi,pEPhi are the same as for G4Tubs, 00041 // pLowNorm=Outside Normal at -Z 00042 // pHighNorm=Outsie Normal at +Z. 00043 00044 // Author: Tatiana Nikitina, CERN 00045 // -------------------------------------------------------------------- 00046 00047 #ifndef G4CUTTUBS_HH 00048 #define G4CUTTUBS_HH 00049 00050 #include "G4Tubs.hh" 00051 00052 class G4CutTubs : public G4Tubs 00053 { 00054 public: // with description 00055 00056 G4CutTubs( const G4String& pName, 00057 G4double pRMin, 00058 G4double pRMax, 00059 G4double pDz, 00060 G4double pSPhi, 00061 G4double pDPhi, 00062 G4ThreeVector pLowNorm, 00063 G4ThreeVector pHighNorm ); 00064 // 00065 // Constructs a tubs with the given name and dimensions 00066 00067 ~G4CutTubs(); 00068 // 00069 // Destructor 00070 00071 // Accessors 00072 00073 inline G4ThreeVector GetLowNorm () const; 00074 inline G4ThreeVector GetHighNorm () const; 00075 00076 // Methods for solid 00077 00078 inline G4double GetCubicVolume(); 00079 inline G4double GetSurfaceArea(); 00080 00081 G4bool CalculateExtent( const EAxis pAxis, 00082 const G4VoxelLimits& pVoxelLimit, 00083 const G4AffineTransform& pTransform, 00084 G4double& pmin, G4double& pmax ) const; 00085 00086 EInside Inside( const G4ThreeVector& p ) const; 00087 00088 G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const; 00089 00090 G4double DistanceToIn(const G4ThreeVector& p, const G4ThreeVector& v) const; 00091 G4double DistanceToIn(const G4ThreeVector& p) const; 00092 G4double DistanceToOut(const G4ThreeVector& p, const G4ThreeVector& v, 00093 const G4bool calcNorm=G4bool(false), 00094 G4bool *validNorm=0, G4ThreeVector *n=0) const; 00095 G4double DistanceToOut(const G4ThreeVector& p) const; 00096 00097 G4GeometryType GetEntityType() const; 00098 00099 G4ThreeVector GetPointOnSurface() const; 00100 00101 G4VSolid* Clone() const; 00102 00103 std::ostream& StreamInfo( std::ostream& os ) const; 00104 00105 // Visualisation functions 00106 00107 void DescribeYourselfTo ( G4VGraphicsScene& scene ) const; 00108 G4Polyhedron* CreatePolyhedron () const; 00109 00110 public: // without description 00111 00112 G4CutTubs(__void__&); 00113 // 00114 // Fake default constructor for usage restricted to direct object 00115 // persistency for clients requiring preallocation of memory for 00116 // persistifiable objects. 00117 00118 G4CutTubs(const G4CutTubs& rhs); 00119 G4CutTubs& operator=(const G4CutTubs& rhs); 00120 // Copy constructor and assignment operator. 00121 00122 protected: 00123 00124 G4ThreeVectorList* 00125 CreateRotatedVertices( const G4AffineTransform& pTransform ) const; 00126 // 00127 // Creates the List of transformed vertices in the format required 00128 // for G4VSolid:: ClipCrossSection and ClipBetweenSections 00129 00130 G4ThreeVector ApproxSurfaceNormal( const G4ThreeVector& p ) const; 00131 // 00132 // Algorithm for SurfaceNormal() following the original 00133 // specification for points not on the surface 00134 00135 G4bool IsCrossingCutPlanes() const; 00136 // Check if the cutted planes are crossing. 00137 // If 'true' , solid is ill defined 00138 00139 G4double GetCutZ(const G4ThreeVector& p) const; 00140 // Get Z value of the point on Cutted Plane 00141 00142 void GetMaxMinZ(G4double& zmin,G4double& zmax)const; 00143 // Get Max and Min values of Z on Cutted Plane, 00144 // Used for Calculate Extent() 00145 00146 private: 00147 00148 G4ThreeVector fLowNorm, fHighNorm; 00149 // 00150 // Normals of Cut at -/+ Dz 00151 00152 G4bool fPhiFullCutTube; 00153 // 00154 // Flag for identification of section or full tube 00155 }; 00156 00157 #include "G4CutTubs.icc" 00158 00159 #endif