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[ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  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 // G4Hype
 27 //
 28 // Class description:
 29 //
 30 //   This class implements a tube with hyperbolic profile.
 31 //
 32 //   It describes an hyperbolic volume with curved sides parallel to
 33 //   the z-axis. The solid has a specified half-length along the z axis,
 34 //   about which it is centered, and a given minimum and maximum radius.
 35 //   A minimum radius of 0 signifies a filled Hype (with hyperbolical
 36 //   inner surface). To have a filled Hype the user must specify
 37 //   inner radius = 0 AND inner stereo angle = 0.
 38 //
 39 //   The inner and outer hyperbolical surfaces can have different
 40 //   stereo angles. A stereo angle of 0 gives a cylindrical surface.
 41 
 42 // Authors:
 43 //      Ernesto Lamanna (Ernesto.Lamanna@roma1.infn.it) &
 44 //      Francesco Safai Tehrani (Francesco.SafaiTehrani@roma1.infn.it)
 45 //      Rome, INFN & University of Rome "La Sapienza",  9 June 1998.
 46 // --------------------------------------------------------------------
 47 #ifndef G4HYPE_HH
 48 #define G4HYPE_HH
 49 
 50 #include "G4GeomTypes.hh"
 51 
 52 #if defined(G4GEOM_USE_USOLIDS)
 53 #define G4GEOM_USE_UHYPE 1
 54 #endif
 55 
 56 #if (defined(G4GEOM_USE_UHYPE) && defined(G4GEOM_USE_SYS_USOLIDS))
 57   #define G4UHype G4Hype
 58   #include "G4UHype.hh"
 59 #else
 60 
 61 #include "G4VSolid.hh"
 62 #include "G4ThreeVector.hh"
 63 #include "G4Polyhedron.hh"
 64 
 65 class G4SolidExtentList;
 66 class G4ClippablePolygon;
 67 
 68 class G4Hype : public G4VSolid
 69 {
 70   public:
 71 
 72     G4Hype(const G4String& pName,
 73                  G4double  newInnerRadius,
 74                  G4double  newOuterRadius,
 75                  G4double  newInnerStereo,
 76                  G4double  newOuterStereo,
 77                  G4double  newHalfLenZ);
 78 
 79     ~G4Hype() override;
 80 
 81     void ComputeDimensions(      G4VPVParameterisation* p,
 82                            const G4int n,
 83                            const G4VPhysicalVolume* pRep) override;
 84 
 85     void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
 86 
 87     G4bool CalculateExtent(const EAxis pAxis,
 88                            const G4VoxelLimits& pVoxelLimit,
 89                            const G4AffineTransform& pTransform,
 90                                  G4double& pMin, G4double& pMax) const override;
 91 
 92     inline G4double GetInnerRadius () const;
 93     inline G4double GetOuterRadius () const;
 94     inline G4double GetZHalfLength () const;
 95     inline G4double GetInnerStereo () const;
 96     inline G4double GetOuterStereo () const;
 97 
 98     inline void SetInnerRadius (G4double newIRad);
 99     inline void SetOuterRadius (G4double newORad);
100     inline void SetZHalfLength (G4double newHLZ);
101     inline void SetInnerStereo (G4double newISte);
102     inline void SetOuterStereo (G4double newOSte);
103 
104     EInside Inside(const G4ThreeVector& p) const override;
105 
106     G4ThreeVector SurfaceNormal(const G4ThreeVector& p) const override;
107 
108     G4double DistanceToIn(const G4ThreeVector& p,
109                           const G4ThreeVector& v) const override;
110     G4double DistanceToIn(const G4ThreeVector& p) const override;
111     G4double DistanceToOut(const G4ThreeVector& p, const G4ThreeVector& v,
112                            const G4bool calcNorm = false,
113                                  G4bool* validNorm = nullptr,
114                                  G4ThreeVector* n = nullptr) const override;
115     G4double DistanceToOut(const G4ThreeVector& p) const override;
116 
117     G4GeometryType  GetEntityType() const override;
118 
119     G4VSolid* Clone() const override;
120 
121     std::ostream& StreamInfo(std::ostream& os) const override;
122 
123     G4double GetCubicVolume() override;
124     G4double GetSurfaceArea() override;
125 
126     G4ThreeVector GetPointOnSurface() const override;
127 
128     void          DescribeYourselfTo (G4VGraphicsScene& scene) const override;
129     G4VisExtent   GetExtent          () const override;
130     G4Polyhedron* CreatePolyhedron   () const override;
131     G4Polyhedron* GetPolyhedron      () const override;
132 
133     G4Hype(__void__&);
134       // Fake default constructor for usage restricted to direct object
135       // persistency for clients requiring preallocation of memory for
136       // persistifiable objects.
137 
138     G4Hype(const G4Hype& rhs);
139     G4Hype& operator=(const G4Hype& rhs);
140       // Copy constructor and assignment operator.
141 
142   protected:
143 
144     inline G4bool InnerSurfaceExists() const;
145       // whether we have an inner surface or not
146 
147     static G4double ApproxDistOutside( G4double pr, G4double pz,
148                                        G4double r0, G4double tanPhi );
149     static G4double ApproxDistInside( G4double pr, G4double pz,
150                                       G4double r0, G4double tan2Phi );
151       // approximate isotropic distance to hyperbolic surface
152 
153     inline G4double HypeInnerRadius2(G4double zVal) const;
154     inline G4double HypeOuterRadius2(G4double zVal) const;
155       // values of hype radius at a given Z
156 
157     static G4int IntersectHype( const G4ThreeVector &p, const G4ThreeVector &v,
158                                 G4double r2, G4double tan2Phi, G4double s[2] );
159       // intersection with hyperbolic surface
160 
161    private:
162 
163     G4double asinh(G4double arg);
164 
165   protected:
166 
167     G4double innerRadius;
168     G4double outerRadius;
169     G4double halfLenZ;
170     G4double innerStereo;
171     G4double outerStereo;
172 
173     // precalculated parameters, squared quantities
174 
175     G4double tanInnerStereo;
176     G4double tanOuterStereo;
177     G4double tanInnerStereo2; // squared tan of Inner Stereo angle
178     G4double tanOuterStereo2; // squared tan of Outer Stereo angle
179     G4double innerRadius2;    // squared Inner Radius
180     G4double outerRadius2;    // squared Outer Radius
181     G4double endInnerRadius2; // squared endcap Inner Radius
182     G4double endOuterRadius2; // squared endcap Outer Radius
183     G4double endInnerRadius; // endcap Inner Radius
184     G4double endOuterRadius; // endcap Outer Radius
185 
186     // Used by distanceToOut
187 
188     enum ESide {outerFace,innerFace,leftCap, rightCap};
189 
190   private:
191 
192     G4double fCubicVolume = 0.0;
193     G4double fSurfaceArea = 0.0;
194 
195     G4double fHalfTol;
196 
197     mutable G4bool fRebuildPolyhedron = false;
198     mutable G4Polyhedron* fpPolyhedron = nullptr;
199 };
200 
201 #include "G4Hype.icc"
202 
203 #endif  // defined(G4GEOM_USE_UHYPE) && defined(G4GEOM_USE_SYS_USOLIDS)
204 
205 #endif // G4HYPE_HH
206