Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4TwistTubsFlatSide.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// G4TwistTubsFlatSide
27//
28// Class description:
29//
30// Class describing a flat boundary surface for a cylinder.
31
32// Author: Kotoyo Hoshina (Chiba University), 01.08.2002 - Created.
33// Oliver Link (CERN), 13.11.2003 - Integration in Geant4
34// from original version in Jupiter-2.5.02 application.
35// --------------------------------------------------------------------
36#ifndef G4TWISTTUBSFLATSIDE_HH
37#define G4TWISTTUBSFLATSIDE_HH
38
39#include "G4VTwistSurface.hh"
40
41/**
42 * @brief G4TwistTubsFlatSide describes a flat boundary surface for a cylinder.
43 */
44
46{
47 public:
48
49 /**
50 * Constructs a cylinder flat boundary surface, given its parameters.
51 * @param[in] name The surface name.
52 * @param[in] rot Rotation.
53 * @param[in] tlate Translation.
54 * @param[in] n Normal vector.
55 * @param[in] axis0 Rho axis.
56 * @param[in] axis1 Phi axis.
57 * @param[in] axis0min Minimum in Rho.
58 * @param[in] axis1min Minimum in Phi.
59 * @param[in] axis0max Maximum in Rho.
60 * @param[in] axis1max Maximum in Phi.
61 */
62 G4TwistTubsFlatSide(const G4String& name,
63 const G4RotationMatrix& rot,
64 const G4ThreeVector& tlate,
65 const G4ThreeVector& n,
66 const EAxis axis0 = kRho, // RHO axis !
67 const EAxis axis1 = kPhi, // PHI axis !
68 G4double axis0min = -kInfinity,
69 G4double axis1min = -kInfinity,
70 G4double axis0max = kInfinity,
71 G4double axis1max = kInfinity);
72
73 /**
74 * Alternative Construct for a cylinder flat boundary surface.
75 * @param[in] name The surface name.
76 * @param[in] EndInnerRadius Inner-hype radius at z=0.
77 * @param[in] EndOuterRadius Outer-hype radius at z=0.
78 * @param[in] DPhi Phi angle.
79 * @param[in] EndPhi Total Phi.
80 * @param[in] EndZ Z length.
81 * @param[in] handedness Orientation: +z = +ve, -z = -ve.
82 */
83 G4TwistTubsFlatSide(const G4String& name,
84 G4double EndInnerRadius[2],
85 G4double EndOuterRadius[2],
86 G4double DPhi,
87 G4double EndPhi[2],
88 G4double EndZ[2],
89 G4int handedness);
90
91 /**
92 * Default destructor.
93 */
94 ~G4TwistTubsFlatSide() override = default;
95
96 /**
97 * Returns a normal vector at a surface (or very close to the surface)
98 * point at 'p'.
99 * @param[in] p Not used. Using current normal.
100 * @param[in] isGlobal If true, it returns the normal in global coordinates.
101 * @returns The current normal vector.
102 */
103 G4ThreeVector GetNormal(const G4ThreeVector& /* p */ ,
104 G4bool isGlobal = false) override;
105
106 /**
107 * Returns the distance to surface, given point 'gp' and direction 'gv'.
108 * @param[in] gp The point from where computing the distance.
109 * @param[in] gv The direction along which computing the distance.
110 * @param[out] gxx Vector of global points based on number of solutions.
111 * @param[out] distance The distance vector based on number of solutions.
112 * @param[out] areacode The location vector based on number of solutions.
113 * @param[out] isvalid Validity vector based on number of solutions.
114 * @param[in] validate Adopted validation criteria.
115 * @returns The number of solutions.
116 */
118 const G4ThreeVector& gv,
119 G4ThreeVector gxx[],
120 G4double distance[],
121 G4int areacode[],
122 G4bool isvalid[],
123 EValidate validate = kValidateWithTol) override;
124
125 /**
126 * Returns the safety distance to surface, given point 'gp'.
127 * @param[in] gp The point from where computing the safety distance.
128 * @param[out] gxx Vector of global points based on number of solutions.
129 * @param[out] distance The distance vector based on number of solutions.
130 * @param[out] areacode The location vector based on number of solutions.
131 * @returns The number of solutions.
132 */
134 G4ThreeVector gxx[],
135 G4double distance[],
136 G4int areacode[]) override;
137
138 /**
139 * Fake default constructor for usage restricted to direct object
140 * persistency for clients requiring preallocation of memory for
141 * persistifiable objects.
142 */
143 G4TwistTubsFlatSide(__void__&);
144
145 private:
146
147 /**
148 * Returns point on surface given 'phi' and 'u'.
149 */
150 inline G4ThreeVector SurfacePoint(G4double, G4double,
151 G4bool isGlobal = false) override;
152
153 /**
154 * Internal accessors.
155 */
156 inline G4double GetBoundaryMin(G4double phi) override;
157 inline G4double GetBoundaryMax(G4double phi) override;
158 inline G4double GetSurfaceArea() override { return fSurfaceArea ; }
159 void GetFacets( G4int m, G4int n, G4double xyz[][3],
160 G4int faces[][4], G4int iside ) override;
161
162 /**
163 * Returns the area code for point 'xx' using or not surface tolerance.
164 */
165 G4int GetAreaCode(const G4ThreeVector& xx,
166 G4bool withTol = true) override ;
167
168 /**
169 * Setters.
170 */
171 void SetCorners() override;
172 void SetBoundaries() override;
173
174 private:
175
176 G4double fSurfaceArea = 0.0;
177};
178
179//========================================================
180// inline functions
181//========================================================
182
183inline G4ThreeVector G4TwistTubsFlatSide::
184SurfacePoint(G4double phi , G4double rho , G4bool isGlobal )
185{
186 G4ThreeVector SurfPoint (rho*std::cos(phi) , rho*std::sin(phi) , 0);
187
188 if (isGlobal) { return (fRot * SurfPoint + fTrans); }
189 return SurfPoint;
190}
191
192inline
193G4double G4TwistTubsFlatSide::GetBoundaryMin(G4double)
194{
196 return std::atan2( dphimin.y(), dphimin.x() );
197}
198
199inline
200G4double G4TwistTubsFlatSide::GetBoundaryMax(G4double)
201{
203 return std::atan2( dphimax.y(), dphimax.x() );
204}
205
206#endif
CLHEP::HepRotation G4RotationMatrix
CLHEP::Hep3Vector G4ThreeVector
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
double x() const
double y() const
G4int DistanceToSurface(const G4ThreeVector &gp, const G4ThreeVector &gv, G4ThreeVector gxx[], G4double distance[], G4int areacode[], G4bool isvalid[], EValidate validate=kValidateWithTol) override
G4ThreeVector GetNormal(const G4ThreeVector &, G4bool isGlobal=false) override
G4TwistTubsFlatSide(const G4String &name, const G4RotationMatrix &rot, const G4ThreeVector &tlate, const G4ThreeVector &n, const EAxis axis0=kRho, const EAxis axis1=kPhi, G4double axis0min=-kInfinity, G4double axis1min=-kInfinity, G4double axis0max=kInfinity, G4double axis1max=kInfinity)
~G4TwistTubsFlatSide() override=default
G4VTwistSurface(const G4String &name)
G4RotationMatrix fRot
static const G4int sC0Max1Max
G4ThreeVector fTrans
G4ThreeVector GetCorner(G4int areacode) const
static const G4int sC0Max1Min
virtual G4double GetSurfaceArea()=0
EAxis
Definition geomdefs.hh:54
@ kPhi
Definition geomdefs.hh:60
@ kRho
Definition geomdefs.hh:58