Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4TwistTubsHypeSide.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// G4TwistTubsHypeSide
27//
28// Class description:
29//
30// Class describing a hyperbolic boundary surface for a cylinder.
31
32// 01-Aug-2002 - Kotoyo Hoshina ([email protected]), created.
33// 13-Nov-2003 - O.Link ([email protected]), Integration in Geant4
34// from original version in Jupiter-2.5.02 application.
35// --------------------------------------------------------------------
36#ifndef G4TWISTTUBSHYPESIDE_HH
37#define G4TWISTTUBSHYPESIDE_HH
38
39#include "G4VTwistSurface.hh"
40#include "G4Integrator.hh"
42
44{
45 public:
46
47 G4TwistTubsHypeSide(const G4String& name,
48 const G4RotationMatrix& rot, // 0.5*(phi-width segment)
49 const G4ThreeVector& tlate,
50 const G4int handedness,// R-hand = 1, L-hand = -1
51 const G4double kappa, // tan(TwistAngle/2)/fZHalfLen
52 const G4double tanstereo, // tan(stereo angle)
53 const G4double r0, // radius at z = 0
54 const EAxis axis0 = kPhi,
55 const EAxis axis1 = kZAxis,
56 G4double axis0min = -kInfinity,
57 G4double axis1min = -kInfinity,
58 G4double axis0max = kInfinity,
59 G4double axis1max = kInfinity);
60
61 G4TwistTubsHypeSide(const G4String& name,
62 G4double EndInnerRadius[2],
63 G4double EndOuterRadius[2],
64 G4double DPhi,
65 G4double EndPhi[2],
66 G4double EndZ[2],
67 G4double InnerRadius,
68 G4double OuterRadius,
69 G4double Kappa,
70 G4double TanInnerStereo,
71 G4double TanOuterStereo,
72 G4int handedness) ;
73
75
77 const G4ThreeVector& gv,
78 G4ThreeVector gxx[],
79 G4double distance[],
80 G4int areacode[],
81 G4bool isvalid[],
82 EValidate validate = kValidateWithTol) override;
83
85 G4ThreeVector gxx[],
86 G4double distance[],
87 G4int areacode[]) override;
88
90 G4bool isGlobal = false) override ;
91 EInside Inside(const G4ThreeVector& gp) ;
92
93 inline G4double GetRhoAtPZ(const G4ThreeVector& p,
94 G4bool isglobal = false) const ;
95
97 G4bool isGlobal = false) override ;
98 inline G4double GetBoundaryMin(G4double phi) override ;
99 inline G4double GetBoundaryMax(G4double phi) override ;
100 inline G4double GetSurfaceArea() override ;
101 void GetFacets( G4int m, G4int n, G4double xyz[][3],
102 G4int faces[][4], G4int iside ) override ;
103
104 G4TwistTubsHypeSide(__void__&);
105 // Fake default constructor for usage restricted to direct object
106 // persistency for clients requiring preallocation of memory for
107 // persistifiable objects.
108
109 private:
110
111 G4int GetAreaCode(const G4ThreeVector& xx,
112 G4bool withTol = true) override;
113 G4int GetAreaCodeInPhi(const G4ThreeVector& xx,
114 G4bool withTol = true);
115 void SetCorners() override;
116
117 void SetCorners(G4double EndInnerRadius[2],
118 G4double EndOuterRadius[2],
119 G4double DPhi,
120 G4double EndPhi[2],
121 G4double EndZ[2]);
122 void SetBoundaries() override;
123
124 private:
125
126 G4double fKappa; // std::tan(TwistedAngle/2)/HalfLenZ;
127 G4double fTanStereo; // std::tan(StereoAngle)
128 G4double fTan2Stereo; // std::tan(StereoAngle)**2
129 G4double fR0; // radius at z = 0
130 G4double fR02; // radius**2 at z = 0
131 G4double fDPhi ; // segment
132
133 class Insidetype
134 {
135 public:
136 G4ThreeVector gp;
137 EInside inside;
138 };
139 Insidetype fInside;
140};
141
142//========================================================
143// inline functions
144//========================================================
145
146inline
148 G4bool isglobal) const
149{
150 // Get Rho at p.z() on Hyperbolic Surface.
151 G4ThreeVector tmpp;
152 if (isglobal) { tmpp = fRot.inverse()*p - fTrans; }
153 else { tmpp = p; }
154
155 return std::sqrt(fR02 + tmpp.z() * tmpp.z() * fTan2Stereo);
156}
157
158inline
160SurfacePoint(G4double phi , G4double z , G4bool isGlobal)
161{
162 G4double rho = std::sqrt(fR02 + z * z * fTan2Stereo) ;
163
164 G4ThreeVector SurfPoint (rho*std::cos(phi), rho*std::sin(phi), z) ;
165
166 if (isGlobal) { return (fRot * SurfPoint + fTrans); }
167 return SurfPoint;
168}
169
170inline
172{
173 G4ThreeVector ptmp(0,0,z) ; // temporary point with z Komponent only
174 G4ThreeVector lowerlimit; // lower phi-boundary limit at z = ptmp.z()
175 lowerlimit = GetBoundaryAtPZ(sAxis0 & sAxisMin, ptmp);
176 return std::atan2( lowerlimit.y(), lowerlimit.x() ) ;
177}
178
179inline
181{
182 G4ThreeVector ptmp(0,0,z) ; // temporary point with z Komponent only
183 G4ThreeVector upperlimit; // upper phi-boundary limit at z = ptmp.z()
184 upperlimit = GetBoundaryAtPZ(sAxis0 & sAxisMax, ptmp);
185 return std::atan2( upperlimit.y(), upperlimit.x() ) ;
186}
187
188inline
190{
191 // approximation with tube surface
192
193 return ( fAxisMax[1] - fAxisMin[1] ) * fR0 * fDPhi ;
194}
195
196#endif
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
double z() const
double x() const
double y() const
HepRotation inverse() const
G4ThreeVector GetNormal(const G4ThreeVector &xx, G4bool isGlobal=false) override
G4int DistanceToSurface(const G4ThreeVector &gp, const G4ThreeVector &gv, G4ThreeVector gxx[], G4double distance[], G4int areacode[], G4bool isvalid[], EValidate validate=kValidateWithTol) override
EInside Inside(const G4ThreeVector &gp)
~G4TwistTubsHypeSide() override
G4ThreeVector SurfacePoint(G4double, G4double, G4bool isGlobal=false) override
G4double GetBoundaryMin(G4double phi) override
G4TwistTubsHypeSide(const G4String &name, const G4RotationMatrix &rot, const G4ThreeVector &tlate, const G4int handedness, const G4double kappa, const G4double tanstereo, const G4double r0, const EAxis axis0=kPhi, const EAxis axis1=kZAxis, G4double axis0min=-kInfinity, G4double axis1min=-kInfinity, G4double axis0max=kInfinity, G4double axis1max=kInfinity)
G4double GetSurfaceArea() override
G4double GetRhoAtPZ(const G4ThreeVector &p, G4bool isglobal=false) const
void GetFacets(G4int m, G4int n, G4double xyz[][3], G4int faces[][4], G4int iside) override
G4double GetBoundaryMax(G4double phi) override
static const G4int sAxisMax
static const G4int sAxis0
G4RotationMatrix fRot
static const G4int sAxisMin
virtual G4ThreeVector GetBoundaryAtPZ(G4int areacode, const G4ThreeVector &p) const
G4ThreeVector fTrans
EAxis
Definition geomdefs.hh:54
@ kPhi
Definition geomdefs.hh:60
@ kZAxis
Definition geomdefs.hh:57
EInside
Definition geomdefs.hh:67