Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4CutTubs.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// G4CutTubs
27//
28// Class description:
29//
30// G4CutTubs is a tube with possible cuts in +-Z.
31// Implementation adapted from G4Tubs (subclass of G4Tubs) and
32// from TGEo Ctube implementation (by A.Gheata, CERN)
33//
34// G4CutTubs(pName,pRMin,pRMax,pDZ,pSPhi,pEPhi,pLowNorm,pHighNorm)
35// pName,pRMin,pRMax,pDZ,pSPhi,pEPhi are the same as for G4Tubs,
36// pLowNorm=Outside Normal at -Z
37// pHighNorm=Outsie Normal at +Z.
38
39// Author: Tatiana Nikitina, CERN
40// --------------------------------------------------------------------
41
42#ifndef G4CUTTUBS_HH
43#define G4CUTTUBS_HH
44
45#include "G4GeomTypes.hh"
46
47#if defined(G4GEOM_USE_USOLIDS)
48#define G4GEOM_USE_UCTUBS 1
49#endif
50
51#if defined(G4GEOM_USE_UCTUBS)
52 #define G4UCutTubs G4CutTubs
53 #include "G4UCutTubs.hh"
54#else
55
56#include "G4CSGSolid.hh"
57#include "G4Polyhedron.hh"
58
59class G4CutTubs : public G4CSGSolid
60{
61 public:
62
63 G4CutTubs( const G4String& pName,
64 G4double pRMin,
65 G4double pRMax,
66 G4double pDz,
67 G4double pSPhi,
68 G4double pDPhi,
69 G4ThreeVector pLowNorm,
70 G4ThreeVector pHighNorm );
71 //
72 // Constructs a tubs with the given name and dimensions
73
74 ~G4CutTubs() override;
75 //
76 // Destructor
77
78 // Accessors
79
80 inline G4double GetInnerRadius () const;
81 inline G4double GetOuterRadius () const;
82 inline G4double GetZHalfLength () const;
83 inline G4double GetStartPhiAngle () const;
84 inline G4double GetDeltaPhiAngle () const;
85 inline G4double GetSinStartPhi () const;
86 inline G4double GetCosStartPhi () const;
87 inline G4double GetSinEndPhi () const;
88 inline G4double GetCosEndPhi () const;
89 inline G4ThreeVector GetLowNorm () const;
90 inline G4ThreeVector GetHighNorm () const;
91
92 // Modifiers
93
94 inline void SetInnerRadius (G4double newRMin);
95 inline void SetOuterRadius (G4double newRMax);
96 inline void SetZHalfLength (G4double newDz);
97 inline void SetStartPhiAngle (G4double newSPhi, G4bool trig=true);
98 inline void SetDeltaPhiAngle (G4double newDPhi);
99
100 // Methods for solid
101
102 G4double GetCubicVolume() override;
103 G4double GetSurfaceArea() override;
104
105 void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
106
107 G4bool CalculateExtent(const EAxis pAxis,
108 const G4VoxelLimits& pVoxelLimit,
109 const G4AffineTransform& pTransform,
110 G4double& pmin, G4double& pmax) const override;
111
112 EInside Inside( const G4ThreeVector& p ) const override;
113
114 G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const override;
115
117 const G4ThreeVector& v) const override;
118 G4double DistanceToIn(const G4ThreeVector& p) const override;
120 const G4bool calcNorm = false,
121 G4bool* validNorm = nullptr,
122 G4ThreeVector* n = nullptr) const override;
123 G4double DistanceToOut(const G4ThreeVector& p) const override;
124
125 G4GeometryType GetEntityType() const override;
126
127 G4ThreeVector GetPointOnSurface() const override;
128
129 G4VSolid* Clone() const override;
130
131 std::ostream& StreamInfo( std::ostream& os ) const override;
132
133 // Visualisation functions
134
135 void DescribeYourselfTo ( G4VGraphicsScene& scene ) const override;
136 G4Polyhedron* CreatePolyhedron () const override;
137
138 G4CutTubs(__void__&);
139 //
140 // Fake default constructor for usage restricted to direct object
141 // persistency for clients requiring preallocation of memory for
142 // persistifiable objects.
143
144 G4CutTubs(const G4CutTubs& rhs);
145 G4CutTubs& operator=(const G4CutTubs& rhs);
146 // Copy constructor and assignment operator.
147
148 protected:
149
150 inline void Initialize();
151 //
152 // Reset relevant values to zero
153
154 inline void CheckSPhiAngle(G4double sPhi);
155 inline void CheckDPhiAngle(G4double dPhi);
156 inline void CheckPhiAngles(G4double sPhi, G4double dPhi);
157 //
158 // Reset relevant flags and angle values
159
161 //
162 // Recompute relevant trigonometric values and cache them
163
165 //
166 // Algorithm for SurfaceNormal() following the original
167 // specification for points not on the surface
168
170 // Check if the cutted planes are crossing.
171 // If 'true' , solid is ill defined
172
173 G4double GetCutZ(const G4ThreeVector& p) const;
174 // Get Z value of the point on Cutted Plane
175
176 private:
177
178 G4double kRadTolerance, kAngTolerance;
179 //
180 // Radial and angular tolerances
181
182 G4double fRMin, fRMax, fDz, fSPhi, fDPhi;
183 mutable G4double fZMin, fZMax;
184 //
185 // Radial and angular dimensions
186
187 G4double sinCPhi, cosCPhi, cosHDPhi, cosHDPhiOT, cosHDPhiIT,
188 sinSPhi, cosSPhi, sinEPhi, cosEPhi;
189 //
190 // Cached trigonometric values
191
192 G4bool fPhiFullCutTube = false;
193 //
194 // Flag for identification of section or full tube
195
196 G4double halfCarTolerance, halfRadTolerance, halfAngTolerance;
197 //
198 // Cached half tolerance values
199
200 G4ThreeVector fLowNorm, fHighNorm;
201 //
202 // Normals of Cut at -/+ Dz
203};
204
205#include "G4CutTubs.icc"
206
207#endif
208
209#endif
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const override
Definition G4CutTubs.cc:327
G4ThreeVector GetPointOnSurface() const override
G4ThreeVector GetHighNorm() const
G4double GetStartPhiAngle() const
void Initialize()
G4double GetZHalfLength() const
G4double GetInnerRadius() const
void SetInnerRadius(G4double newRMin)
G4ThreeVector GetLowNorm() const
void CheckDPhiAngle(G4double dPhi)
G4VSolid * Clone() const override
void SetStartPhiAngle(G4double newSPhi, G4bool trig=true)
void SetDeltaPhiAngle(G4double newDPhi)
G4double GetSurfaceArea() override
Definition G4CutTubs.cc:273
G4GeometryType GetEntityType() const override
G4double GetCutZ(const G4ThreeVector &p) const
G4double GetDeltaPhiAngle() const
G4double GetOuterRadius() const
~G4CutTubs() override
G4ThreeVector ApproxSurfaceNormal(const G4ThreeVector &p) const
Definition G4CutTubs.cc:740
G4bool IsCrossingCutPlanes() const
G4double GetSinStartPhi() const
void CheckPhiAngles(G4double sPhi, G4double dPhi)
void SetZHalfLength(G4double newDz)
G4CutTubs & operator=(const G4CutTubs &rhs)
Definition G4CutTubs.cc:189
void DescribeYourselfTo(G4VGraphicsScene &scene) const override
EInside Inside(const G4ThreeVector &p) const override
Definition G4CutTubs.cc:555
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const override
Definition G4CutTubs.cc:884
void InitializeTrigonometry()
G4double GetSinEndPhi() const
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const override
Definition G4CutTubs.cc:637
void CheckSPhiAngle(G4double sPhi)
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pmin, G4double &pmax) const override
Definition G4CutTubs.cc:444
G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=nullptr, G4ThreeVector *n=nullptr) const override
G4double GetCosStartPhi() const
G4double GetCosEndPhi() const
std::ostream & StreamInfo(std::ostream &os) const override
G4CutTubs(const G4String &pName, G4double pRMin, G4double pRMax, G4double pDz, G4double pSPhi, G4double pDPhi, G4ThreeVector pLowNorm, G4ThreeVector pHighNorm)
Definition G4CutTubs.cc:63
G4double GetCubicVolume() override
Definition G4CutTubs.cc:222
void SetOuterRadius(G4double newRMax)
G4CutTubs(const G4CutTubs &rhs)
G4Polyhedron * CreatePolyhedron() const override
EAxis
Definition geomdefs.hh:54
EInside
Definition geomdefs.hh:67