| 1 | //
|
|---|
| 2 | // ********************************************************************
|
|---|
| 3 | // * License and Disclaimer *
|
|---|
| 4 | // * *
|
|---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of *
|
|---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and *
|
|---|
| 7 | // * conditions of the Geant4 Software License, included in the file *
|
|---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These *
|
|---|
| 9 | // * include a list of copyright holders. *
|
|---|
| 10 | // * *
|
|---|
| 11 | // * Neither the authors of this software system, nor their employing *
|
|---|
| 12 | // * institutes,nor the agencies providing financial support for this *
|
|---|
| 13 | // * work make any representation or warranty, express or implied, *
|
|---|
| 14 | // * regarding this software system or assume any liability for its *
|
|---|
| 15 | // * use. Please see the license in the file LICENSE and URL above *
|
|---|
| 16 | // * for the full disclaimer and the limitation of liability. *
|
|---|
| 17 | // * *
|
|---|
| 18 | // * This code implementation is the result of the scientific and *
|
|---|
| 19 | // * technical work of the GEANT4 collaboration. *
|
|---|
| 20 | // * By using, copying, modifying or distributing the software (or *
|
|---|
| 21 | // * any work based on the software) you agree to acknowledge its *
|
|---|
| 22 | // * use in resulting scientific publications, and indicate your *
|
|---|
| 23 | // * acceptance of all terms of the Geant4 Software license. *
|
|---|
| 24 | // ********************************************************************
|
|---|
| 25 | //
|
|---|
| 26 | //
|
|---|
| 27 | // $Id: G4Polyhedra.hh,v 1.20 2008/05/15 13:45:15 gcosmo Exp $
|
|---|
| 28 | // GEANT4 tag $Name: geant4-09-04-beta-01 $
|
|---|
| 29 | //
|
|---|
| 30 | //
|
|---|
| 31 | // --------------------------------------------------------------------
|
|---|
| 32 | // GEANT 4 class header file
|
|---|
| 33 | //
|
|---|
| 34 | //
|
|---|
| 35 | // G4Polyhedra.hh
|
|---|
| 36 | //
|
|---|
| 37 | // Class description:
|
|---|
| 38 | //
|
|---|
| 39 | // Class implementing a CSG-like type "PGON" Geant 3.21 volume,
|
|---|
| 40 | // inherited from class G4VCSGfaceted:
|
|---|
| 41 | //
|
|---|
| 42 | // G4Polyhedra( const G4String& name,
|
|---|
| 43 | // G4double phiStart, - initial phi starting angle
|
|---|
| 44 | // G4double phiTotal, - total phi angle
|
|---|
| 45 | // G4int numSide, - number sides
|
|---|
| 46 | // G4int numZPlanes, - number of z planes
|
|---|
| 47 | // const G4double zPlane[], - position of z planes
|
|---|
| 48 | // const G4double rInner[], - tangent distance to inner surface
|
|---|
| 49 | // const G4double rOuter[] ) - tangent distance to outer surface
|
|---|
| 50 | //
|
|---|
| 51 | // G4Polyhedra( const G4String& name,
|
|---|
| 52 | // G4double phiStart, - initial phi starting angle
|
|---|
| 53 | // G4double phiTotal, - total phi angle
|
|---|
| 54 | // G4int numSide, - number sides
|
|---|
| 55 | // G4int numRZ, - number corners in r,z space
|
|---|
| 56 | // const G4double r[], - r coordinate of these corners
|
|---|
| 57 | // const G4double z[] ) - z coordinate of these corners
|
|---|
| 58 |
|
|---|
| 59 | // Author:
|
|---|
| 60 | // David C. Williams (davidw@scipp.ucsc.edu)
|
|---|
| 61 | // --------------------------------------------------------------------
|
|---|
| 62 |
|
|---|
| 63 | #ifndef G4Polyhedra_hh
|
|---|
| 64 | #define G4Polyhedra_hh
|
|---|
| 65 |
|
|---|
| 66 | #include "G4VCSGfaceted.hh"
|
|---|
| 67 | #include "G4PolyhedraSide.hh"
|
|---|
| 68 |
|
|---|
| 69 | class G4EnclosingCylinder;
|
|---|
| 70 | class G4ReduciblePolygon;
|
|---|
| 71 | class G4PolyhedraHistorical
|
|---|
| 72 | {
|
|---|
| 73 | public:
|
|---|
| 74 |
|
|---|
| 75 | G4PolyhedraHistorical();
|
|---|
| 76 | ~G4PolyhedraHistorical();
|
|---|
| 77 | G4PolyhedraHistorical( const G4PolyhedraHistorical &source );
|
|---|
| 78 | G4PolyhedraHistorical& operator=( const G4PolyhedraHistorical& right );
|
|---|
| 79 |
|
|---|
| 80 | G4double Start_angle;
|
|---|
| 81 | G4double Opening_angle;
|
|---|
| 82 | G4int numSide;
|
|---|
| 83 | G4int Num_z_planes;
|
|---|
| 84 | G4double *Z_values;
|
|---|
| 85 | G4double *Rmin;
|
|---|
| 86 | G4double *Rmax;
|
|---|
| 87 | };
|
|---|
| 88 |
|
|---|
| 89 | class G4Polyhedra : public G4VCSGfaceted
|
|---|
| 90 | {
|
|---|
| 91 | public: // with description
|
|---|
| 92 |
|
|---|
| 93 | G4Polyhedra( const G4String& name,
|
|---|
| 94 | G4double phiStart, // initial phi starting angle
|
|---|
| 95 | G4double phiTotal, // total phi angle
|
|---|
| 96 | G4int numSide, // number sides
|
|---|
| 97 | G4int numZPlanes, // number of z planes
|
|---|
| 98 | const G4double zPlane[], // position of z planes
|
|---|
| 99 | const G4double rInner[], // tangent distance to inner surface
|
|---|
| 100 | const G4double rOuter[] ); // tangent distance to outer surface
|
|---|
| 101 |
|
|---|
| 102 | G4Polyhedra( const G4String& name,
|
|---|
| 103 | G4double phiStart, // initial phi starting angle
|
|---|
| 104 | G4double phiTotal, // total phi angle
|
|---|
| 105 | G4int numSide, // number sides
|
|---|
| 106 | G4int numRZ, // number corners in r,z space
|
|---|
| 107 | const G4double r[], // r coordinate of these corners
|
|---|
| 108 | const G4double z[] ); // z coordinate of these corners
|
|---|
| 109 |
|
|---|
| 110 | virtual ~G4Polyhedra();
|
|---|
| 111 |
|
|---|
| 112 | G4Polyhedra( const G4Polyhedra &source );
|
|---|
| 113 | const G4Polyhedra &operator=( const G4Polyhedra &source );
|
|---|
| 114 |
|
|---|
| 115 | // Methods for solid
|
|---|
| 116 |
|
|---|
| 117 | EInside Inside( const G4ThreeVector &p ) const;
|
|---|
| 118 | G4double DistanceToIn( const G4ThreeVector &p,
|
|---|
| 119 | const G4ThreeVector &v ) const;
|
|---|
| 120 | G4double DistanceToIn( const G4ThreeVector &p ) const;
|
|---|
| 121 |
|
|---|
| 122 | void ComputeDimensions( G4VPVParameterisation* p,
|
|---|
| 123 | const G4int n,
|
|---|
| 124 | const G4VPhysicalVolume* pRep);
|
|---|
| 125 |
|
|---|
| 126 | G4GeometryType GetEntityType() const;
|
|---|
| 127 |
|
|---|
| 128 | G4ThreeVector GetPointOnSurface() const;
|
|---|
| 129 |
|
|---|
| 130 | std::ostream& StreamInfo( std::ostream& os ) const;
|
|---|
| 131 |
|
|---|
| 132 | G4Polyhedron* CreatePolyhedron() const;
|
|---|
| 133 | G4NURBS* CreateNURBS() const;
|
|---|
| 134 |
|
|---|
| 135 | G4bool Reset();
|
|---|
| 136 |
|
|---|
| 137 | // Accessors
|
|---|
| 138 |
|
|---|
| 139 | inline G4int GetNumSide() const;
|
|---|
| 140 | inline G4double GetStartPhi() const;
|
|---|
| 141 | inline G4double GetEndPhi() const;
|
|---|
| 142 | inline G4bool IsOpen() const;
|
|---|
| 143 | inline G4bool IsGeneric() const;
|
|---|
| 144 | inline G4int GetNumRZCorner() const;
|
|---|
| 145 | inline G4PolyhedraSideRZ GetCorner( const G4int index ) const;
|
|---|
| 146 |
|
|---|
| 147 | inline G4PolyhedraHistorical* GetOriginalParameters() const;
|
|---|
| 148 | // Returns internal scaled parameters.
|
|---|
| 149 | inline void SetOriginalParameters(G4PolyhedraHistorical* pars);
|
|---|
| 150 | // Sets internal parameters. Parameters 'Rmin' and 'Rmax' in input must
|
|---|
| 151 | // be scaled first by a factor computed as 'cos(0.5*phiTotal/theNumSide)',
|
|---|
| 152 | // if not already scaled.
|
|---|
| 153 |
|
|---|
| 154 | public: // without description
|
|---|
| 155 |
|
|---|
| 156 | G4Polyhedra(__void__&);
|
|---|
| 157 | // Fake default constructor for usage restricted to direct object
|
|---|
| 158 | // persistency for clients requiring preallocation of memory for
|
|---|
| 159 | // persistifiable objects.
|
|---|
| 160 |
|
|---|
| 161 | protected: // without description
|
|---|
| 162 |
|
|---|
| 163 | inline void SetOriginalParameters();
|
|---|
| 164 | // Sets internal parameters for the generic constructor.
|
|---|
| 165 |
|
|---|
| 166 | void Create( G4double phiStart, // initial phi starting angle
|
|---|
| 167 | G4double phiTotal, // total phi angle
|
|---|
| 168 | G4int numSide, // number sides
|
|---|
| 169 | G4ReduciblePolygon *rz ); // rz coordinates
|
|---|
| 170 | // Generates the shape and is called by each constructor, after the
|
|---|
| 171 | // conversion of the arguments
|
|---|
| 172 |
|
|---|
| 173 | void CopyStuff( const G4Polyhedra &source );
|
|---|
| 174 | void DeleteStuff();
|
|---|
| 175 |
|
|---|
| 176 | // Methods for generation of random points on surface
|
|---|
| 177 |
|
|---|
| 178 | G4ThreeVector GetPointOnPlane(G4ThreeVector p0, G4ThreeVector p1,
|
|---|
| 179 | G4ThreeVector p2, G4ThreeVector p3) const;
|
|---|
| 180 | G4ThreeVector GetPointOnTriangle(G4ThreeVector p0, G4ThreeVector p1,
|
|---|
| 181 | G4ThreeVector p2) const;
|
|---|
| 182 | G4ThreeVector GetPointOnSurfaceCorners() const;
|
|---|
| 183 |
|
|---|
| 184 | protected: // without description
|
|---|
| 185 |
|
|---|
| 186 | G4int numSide; // Number of sides
|
|---|
| 187 | G4double startPhi; // Starting phi value (0 < phiStart < 2pi)
|
|---|
| 188 | G4double endPhi; // end phi value (0 < endPhi-phiStart < 2pi)
|
|---|
| 189 | G4bool phiIsOpen; // true if there is a phi segment
|
|---|
| 190 | G4bool genericPgon; // true if created through the 2nd generic constructor
|
|---|
| 191 | G4int numCorner; // number RZ points
|
|---|
| 192 | G4PolyhedraSideRZ *corners; // our corners
|
|---|
| 193 | G4PolyhedraHistorical *original_parameters; // original input parameters
|
|---|
| 194 |
|
|---|
| 195 | G4EnclosingCylinder *enclosingCylinder;
|
|---|
| 196 |
|
|---|
| 197 | };
|
|---|
| 198 |
|
|---|
| 199 | #include "G4Polyhedra.icc"
|
|---|
| 200 |
|
|---|
| 201 | #endif
|
|---|