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 << 7 // 6 // * the Geant4 Collaboration. It is provided << 8 // $Id: G4Para.hh,v 1.6 2000/11/02 17:06:39 gcosmo Exp $ 7 // * conditions of the Geant4 Software License << 9 // GEANT4 tag $Name: geant4-03-01 $ 8 // * LICENSE and available at http://cern.ch/ << 10 // 9 // * include a list of copyright holders. << 11 // 10 // * << 12 // -------------------------------------------------------------------- 11 // * Neither the authors of this software syst << 13 // GEANT 4 class header file 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 // 14 // 26 // G4Para 15 // G4Para 27 // 16 // 28 // Class description: 17 // Class description: 29 // 18 // 30 // A G4Parallepiped, essentially a box with 19 // A G4Parallepiped, essentially a box with half lengths dx,dy,dz 31 // `skewed' so that there are angles theta & 20 // `skewed' so that there are angles theta & phi of the polar line 32 // joining the faces at +-dz in z, and alpha 21 // joining the faces at +-dz in z, and alpha formed by the y axis 33 // and the plane joinng the centre of the fa 22 // and the plane joinng the centre of the faces G4Parallel to the 34 // z-x plane at -dy and +dy. 23 // z-x plane at -dy and +dy. 35 // 24 // 36 // A G4Para is defined by: 25 // A G4Para is defined by: 37 // dx,dy,dz - Half-length in x,y,z << 26 // dx,dy,dz Half-length in x,y,z 38 // alpha - Angle formed by the y axis and << 27 // alpha Angle formed by the y axis and by the plane joining 39 // the centre of the faces G4Para << 28 // the centre of the faces G4Parallel to the z-x plane 40 // at -dy and +dy << 29 // at -dy and +dy 41 // theta - Polar angle of the line joinin << 30 // theta Polar angle of the line joining the centres of the 42 // faces at -dz and +dz in z << 31 // faces at -dz and +dz in z 43 // phi - Azimuthal angle of the line jo << 32 // phi Azimuthal angle of the line joining the centres of the 44 // faces at -dz and +dz in z << 33 // faces at -dz and +dz in z 45 // Member data: 34 // Member data: 46 // 35 // 47 // Note that the angles parameters are not s 36 // Note that the angles parameters are not stored - precomputed trig is 48 // stored instead. 37 // stored instead. 49 // 38 // 50 // fDx Half-length in x 39 // fDx Half-length in x 51 // fDy Half-length in y 40 // fDy Half-length in y 52 // fDz Half-length in z 41 // fDz Half-length in z 53 // 42 // 54 // fTalpha Tan of alpha 43 // fTalpha Tan of alpha 55 // fTthetaCphi Tan theta * Cos phi 44 // fTthetaCphi Tan theta * Cos phi 56 // fTthetaSphi Tan theta * Sin phi 45 // fTthetaSphi Tan theta * Sin phi 57 46 >> 47 // History: 58 // 21.3.94 P.Kent Old C++ code converted to to 48 // 21.3.94 P.Kent Old C++ code converted to tolerant geometry 59 // 31.10.96 V.Grichine Modifications according 49 // 31.10.96 V.Grichine Modifications according G4Box/Tubs before to commit >> 50 // 18.11.99 V.Grichine , kUndefined was added to ESide 60 // ------------------------------------------- 51 // -------------------------------------------------------------------- 61 #ifndef G4PARA_HH << 62 #define G4PARA_HH << 63 52 64 #include "G4GeomTypes.hh" << 53 #ifndef G4Para_HH 65 << 54 #define G4Para_HH 66 #if defined(G4GEOM_USE_USOLIDS) << 67 #define G4GEOM_USE_UPARA 1 << 68 #endif << 69 << 70 #if defined(G4GEOM_USE_UPARA) << 71 #define G4UPara G4Para << 72 #include "G4UPara.hh" << 73 #else << 74 55 75 #include "G4CSGSolid.hh" 56 #include "G4CSGSolid.hh" 76 #include "G4Polyhedron.hh" << 77 57 78 class G4Para : public G4CSGSolid 58 class G4Para : public G4CSGSolid 79 { 59 { 80 public: // with description << 60 public: 81 << 82 G4Para(const G4String& pName, << 83 G4double pDx, G4double pDy, G << 84 G4double pAlpha, G4double pTh << 85 61 86 G4Para(const G4String& pName, 62 G4Para(const G4String& pName, 87 const G4ThreeVector pt[8]); << 63 G4double pDx, G4double pDy, G4double pDz, 88 << 64 G4double pAlpha, G4double pTheta, G4double pPhi); 89 ~G4Para() override; << 65 90 << 66 G4Para( const G4String& pName, 91 // Accessors << 67 const G4ThreeVector pt[8]) ; 92 << 68 93 inline G4double GetZHalfLength() const; << 69 virtual ~G4Para() ; 94 inline G4ThreeVector GetSymAxis() const; << 70 95 inline G4double GetYHalfLength() const; << 71 // Access functions 96 inline G4double GetXHalfLength() const; << 72 97 inline G4double GetTanAlpha() const; << 73 G4double GetZHalfLength() const { return fDz ; } 98 << 74 G4ThreeVector GetSymAxis() const 99 inline G4double GetAlpha() const; << 75 { 100 inline G4double GetTheta() const; << 76 G4double cosTheta = 1.0/sqrt(1+fTthetaCphi*fTthetaCphi + 101 inline G4double GetPhi() const; << 77 fTthetaSphi*fTthetaSphi) ; 102 // Obtain (re)computed values of original << 78 103 << 79 return G4ThreeVector(fTthetaCphi*cosTheta, 104 // Modifiers << 80 fTthetaSphi*cosTheta, 105 << 81 cosTheta) ; 106 inline void SetXHalfLength(G4double val); << 82 } 107 inline void SetYHalfLength(G4double val); << 83 G4double GetYHalfLength() const { return fDy ; } 108 inline void SetZHalfLength(G4double val); << 84 G4double GetXHalfLength() const { return fDx ; } 109 inline void SetAlpha(G4double alpha); << 85 G4double GetTanAlpha() const { return fTalpha ; } 110 inline void SetTanAlpha(G4double val); << 86 111 inline void SetThetaAndPhi(G4double pTheta << 87 // Set functions 112 << 88 113 void SetAllParameters(G4double pDx, G4doub << 89 void SetXHalfLength(G4double val) { fDx= val; } >> 90 void SetYHalfLength(G4double val) { fDy= val; } >> 91 void SetZHalfLength(G4double val) { fDz= val; } >> 92 void SetAlpha(G4double alpha) { fTalpha= tan(alpha); } >> 93 void SetTanAlpha(G4double val) { fTalpha= val; } >> 94 void SetThetaAndPhi(double pTheta, double pPhi) >> 95 { >> 96 fTthetaCphi=tan(pTheta)*cos(pPhi); >> 97 fTthetaSphi=tan(pTheta)*sin(pPhi); >> 98 } >> 99 void SetAllParameters(G4double pDx, G4double pDy, G4double pDz, 114 G4double pAlpha, G4d 100 G4double pAlpha, G4double pTheta, G4double pPhi); 115 << 101 116 // Methods of solid << 102 // Methods 117 << 103 118 G4double GetCubicVolume() override; << 119 G4double GetSurfaceArea() override; << 120 << 121 void ComputeDimensions(G4VPVParameterisati 104 void ComputeDimensions(G4VPVParameterisation* p, 122 const G4int n, 105 const G4int n, 123 const G4VPhysicalVo << 106 const G4VPhysicalVolume* pRep); 124 << 125 void BoundingLimits(G4ThreeVector& pMin, G << 126 107 127 G4bool CalculateExtent(const EAxis pAxis, 108 G4bool CalculateExtent(const EAxis pAxis, 128 const G4VoxelLimits 109 const G4VoxelLimits& pVoxelLimit, 129 const G4AffineTrans 110 const G4AffineTransform& pTransform, 130 G4double& pMi << 111 G4double& pMin, G4double& pMax) const; >> 112 >> 113 EInside Inside(const G4ThreeVector& p) const; 131 114 132 EInside Inside(const G4ThreeVector& p) con << 115 G4ThreeVector SurfaceNormal( const G4ThreeVector& p) const; 133 << 134 G4ThreeVector SurfaceNormal( const G4Three << 135 116 136 G4double DistanceToIn(const G4ThreeVector& 117 G4double DistanceToIn(const G4ThreeVector& p, 137 const G4ThreeVector& << 118 const G4ThreeVector& v) const; 138 G4double DistanceToIn(const G4ThreeVector& << 119 G4double DistanceToIn(const G4ThreeVector& p) const; 139 << 120 140 G4double DistanceToOut(const G4ThreeVector << 121 G4double DistanceToOut(const G4ThreeVector& p,const G4ThreeVector& v, 141 const G4bool calcNo << 122 const G4bool calcNorm=G4bool(false), 142 G4bool* valid << 123 G4bool *validNorm=0,G4ThreeVector *n=0) const; 143 G4ThreeVector << 124 G4double DistanceToOut(const G4ThreeVector& p) const; 144 G4double DistanceToOut(const G4ThreeVector << 145 << 146 G4GeometryType GetEntityType() const overr << 147 << 148 G4ThreeVector GetPointOnSurface() const ov << 149 125 150 G4bool IsFaceted() const override; << 126 // Naming method (pseudo-RTTI : run-time type identification 151 127 152 G4VSolid* Clone() const override; << 128 G4GeometryType GetEntityType() const { return G4String("G4Para"); } 153 129 154 std::ostream& StreamInfo(std::ostream& os) << 130 // Visualisation functions 155 131 156 // Visualisation functions << 132 void DescribeYourselfTo (G4VGraphicsScene& scene) const; >> 133 G4Polyhedron* CreatePolyhedron () const; >> 134 G4NURBS* CreateNURBS () const; 157 135 158 void DescribeYourselfTo (G4VGraph << 136 protected: 159 G4Polyhedron* CreatePolyhedron () const << 160 137 161 G4Para(__void__&); << 138 G4ThreeVectorList* 162 // Fake default constructor for usage re << 139 CreateRotatedVertices(const G4AffineTransform& pTransform) const; 163 // persistency for clients requiring pre << 164 // persistifiable objects << 165 << 166 G4Para(const G4Para& rhs); << 167 G4Para& operator=(const G4Para& rhs); << 168 // Copy constructor and assignment opera << 169 140 170 private: 141 private: 171 142 172 void CheckParameters(); << 173 // Check parameters << 174 << 175 void MakePlanes(); << 176 // Set side planes << 177 << 178 G4ThreeVector ApproxSurfaceNormal(const G4 << 179 // Algorithm for SurfaceNormal() followi << 180 // specification for points not on the s << 181 << 182 << 183 private: << 184 << 185 G4double halfCarTolerance; << 186 G4double fDx,fDy,fDz; 143 G4double fDx,fDy,fDz; 187 G4double fTalpha,fTthetaCphi,fTthetaSphi; 144 G4double fTalpha,fTthetaCphi,fTthetaSphi; 188 struct { G4double a,b,c,d; } fPlanes[4]; << 189 }; 145 }; 190 << 146 191 #include "G4Para.icc" << 192 << 193 #endif << 194 << 195 #endif 147 #endif 196 148