Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // >> 23 // >> 24 // $Id: G4TwistTubsSide.hh,v 1.4 2005/12/06 18:21:15 gcosmo Exp $ >> 25 // GEANT4 tag $Name: geant4-08-00 $ >> 26 // >> 27 // >> 28 // -------------------------------------------------------------------- >> 29 // GEANT 4 class header file >> 30 // >> 31 // 26 // G4TwistTubsSide 32 // G4TwistTubsSide 27 // 33 // 28 // Class description: 34 // Class description: 29 // 35 // 30 // Class describing a twisted boundary surface << 36 // Class describing a twisted boundary surface for a cylinder. 31 37 32 // 01-Aug-2002 - Kotoyo Hoshina (hoshina@hepbu << 38 // Author: 33 // 13-Nov-2003 - O.Link (Oliver.Link@cern.ch), << 39 // 01-Aug-2002 - Kotoyo Hoshina (hoshina@hepburn.s.chiba-u.ac.jp) 34 // from original version in Jupi << 40 // >> 41 // History: >> 42 // 13-Nov-2003 - O.Link (Oliver.Link@cern.ch), Integration in Geant4 >> 43 // from original version in Jupiter-2.5.02 application. 35 // ------------------------------------------- 44 // -------------------------------------------------------------------- 36 #ifndef G4TWISTTUBSSIDE_HH << 45 #ifndef __G4TWISTTUBSSIDE__ 37 #define G4TWISTTUBSSIDE_HH << 46 #define __G4TWISTTUBSSIDE__ 38 47 39 #include "G4VTwistSurface.hh" 48 #include "G4VTwistSurface.hh" 40 49 41 class G4TwistTubsSide : public G4VTwistSurface 50 class G4TwistTubsSide : public G4VTwistSurface 42 { 51 { 43 public: << 52 public: // with description 44 53 45 G4TwistTubsSide(const G4String& na << 54 G4TwistTubsSide(const G4String &name, 46 const G4RotationMatrix& ro << 55 const G4RotationMatrix &rot, // 0.5*(phi-width segment) 47 const G4ThreeVector& tl << 56 const G4ThreeVector &tlate, 48 G4int handedness, << 57 G4int handedness, // R-hand = 1, L-hand = -1 49 const G4double kappa, << 58 const G4double kappa, // tan(TwistAngle/2)/fZHalfLen 50 const EAxis axis0 = kXA << 59 const EAxis axis0 = kXAxis, 51 const EAxis axis1 = kZA << 60 const EAxis axis1 = kZAxis, 52 G4double axis0min = << 61 G4double axis0min = -kInfinity, 53 G4double axis1min = << 62 G4double axis1min = -kInfinity, 54 G4double axis0max = << 63 G4double axis0max = kInfinity, 55 G4double axis1max = << 64 G4double axis1max = kInfinity ); 56 << 65 57 G4TwistTubsSide(const G4String& name, << 66 G4TwistTubsSide(const G4String &name, 58 G4double EndInnerRa << 67 G4double EndInnerRadius[2], 59 G4double EndOuterRa << 68 G4double EndOuterRadius[2], 60 G4double DPhi, << 69 G4double DPhi, 61 G4double EndPhi[2], << 70 G4double EndPhi[2], 62 G4double EndZ[2], << 71 G4double EndZ[2], 63 G4double InnerRadiu << 72 G4double InnerRadius, 64 G4double OuterRadiu << 73 G4double OuterRadius, 65 G4double Kappa, << 74 G4double Kappa, 66 G4int handedness << 75 G4int handedness); 67 << 68 ~G4TwistTubsSide() override; << 69 << 70 G4ThreeVector GetNormal(const G4ThreeVecto << 71 G4bool isGlo << 72 << 73 G4int DistanceToSurface(const G4ThreeVecto << 74 const G4ThreeVecto << 75 G4ThreeVecto << 76 G4double di << 77 G4int ar << 78 G4bool is << 79 EValidate validate << 80 << 81 G4int DistanceToSurface(const G4ThreeVecto << 82 G4ThreeVecto << 83 G4double << 84 G4int << 85 << 86 inline G4ThreeVector ProjectAtPXPZ(const G << 87 G << 88 << 89 inline G4ThreeVector SurfacePoint(G4double << 90 G4bool i << 91 inline G4double GetBoundaryMin(G4double ph << 92 inline G4double GetBoundaryMax(G4double ph << 93 inline G4double GetSurfaceArea() override << 94 void GetFacets( G4int m, G4int n, G4double << 95 G4int faces[][4], G4int is << 96 << 97 G4TwistTubsSide(__void__&); << 98 // Fake default constructor for usage re << 99 // persistency for clients requiring pre << 100 // persistifiable objects. << 101 << 102 private: << 103 76 104 G4double DistanceToPlane(const G4ThreeVect << 77 virtual ~G4TwistTubsSide(); 105 const G4ThreeVect << 78 106 const G4ThreeVect << 79 virtual G4ThreeVector GetNormal(const G4ThreeVector &xx, 107 const G4ThreeVect << 80 G4bool isGlobal = false) ; 108 const G4ThreeVect << 81 109 const G4int << 82 virtual G4int DistanceToSurface(const G4ThreeVector &gp, 110 G4ThreeVect << 83 const G4ThreeVector &gv, 111 G4ThreeVect << 84 G4ThreeVector gxx[], 112 << 85 G4double distance[], 113 G4int GetAreaCode(const G4ThreeVector& xx, << 86 G4int areacode[], 114 G4bool wit << 87 G4bool isvalid[], 115 << 88 EValidate validate = kValidateWithTol); 116 void SetCorners() override; << 89 117 << 90 virtual G4int DistanceToSurface(const G4ThreeVector &gp, 118 void SetCorners( G4double endInnerRad[2], << 91 G4ThreeVector gxx[], 119 G4double endOuterRad[2], << 92 G4double distance[], 120 G4double endPhi[2], << 93 G4int areacode[]); 121 G4double endZ[2] ) ; << 94 >> 95 inline G4ThreeVector ProjectAtPXPZ(const G4ThreeVector &p, >> 96 G4bool isglobal = false) const ; >> 97 >> 98 virtual G4ThreeVector SurfacePoint(G4double, G4double, >> 99 G4bool isGlobal = false) ; >> 100 virtual G4double GetBoundaryMin(G4double phi) ; >> 101 virtual G4double GetBoundaryMax(G4double phi) ; >> 102 virtual G4double GetSurfaceArea() ; >> 103 virtual void GetFacets( G4int m, G4int n, G4double xyz[][3], >> 104 G4int faces[][4], G4int iside ) ; >> 105 >> 106 public: // without description >> 107 >> 108 G4TwistTubsSide(__void__&); >> 109 // Fake default constructor for usage restricted to direct object >> 110 // persistency for clients requiring preallocation of memory for >> 111 // persistifiable objects. >> 112 >> 113 private: >> 114 >> 115 virtual G4double DistanceToPlane(const G4ThreeVector &p, >> 116 const G4ThreeVector &A, >> 117 const G4ThreeVector &B, >> 118 const G4ThreeVector &C, >> 119 const G4ThreeVector &D, >> 120 const G4int parity, >> 121 G4ThreeVector &xx, >> 122 G4ThreeVector &n); >> 123 >> 124 virtual G4int GetAreaCode(const G4ThreeVector &xx, >> 125 G4bool withTol = true); >> 126 >> 127 virtual void SetCorners(); >> 128 >> 129 virtual void SetCorners( G4double endInnerRad[2], >> 130 G4double endOuterRad[2], >> 131 G4double endPhi[2], >> 132 G4double endZ[2] ) ; 122 133 123 void SetBoundaries() override; << 134 virtual void SetBoundaries(); 124 135 125 private: 136 private: 126 137 127 G4double fKappa; // std::ta << 138 G4double fKappa; // std::tan(TwistedAngle/2)/HalfLenZ; 128 }; 139 }; 129 140 130 141 131 //============================================ 142 //======================================================== 132 // inline functions 143 // inline functions 133 //============================================ 144 //======================================================== 134 145 135 inline 146 inline 136 G4ThreeVector G4TwistTubsSide::ProjectAtPXPZ(c << 147 G4ThreeVector G4TwistTubsSide::ProjectAtPXPZ(const G4ThreeVector &p, 137 148 G4bool isglobal) const 138 { 149 { 139 // Get Rho at p.z() on Hyperbolic Surface. 150 // Get Rho at p.z() on Hyperbolic Surface. 140 G4ThreeVector tmpp; 151 G4ThreeVector tmpp; 141 if (isglobal) { tmpp = fRot.inverse()*p - fT << 152 if (isglobal) { 142 else { tmpp = p; } << 153 tmpp = fRot.inverse()*p - fTrans; >> 154 } else { >> 155 tmpp = p; >> 156 } 143 G4ThreeVector xx(p.x(), p.x() * fKappa * p.z 157 G4ThreeVector xx(p.x(), p.x() * fKappa * p.z(), p.z()); 144 if (isglobal) { return (fRot * xx + fTrans); 158 if (isglobal) { return (fRot * xx + fTrans); } 145 return xx; 159 return xx; 146 } 160 } 147 161 148 inline 162 inline 149 G4ThreeVector 163 G4ThreeVector 150 G4TwistTubsSide::SurfacePoint(G4double x, G4do 164 G4TwistTubsSide::SurfacePoint(G4double x, G4double z, G4bool isGlobal) 151 { 165 { 152 G4ThreeVector SurfPoint( x , x * fKappa * z 166 G4ThreeVector SurfPoint( x , x * fKappa * z , z ) ; 153 167 154 if (isGlobal) { return (fRot * SurfPoint + f 168 if (isGlobal) { return (fRot * SurfPoint + fTrans); } 155 return SurfPoint; 169 return SurfPoint; 156 } 170 } 157 171 158 inline 172 inline 159 G4double G4TwistTubsSide::GetBoundaryMin(G4dou 173 G4double G4TwistTubsSide::GetBoundaryMin(G4double) 160 { 174 { 161 return fAxisMin[0] ; // inner radius at z 175 return fAxisMin[0] ; // inner radius at z = 0 162 } 176 } 163 177 164 inline 178 inline 165 G4double G4TwistTubsSide::GetBoundaryMax(G4dou 179 G4double G4TwistTubsSide::GetBoundaryMax(G4double) 166 { 180 { 167 return fAxisMax[0] ; // outer radius at z 181 return fAxisMax[0] ; // outer radius at z = 0 168 } 182 } 169 183 170 inline 184 inline 171 G4double G4TwistTubsSide::GetSurfaceArea() 185 G4double G4TwistTubsSide::GetSurfaceArea() 172 { 186 { 173 // approximation only 187 // approximation only 174 return ( fAxisMax[0] - fAxisMin[0] ) * ( fAx 188 return ( fAxisMax[0] - fAxisMin[0] ) * ( fAxisMax[1] - fAxisMin[1] ) ; 175 } 189 } 176 190 177 #endif 191 #endif 178 192