Geant4  10.00.p01
G4TwistTubsSide.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 //
27 // $Id: G4TwistTubsSide.hh 66356 2012-12-18 09:02:32Z gcosmo $
28 //
29 //
30 // --------------------------------------------------------------------
31 // GEANT 4 class header file
32 //
33 //
34 // G4TwistTubsSide
35 //
36 // Class description:
37 //
38 // Class describing a twisted boundary surface for a cylinder.
39 
40 // Author:
41 // 01-Aug-2002 - Kotoyo Hoshina (hoshina@hepburn.s.chiba-u.ac.jp)
42 //
43 // History:
44 // 13-Nov-2003 - O.Link (Oliver.Link@cern.ch), Integration in Geant4
45 // from original version in Jupiter-2.5.02 application.
46 // --------------------------------------------------------------------
47 #ifndef __G4TWISTTUBSSIDE__
48 #define __G4TWISTTUBSSIDE__
49 
50 #include "G4VTwistSurface.hh"
51 
53 {
54  public: // with description
55 
57  const G4RotationMatrix &rot, // 0.5*(phi-width segment)
58  const G4ThreeVector &tlate,
59  G4int handedness, // R-hand = 1, L-hand = -1
60  const G4double kappa, // tan(TwistAngle/2)/fZHalfLen
61  const EAxis axis0 = kXAxis,
62  const EAxis axis1 = kZAxis,
63  G4double axis0min = -kInfinity,
64  G4double axis1min = -kInfinity,
65  G4double axis0max = kInfinity,
66  G4double axis1max = kInfinity );
67 
68  G4TwistTubsSide(const G4String &name,
69  G4double EndInnerRadius[2],
70  G4double EndOuterRadius[2],
71  G4double DPhi,
72  G4double EndPhi[2],
73  G4double EndZ[2],
74  G4double InnerRadius,
75  G4double OuterRadius,
76  G4double Kappa,
77  G4int handedness);
78 
79  virtual ~G4TwistTubsSide();
80 
81  virtual G4ThreeVector GetNormal(const G4ThreeVector &xx,
82  G4bool isGlobal = false) ;
83 
84  virtual G4int DistanceToSurface(const G4ThreeVector &gp,
85  const G4ThreeVector &gv,
86  G4ThreeVector gxx[],
87  G4double distance[],
88  G4int areacode[],
89  G4bool isvalid[],
90  EValidate validate = kValidateWithTol);
91 
92  virtual G4int DistanceToSurface(const G4ThreeVector &gp,
93  G4ThreeVector gxx[],
94  G4double distance[],
95  G4int areacode[]);
96 
98  G4bool isglobal = false) const ;
99 
101  G4bool isGlobal = false) ;
102  virtual G4double GetBoundaryMin(G4double phi) ;
103  virtual G4double GetBoundaryMax(G4double phi) ;
104  virtual G4double GetSurfaceArea() ;
105  virtual void GetFacets( G4int m, G4int n, G4double xyz[][3],
106  G4int faces[][4], G4int iside ) ;
107 
108  public: // without description
109 
110  G4TwistTubsSide(__void__&);
111  // Fake default constructor for usage restricted to direct object
112  // persistency for clients requiring preallocation of memory for
113  // persistifiable objects.
114 
115  private:
116 
117  virtual G4double DistanceToPlane(const G4ThreeVector &p,
118  const G4ThreeVector &A,
119  const G4ThreeVector &B,
120  const G4ThreeVector &C,
121  const G4ThreeVector &D,
122  const G4int parity,
123  G4ThreeVector &xx,
124  G4ThreeVector &n);
125 
126  virtual G4int GetAreaCode(const G4ThreeVector &xx,
127  G4bool withTol = true);
128 
129  virtual void SetCorners();
130 
131  virtual void SetCorners( G4double endInnerRad[2],
132  G4double endOuterRad[2],
133  G4double endPhi[2],
134  G4double endZ[2] ) ;
135 
136  virtual void SetBoundaries();
137 
138  private:
139 
140  G4double fKappa; // std::tan(TwistedAngle/2)/HalfLenZ;
141 };
142 
143 
144 //========================================================
145 // inline functions
146 //========================================================
147 
148 inline
150  G4bool isglobal) const
151 {
152  // Get Rho at p.z() on Hyperbolic Surface.
153  G4ThreeVector tmpp;
154  if (isglobal) {
155  tmpp = fRot.inverse()*p - fTrans;
156  } else {
157  tmpp = p;
158  }
159  G4ThreeVector xx(p.x(), p.x() * fKappa * p.z(), p.z());
160  if (isglobal) { return (fRot * xx + fTrans); }
161  return xx;
162 }
163 
164 inline
167 {
168  G4ThreeVector SurfPoint( x , x * fKappa * z , z ) ;
169 
170  if (isGlobal) { return (fRot * SurfPoint + fTrans); }
171  return SurfPoint;
172 }
173 
174 inline
176 {
177  return fAxisMin[0] ; // inner radius at z = 0
178 }
179 
180 inline
182 {
183  return fAxisMax[0] ; // outer radius at z = 0
184 }
185 
186 inline
188 {
189  // approximation only
190  return ( fAxisMax[0] - fAxisMin[0] ) * ( fAxisMax[1] - fAxisMin[1] ) ;
191 }
192 
193 #endif
virtual void GetFacets(G4int m, G4int n, G4double xyz[][3], G4int faces[][4], G4int iside)
virtual G4ThreeVector GetNormal(const G4ThreeVector &xx, G4bool isGlobal=false)
static const G4double kInfinity
Definition: geomdefs.hh:42
CLHEP::Hep3Vector G4ThreeVector
CLHEP::HepRotation G4RotationMatrix
G4double z
Definition: TRTMaterials.hh:39
G4String name
Definition: TRTMaterials.hh:40
G4double fAxisMax[2]
virtual ~G4TwistTubsSide()
int G4int
Definition: G4Types.hh:78
G4RotationMatrix fRot
G4ThreeVector fTrans
G4double fAxisMin[2]
virtual void SetCorners()
virtual void SetBoundaries()
virtual G4double GetSurfaceArea()
bool G4bool
Definition: G4Types.hh:79
virtual G4double GetBoundaryMax(G4double phi)
virtual G4ThreeVector SurfacePoint(G4double, G4double, G4bool isGlobal=false)
const G4int n
static const G4double A[nN]
virtual G4double GetBoundaryMin(G4double phi)
EAxis
Definition: geomdefs.hh:54
virtual G4int DistanceToSurface(const G4ThreeVector &gp, const G4ThreeVector &gv, G4ThreeVector gxx[], G4double distance[], G4int areacode[], G4bool isvalid[], EValidate validate=kValidateWithTol)
G4TwistTubsSide(const G4String &name, const G4RotationMatrix &rot, const G4ThreeVector &tlate, G4int handedness, const G4double kappa, const EAxis axis0=kXAxis, const EAxis axis1=kZAxis, G4double axis0min=-kInfinity, G4double axis1min=-kInfinity, G4double axis0max=kInfinity, G4double axis1max=kInfinity)
static const double m
Definition: G4SIunits.hh:110
double G4double
Definition: G4Types.hh:76
virtual G4int GetAreaCode(const G4ThreeVector &xx, G4bool withTol=true)
virtual G4double DistanceToPlane(const G4ThreeVector &p, const G4ThreeVector &A, const G4ThreeVector &B, const G4ThreeVector &C, const G4ThreeVector &D, const G4int parity, G4ThreeVector &xx, G4ThreeVector &n)
G4ThreeVector ProjectAtPXPZ(const G4ThreeVector &p, G4bool isglobal=false) const