[831] | 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 | // |
---|
[850] | 27 | // $Id: G4Polycone.hh,v 1.22 2008/05/15 13:45:15 gcosmo Exp $ |
---|
[1337] | 28 | // GEANT4 tag $Name: geant4-09-04-beta-01 $ |
---|
[831] | 29 | // |
---|
| 30 | // |
---|
| 31 | // -------------------------------------------------------------------- |
---|
| 32 | // GEANT 4 class header file |
---|
| 33 | // |
---|
| 34 | // |
---|
| 35 | // G4Polycone |
---|
| 36 | // |
---|
| 37 | // Class description: |
---|
| 38 | // |
---|
| 39 | // Class implementing a CSG-like type "PCON" Geant 3.21 volume, |
---|
| 40 | // inherited from class G4VCSGfaceted: |
---|
| 41 | // |
---|
| 42 | // G4Polycone( const G4String& name, |
---|
| 43 | // G4double phiStart, // initial phi starting angle |
---|
| 44 | // G4double phiTotal, // total phi angle |
---|
| 45 | // G4int numZPlanes, // number of z planes |
---|
| 46 | // const G4double zPlane[], // position of z planes |
---|
| 47 | // const G4double rInner[], // tangent distance to inner surface |
---|
| 48 | // const G4double rOuter[]) // tangent distance to outer surface |
---|
| 49 | // |
---|
| 50 | // G4Polycone( const G4String& name, |
---|
| 51 | // G4double phiStart, // initial phi starting angle |
---|
| 52 | // G4double phiTotal, // total phi angle |
---|
| 53 | // G4int numRZ, // number corners in r,z space |
---|
| 54 | // const G4double r[], // r coordinate of these corners |
---|
| 55 | // const G4double z[]) // z coordinate of these corners |
---|
| 56 | |
---|
| 57 | // Author: |
---|
| 58 | // David C. Williams (davidw@scipp.ucsc.edu) |
---|
| 59 | // -------------------------------------------------------------------- |
---|
| 60 | |
---|
| 61 | #ifndef G4Polycone_hh |
---|
| 62 | #define G4Polycone_hh |
---|
| 63 | |
---|
| 64 | #include "G4VCSGfaceted.hh" |
---|
| 65 | #include "G4PolyconeSide.hh" |
---|
| 66 | |
---|
| 67 | class G4EnclosingCylinder; |
---|
| 68 | class G4ReduciblePolygon; |
---|
| 69 | class G4VCSGface; |
---|
| 70 | class G4PolyconeHistorical |
---|
| 71 | { |
---|
| 72 | public: |
---|
| 73 | G4PolyconeHistorical(); |
---|
| 74 | ~G4PolyconeHistorical(); |
---|
| 75 | G4PolyconeHistorical( const G4PolyconeHistorical& source ); |
---|
| 76 | G4PolyconeHistorical& operator=( const G4PolyconeHistorical& right ); |
---|
| 77 | |
---|
| 78 | G4double Start_angle; |
---|
| 79 | G4double Opening_angle; |
---|
| 80 | G4int Num_z_planes; |
---|
| 81 | G4double *Z_values; |
---|
| 82 | G4double *Rmin; |
---|
| 83 | G4double *Rmax; |
---|
| 84 | }; |
---|
| 85 | |
---|
| 86 | class G4Polycone : public G4VCSGfaceted |
---|
| 87 | { |
---|
| 88 | |
---|
| 89 | public: // with description |
---|
| 90 | |
---|
| 91 | G4Polycone( const G4String& name, |
---|
| 92 | G4double phiStart, // initial phi starting angle |
---|
| 93 | G4double phiTotal, // total phi angle |
---|
| 94 | G4int numZPlanes, // number of z planes |
---|
| 95 | const G4double zPlane[], // position of z planes |
---|
| 96 | const G4double rInner[], // tangent distance to inner surface |
---|
| 97 | const G4double rOuter[] ); // tangent distance to outer surface |
---|
| 98 | |
---|
| 99 | G4Polycone( const G4String& name, |
---|
| 100 | G4double phiStart, // initial phi starting angle |
---|
| 101 | G4double phiTotal, // total phi angle |
---|
| 102 | G4int numRZ, // number corners in r,z space |
---|
| 103 | const G4double r[], // r coordinate of these corners |
---|
| 104 | const G4double z[] ); // z coordinate of these corners |
---|
| 105 | |
---|
| 106 | virtual ~G4Polycone(); |
---|
| 107 | |
---|
| 108 | G4Polycone( const G4Polycone &source ); |
---|
| 109 | const G4Polycone &operator=( const G4Polycone &source ); |
---|
| 110 | |
---|
| 111 | // Methods for solid |
---|
| 112 | |
---|
| 113 | EInside Inside( const G4ThreeVector &p ) const; |
---|
| 114 | G4double DistanceToIn( const G4ThreeVector &p, const G4ThreeVector &v ) const; |
---|
| 115 | G4double DistanceToIn( const G4ThreeVector &p ) const; |
---|
| 116 | |
---|
| 117 | G4ThreeVector GetPointOnSurface() const; |
---|
[850] | 118 | |
---|
[831] | 119 | void ComputeDimensions( G4VPVParameterisation* p, |
---|
| 120 | const G4int n, |
---|
| 121 | const G4VPhysicalVolume* pRep ); |
---|
| 122 | |
---|
| 123 | G4GeometryType GetEntityType() const; |
---|
| 124 | |
---|
| 125 | std::ostream& StreamInfo(std::ostream& os) const; |
---|
| 126 | |
---|
| 127 | G4Polyhedron* CreatePolyhedron() const; |
---|
| 128 | G4NURBS* CreateNURBS() const; |
---|
| 129 | |
---|
| 130 | G4bool Reset(); |
---|
| 131 | |
---|
| 132 | // Accessors |
---|
| 133 | |
---|
| 134 | inline G4double GetStartPhi() const; |
---|
| 135 | inline G4double GetEndPhi() const; |
---|
| 136 | inline G4bool IsOpen() const; |
---|
| 137 | inline G4bool IsGeneric() const; |
---|
| 138 | inline G4int GetNumRZCorner() const; |
---|
| 139 | inline G4PolyconeSideRZ GetCorner(G4int index) const; |
---|
| 140 | inline G4PolyconeHistorical* GetOriginalParameters() const; |
---|
| 141 | inline void SetOriginalParameters(G4PolyconeHistorical* pars); |
---|
| 142 | |
---|
| 143 | public: // without description |
---|
| 144 | |
---|
| 145 | G4Polycone(__void__&); |
---|
| 146 | // Fake default constructor for usage restricted to direct object |
---|
| 147 | // persistency for clients requiring preallocation of memory for |
---|
| 148 | // persistifiable objects. |
---|
| 149 | |
---|
| 150 | protected: // without description |
---|
| 151 | |
---|
| 152 | // Generic initializer, called by all constructors |
---|
| 153 | |
---|
| 154 | inline void SetOriginalParameters(); |
---|
| 155 | |
---|
| 156 | void Create( G4double phiStart, // initial phi starting angle |
---|
| 157 | G4double phiTotal, // total phi angle |
---|
| 158 | G4ReduciblePolygon *rz ); // r/z coordinate of these corners |
---|
| 159 | |
---|
| 160 | void CopyStuff( const G4Polycone &source ); |
---|
| 161 | |
---|
| 162 | // Methods for random point generation |
---|
| 163 | |
---|
| 164 | G4ThreeVector GetPointOnCone(G4double fRmin1, G4double fRmax1, |
---|
| 165 | G4double fRmin2, G4double fRmax2, |
---|
| 166 | G4double zOne, G4double zTwo, |
---|
| 167 | G4double& totArea) const; |
---|
| 168 | |
---|
| 169 | G4ThreeVector GetPointOnTubs(G4double fRMin, G4double fRMax, |
---|
| 170 | G4double zOne, G4double zTwo, |
---|
| 171 | G4double& totArea) const; |
---|
| 172 | |
---|
| 173 | G4ThreeVector GetPointOnCut(G4double fRMin1, G4double fRMax1, |
---|
| 174 | G4double fRMin2, G4double fRMax2, |
---|
| 175 | G4double zOne, G4double zTwo, |
---|
| 176 | G4double& totArea) const; |
---|
| 177 | |
---|
| 178 | G4ThreeVector GetPointOnRing(G4double fRMin, G4double fRMax, |
---|
| 179 | G4double fRMin2, G4double fRMax2, |
---|
| 180 | G4double zOne) const; |
---|
| 181 | |
---|
| 182 | protected: // without description |
---|
| 183 | |
---|
| 184 | // Here are our parameters |
---|
| 185 | |
---|
| 186 | G4double startPhi; // Starting phi value (0 < phiStart < 2pi) |
---|
| 187 | G4double endPhi; // end phi value (0 < endPhi-phiStart < 2pi) |
---|
| 188 | G4bool phiIsOpen; // true if there is a phi segment |
---|
| 189 | G4bool genericPcon; // true if created through the 2nd generic constructor |
---|
| 190 | G4int numCorner; // number RZ points |
---|
| 191 | G4PolyconeSideRZ *corners; // corner r,z points |
---|
| 192 | G4PolyconeHistorical *original_parameters; // original input parameters |
---|
| 193 | |
---|
| 194 | // Our quick test |
---|
| 195 | |
---|
| 196 | G4EnclosingCylinder *enclosingCylinder; |
---|
| 197 | |
---|
| 198 | }; |
---|
| 199 | |
---|
| 200 | #include "G4Polycone.icc" |
---|
| 201 | |
---|
| 202 | #endif |
---|