Geant4.10
 All Data Structures 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 66356 2012-12-18 09:02:32Z 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 
76 class G4Para : public G4CSGSolid
77 {
78  public: // with description
79 
80  G4Para(const G4String& pName,
81  G4double pDx, G4double pDy, G4double pDz,
82  G4double pAlpha, G4double pTheta, G4double pPhi);
83 
84  G4Para(const G4String& pName,
85  const G4ThreeVector pt[8]);
86 
87  virtual ~G4Para();
88 
89  // Accessors
90 
91  inline G4double GetZHalfLength() const;
92  inline G4ThreeVector GetSymAxis() const;
93  inline G4double GetYHalfLength() const;
94  inline G4double GetXHalfLength() const;
95  inline G4double GetTanAlpha() const;
96 
97  // Modifiers
98 
99  inline void SetXHalfLength(G4double val);
100  inline void SetYHalfLength(G4double val);
101  inline void SetZHalfLength(G4double val);
102  inline void SetAlpha(G4double alpha);
103  inline void SetTanAlpha(G4double val);
104  inline void SetThetaAndPhi(double pTheta, double pPhi);
105 
106  void SetAllParameters(G4double pDx, G4double pDy, G4double pDz,
107  G4double pAlpha, G4double pTheta, G4double pPhi);
108 
109  // Other methods of solid
110 
111  inline G4double GetCubicVolume();
112  inline G4double GetSurfaceArea();
113 
115  const G4int n,
116  const G4VPhysicalVolume* pRep);
117 
118  G4bool CalculateExtent(const EAxis pAxis,
119  const G4VoxelLimits& pVoxelLimit,
120  const G4AffineTransform& pTransform,
121  G4double& pMin, G4double& pMax) const;
122 
123  EInside Inside(const G4ThreeVector& p) const;
124 
125  G4ThreeVector SurfaceNormal( const G4ThreeVector& p) const;
126 
128  const G4ThreeVector& v) const;
129  G4double DistanceToIn(const G4ThreeVector& p) const;
130 
132  const G4bool calcNorm=G4bool(false),
133  G4bool *validNorm=0, G4ThreeVector *n=0) const;
134  G4double DistanceToOut(const G4ThreeVector& p) const;
135 
137 
139 
140  G4VSolid* Clone() const;
141 
142  std::ostream& StreamInfo(std::ostream& os) const;
143 
144  // Visualisation functions
145 
146  void DescribeYourselfTo (G4VGraphicsScene& scene) const;
147  G4Polyhedron* CreatePolyhedron () const;
148 
149  public: // without description
150 
151  G4Para(__void__&);
152  // Fake default constructor for usage restricted to direct object
153  // persistency for clients requiring preallocation of memory for
154  // persistifiable objects.
155 
156  G4Para(const G4Para& rhs);
157  G4Para& operator=(const G4Para& rhs);
158  // Copy constructor and assignment operator.
159 
160  protected: // without description
161 
163  CreateRotatedVertices(const G4AffineTransform& pTransform) const;
164 
165  private:
166 
167  G4ThreeVector ApproxSurfaceNormal( const G4ThreeVector& p) const;
168  // Algorithm for SurfaceNormal() following the original
169  // specification for points not on the surface
170 
171  G4ThreeVector GetPointOnPlane(G4ThreeVector p0, G4ThreeVector p1,
173  G4double& area) const;
174  // Returns a random point on the surface of one of the faces.
175 
176  private:
177 
178  G4double fDx,fDy,fDz;
179  G4double fTalpha,fTthetaCphi,fTthetaSphi;
180 };
181 
182 #include "G4Para.icc"
183 
184 #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:872
G4ThreeVector GetPointOnSurface() const
Definition: G4Para.cc:1328
void SetXHalfLength(G4double val)
Definition: G4Para.hh:76
void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
Definition: G4Para.cc:209
EInside Inside(const G4ThreeVector &p) const
Definition: G4Para.cc:441
void SetAlpha(G4double alpha)
void SetAllParameters(G4double pDx, G4double pDy, G4double pDz, G4double pAlpha, G4double pTheta, G4double pPhi)
Definition: G4Para.cc:71
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const
Definition: G4Para.cc:221
const char * p
Definition: xmltok.h:285
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const
Definition: G4Para.cc:480
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const
Definition: G4Para.cc:649
G4Para(const G4String &pName, G4double pDx, G4double pDy, G4double pDz, G4double pAlpha, G4double pTheta, G4double pPhi)
Definition: G4Para.cc:100
std::ostream & StreamInfo(std::ostream &os) const
Definition: G4Para.cc:1251
G4Para & operator=(const G4Para &rhs)
Definition: G4Para.cc:185
int G4int
Definition: G4Types.hh:78
G4double GetCubicVolume()
G4Polyhedron * CreatePolyhedron() const
Definition: G4Para.cc:1384
void SetThetaAndPhi(double pTheta, double pPhi)
void SetZHalfLength(G4double val)
bool G4bool
Definition: G4Types.hh:79
std::vector< G4ThreeVector > G4ThreeVectorList
Definition: G4VSolid.hh:79
void SetYHalfLength(G4double val)
const G4int n
G4GeometryType GetEntityType() const
Definition: G4Para.cc:1233
G4double GetXHalfLength() const
void SetTanAlpha(G4double val)
void DescribeYourselfTo(G4VGraphicsScene &scene) const
Definition: G4Para.cc:1379
G4double GetTanAlpha() const
EInside
Definition: geomdefs.hh:58
EAxis
Definition: geomdefs.hh:54
G4ThreeVectorList * CreateRotatedVertices(const G4AffineTransform &pTransform) const
Definition: G4Para.cc:1186
G4double GetZHalfLength() const
G4VSolid * Clone() const
Definition: G4Para.cc:1242
G4double GetSurfaceArea()
virtual ~G4Para()
Definition: G4Para.cc:166
double G4double
Definition: G4Types.hh:76
G4double GetYHalfLength() const