Geant4 Cross Reference |
>> 1 // This code implementation is the intellectual property of >> 2 // the GEANT4 collaboration. 1 // 3 // 2 // ******************************************* << 4 // By copying, distributing or modifying the Program (or any work 3 // * License and Disclaimer << 5 // based on the Program) you indicate your acceptance of this statement, 4 // * << 6 // and all its terms. 5 // * The Geant4 software is copyright of th << 6 // * the Geant4 Collaboration. It is provided << 7 // * conditions of the Geant4 Software License << 8 // * LICENSE and available at http://cern.ch/ << 9 // * include a list of copyright holders. << 10 // * << 11 // * Neither the authors of this software syst << 12 // * institutes,nor the agencies providing fin << 13 // * work make any representation or warran << 14 // * regarding this software system or assum << 15 // * use. Please see the license in the file << 16 // * for the full disclaimer and the limitatio << 17 // * << 18 // * This code implementation is the result << 19 // * technical work of the GEANT4 collaboratio << 20 // * By using, copying, modifying or distri << 21 // * any work based on the software) you ag << 22 // * use in resulting scientific publicati << 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* << 25 // 7 // 26 // G4Trd << 8 // $Id: G4Trd.hh,v 1.2.2.1 1999/12/07 20:48:30 gunter Exp $ >> 9 // GEANT4 tag $Name: geant4-01-00 $ 27 // 10 // 28 // Class description: << 11 >> 12 // class G4Trd >> 13 // >> 14 // A Trd is a trapezoid with the x and y dimensions varying along z >> 15 // functions: >> 16 // >> 17 // As inherited from G4CSGSolid + >> 18 // >> 19 // G4Trd( const G4String& pName, >> 20 // G4double pdx1, G4double pdx2, >> 21 // G4double pdy1, G4double pdy2, >> 22 // G4double pdz ) >> 23 // Construct a trapezoid with name, and half lengths dpx1,dpx2,dpy1, >> 24 // dpy2,dpz >> 25 // >> 26 // G4double GetXHalfLength1() const >> 27 // G4double GetXHalfLength2() const >> 28 // G4double GetYHalfLength1() const >> 29 // G4double GetYHalfLength2() const >> 30 // G4double GetZHalfLength() const >> 31 // >> 32 // Return the respective parameter 29 // 33 // 30 // A G4Trd is a trapezoid with the x and y d << 34 // void SetXHalfLength1(G4double) 31 // functions: << 35 // void SetXHalfLength2(G4double) >> 36 // void SetYHalfLength1(G4double) >> 37 // void SetYHalfLength2(G4double) >> 38 // void SetZHalfLength(G4double) 32 // 39 // 33 // Member Data: << 40 // Set the respective parameter 34 // 41 // >> 42 // Protected: >> 43 // >> 44 // G4ThreeVectorList* >> 45 // CreateRotatedVertices(const G4AffineTransform& pTransform) const >> 46 // >> 47 // Create the List of transformed vertices in the format required >> 48 // for G4CSGSolid:: ClipCrossSection and ClipBetweenSections. >> 49 // >> 50 >> 51 // Member Data: >> 52 35 // fDx1 Half-length along x at the surf 53 // fDx1 Half-length along x at the surface positioned at -dz 36 // fDx2 Half-length along x at the surf 54 // fDx2 Half-length along x at the surface positioned at +dz 37 // fDy1 Half-length along y at the surf 55 // fDy1 Half-length along y at the surface positioned at -dz 38 // fDy2 Half-length along y at the surf 56 // fDy2 Half-length along y at the surface positioned at +dz 39 // fDz Half-length along z axis 57 // fDz Half-length along z axis >> 58 // >> 59 // History: >> 60 // 19.11.99 V.Grichine, kUndefined was added to Eside enum >> 61 // 21.04.97 J. Apostolakis Added Set Methods. >> 62 // 19.08.96 P. Kent, V. Grichine ->Fs in accordance with G4Box >> 63 // 17.02.95 P.Kent Exiting normal return >> 64 // 12.01.95 P.Kent Old prototype code converted to thick geometry 40 65 41 // 12.01.95 P.Kent: Old prototype code convert << 42 // 21.04.97 J.Apostolakis: Added Set Methods << 43 // 19.11.99 V.Grichine: kUndefined was added t << 44 // ------------------------------------------- << 45 #ifndef G4TRD_HH 66 #ifndef G4TRD_HH 46 #define G4TRD_HH 67 #define G4TRD_HH 47 68 48 #include "G4GeomTypes.hh" << 49 << 50 #if defined(G4GEOM_USE_USOLIDS) << 51 #define G4GEOM_USE_UTRD 1 << 52 #endif << 53 << 54 #if defined(G4GEOM_USE_UTRD) << 55 #define G4UTrd G4Trd << 56 #include "G4UTrd.hh" << 57 #else << 58 << 59 #include "G4CSGSolid.hh" 69 #include "G4CSGSolid.hh" 60 #include "G4Polyhedron.hh" << 61 70 62 class G4Trd : public G4CSGSolid << 71 class G4Trd : public G4CSGSolid 63 { 72 { 64 public: 73 public: 65 74 66 G4Trd( const G4String& pName, 75 G4Trd( const G4String& pName, 67 G4double pdx1, G4double pdx2, << 76 G4double pdx1, G4double pdx2, 68 G4double pdy1, G4double pdy2, << 77 G4double pdy1, G4double pdy2, 69 G4double pdz ); << 78 G4double pdz); 70 // << 79 71 // Constructs a trapezoid with name, and << 80 virtual ~G4Trd(); 72 << 81 73 ~G4Trd() override; << 82 // Access functions 74 // << 83 G4double GetXHalfLength1() const 75 // Destructor << 84 { 76 << 85 return fDx1; 77 // Accessors << 86 } 78 << 87 79 inline G4double GetXHalfLength1() const; << 88 G4double GetXHalfLength2() const 80 inline G4double GetXHalfLength2() const; << 89 { 81 inline G4double GetYHalfLength1() const; << 90 return fDx2; 82 inline G4double GetYHalfLength2() const; << 91 } 83 inline G4double GetZHalfLength() const; << 92 84 << 93 G4double GetYHalfLength1() const 85 // Modifiers << 94 { 86 << 95 return fDy1; 87 inline void SetXHalfLength1(G4double val); << 96 } 88 inline void SetXHalfLength2(G4double val); << 97 89 inline void SetYHalfLength1(G4double val); << 98 G4double GetYHalfLength2() const 90 inline void SetYHalfLength2(G4double val); << 99 { 91 inline void SetZHalfLength(G4double val); << 100 return fDy2; 92 << 101 } 93 void SetAllParameters ( G4double pdx1, G4d << 102 94 G4double pdy1, G4d << 103 G4double GetZHalfLength() const 95 G4double pdz ); << 104 { 96 << 105 return fDz; 97 // Methods of solid << 106 } 98 << 107 99 G4double GetCubicVolume() override; << 108 void SetXHalfLength1(G4double val) 100 G4double GetSurfaceArea() override; << 109 { 101 << 110 fDx1= val; 102 void ComputeDimensions( G4VPVParamet << 111 } 103 const G4int n, << 112 void SetXHalfLength2(G4double val) 104 const G4VPhysicalV << 113 { 105 << 114 fDx2= val; 106 void BoundingLimits(G4ThreeVector& pMin, G << 115 } >> 116 void SetYHalfLength1(G4double val) >> 117 { >> 118 fDy1= val; >> 119 } >> 120 void SetYHalfLength2(G4double val) >> 121 { >> 122 fDy2= val; >> 123 } >> 124 void SetZHalfLength(G4double val) >> 125 { >> 126 fDz= val; >> 127 } >> 128 >> 129 void ComputeDimensions(G4VPVParameterisation* p, >> 130 const G4int n, >> 131 const G4VPhysicalVolume* pRep); 107 132 108 G4bool CalculateExtent(const EAxis pAxis, 133 G4bool CalculateExtent(const EAxis pAxis, 109 const G4VoxelLimits << 134 const G4VoxelLimits& pVoxelLimit, 110 const G4AffineTrans << 135 const G4AffineTransform& pTransform, 111 G4double& pMi << 136 G4double& pMin, G4double& pMax) const; 112 137 113 EInside Inside( const G4ThreeVector& p ) c << 114 138 115 G4ThreeVector SurfaceNormal( const G4Three << 139 EInside Inside(const G4ThreeVector& p) const; 116 140 117 G4double DistanceToIn( const G4ThreeVector << 141 G4ThreeVector SurfaceNormal( const G4ThreeVector& p) const; 118 const G4ThreeVector << 119 142 120 G4double DistanceToIn( const G4ThreeVector << 143 G4double DistanceToIn(const G4ThreeVector& p, >> 144 const G4ThreeVector& v) const; 121 145 122 G4double DistanceToOut( const G4ThreeVecto << 146 G4double DistanceToIn(const G4ThreeVector& p) const; 123 const G4ThreeVecto << 124 const G4bool calcN << 125 G4bool* vali << 126 G4ThreeVecto << 127 147 128 G4double DistanceToOut( const G4ThreeVecto << 148 G4double DistanceToOut(const G4ThreeVector& p, >> 149 const G4ThreeVector& v, >> 150 const G4bool calcNorm=false, >> 151 G4bool *validNorm=0, >> 152 G4ThreeVector *n=0) const; 129 153 130 G4GeometryType GetEntityType() const overr << 154 G4double DistanceToOut(const G4ThreeVector& p) const; 131 155 132 G4ThreeVector GetPointOnSurface() const ov << 156 // Naming method (pseudo-RTTI : run-time type identification 133 157 134 G4bool IsFaceted() const override; << 158 virtual G4GeometryType GetEntityType() const { return G4String("G4Trd"); } 135 159 136 G4VSolid* Clone() const override; << 160 // Visualisation functions 137 161 138 std::ostream& StreamInfo( std::ostream& os << 162 void DescribeYourselfTo (G4VGraphicsScene& scene) const; >> 163 G4VisExtent GetExtent () const; >> 164 G4Polyhedron* CreatePolyhedron () const; >> 165 G4NURBS* CreateNURBS () const; 139 166 140 // Visualisation functions << 167 void CheckAndSetAllParameters (G4double pdx1, G4double pdx2, >> 168 G4double pdy1, G4double pdy2, >> 169 G4double pdz); 141 170 142 void DescribeYourselfTo (G4VGraph << 171 void SetAllParameters (G4double pdx1, G4double pdx2, 143 G4Polyhedron* CreatePolyhedron () const << 172 G4double pdy1, G4double pdy2, >> 173 G4double pdz); 144 174 145 G4Trd(__void__&); << 175 protected: 146 // Fake default constructor for usage re << 147 // persistency for clients requiring pre << 148 // persistifiable objects. << 149 176 150 G4Trd(const G4Trd& rhs); << 177 G4ThreeVectorList* 151 G4Trd& operator=(const G4Trd& rhs); << 178 CreateRotatedVertices(const G4AffineTransform& pTransform) const; 152 // Copy constructor and assignment opera << 179 >> 180 G4double fDx1,fDx2,fDy1,fDy2,fDz; 153 181 154 private: << 182 // Codes for faces (kPX=plus x face,kMY= minus y face etc) 155 183 156 void CheckParameters(); << 184 enum ESide {kUndefined, kPX,kMX,kPY,kMY,kPZ,kMZ}; 157 // Check parameters << 185 >> 186 }; >> 187 >> 188 #endif 158 189 159 void MakePlanes(); << 160 // Set side planes << 161 190 162 G4ThreeVector ApproxSurfaceNormal( const G << 163 // Algorithm for SurfaceNormal() followi << 164 // specification for points not on the s << 165 191 166 private: << 167 192 168 G4double halfCarTolerance; << 169 G4double fDx1,fDx2,fDy1,fDy2,fDz,fHx,fHy; << 170 struct { G4double a,b,c,d; } fPlanes[4]; << 171 }; << 172 193 173 #include "G4Trd.icc" << 174 194 175 #endif << 176 195 177 #endif << 178 196