Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
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// G4Para
27//
28// Class description:
29//
30// A G4Parallepiped, essentially a box with half lengths dx,dy,dz
31// `skewed' so that there are angles theta & phi of the polar line
32// joining the faces at +-dz in z, and alpha formed by the y axis
33// and the plane joinng the centre of the faces G4Parallel to the
34// z-x plane at -dy and +dy.
35//
36// A G4Para is defined by:
37// dx,dy,dz - Half-length in x,y,z
38// alpha - Angle formed by the y axis and by the plane joining
39// the centre of the faces G4Parallel to the z-x plane
40// at -dy and +dy
41// theta - Polar angle of the line joining the centres of the
42// faces at -dz and +dz in z
43// phi - Azimuthal angle of the line joining the centres of the
44// faces at -dz and +dz in z
45// Member data:
46//
47// Note that the angles parameters are not stored - precomputed trig is
48// stored instead.
49//
50// fDx Half-length in x
51// fDy Half-length in y
52// fDz Half-length in z
53//
54// fTalpha Tan of alpha
55// fTthetaCphi Tan theta * Cos phi
56// fTthetaSphi Tan theta * Sin phi
57
58// 21.3.94 P.Kent Old C++ code converted to tolerant geometry
59// 31.10.96 V.Grichine Modifications according G4Box/Tubs before to commit
60// --------------------------------------------------------------------
61#ifndef G4PARA_HH
62#define G4PARA_HH
63
64#include "G4GeomTypes.hh"
65
66#if defined(G4GEOM_USE_USOLIDS)
67#define G4GEOM_USE_UPARA 1
68#endif
69
70#if defined(G4GEOM_USE_UPARA)
71 #define G4UPara G4Para
72 #include "G4UPara.hh"
73#else
74
75#include "G4CSGSolid.hh"
76#include "G4Polyhedron.hh"
77
78class G4Para : public G4CSGSolid
79{
80 public: // with description
81
82 G4Para(const G4String& pName,
83 G4double pDx, G4double pDy, G4double pDz,
84 G4double pAlpha, G4double pTheta, G4double pPhi);
85
86 G4Para(const G4String& pName,
87 const G4ThreeVector pt[8]);
88
89 ~G4Para() override;
90
91 // Accessors
92
93 inline G4double GetZHalfLength() const;
94 inline G4ThreeVector GetSymAxis() const;
95 inline G4double GetYHalfLength() const;
96 inline G4double GetXHalfLength() const;
97 inline G4double GetTanAlpha() const;
98
99 inline G4double GetAlpha() const;
100 inline G4double GetTheta() const;
101 inline G4double GetPhi() const;
102 // Obtain (re)computed values of original parameters
103
104 // Modifiers
105
106 inline void SetXHalfLength(G4double val);
107 inline void SetYHalfLength(G4double val);
108 inline void SetZHalfLength(G4double val);
109 inline void SetAlpha(G4double alpha);
110 inline void SetTanAlpha(G4double val);
111 inline void SetThetaAndPhi(G4double pTheta, G4double pPhi);
112
113 void SetAllParameters(G4double pDx, G4double pDy, G4double pDz,
114 G4double pAlpha, G4double pTheta, G4double pPhi);
115
116 // Methods of solid
117
118 G4double GetCubicVolume() override;
119 G4double GetSurfaceArea() override;
120
122 const G4int n,
123 const G4VPhysicalVolume* pRep) override;
124
125 void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
126
127 G4bool CalculateExtent(const EAxis pAxis,
128 const G4VoxelLimits& pVoxelLimit,
129 const G4AffineTransform& pTransform,
130 G4double& pMin, G4double& pMax) const override;
131
132 EInside Inside(const G4ThreeVector& p) const override;
133
134 G4ThreeVector SurfaceNormal( const G4ThreeVector& p) const override;
135
137 const G4ThreeVector& v) const override;
138 G4double DistanceToIn(const G4ThreeVector& p) const override;
139
141 const G4bool calcNorm = false,
142 G4bool* validNorm = nullptr,
143 G4ThreeVector* n = nullptr) const override;
144 G4double DistanceToOut(const G4ThreeVector& p) const override;
145
146 G4GeometryType GetEntityType() const override;
147
148 G4ThreeVector GetPointOnSurface() const override;
149
150 G4VSolid* Clone() const override;
151
152 std::ostream& StreamInfo(std::ostream& os) const override;
153
154 // Visualisation functions
155
156 void DescribeYourselfTo (G4VGraphicsScene& scene) const override;
157 G4Polyhedron* CreatePolyhedron () const override;
158
159 G4Para(__void__&);
160 // Fake default constructor for usage restricted to direct object
161 // persistency for clients requiring preallocation of memory for
162 // persistifiable objects
163
164 G4Para(const G4Para& rhs);
165 G4Para& operator=(const G4Para& rhs);
166 // Copy constructor and assignment operator
167
168 private:
169
170 void CheckParameters();
171 // Check parameters
172
173 void MakePlanes();
174 // Set side planes
175
176 G4ThreeVector ApproxSurfaceNormal(const G4ThreeVector& p) const;
177 // Algorithm for SurfaceNormal() following the original
178 // specification for points not on the surface
179
180
181 private:
182
183 G4double halfCarTolerance;
184 G4double fDx,fDy,fDz;
185 G4double fTalpha,fTthetaCphi,fTthetaSphi;
186 struct { G4double a,b,c,d; } fPlanes[4];
187};
188
189#include "G4Para.icc"
190
191#endif
192
193#endif
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const override
Definition G4Para.cc:537
std::ostream & StreamInfo(std::ostream &os) const override
Definition G4Para.cc:810
~G4Para() override
EInside Inside(const G4ThreeVector &p) const override
Definition G4Para.cc:412
G4double GetPhi() const
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const override
Definition G4Para.cc:357
G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=nullptr, G4ThreeVector *n=nullptr) const override
Definition G4Para.cc:648
void SetYHalfLength(G4double val)
void SetTanAlpha(G4double val)
G4double GetSurfaceArea() override
Definition G4Para.cc:281
G4Polyhedron * CreatePolyhedron() const override
Definition G4Para.cc:897
G4double GetTanAlpha() const
G4GeometryType GetEntityType() const override
Definition G4Para.cc:792
G4ThreeVector GetPointOnSurface() const override
Definition G4Para.cc:839
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const override
Definition G4Para.cc:432
void SetZHalfLength(G4double val)
G4ThreeVector GetSymAxis() const
void SetXHalfLength(G4double val)
G4Para & operator=(const G4Para &rhs)
Definition G4Para.cc:155
G4Para(const G4String &pName, G4double pDx, G4double pDy, G4double pDz, G4double pAlpha, G4double pTheta, G4double pPhi)
Definition G4Para.cc:53
G4VSolid * Clone() const override
Definition G4Para.cc:801
void SetAllParameters(G4double pDx, G4double pDy, G4double pDz, G4double pAlpha, G4double pTheta, G4double pPhi)
Definition G4Para.cc:183
G4double GetAlpha() const
void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const override
Definition G4Para.cc:314
void SetThetaAndPhi(G4double pTheta, G4double pPhi)
G4double GetYHalfLength() const
G4double d
Definition G4Para.hh:186
void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep) override
Definition G4Para.cc:303
G4double GetZHalfLength() const
G4double GetCubicVolume() override
Definition G4Para.cc:267
void SetAlpha(G4double alpha)
G4double a
Definition G4Para.hh:186
G4double GetXHalfLength() const
G4double GetTheta() const
void DescribeYourselfTo(G4VGraphicsScene &scene) const override
Definition G4Para.cc:892
G4double b
Definition G4Para.hh:186
G4double c
Definition G4Para.hh:186
EAxis
Definition geomdefs.hh:54
EInside
Definition geomdefs.hh:67