Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4Para.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: G4Para.hh 99509 2016-09-26 07:48:56Z gcosmo $
28 //
29 //
30 // --------------------------------------------------------------------
31 // GEANT 4 class header file
32 //
33 // G4Para
34 //
35 // Class description:
36 //
37 // A G4Parallepiped, essentially a box with half lengths dx,dy,dz
38 // `skewed' so that there are angles theta & phi of the polar line
39 // joining the faces at +-dz in z, and alpha formed by the y axis
40 // and the plane joinng the centre of the faces G4Parallel to the
41 // z-x plane at -dy and +dy.
42 //
43 // A G4Para is defined by:
44 // dx,dy,dz - Half-length in x,y,z
45 // alpha - Angle formed by the y axis and by the plane joining
46 // the centre of the faces G4Parallel to the z-x plane
47 // at -dy and +dy
48 // theta - Polar angle of the line joining the centres of the
49 // faces at -dz and +dz in z
50 // phi - Azimuthal angle of the line joining the centres of the
51 // faces at -dz and +dz in z
52 // Member data:
53 //
54 // Note that the angles parameters are not stored - precomputed trig is
55 // stored instead.
56 //
57 // fDx Half-length in x
58 // fDy Half-length in y
59 // fDz Half-length in z
60 //
61 // fTalpha Tan of alpha
62 // fTthetaCphi Tan theta * Cos phi
63 // fTthetaSphi Tan theta * Sin phi
64 
65 // History:
66 // 21.3.94 P.Kent Old C++ code converted to tolerant geometry
67 // 31.10.96 V.Grichine Modifications according G4Box/Tubs before to commit
68 // 18.11.99 V.Grichine , kUndefined was added to ESide
69 // --------------------------------------------------------------------
70 
71 #ifndef G4Para_HH
72 #define G4Para_HH
73 
74 #include "G4CSGSolid.hh"
75 #include "G4Polyhedron.hh"
76 
77 class G4Para : public G4CSGSolid
78 {
79  public: // with description
80 
81  G4Para(const G4String& pName,
82  G4double pDx, G4double pDy, G4double pDz,
83  G4double pAlpha, G4double pTheta, G4double pPhi);
84 
85  G4Para(const G4String& pName,
86  const G4ThreeVector pt[8]);
87 
88  virtual ~G4Para();
89 
90  // Accessors
91 
92  inline G4double GetZHalfLength() const;
93  inline G4ThreeVector GetSymAxis() const;
94  inline G4double GetYHalfLength() const;
95  inline G4double GetXHalfLength() const;
96  inline G4double GetTanAlpha() const;
97 
98  // Modifiers
99 
100  inline void SetXHalfLength(G4double val);
101  inline void SetYHalfLength(G4double val);
102  inline void SetZHalfLength(G4double val);
103  inline void SetAlpha(G4double alpha);
104  inline void SetTanAlpha(G4double val);
105  inline void SetThetaAndPhi(double pTheta, double pPhi);
106 
107  void SetAllParameters(G4double pDx, G4double pDy, G4double pDz,
108  G4double pAlpha, G4double pTheta, G4double pPhi);
109 
110  // Other methods of solid
111 
112  inline G4double GetCubicVolume();
113  inline G4double GetSurfaceArea();
114 
116  const G4int n,
117  const G4VPhysicalVolume* pRep);
118 
119  void Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
120 
121  G4bool CalculateExtent(const EAxis pAxis,
122  const G4VoxelLimits& pVoxelLimit,
123  const G4AffineTransform& pTransform,
124  G4double& pMin, G4double& pMax) const;
125 
126  EInside Inside(const G4ThreeVector& p) const;
127 
128  G4ThreeVector SurfaceNormal( const G4ThreeVector& p) const;
129 
131  const G4ThreeVector& v) const;
132  G4double DistanceToIn(const G4ThreeVector& p) const;
133 
135  const G4bool calcNorm=G4bool(false),
136  G4bool *validNorm=0, G4ThreeVector *n=0) const;
137  G4double DistanceToOut(const G4ThreeVector& p) const;
138 
140 
142 
143  G4VSolid* Clone() const;
144 
145  std::ostream& StreamInfo(std::ostream& os) const;
146 
147  // Visualisation functions
148 
149  void DescribeYourselfTo (G4VGraphicsScene& scene) const;
150  G4Polyhedron* CreatePolyhedron () const;
151 
152  public: // without description
153 
154  G4Para(__void__&);
155  // Fake default constructor for usage restricted to direct object
156  // persistency for clients requiring preallocation of memory for
157  // persistifiable objects.
158 
159  G4Para(const G4Para& rhs);
160  G4Para& operator=(const G4Para& rhs);
161  // Copy constructor and assignment operator.
162 
163  private:
164 
165  G4ThreeVector ApproxSurfaceNormal( const G4ThreeVector& p) const;
166  // Algorithm for SurfaceNormal() following the original
167  // specification for points not on the surface
168 
169  G4ThreeVector GetPointOnPlane(G4ThreeVector p0, G4ThreeVector p1,
171  G4double& area) const;
172  // Returns a random point on the surface of one of the faces.
173 
174  private:
175 
176  G4double fDx,fDy,fDz;
177  G4double fTalpha,fTthetaCphi,fTthetaSphi;
178 };
179 
180 #include "G4Para.icc"
181 
182 #endif
G4ThreeVector GetSymAxis() const
G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=G4bool(false), G4bool *validNorm=0, G4ThreeVector *n=0) const
Definition: G4Para.cc:740
G4ThreeVector GetPointOnSurface() const
Definition: G4Para.cc:1115
void SetXHalfLength(G4double val)
Definition: G4Para.hh:77
void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
Definition: G4Para.cc:210
EInside Inside(const G4ThreeVector &p) const
Definition: G4Para.cc:317
void SetAlpha(G4double alpha)
void SetAllParameters(G4double pDx, G4double pDy, G4double pDz, G4double pAlpha, G4double pTheta, G4double pPhi)
Definition: G4Para.cc:74
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const
Definition: G4Para.cc:263
const char * p
Definition: xmltok.h:285
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const
Definition: G4Para.cc:356
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const
Definition: G4Para.cc:517
G4Para(const G4String &pName, G4double pDx, G4double pDy, G4double pDz, G4double pAlpha, G4double pTheta, G4double pPhi)
Definition: G4Para.cc:102
std::ostream & StreamInfo(std::ostream &os) const
Definition: G4Para.cc:1038
G4Para & operator=(const G4Para &rhs)
Definition: G4Para.cc:186
int G4int
Definition: G4Types.hh:78
G4double GetCubicVolume()
G4Polyhedron * CreatePolyhedron() const
Definition: G4Para.cc:1171
void SetThetaAndPhi(double pTheta, double pPhi)
void SetZHalfLength(G4double val)
bool G4bool
Definition: G4Types.hh:79
void SetYHalfLength(G4double val)
const G4int n
G4GeometryType GetEntityType() const
Definition: G4Para.cc:1020
tuple v
Definition: test.py:18
G4double GetXHalfLength() const
void SetTanAlpha(G4double val)
void DescribeYourselfTo(G4VGraphicsScene &scene) const
Definition: G4Para.cc:1166
G4double GetTanAlpha() const
EInside
Definition: geomdefs.hh:58
EAxis
Definition: geomdefs.hh:54
G4double GetZHalfLength() const
G4VSolid * Clone() const
Definition: G4Para.cc:1029
G4double GetSurfaceArea()
virtual ~G4Para()
Definition: G4Para.cc:167
double G4double
Definition: G4Types.hh:76
static const G4double alpha
void Extent(G4ThreeVector &pMin, G4ThreeVector &pMax) const
Definition: G4Para.cc:221
G4double GetYHalfLength() const