|
|
|||
File indexing completed on 2026-09-22 08:52:11
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 // 0026 // G4TwistTrapFlatSide 0027 // 0028 // Class description: 0029 // 0030 // Class describing a flat boundary surface for a trapezoid. 0031 0032 // Author: Oliver Link (CERN), 27.10.2004 - Created 0033 // -------------------------------------------------------------------- 0034 #ifndef G4TWISTTRAPFLATSIDE_HH 0035 #define G4TWISTTRAPFLATSIDE_HH 0036 0037 #include "G4VTwistSurface.hh" 0038 0039 /** 0040 * @brief G4TwistTrapFlatSide describes a flat boundary surface for a trapezoid. 0041 */ 0042 0043 class G4TwistTrapFlatSide : public G4VTwistSurface 0044 { 0045 public: 0046 0047 /** 0048 * Constructs a trapezoid flat boundary surface, given its parameters. 0049 * @param[in] name The surface name. 0050 * @param[in] PhiTwist The twist angle. 0051 * @param[in] pDx1 Half x length at -pDz,-pDy. 0052 * @param[in] pDx2 Half x length at -pDz,+pDy. 0053 * @param[in] pDy Half y length. 0054 * @param[in] pDz Half z length. 0055 * @param[in] pAlpha Tilt angle at +pDz. 0056 * @param[in] pPhi Direction between end planes - azimuthal angle. 0057 * @param[in] pTheta Direction between end planes - polar angle. 0058 * @param[in] handedness Orientation: +z = +ve, -z = -ve. 0059 */ 0060 G4TwistTrapFlatSide( const G4String& name, 0061 G4double PhiTwist, 0062 G4double pDx1, 0063 G4double pDx2, 0064 G4double pDy, 0065 G4double pDz, 0066 G4double pAlpha, 0067 G4double pPhi, 0068 G4double pTheta, 0069 G4int handedness ); 0070 0071 /** 0072 * Default destructor. 0073 */ 0074 ~G4TwistTrapFlatSide() override = default; 0075 0076 /** 0077 * Returns a normal vector at a surface (or very close to the surface) 0078 * point at 'p'. 0079 * @param[in] p Not used. Using current normal. 0080 * @param[in] isGlobal If true, it returns the normal in global coordinates. 0081 * @returns The current normal vector. 0082 */ 0083 G4ThreeVector GetNormal(const G4ThreeVector& /* p */ , 0084 G4bool isGlobal = false) override; 0085 0086 /** 0087 * Returns the distance to surface, given point 'gp' and direction 'gv'. 0088 * @param[in] gp The point from where computing the distance. 0089 * @param[in] gv The direction along which computing the distance. 0090 * @param[out] gxx Vector of global points based on number of solutions. 0091 * @param[out] distance The distance vector based on number of solutions. 0092 * @param[out] areacode The location vector based on number of solutions. 0093 * @param[out] isvalid Validity vector based on number of solutions. 0094 * @param[in] validate Adopted validation criteria. 0095 * @returns The number of solutions. 0096 */ 0097 G4int DistanceToSurface(const G4ThreeVector& gp, 0098 const G4ThreeVector& gv, 0099 G4ThreeVector gxx[], 0100 G4double distance[], 0101 G4int areacode[], 0102 G4bool isvalid[], 0103 EValidate validate = kValidateWithTol) override; 0104 0105 /** 0106 * Returns the safety distance to surface, given point 'gp'. 0107 * @param[in] gp The point from where computing the safety distance. 0108 * @param[out] gxx Vector of global points based on number of solutions. 0109 * @param[out] distance The distance vector based on number of solutions. 0110 * @param[out] areacode The location vector based on number of solutions. 0111 * @returns The number of solutions. 0112 */ 0113 G4int DistanceToSurface(const G4ThreeVector& gp, 0114 G4ThreeVector gxx[], 0115 G4double distance[], 0116 G4int areacode[]) override; 0117 0118 /** 0119 * Fake default constructor for usage restricted to direct object 0120 * persistency for clients requiring preallocation of memory for 0121 * persistifiable objects. 0122 */ 0123 G4TwistTrapFlatSide(__void__&); 0124 0125 private: 0126 0127 /** 0128 * Returns point on surface given 'phi' and 'u'. 0129 */ 0130 inline G4ThreeVector SurfacePoint(G4double x, G4double y, 0131 G4bool isGlobal = false) override; 0132 0133 /** 0134 * Internal accessors. 0135 */ 0136 inline G4double GetBoundaryMin(G4double u) override; 0137 inline G4double GetBoundaryMax(G4double u) override; 0138 inline G4double GetSurfaceArea() override; 0139 void GetFacets( G4int m, G4int n, G4double xyz[][3], 0140 G4int faces[][4], G4int iside ) override; 0141 inline G4double xAxisMax(G4double u, G4double fTanAlpha) const; 0142 0143 /** 0144 * Setters. 0145 */ 0146 void SetCorners() override; 0147 void SetBoundaries() override; 0148 0149 /** 0150 * Returns the area code for point 'xx' using or not surface tolerance. 0151 */ 0152 G4int GetAreaCode(const G4ThreeVector& xx, 0153 G4bool withTol = true) override; 0154 0155 private: 0156 0157 G4double fDx1; 0158 G4double fDx2; 0159 G4double fDy; 0160 G4double fDz; 0161 G4double fPhiTwist; 0162 G4double fAlpha; 0163 G4double fTAlph; 0164 G4double fPhi; 0165 G4double fTheta; 0166 G4double fdeltaX; 0167 G4double fdeltaY; 0168 }; 0169 0170 //======================================================== 0171 // inline functions 0172 //======================================================== 0173 0174 inline 0175 G4double G4TwistTrapFlatSide::xAxisMax(G4double u, G4double fTanAlpha) const 0176 { 0177 return ( ( fDx2 + fDx1 )/2. + u*(fDx2 - fDx1)/(2.*fDy) + u *fTanAlpha ) ; 0178 } 0179 0180 inline G4ThreeVector 0181 G4TwistTrapFlatSide::SurfacePoint(G4double x, G4double y, G4bool isGlobal) 0182 { 0183 G4ThreeVector SurfPoint ( x,y,0); 0184 0185 if (isGlobal) { return (fRot*SurfPoint + fTrans); } 0186 return SurfPoint; 0187 } 0188 0189 inline 0190 G4double G4TwistTrapFlatSide::GetBoundaryMin(G4double y) 0191 { 0192 return -xAxisMax(y, -fTAlph) ; 0193 } 0194 0195 inline 0196 G4double G4TwistTrapFlatSide::GetBoundaryMax(G4double y) 0197 { 0198 return xAxisMax(y, fTAlph) ; 0199 } 0200 0201 inline 0202 G4double G4TwistTrapFlatSide::GetSurfaceArea() 0203 { 0204 return 2*(fDx1 + fDx2)*fDy ; 0205 } 0206 0207 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|