|
|
|||
File indexing completed on 2026-07-26 09:09:49
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 // G4Hype 0027 // 0028 // Class description: 0029 // 0030 // This class implements a tube with hyperbolic profile. 0031 // It describes an hyperbolic volume with curved sides parallel to 0032 // the z-axis. The solid has a specified half-length along the z axis, 0033 // about which it is centered, and a given minimum and maximum radius. 0034 // A minimum radius of 0 signifies a filled Hype (with hyperbolical 0035 // inner surface). To have a filled Hype the user must specify 0036 // inner radius = 0 AND inner stereo angle = 0. 0037 // The inner and outer hyperbolical surfaces can have different 0038 // stereo angles. A stereo angle of 0 gives a cylindrical surface. 0039 0040 // Authors: Ernesto Lamanna & Francesco Safai Tehrani - Created 0041 // Rome, INFN & University of Rome "La Sapienza", 09.06.1998. 0042 // -------------------------------------------------------------------- 0043 #ifndef G4HYPE_HH 0044 #define G4HYPE_HH 0045 0046 #include "G4GeomTypes.hh" 0047 0048 #if defined(G4GEOM_USE_USOLIDS) 0049 #define G4GEOM_USE_UHYPE 1 0050 #endif 0051 0052 #if (defined(G4GEOM_USE_UHYPE) && defined(G4GEOM_USE_SYS_USOLIDS)) 0053 #define G4UHype G4Hype 0054 #include "G4UHype.hh" 0055 #else 0056 0057 #include "G4VSolid.hh" 0058 #include "G4ThreeVector.hh" 0059 #include "G4Polyhedron.hh" 0060 0061 class G4SolidExtentList; 0062 class G4ClippablePolygon; 0063 0064 /** 0065 * @brief G4Hype is a tube with hyperbolic profile; it describes an hyperbolic 0066 * volume with curved sides parallel to the Z axis. The solid has a specified 0067 * half-length along the Z axis, about which it is centered, and a given 0068 * minimum and maximum radii. 0069 */ 0070 0071 class G4Hype : public G4VSolid 0072 { 0073 public: 0074 0075 /** 0076 * Constructs a hyperbolic tube, given its parameters. 0077 * @param[in] pName The solid name. 0078 * @param[in] newInnerRadius Inner radius. 0079 * @param[in] newOuterRadius Outer radius. 0080 * @param[in] newInnerStereo Inner stereo angle in radians. 0081 * @param[in] newOuterStereo Outer stereo angle in radians. 0082 * @param[in] newHalfLenZ Half length in Z. 0083 */ 0084 G4Hype(const G4String& pName, 0085 G4double newInnerRadius, 0086 G4double newOuterRadius, 0087 G4double newInnerStereo, 0088 G4double newOuterStereo, 0089 G4double newHalfLenZ); 0090 0091 /** 0092 * Destructor. 0093 */ 0094 ~G4Hype() override; 0095 0096 /** 0097 * Accessors. 0098 */ 0099 inline G4double GetInnerRadius () const; 0100 inline G4double GetOuterRadius () const; 0101 inline G4double GetZHalfLength () const; 0102 inline G4double GetInnerStereo () const; 0103 inline G4double GetOuterStereo () const; 0104 0105 /** 0106 * Modifiers. 0107 */ 0108 void SetInnerRadius (G4double newIRad); 0109 void SetOuterRadius (G4double newORad); 0110 void SetZHalfLength (G4double newHLZ); 0111 void SetInnerStereo (G4double newISte); 0112 void SetOuterStereo (G4double newOSte); 0113 0114 /** 0115 * Dispatch method for parameterisation replication mechanism and 0116 * dimension computation. 0117 */ 0118 void ComputeDimensions(G4VPVParameterisation* p, 0119 const G4int n, 0120 const G4VPhysicalVolume* pRep) override; 0121 0122 /** 0123 * Computes the bounding limits of the solid. 0124 * @param[out] pMin The minimum bounding limit point. 0125 * @param[out] pMax The maximum bounding limit point. 0126 */ 0127 void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override; 0128 0129 /** 0130 * Calculates the minimum and maximum extent of the solid, when under the 0131 * specified transform, and within the specified limits. 0132 * @param[in] pAxis The axis along which compute the extent. 0133 * @param[in] pVoxelLimit The limiting space dictated by voxels. 0134 * @param[in] pTransform The internal transformation applied to the solid. 0135 * @param[out] pMin The minimum extent value. 0136 * @param[out] pMax The maximum extent value. 0137 * @returns True if the solid is intersected by the extent region. 0138 */ 0139 G4bool CalculateExtent(const EAxis pAxis, 0140 const G4VoxelLimits& pVoxelLimit, 0141 const G4AffineTransform& pTransform, 0142 G4double& pMin, G4double& pMax) const override; 0143 0144 /** 0145 * Concrete implementations of the expected query interfaces for 0146 * solids, as defined in the base class G4VSolid. 0147 */ 0148 EInside Inside(const G4ThreeVector& p) const override; 0149 G4ThreeVector SurfaceNormal(const G4ThreeVector& p) const override; 0150 G4double DistanceToIn(const G4ThreeVector& p, 0151 const G4ThreeVector& v) const override; 0152 G4double DistanceToIn(const G4ThreeVector& p) const override; 0153 G4double DistanceToOut(const G4ThreeVector& p, const G4ThreeVector& v, 0154 const G4bool calcNorm = false, 0155 G4bool* validNorm = nullptr, 0156 G4ThreeVector* n = nullptr) const override; 0157 G4double DistanceToOut(const G4ThreeVector& p) const override; 0158 0159 /** 0160 * Returns the type ID, "G4Hype" of the solid. 0161 */ 0162 G4GeometryType GetEntityType() const override; 0163 0164 /** 0165 * Makes a clone of the object for use in multi-treading. 0166 * @returns A pointer to the new cloned allocated solid. 0167 */ 0168 G4VSolid* Clone() const override; 0169 0170 /** 0171 * Streams the object contents to an output stream. 0172 */ 0173 std::ostream& StreamInfo(std::ostream& os) const override; 0174 0175 /** 0176 * Returning an estimation of the solid volume (capacity) and 0177 * surface area, in internal units. 0178 */ 0179 G4double GetCubicVolume() override; 0180 G4double GetSurfaceArea() override; 0181 0182 /** 0183 * Returns a random point located and uniformly distributed on the 0184 * surface of the solid. 0185 */ 0186 G4ThreeVector GetPointOnSurface() const override; 0187 0188 /** 0189 * Methods for creating graphical representations (i.e. for visualisation). 0190 */ 0191 void DescribeYourselfTo(G4VGraphicsScene& scene) const override; 0192 G4VisExtent GetExtent() const override; 0193 G4Polyhedron* CreatePolyhedron() const override; 0194 G4Polyhedron* GetPolyhedron() const override; 0195 0196 /** 0197 * Fake default constructor for usage restricted to direct object 0198 * persistency for clients requiring preallocation of memory for 0199 * persistifiable objects. 0200 */ 0201 G4Hype(__void__&); 0202 0203 /** 0204 * Copy constructor and assignment operator. 0205 */ 0206 G4Hype(const G4Hype& rhs); 0207 G4Hype& operator=(const G4Hype& rhs); 0208 0209 private: 0210 0211 /** 0212 * Tells whether we have an inner surface or not. 0213 */ 0214 inline G4bool InnerSurfaceExists() const; 0215 0216 /** 0217 * Returns the approximate isotropic distance to the hyperbolic surface. 0218 */ 0219 G4double ApproxDistOutside( G4double pr, G4double pz, 0220 G4double r0, G4double tanPhi ) const; 0221 G4double ApproxDistInside( G4double pr, G4double pz, 0222 G4double r0, G4double tan2Phi ) const; 0223 0224 /** 0225 * Returns the values of the hype radii at a given Z. 0226 */ 0227 inline G4double HypeInnerRadius2(G4double zVal) const; 0228 inline G4double HypeOuterRadius2(G4double zVal) const; 0229 0230 /** 0231 * Decides if and where a line intersects with a hyperbolic surface 0232 * (of infinite extent). 0233 * @returns The number of intersections. If 0, the trajectory misses. 0234 */ 0235 G4int IntersectHype( const G4ThreeVector& p, const G4ThreeVector& v, 0236 G4double r2, G4double tan2Phi, G4double s[2] ) const; 0237 0238 private: 0239 0240 G4double innerRadius; 0241 G4double outerRadius; 0242 G4double halfLenZ; 0243 G4double innerStereo; 0244 G4double outerStereo; 0245 0246 /** Precalculated parameters, squared quantities. */ 0247 G4double tanInnerStereo; // tan of Inner Stereo angle 0248 G4double tanOuterStereo; // tan of Outer Stereo angle 0249 G4double tanInnerStereo2; // squared tan of Inner Stereo angle 0250 G4double tanOuterStereo2; // squared tan of Outer Stereo angle 0251 G4double innerRadius2; // squared Inner Radius 0252 G4double outerRadius2; // squared Outer Radius 0253 G4double endInnerRadius2; // squared endcap Inner Radius 0254 G4double endOuterRadius2; // squared endcap Outer Radius 0255 G4double endInnerRadius; // endcap Inner Radius 0256 G4double endOuterRadius; // endcap Outer Radius 0257 0258 /** Used by DistanceToOut(). */ 0259 enum ESide { outerFace, innerFace, leftCap, rightCap }; 0260 0261 G4double fCubicVolume = 0.0; 0262 G4double fSurfaceArea = 0.0; 0263 G4double fInnerSurfaceArea = 0.0; 0264 G4double fOuterSurfaceArea = 0.0; 0265 0266 G4double fHalfTol; 0267 0268 mutable G4bool fRebuildPolyhedron = false; 0269 mutable G4Polyhedron* fpPolyhedron = nullptr; 0270 }; 0271 0272 #include "G4Hype.icc" 0273 0274 #endif // defined(G4GEOM_USE_UHYPE) && defined(G4GEOM_USE_SYS_USOLIDS) 0275 0276 #endif // G4HYPE_HH
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|