| [831] | 1 | //
|
|---|
| 2 | // ********************************************************************
|
|---|
| 3 | // * License and Disclaimer *
|
|---|
| 4 | // * *
|
|---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of *
|
|---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and *
|
|---|
| 7 | // * conditions of the Geant4 Software License, included in the file *
|
|---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These *
|
|---|
| 9 | // * include a list of copyright holders. *
|
|---|
| 10 | // * *
|
|---|
| 11 | // * Neither the authors of this software system, nor their employing *
|
|---|
| 12 | // * institutes,nor the agencies providing financial support for this *
|
|---|
| 13 | // * work make any representation or warranty, express or implied, *
|
|---|
| 14 | // * regarding this software system or assume any liability for its *
|
|---|
| 15 | // * use. Please see the license in the file LICENSE and URL above *
|
|---|
| 16 | // * for the full disclaimer and the limitation of liability. *
|
|---|
| 17 | // * *
|
|---|
| 18 | // * This code implementation is the result of the scientific and *
|
|---|
| 19 | // * technical work of the GEANT4 collaboration. *
|
|---|
| 20 | // * By using, copying, modifying or distributing the software (or *
|
|---|
| 21 | // * any work based on the software) you agree to acknowledge its *
|
|---|
| 22 | // * use in resulting scientific publications, and indicate your *
|
|---|
| 23 | // * acceptance of all terms of the Geant4 Software license. *
|
|---|
| 24 | // ********************************************************************
|
|---|
| 25 | //
|
|---|
| 26 | //
|
|---|
| 27 | // $Id: G4Hype.hh,v 1.15 2006/10/20 13:45:20 gcosmo Exp $
|
|---|
| 28 | // $Original: G4Hype.hh,v 1.0 1998/06/09 16:57:50 safai Exp $
|
|---|
| [1058] | 29 | // GEANT4 tag $Name: geant4-09-02-ref-02 $
|
|---|
| [831] | 30 | //
|
|---|
| 31 | //
|
|---|
| 32 | // --------------------------------------------------------------------
|
|---|
| 33 | // GEANT 4 class header file
|
|---|
| 34 | //
|
|---|
| 35 | //
|
|---|
| 36 | // G4Hype
|
|---|
| 37 | //
|
|---|
| 38 | // Class description:
|
|---|
| 39 | //
|
|---|
| 40 | // This class implements a tube with hyperbolic profile.
|
|---|
| 41 | //
|
|---|
| 42 | // It describes an hyperbolic volume with curved sides parallel to
|
|---|
| 43 | // the z-axis. The solid has a specified half-length along the z axis,
|
|---|
| 44 | // about which it is centered, and a given minimum and maximum radius.
|
|---|
| 45 | // A minimum radius of 0 signifies a filled Hype (with hyperbolical
|
|---|
| 46 | // inner surface). To have a filled Hype the user must specify
|
|---|
| 47 | // inner radius = 0 AND inner stereo angle = 0.
|
|---|
| 48 | //
|
|---|
| 49 | // The inner and outer hyperbolical surfaces can have different
|
|---|
| 50 | // stereo angles. A stereo angle of 0 gives a cylindrical surface.
|
|---|
| 51 |
|
|---|
| 52 | // Authors:
|
|---|
| 53 | // Ernesto Lamanna (Ernesto.Lamanna@roma1.infn.it) &
|
|---|
| 54 | // Francesco Safai Tehrani (Francesco.SafaiTehrani@roma1.infn.it)
|
|---|
| 55 | // Rome, INFN & University of Rome "La Sapienza", 9 June 1998.
|
|---|
| 56 | //
|
|---|
| 57 | // --------------------------------------------------------------------
|
|---|
| 58 | #ifndef G4HYPE_HH
|
|---|
| 59 | #define G4HYPE_HH
|
|---|
| 60 |
|
|---|
| 61 | #include "G4VSolid.hh"
|
|---|
| 62 | #include "G4ThreeVector.hh"
|
|---|
| 63 |
|
|---|
| 64 | class G4SolidExtentList;
|
|---|
| 65 | class G4ClippablePolygon;
|
|---|
| 66 |
|
|---|
| 67 | class G4Hype : public G4VSolid
|
|---|
| 68 | {
|
|---|
| 69 | public: // with description
|
|---|
| 70 |
|
|---|
| 71 | G4Hype(const G4String& pName,
|
|---|
| 72 | G4double newInnerRadius,
|
|---|
| 73 | G4double newOuterRadius,
|
|---|
| 74 | G4double newInnerStereo,
|
|---|
| 75 | G4double newOuterStereo,
|
|---|
| 76 | G4double newHalfLenZ);
|
|---|
| 77 |
|
|---|
| 78 | virtual ~G4Hype();
|
|---|
| 79 |
|
|---|
| 80 | void ComputeDimensions(G4VPVParameterisation* p,
|
|---|
| 81 | const G4int n,
|
|---|
| 82 | const G4VPhysicalVolume* pRep);
|
|---|
| 83 |
|
|---|
| 84 | G4bool CalculateExtent(const EAxis pAxis,
|
|---|
| 85 | const G4VoxelLimits& pVoxelLimit,
|
|---|
| 86 | const G4AffineTransform& pTransform,
|
|---|
| 87 | G4double& pmin, G4double& pmax) const;
|
|---|
| 88 |
|
|---|
| 89 | inline G4double GetInnerRadius () const;
|
|---|
| 90 | inline G4double GetOuterRadius () const;
|
|---|
| 91 | inline G4double GetZHalfLength () const;
|
|---|
| 92 | inline G4double GetInnerStereo () const;
|
|---|
| 93 | inline G4double GetOuterStereo () const;
|
|---|
| 94 |
|
|---|
| 95 | inline void SetInnerRadius (G4double newIRad);
|
|---|
| 96 | inline void SetOuterRadius (G4double newORad);
|
|---|
| 97 | inline void SetZHalfLength (G4double newHLZ);
|
|---|
| 98 | inline void SetInnerStereo (G4double newISte);
|
|---|
| 99 | inline void SetOuterStereo (G4double newOSte);
|
|---|
| 100 |
|
|---|
| 101 | EInside Inside(const G4ThreeVector& p) const;
|
|---|
| 102 |
|
|---|
| 103 | G4ThreeVector SurfaceNormal(const G4ThreeVector& p) const;
|
|---|
| 104 |
|
|---|
| 105 | G4double DistanceToIn(const G4ThreeVector& p, const G4ThreeVector& v) const;
|
|---|
| 106 | G4double DistanceToIn(const G4ThreeVector& p) const;
|
|---|
| 107 | G4double DistanceToOut(const G4ThreeVector& p, const G4ThreeVector& v,
|
|---|
| 108 | const G4bool calcNorm=G4bool(false),
|
|---|
| 109 | G4bool *validNorm=0, G4ThreeVector *n=0) const;
|
|---|
| 110 | G4double DistanceToOut(const G4ThreeVector& p) const;
|
|---|
| 111 |
|
|---|
| 112 | G4GeometryType GetEntityType() const;
|
|---|
| 113 |
|
|---|
| 114 | std::ostream& StreamInfo(std::ostream& os) const;
|
|---|
| 115 |
|
|---|
| 116 | G4double GetCubicVolume();
|
|---|
| 117 | G4double GetSurfaceArea();
|
|---|
| 118 |
|
|---|
| 119 | G4ThreeVector GetPointOnSurface() const;
|
|---|
| 120 |
|
|---|
| 121 | void DescribeYourselfTo (G4VGraphicsScene& scene) const;
|
|---|
| 122 | G4VisExtent GetExtent () const;
|
|---|
| 123 | G4Polyhedron* CreatePolyhedron () const;
|
|---|
| 124 | G4NURBS* CreateNURBS () const;
|
|---|
| 125 | G4Polyhedron* GetPolyhedron () const;
|
|---|
| 126 |
|
|---|
| 127 | public: // without description
|
|---|
| 128 |
|
|---|
| 129 | G4Hype(__void__&);
|
|---|
| 130 | // Fake default constructor for usage restricted to direct object
|
|---|
| 131 | // persistency for clients requiring preallocation of memory for
|
|---|
| 132 | // persistifiable objects.
|
|---|
| 133 |
|
|---|
| 134 | protected: // without description
|
|---|
| 135 |
|
|---|
| 136 | inline G4bool InnerSurfaceExists() const;
|
|---|
| 137 | // whether we have an inner surface or not
|
|---|
| 138 |
|
|---|
| 139 | static G4double ApproxDistOutside( G4double pr, G4double pz,
|
|---|
| 140 | G4double r0, G4double tanPhi );
|
|---|
| 141 | static G4double ApproxDistInside( G4double pr, G4double pz,
|
|---|
| 142 | G4double r0, G4double tan2Phi );
|
|---|
| 143 | // approximate isotropic distance to hyperbolic surface
|
|---|
| 144 |
|
|---|
| 145 | inline G4double HypeInnerRadius2(G4double zVal) const;
|
|---|
| 146 | inline G4double HypeOuterRadius2(G4double zVal) const;
|
|---|
| 147 | // values of hype radius at a given Z
|
|---|
| 148 |
|
|---|
| 149 | static G4int IntersectHype( const G4ThreeVector &p, const G4ThreeVector &v,
|
|---|
| 150 | G4double r2, G4double tan2Phi, G4double s[2] );
|
|---|
| 151 | // intersection with hyperbolic surface
|
|---|
| 152 |
|
|---|
| 153 | static void AddPolyToExtent( const G4ThreeVector &v0,
|
|---|
| 154 | const G4ThreeVector &v1,
|
|---|
| 155 | const G4ThreeVector &w1,
|
|---|
| 156 | const G4ThreeVector &w0,
|
|---|
| 157 | const G4VoxelLimits &voxelLimit,
|
|---|
| 158 | const EAxis axis,
|
|---|
| 159 | G4SolidExtentList &extentList );
|
|---|
| 160 |
|
|---|
| 161 | protected:
|
|---|
| 162 |
|
|---|
| 163 | G4double innerRadius;
|
|---|
| 164 | G4double outerRadius;
|
|---|
| 165 | G4double halfLenZ;
|
|---|
| 166 | G4double innerStereo;
|
|---|
| 167 | G4double outerStereo;
|
|---|
| 168 |
|
|---|
| 169 | // precalculated parameters, squared quantities
|
|---|
| 170 |
|
|---|
| 171 | G4double tanInnerStereo;
|
|---|
| 172 | G4double tanOuterStereo;
|
|---|
| 173 | G4double tanInnerStereo2; // squared tan of Inner Stereo angle
|
|---|
| 174 | G4double tanOuterStereo2; // squared tan of Outer Stereo angle
|
|---|
| 175 | G4double innerRadius2; // squared Inner Radius
|
|---|
| 176 | G4double outerRadius2; // squared Outer Radius
|
|---|
| 177 | G4double endInnerRadius2; // squared endcap Inner Radius
|
|---|
| 178 | G4double endOuterRadius2; // squared endcap Outer Radius
|
|---|
| 179 | G4double endInnerRadius; // endcap Inner Radius
|
|---|
| 180 | G4double endOuterRadius; // endcap Outer Radius
|
|---|
| 181 |
|
|---|
| 182 | // Used by distanceToOut
|
|---|
| 183 |
|
|---|
| 184 | enum ESide {outerFace,innerFace,leftCap, rightCap};
|
|---|
| 185 |
|
|---|
| 186 | private:
|
|---|
| 187 |
|
|---|
| 188 | G4double asinh(G4double arg);
|
|---|
| 189 |
|
|---|
| 190 | private:
|
|---|
| 191 |
|
|---|
| 192 | G4double fCubicVolume;
|
|---|
| 193 | G4double fSurfaceArea;
|
|---|
| 194 |
|
|---|
| 195 | mutable G4Polyhedron* fpPolyhedron;
|
|---|
| 196 |
|
|---|
| 197 | };
|
|---|
| 198 |
|
|---|
| 199 | #include "G4Hype.icc"
|
|---|
| 200 |
|
|---|
| 201 | #endif
|
|---|