Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4EllipticalTube.hh
Go to the documentation of this file.
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// G4EllipticalTube
27//
28// Class description:
29//
30// Declaration of a CSG volume representing a tube with elliptical
31// cross section (geant3 solid 'ELTU'):
32//
33// G4EllipticalTube( const G4String& name,
34// G4double Dx,
35// G4double Dy,
36// G4double Dz )
37//
38// The equation of the lateral surface : (x/dx)^2 + (y/dy)^2 = 1
39
40// Author: David C. Williams ([email protected])
41// Revision: Evgueni Tcherniaev ([email protected]), 23.12.2019
42// --------------------------------------------------------------------
43#ifndef G4ELLIPTICALTUBE_HH
44#define G4ELLIPTICALTUBE_HH
45
46#include "G4GeomTypes.hh"
47
48#if defined(G4GEOM_USE_USOLIDS)
49#define G4GEOM_USE_UELLIPTICALTUBE 1
50#endif
51
52#if (defined(G4GEOM_USE_UELLIPTICALTUBE) && defined(G4GEOM_USE_SYS_USOLIDS))
53 #define G4UEllipticalTube G4EllipticalTube
54 #include "G4UEllipticalTube.hh"
55#else
56
57#include "G4VSolid.hh"
58#include "G4Polyhedron.hh"
59
61{
62 public:
63
64 G4EllipticalTube( const G4String& name,
65 G4double Dx,
66 G4double Dy,
67 G4double Dz );
68
69 ~G4EllipticalTube() override;
70
71 // Standard methods
72 //
73 void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
74
75 G4bool CalculateExtent(const EAxis pAxis,
76 const G4VoxelLimits& pVoxelLimit,
77 const G4AffineTransform& pTransform,
78 G4double& pmin, G4double& pmax) const override;
79
80 EInside Inside( const G4ThreeVector& p ) const override;
81
82 G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const override;
83
85 const G4ThreeVector& v ) const override;
86
87 G4double DistanceToIn( const G4ThreeVector& p ) const override;
88
90 const G4ThreeVector& v,
91 const G4bool calcNorm = false,
92 G4bool* validNorm = nullptr,
93 G4ThreeVector* n = nullptr ) const override;
94
95 G4double DistanceToOut( const G4ThreeVector& p ) const override;
96
97 G4GeometryType GetEntityType() const override;
98
99 G4VSolid* Clone() const override;
100
101 std::ostream& StreamInfo(std::ostream& os) const override;
102
103 G4double GetCubicVolume() override;
104 G4double GetSurfaceArea() override;
105
106 G4ThreeVector GetPointOnSurface() const override;
107
108 // Visualisation methods
109 //
110 G4Polyhedron* CreatePolyhedron() const override;
111 G4Polyhedron* GetPolyhedron () const override;
112 void DescribeYourselfTo( G4VGraphicsScene& scene ) const override;
113 G4VisExtent GetExtent() const override;
114
115 // Accessors
116 //
117 inline G4double GetDx() const;
118 inline G4double GetDy() const;
119 inline G4double GetDz() const;
120
121 inline void SetDx( G4double Dx );
122 inline void SetDy( G4double Dy );
123 inline void SetDz( G4double Dz );
124
125 G4EllipticalTube(__void__&);
126 // Fake default constructor for usage restricted to direct object
127 // persistency for clients requiring preallocation of memory for
128 // persistifiable objects
129
132 // Copy constructor and assignment operator
133
134 private:
135
136 void CheckParameters();
137 // Check parameters and set pre-calculated values
138
139 G4ThreeVector ApproxSurfaceNormal( const G4ThreeVector& p ) const;
140 // Algorithm for SurfaceNormal() following the original
141 // specification for points not on the surface
142
143 G4double GetCachedSurfaceArea() const;
144 // Calculate surface area and cache it
145
146 private:
147
148 G4double halfTolerance;
149
150 G4double fDx; // semi-axis in X
151 G4double fDy; // semi-axis in Y
152 G4double fDz; // half length in Z
153
154 G4double fCubicVolume = 0.0; // volume
155 G4double fSurfaceArea = 0.0; // surface area
156
157 // Cached pre-calculated values
158 G4double fRsph; // R of bounding sphere
159 G4double fDDx; // Dx squared
160 G4double fDDy; // Dy squared
161 G4double fSx; // X scale factor
162 G4double fSy; // Y scale factor
163 G4double fR; // resulting Radius, after scaling elipse to circle
164 G4double fQ1; // distance approximation : dist = Q1*(x^2 + y^2) - Q2
165 G4double fQ2; // distance approximation : dist = Q1*(x^2 + y^2) - Q2
166 G4double fScratch; // half length of scratching segment squared
167
168 mutable G4bool fRebuildPolyhedron = false;
169 mutable G4Polyhedron* fpPolyhedron = nullptr;
170};
171
172#include "G4EllipticalTube.icc"
173
174#endif // defined(G4GEOM_USE_UELLIPTICALTUBE) && defined(G4GEOM_USE_SYS_USOLIDS)
175
176#endif // G4ELLIPTICALTUBE_HH
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
G4ThreeVector GetPointOnSurface() const override
G4EllipticalTube & operator=(const G4EllipticalTube &rhs)
G4double GetSurfaceArea() override
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const override
EInside Inside(const G4ThreeVector &p) const override
void SetDz(G4double Dz)
G4Polyhedron * CreatePolyhedron() const override
G4double GetDy() const
G4GeometryType GetEntityType() const override
G4VisExtent GetExtent() const override
void SetDx(G4double Dx)
std::ostream & StreamInfo(std::ostream &os) const override
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const override
G4double GetDx() const
G4Polyhedron * GetPolyhedron() const override
void SetDy(G4double Dy)
G4VSolid * Clone() const override
~G4EllipticalTube() override
void DescribeYourselfTo(G4VGraphicsScene &scene) const override
G4double GetDz() const
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pmin, G4double &pmax) const override
G4EllipticalTube(const G4String &name, G4double Dx, G4double Dy, G4double Dz)
void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const override
G4double GetCubicVolume() override
G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=nullptr, G4ThreeVector *n=nullptr) const override
EAxis
Definition geomdefs.hh:54
EInside
Definition geomdefs.hh:67