Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4UPara.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// G4UPara
27//
28// Class description:
29//
30// Wrapper class for G4Para to make use of VecGeom Parallelepiped.
31
32// Author: G.Cosmo (CERN), 13.09.2013
33// --------------------------------------------------------------------
34#ifndef G4UPARA_HH
35#define G4UPARA_HH
36
37#include "G4UAdapter.hh"
38
39#if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
40
41#include <VecGeom/volumes/UnplacedParallelepiped.h>
42
43#include "G4Polyhedron.hh"
44
45/**
46 * @brief G4UPara is a wrapper class for G4Para to make use of
47 * VecGeom Parallelepiped.
48 */
49
50class G4UPara : public G4UAdapter<vecgeom::UnplacedParallelepiped>
51{
52 using Shape_t = vecgeom::UnplacedParallelepiped;
53 using Base_t = G4UAdapter<vecgeom::UnplacedParallelepiped>;
54
55 public:
56
57 /**
58 * Constructs a parallelepiped, given a name and its parameters.
59 * @param[in] pName The name of the solid.
60 * @param[in] pDx Half-length in x.
61 * @param[in] pDy Half-length in y.
62 * @param[in] pDz Half-length in z.
63 * @param[in] pAlpha Angle formed by the Y axis and by the plane joining
64 * the centre of the faces parallel to the Z-X plane at -dy
65 * and +dy.
66 * @param[in] pTheta Polar angle of the line joining the centres of the
67 * faces at -dz and +dz in Z.
68 * @param[in] pPhi Azimuthal angle of the line joining the centres of
69 * the faces at -dz and +dz in Z.
70 */
71 G4UPara(const G4String& pName,
72 G4double pDx, G4double pDy, G4double pDz,
73 G4double pAlpha, G4double pTheta, G4double pPhi);
74
75 /**
76 * Constructs a parallelepiped, given a name and its 8 vertices.
77 * @param[in] pName The name of the solid.
78 * @param[in] pt Points of the 8 vertices.
79 */
80 G4UPara(const G4String& pName,
81 const G4ThreeVector pt[8]);
82
83 /**
84 * Default destructor.
85 */
86 ~G4UPara() override = default;
87
88 /**
89 * Accessors.
90 */
91 G4double GetZHalfLength() const;
92 G4double GetYHalfLength() const;
93 G4double GetXHalfLength() const;
94 G4ThreeVector GetSymAxis() const;
95 G4double GetTanAlpha() const;
96
97 /**
98 * Accessors. Obtain (re)computed values of the original parameters.
99 */
100 G4double GetAlpha() const;
101 G4double GetTheta() const;
102 G4double GetPhi() const;
103 // Obtain (re)computed values of original parameters
104
105 /**
106 * Modifiers.
107 */
108 void SetXHalfLength(G4double val);
109 void SetYHalfLength(G4double val);
110 void SetZHalfLength(G4double val);
111 void SetAlpha(G4double alpha);
112 void SetTanAlpha(G4double val);
113 void SetThetaAndPhi(double pTheta, double pPhi);
114
115 /**
116 * Sets all parameters, as for constructor.
117 */
118 void SetAllParameters(G4double pDx, G4double pDy, G4double pDz,
119 G4double pAlpha, G4double pTheta, G4double pPhi);
120
121 /**
122 * Dispatch method for parameterisation replication mechanism and
123 * dimension computation.
124 */
125 void ComputeDimensions(G4VPVParameterisation* p,
126 const G4int n,
127 const G4VPhysicalVolume* pRep) override;
128
129 /**
130 * Returns the type ID, "G4Para" of the solid.
131 */
132 inline G4GeometryType GetEntityType() const override;
133
134 /**
135 * Returns true as the solid has only planar faces.
136 */
137 inline G4bool IsFaceted() const override;
138
139 /**
140 * Computes the bounding limits of the solid.
141 * @param[out] pMin The minimum bounding limit point.
142 * @param[out] pMax The maximum bounding limit point.
143 */
144 void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
145
146 /**
147 * Calculates the minimum and maximum extent of the solid, when under the
148 * specified transform, and within the specified limits.
149 * @param[in] pAxis The axis along which compute the extent.
150 * @param[in] pVoxelLimit The limiting space dictated by voxels.
151 * @param[in] pTransform The internal transformation applied to the solid.
152 * @param[out] pMin The minimum extent value.
153 * @param[out] pMax The maximum extent value.
154 * @returns True if the solid is intersected by the extent region.
155 */
156 G4bool CalculateExtent(const EAxis pAxis,
157 const G4VoxelLimits& pVoxelLimit,
158 const G4AffineTransform& pTransform,
159 G4double& pMin, G4double& pMax) const override;
160
161 /**
162 * Makes a clone of the object for use in multi-treading.
163 * @returns A pointer to the new cloned allocated solid.
164 */
165 G4VSolid* Clone() const override;
166
167 /**
168 * Returns a generated polyhedron as graphical representations.
169 */
170 G4Polyhedron* CreatePolyhedron() const override;
171
172 /**
173 * Copy constructor and assignment operator.
174 */
175 G4UPara(const G4UPara& rhs);
176 G4UPara& operator=(const G4UPara& rhs);
177
178 private:
179
180 /**
181 * Checks input parameters.
182 */
183 void CheckParameters();
184
185 /**
186 * Sets the side planes.
187 */
188 void MakePlanes();
189
190 private:
191
192 G4double fTalpha,fTthetaCphi,fTthetaSphi;
193 struct { G4double a,b,c,d; } fPlanes[4];
194};
195
196// --------------------------------------------------------------------
197// Inline methods
198// --------------------------------------------------------------------
199
200inline G4GeometryType G4UPara::GetEntityType() const
201{
202 return "G4Para";
203}
204
205inline G4bool G4UPara::IsFaceted() const
206{
207 return true;
208}
209
210#endif // G4GEOM_USE_USOLIDS
211
212#endif
G4PVDivision & operator=(const G4PVDivision &)=delete
CLHEP::Hep3Vector G4ThreeVector
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
G4String G4GeometryType
Definition G4VSolid.hh:70
EAxis
Definition geomdefs.hh:54