Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4PolyconeSide.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: G4PolyconeSide.hh 99392 2016-09-20 13:33:55Z gcosmo $
28 //
29 //
30 // --------------------------------------------------------------------
31 // GEANT 4 class header file
32 //
33 //
34 // G4PolyconeSide
35 //
36 // Class description:
37 //
38 // Class implmenting a face that represents one conical side
39 // of a polycone:
40 //
41 // G4PolyconeSide( const G4PolyconeSideRZ *prevRZ,
42 // const G4PolyconeSideRZ *tail,
43 // const G4PolyconeSideRZ *head,
44 // const G4PolyconeSideRZ *nextRZ,
45 // G4double phiStart, G4double deltaPhi,
46 // G4bool phiIsOpen, G4bool isAllBehind=false )
47 //
48 // Values for r1,z1 and r2,z2 should be specified in clockwise
49 // order in (r,z).
50 
51 // Author:
52 // David C. Williams (davidw@scipp.ucsc.edu)
53 // --------------------------------------------------------------------
54 
55 #ifndef G4PolyconeSide_hh
56 #define G4PolyconeSide_hh
57 
58 #include "G4VCSGface.hh"
59 
60 class G4IntersectingCone;
61 
63 {
64  G4double r, z; // start of vector
65 };
66 
67 // ----------------------------------------------------------------------------
68 // MT-specific utility code
69 
70 #include "G4GeomSplitter.hh"
71 
72 // The class G4PlSideData is introduced to encapsulate the
73 // fields of the class G4PolyconeSide that may not be read-only.
74 //
76 {
77  public:
78 
79  void initialize()
80  {
81  fPhi.first = G4ThreeVector(0,0,0);
82  fPhi.second= 0.0;
83  }
84 
85  std::pair<G4ThreeVector, G4double> fPhi; // Cached value for phi
86 };
87 
88 // The type G4PlSideManager is introduced to
89 // encapsulate the methods used by both the master thread and
90 // worker threads to allocate memory space for the fields encapsulated
91 // by the class G4PlSideData.
92 //
94 
95 //
96 // ----------------------------------------------------------------------------
97 
98 class G4PolyconeSide : public G4VCSGface
99 {
100  public:
101 
102  G4PolyconeSide( const G4PolyconeSideRZ *prevRZ,
103  const G4PolyconeSideRZ *tail,
104  const G4PolyconeSideRZ *head,
105  const G4PolyconeSideRZ *nextRZ,
106  G4double phiStart, G4double deltaPhi,
107  G4bool phiIsOpen, G4bool isAllBehind=false );
108  virtual ~G4PolyconeSide();
109 
110  G4PolyconeSide( const G4PolyconeSide &source );
111  G4PolyconeSide& operator=( const G4PolyconeSide &source );
112 
113  G4bool Intersect( const G4ThreeVector &p, const G4ThreeVector &v,
114  G4bool outgoing, G4double surfTolerance,
115  G4double &distance, G4double &distFromSurface,
116  G4ThreeVector &normal, G4bool &isAllBehind );
117 
118  G4double Distance( const G4ThreeVector &p, G4bool outgoing );
119 
120  EInside Inside( const G4ThreeVector &p, G4double tolerance,
121  G4double *bestDistance );
122 
123  G4ThreeVector Normal( const G4ThreeVector &p, G4double *bestDistance );
124 
125  G4double Extent( const G4ThreeVector axis );
126 
127  void CalculateExtent( const EAxis axis,
128  const G4VoxelLimits &voxelLimit,
129  const G4AffineTransform &tranform,
130  G4SolidExtentList &extentList );
131 
132  G4VCSGface *Clone() { return new G4PolyconeSide( *this ); }
133 
136 
137  public: // without description
138 
139  G4PolyconeSide(__void__&);
140  // Fake default constructor for usage restricted to direct object
141  // persistency for clients requiring preallocation of memory for
142  // persistifiable objects.
143 
144  inline G4int GetInstanceID() const { return instanceID; }
145  // Returns the instance ID.
146 
147  static const G4PlSideManager& GetSubInstanceManager();
148  // Returns the private data instance manager.
149 
150  protected:
151 
152  G4double DistanceAway( const G4ThreeVector &p, G4bool opposite,
153  G4double &distOutside2, G4double *rzNorm=0 );
154 
156  G4double &distOutside2, G4double *edgeRZnorm );
157 
158  G4bool PointOnCone( const G4ThreeVector &hit, G4double normSign,
159  const G4ThreeVector &p,
160  const G4ThreeVector &v, G4ThreeVector &normal );
161 
162  void CopyStuff( const G4PolyconeSide &source );
163 
164  static void FindLineIntersect( G4double x1, G4double y1,
165  G4double tx1, G4double ty1,
166  G4double x2, G4double y2,
167  G4double tx2, G4double ty2,
168  G4double &x, G4double &y );
169 
170  G4double GetPhi( const G4ThreeVector& p );
171 
172  protected:
173 
174  G4double r[2], z[2]; // r, z parameters, in specified order
175  G4double startPhi, // Start phi (0 to 2pi), if phiIsOpen
176  deltaPhi; // Delta phi (0 to 2pi), if phiIsOpen
177  G4bool phiIsOpen; // True if there is a phi slice
178  G4bool allBehind; // True if the entire solid is "behind" this face
179 
180  G4IntersectingCone *cone; // Our intersecting utility class
181 
182  G4double rNorm, zNorm; // Normal to surface in r,z space
183  G4double rS, zS; // Unit vector along surface in r,z space
184  G4double length; // Length of face in r,z space
186  prevZS; // Unit vector along previous polyconeSide
188  nextZS; // Unit vector along next polyconeSide
189 
191  zNormEdge[2]; // Normal to edges
192 
194  G4ThreeVector *corners; // The coordinates of the corners (if phiIsOpen)
195 
196  private:
197 
198  G4double kCarTolerance; // Geometrical surface thickness
199  G4double fSurfaceArea; // Used for surface calculation
200 
201  G4int instanceID;
202  // This field is used as instance ID.
203  G4GEOM_DLL static G4PlSideManager subInstanceManager;
204  // This field helps to use the class G4PlSideManager introduced above.
205 };
206 
207 #endif
G4ThreeVector GetPointOnFace()
G4double SurfaceArea()
CLHEP::Hep3Vector G4ThreeVector
G4double zNormEdge[2]
const char * p
Definition: xmltok.h:285
G4bool Intersect(const G4ThreeVector &p, const G4ThreeVector &v, G4bool outgoing, G4double surfTolerance, G4double &distance, G4double &distFromSurface, G4ThreeVector &normal, G4bool &isAllBehind)
EInside Inside(const G4ThreeVector &p, G4double tolerance, G4double *bestDistance)
tuple x
Definition: test.py:50
G4double Extent(const G4ThreeVector axis)
G4ThreeVector Normal(const G4ThreeVector &p, G4double *bestDistance)
void CopyStuff(const G4PolyconeSide &source)
int G4int
Definition: G4Types.hh:78
static void FindLineIntersect(G4double x1, G4double y1, G4double tx1, G4double ty1, G4double x2, G4double y2, G4double tx2, G4double ty2, G4double &x, G4double &y)
G4ThreeVector * corners
virtual ~G4PolyconeSide()
static double normal(HepRandomEngine *eptr)
Definition: RandPoisson.cc:77
G4int GetInstanceID() const
G4double rNormEdge[2]
void CalculateExtent(const EAxis axis, const G4VoxelLimits &voxelLimit, const G4AffineTransform &tranform, G4SolidExtentList &extentList)
G4PolyconeSide(const G4PolyconeSideRZ *prevRZ, const G4PolyconeSideRZ *tail, const G4PolyconeSideRZ *head, const G4PolyconeSideRZ *nextRZ, G4double phiStart, G4double deltaPhi, G4bool phiIsOpen, G4bool isAllBehind=false)
bool G4bool
Definition: G4Types.hh:79
G4VCSGface * Clone()
static const G4PlSideManager & GetSubInstanceManager()
tuple v
Definition: test.py:18
std::pair< G4ThreeVector, G4double > fPhi
G4IntersectingCone * cone
EInside
Definition: geomdefs.hh:58
EAxis
Definition: geomdefs.hh:54
G4double GetPhi(const G4ThreeVector &p)
G4double DistanceAway(const G4ThreeVector &p, G4bool opposite, G4double &distOutside2, G4double *rzNorm=0)
G4bool PointOnCone(const G4ThreeVector &hit, G4double normSign, const G4ThreeVector &p, const G4ThreeVector &v, G4ThreeVector &normal)
G4double Distance(const G4ThreeVector &p, G4bool outgoing)
G4GeomSplitter< G4PlSideData > G4PlSideManager
double G4double
Definition: G4Types.hh:76
#define G4GEOM_DLL
Definition: geomwdefs.hh:48
G4PolyconeSide & operator=(const G4PolyconeSide &source)