Geant4  10.01.p03
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 79491 2014-03-05 15:24:29Z 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  G4bool CalculateExtent(const EAxis pAxis,
120  const G4VoxelLimits& pVoxelLimit,
121  const G4AffineTransform& pTransform,
122  G4double& pMin, G4double& pMax) const;
123 
124  EInside Inside(const G4ThreeVector& p) const;
125 
126  G4ThreeVector SurfaceNormal( const G4ThreeVector& p) const;
127 
129  const G4ThreeVector& v) const;
130  G4double DistanceToIn(const G4ThreeVector& p) const;
131 
133  const G4bool calcNorm=G4bool(false),
134  G4bool *validNorm=0, G4ThreeVector *n=0) const;
135  G4double DistanceToOut(const G4ThreeVector& p) const;
136 
138 
140 
141  G4VSolid* Clone() const;
142 
143  std::ostream& StreamInfo(std::ostream& os) const;
144 
145  // Visualisation functions
146 
147  void DescribeYourselfTo (G4VGraphicsScene& scene) const;
148  G4Polyhedron* CreatePolyhedron () const;
149 
150  public: // without description
151 
152  G4Para(__void__&);
153  // Fake default constructor for usage restricted to direct object
154  // persistency for clients requiring preallocation of memory for
155  // persistifiable objects.
156 
157  G4Para(const G4Para& rhs);
158  G4Para& operator=(const G4Para& rhs);
159  // Copy constructor and assignment operator.
160 
161  protected: // without description
162 
164  CreateRotatedVertices(const G4AffineTransform& pTransform) const;
165 
166  private:
167 
169  // Algorithm for SurfaceNormal() following the original
170  // specification for points not on the surface
171 
174  G4double& area) const;
175  // Returns a random point on the surface of one of the faces.
176 
177  private:
178 
181 };
182 
183 #include "G4Para.icc"
184 
185 #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:861
G4ThreeVector GetPointOnSurface() const
Definition: G4Para.cc:1289
void SetXHalfLength(G4double val)
Definition: G4Para.hh:77
void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
Definition: G4Para.cc:206
EInside Inside(const G4ThreeVector &p) const
Definition: G4Para.cc:438
void SetAlpha(G4double alpha)
void SetAllParameters(G4double pDx, G4double pDy, G4double pDz, G4double pAlpha, G4double pTheta, G4double pPhi)
Definition: G4Para.cc:70
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const
Definition: G4Para.cc:218
CLHEP::Hep3Vector G4ThreeVector
G4double fTalpha
Definition: G4Para.hh:180
G4ThreeVector ApproxSurfaceNormal(const G4ThreeVector &p) const
Definition: G4Para.cc:550
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const
Definition: G4Para.cc:477
G4double fDx
Definition: G4Para.hh:179
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const
Definition: G4Para.cc:638
G4Para(const G4String &pName, G4double pDx, G4double pDy, G4double pDz, G4double pAlpha, G4double pTheta, G4double pPhi)
Definition: G4Para.cc:98
std::ostream & StreamInfo(std::ostream &os) const
Definition: G4Para.cc:1212
G4Para & operator=(const G4Para &rhs)
Definition: G4Para.cc:182
int G4int
Definition: G4Types.hh:78
G4double GetCubicVolume()
G4Polyhedron * CreatePolyhedron() const
Definition: G4Para.cc:1345
G4double fDz
Definition: G4Para.hh:179
void SetThetaAndPhi(double pTheta, double pPhi)
void SetZHalfLength(G4double val)
bool G4bool
Definition: G4Types.hh:79
const G4double p2
const G4double p1
std::vector< G4ThreeVector > G4ThreeVectorList
Definition: G4VSolid.hh:79
void SetYHalfLength(G4double val)
const G4int n
G4GeometryType GetEntityType() const
Definition: G4Para.cc:1194
G4double GetXHalfLength() const
void SetTanAlpha(G4double val)
void DescribeYourselfTo(G4VGraphicsScene &scene) const
Definition: G4Para.cc:1340
const G4double p0
G4double GetTanAlpha() const
EInside
Definition: geomdefs.hh:58
G4double fTthetaCphi
Definition: G4Para.hh:180
EAxis
Definition: geomdefs.hh:54
G4double fTthetaSphi
Definition: G4Para.hh:180
G4ThreeVectorList * CreateRotatedVertices(const G4AffineTransform &pTransform) const
Definition: G4Para.cc:1147
G4double GetZHalfLength() const
G4VSolid * Clone() const
Definition: G4Para.cc:1203
G4double GetSurfaceArea()
virtual ~G4Para()
Definition: G4Para.cc:163
double G4double
Definition: G4Types.hh:76
static const G4double alpha
G4double fDy
Definition: G4Para.hh:179
G4ThreeVector GetPointOnPlane(G4ThreeVector p0, G4ThreeVector p1, G4ThreeVector p2, G4ThreeVector p3, G4double &area) const
Definition: G4Para.cc:1240
G4double GetYHalfLength() const