Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VTwistedFaceted.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// G4VTwistedFaceted
27//
28// Class description:
29//
30// G4VTwistedFaceted is a base class for twisted boxoids:
31// G4TwistedTrd, G4TwistedTrap and G4TwistedBox
32
33// Author: Oliver Link (CERN), 27.10.2004 - Created
34// --------------------------------------------------------------------
35#ifndef G4VTWISTEDFACETED_HH
36#define G4VTWISTEDFACETED_HH 1
37
38#include "G4VSolid.hh"
39#include "G4TwoVector.hh"
42#include "G4TwistBoxSide.hh"
44
47
48/**
49 * @brief G4VTwistedFaceted is a base class for twisted boxoids:
50 * G4TwistedTrd, G4TwistedTrap and G4TwistedBox.
51 */
52
54{
55 public:
56
57 /**
58 * Constructs a faceted solid, given its parameters.
59 * @param[in] pName The solid name.
60 * @param[in] pPhiTwist Twist angle.
61 * @param[in] pDz Half-length along Z axis.
62 * @param[in] pTheta Polar angle of the line joining the centres of the
63 * faces at -/+pDz.
64 * @param[in] pPhi Azimuthal angle of the line joining the centres of the
65 * faces at -/+pDz.
66 * @param[in] pDy1 Half Y length at -pDz.
67 * @param[in] pDx1 Half X length at -pDz, y=-pDy1.
68 * @param[in] pDx2 Half X length at -pDz, y=+pDy1.
69 * @param[in] pDy2 Half Y length at +pDz.
70 * @param[in] pDx3 Half X length at +pDz, y=-pDy2.
71 * @param[in] pDx4 Half X length at +pDz, y=+pDy2.
72 * @param[in] pAlph Angle with respect to the Y axis from centre of side.
73 */
74 G4VTwistedFaceted(const G4String& pname, // Name of instance
75 G4double PhiTwist, // twist angle
76 G4double pDz, // half z lenght
77 G4double pTheta, // direction between end planes
78 G4double pPhi, // defined by polar & azim. angles
79 G4double pDy1, // half y length at -pDz
80 G4double pDx1, // half x length at -pDz,-pDy
81 G4double pDx2, // half x length at -pDz,+pDy
82 G4double pDy2, // half y length at +pDz
83 G4double pDx3, // half x length at +pDz,-pDy
84 G4double pDx4, // half x length at +pDz,+pDy
85 G4double pAlph ); // tilt angle at +pDz
86
87 /**
88 * Destructor.
89 */
90 ~G4VTwistedFaceted() override;
91
92 /**
93 * Dispatch method for parameterisation replication mechanism and
94 * dimension computation.
95 */
97 const G4int,
98 const G4VPhysicalVolume* ) override;
99
100 /**
101 * Computes the bounding limits of the solid.
102 * @param[out] pMin The minimum bounding limit point.
103 * @param[out] pMax The maximum bounding limit point.
104 */
105 void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const override;
106
107 /**
108 * Calculates the minimum and maximum extent of the solid, when under the
109 * specified transform, and within the specified limits.
110 * @param[in] pAxis The axis along which compute the extent.
111 * @param[in] pVoxelLimit The limiting space dictated by voxels.
112 * @param[in] pTransform The internal transformation applied to the solid.
113 * @param[out] pMin The minimum extent value.
114 * @param[out] pMax The maximum extent value.
115 * @returns True if the solid is intersected by the extent region.
116 */
117 G4bool CalculateExtent(const EAxis pAxis,
118 const G4VoxelLimits& pVoxelLimit,
119 const G4AffineTransform& pTransform,
120 G4double& pMin,
121 G4double& pMax ) const override;
122
123 /**
124 * Concrete implementations of the expected query interfaces for
125 * solids, as defined in the base class G4VSolid.
126 */
128 const G4ThreeVector& v ) const override;
129 G4double DistanceToIn (const G4ThreeVector& p ) const override;
131 const G4ThreeVector& v,
132 const G4bool calcnorm = false,
133 G4bool* validnorm = nullptr,
134 G4ThreeVector* n = nullptr ) const override;
135 G4double DistanceToOut(const G4ThreeVector& p) const override;
136 EInside Inside (const G4ThreeVector& p) const override;
137 G4ThreeVector SurfaceNormal(const G4ThreeVector& p) const override;
138
139 /**
140 * Returns a random point located and uniformly distributed on the
141 * surface of the solid.
142 */
143 G4ThreeVector GetPointOnSurface() const override;
144
145 /**
146 * Returning an estimation of the solid volume (capacity) and
147 * surface area, in internal units.
148 */
149 G4double GetCubicVolume() override;
150 G4double GetSurfaceArea() override;
151
152 /**
153 * Methods for creating graphical representations (i.e. for visualisation).
154 */
155 void DescribeYourselfTo (G4VGraphicsScene& scene) const override;
156 G4Polyhedron* CreatePolyhedron () const override;
157 G4Polyhedron* GetPolyhedron () const override;
158 G4VisExtent GetExtent () const override;
159
160 /**
161 * Streams the object contents to an output stream.
162 */
163 std::ostream& StreamInfo(std::ostream& os) const override;
164
165 /**
166 * Accessors.
167 */
168 inline G4double GetTwistAngle() const { return fPhiTwist; }
169 inline G4double GetDx1 () const { return fDx1 ; }
170 inline G4double GetDx2 () const { return fDx2 ; }
171 inline G4double GetDx3 () const { return fDx3 ; }
172 inline G4double GetDx4 () const { return fDx4 ; }
173 inline G4double GetDy1 () const { return fDy1 ; }
174 inline G4double GetDy2 () const { return fDy2 ; }
175 inline G4double GetDz () const { return fDz ; }
176 inline G4double GetPhi () const { return fPhi ; }
177 inline G4double GetTheta () const { return fTheta ; }
178 inline G4double GetAlpha () const { return fAlph ; }
179 inline G4double Xcoef(G4double u, G4double phi, G4double ftg) const;
180 inline G4double GetValueA(G4double phi) const;
181 inline G4double GetValueB(G4double phi) const;
182 inline G4double GetValueD(G4double phi) const;
183
184 /**
185 * Returns the type ID, "G4VTwistedFaceted" of the solid.
186 */
187 G4GeometryType GetEntityType() const override;
188
189 /**
190 * Fake default constructor for usage restricted to direct object
191 * persistency for clients requiring preallocation of memory for
192 * persistifiable objects.
193 */
194 G4VTwistedFaceted(__void__&);
195
196 /**
197 * Copy constructor and assignment operator.
198 */
201
202 protected:
203
204 mutable G4bool fRebuildPolyhedron = false;
205 mutable G4Polyhedron* fpPolyhedron = nullptr; // polyhedron for vis
206
207 G4double fCubicVolume = 0.0; // volume of the solid
208 G4double fSurfaceArea = 0.0; // area of the solid
209
210 private:
211
212 /**
213 * Utility used for computing the surface area.
214 */
215 G4double GetLateralFaceArea(const G4TwoVector& p1,
216 const G4TwoVector& p2,
217 const G4TwoVector& p3,
218 const G4TwoVector& p4) const;
219
220 /**
221 * Utility used in constructor for creating the surfaces.
222 */
223 void CreateSurfaces();
224
225 private:
226
227 G4double fTheta;
228 G4double fPhi ;
229
230 G4double fDy1;
231 G4double fDx1;
232 G4double fDx2;
233
234 G4double fDy2;
235 G4double fDx3;
236 G4double fDx4;
237
238 G4double fDz; // Half-length along the z axis
239
240 G4double fDx ; // maximum side in x
241 G4double fDy ; // maximum side in y
242
243 G4double fAlph ;
244 G4double fTAlph ; // std::tan(fAlph)
245
246 G4double fdeltaX ;
247 G4double fdeltaY ;
248
249 G4double fPhiTwist; // twist angle ( dphi in surface equation)
250
251 G4VTwistSurface* fLowerEndcap ; // surface of -ve z
252 G4VTwistSurface* fUpperEndcap ; // surface of +ve z
253
254 G4VTwistSurface* fSide0 ; // Twisted Side at phi = 0 deg
255 G4VTwistSurface* fSide90 ; // Twisted Side at phi = 90 deg
256 G4VTwistSurface* fSide180 ; // Twisted Side at phi = 180 deg
257 G4VTwistSurface* fSide270 ; // Twisted Side at phi = 270 deg
258
259};
260
261//=====================================================================
262
263inline
265{
266 return ( fDx4 + fDx2 + ( fDx4 - fDx2 ) * ( 2 * phi ) / fPhiTwist ) ;
267}
268
269inline
271{
272 return ( fDx3 + fDx1 + ( fDx3 - fDx1 ) * ( 2 * phi ) / fPhiTwist ) ;
273}
274
275inline
277{
278 return ( fDy2 + fDy1 + ( fDy2 - fDy1 ) * ( 2 * phi ) / fPhiTwist ) ;
279}
280
281inline
283{
284 return GetValueA(phi)/2. + (GetValueD(phi)-GetValueA(phi))/4.
285 - u*( ( GetValueD(phi)-GetValueA(phi) ) / ( 2 * GetValueB(phi) ) - ftg );
286}
287
288#endif
CLHEP::Hep3Vector G4ThreeVector
CLHEP::Hep2Vector G4TwoVector
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
G4String G4GeometryType
Definition G4VSolid.hh:70
G4AffineTransform is a class for geometric affine transformations. It supports efficient arbitrary ro...
G4ClippablePolygon in a utility class defining a polygon that can be clipped by a voxel.
G4SolidExtentList is utility class designed for calculating the extent of a CSG-like solid for a voxe...
G4VPVParameterisation ia an abstract base class for Parameterisation, able to compute the transformat...
G4VPhysicalVolume is an abstract base class for the representation of a positioned volume....
G4VSolid(const G4String &name)
Definition G4VSolid.cc:59
G4VTwistSurface is a base class for boundary surface of a G4VSolid.
G4VTwistedFaceted is a base class for twisted boxoids: G4TwistedTrd, G4TwistedTrap and G4TwistedBox.
G4double GetValueD(G4double phi) const
G4double GetDy1() const
G4Polyhedron * GetPolyhedron() const override
G4double GetValueA(G4double phi) const
void DescribeYourselfTo(G4VGraphicsScene &scene) const override
G4ThreeVector GetPointOnSurface() const override
G4double GetDy2() const
G4double GetTheta() const
G4VTwistedFaceted & operator=(const G4VTwistedFaceted &rhs)
G4Polyhedron * fpPolyhedron
G4double GetPhi() const
void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const override
G4double GetDx3() const
G4double GetTwistAngle() const
G4double GetCubicVolume() override
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const override
EInside Inside(const G4ThreeVector &p) const override
G4double GetDx4() const
G4double GetAlpha() const
void ComputeDimensions(G4VPVParameterisation *, const G4int, const G4VPhysicalVolume *) override
G4Polyhedron * CreatePolyhedron() const override
std::ostream & StreamInfo(std::ostream &os) const override
G4GeometryType GetEntityType() const override
G4double GetDz() const
G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcnorm=false, G4bool *validnorm=nullptr, G4ThreeVector *n=nullptr) const override
G4VTwistedFaceted(const G4String &pname, G4double PhiTwist, G4double pDz, G4double pTheta, G4double pPhi, G4double pDy1, G4double pDx1, G4double pDx2, G4double pDy2, G4double pDx3, G4double pDx4, G4double pAlph)
G4double GetDx1() const
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const override
G4double GetDx2() const
G4VisExtent GetExtent() const override
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const override
G4double GetValueB(G4double phi) const
G4double Xcoef(G4double u, G4double phi, G4double ftg) const
G4double GetSurfaceArea() override
G4VoxelLimits represents limitation/restrictions of space, where restrictions are only made perpendic...
EAxis
Definition geomdefs.hh:54
EInside
Definition geomdefs.hh:67