Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4UHype.cc
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// Implementation for G4UHype wrapper class
27//
28// 16-10-2017 G.Cosmo, CERN
29// --------------------------------------------------------------------
30
31#include "G4Hype.hh"
32
33#include "G4UHype.hh"
34
35#if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
36
37#include "G4AffineTransform.hh"
39#include "G4BoundingEnvelope.hh"
40#include "G4Polyhedron.hh"
41
42////////////////////////////////////////////////////////////////////////
43//
44// Constructor
45
46G4UHype::G4UHype(const G4String& pName,
47 G4double newInnerRadius,
48 G4double newOuterRadius,
49 G4double newInnerStereo,
50 G4double newOuterStereo,
51 G4double newHalfLenZ)
52 : Base_t(pName, newInnerRadius, newOuterRadius,
53 newInnerStereo, newOuterStereo, newHalfLenZ)
54{ }
55
56//////////////////////////////////////////////////////////////////////////
57//
58// Copy constructor
59
60G4UHype::G4UHype(const G4UHype& rhs)
61 : Base_t(rhs)
62{ }
63
64//////////////////////////////////////////////////////////////////////////
65//
66// Assignment operator
67
68G4UHype& G4UHype::operator = (const G4UHype& rhs)
69{
70 // Check assignment to self
71 //
72 if (this == &rhs) { return *this; }
73
74 // Copy base class data
75 //
76 Base_t::operator=(rhs);
77
78 return *this;
79}
80
81//////////////////////////////////////////////////////////////////////////
82//
83// Accessors
84
85G4double G4UHype::GetInnerRadius () const
86{
87 return GetRmin();
88}
89
90G4double G4UHype::GetOuterRadius () const
91{
92 return GetRmax();
93}
94
95G4double G4UHype::GetZHalfLength () const
96{
97 return GetDz();
98}
99
100G4double G4UHype::GetInnerStereo () const
101{
102 return GetStIn();
103}
104
105G4double G4UHype::GetOuterStereo () const
106{
107 return GetStOut();
108}
109
110//////////////////////////////////////////////////////////////////////////
111//
112// Modifiers
113
114void G4UHype::SetInnerRadius (G4double newIRad)
115{
116 SetParameters(newIRad, GetRmax(), GetStIn(), GetStOut(), GetDz());
117 fRebuildPolyhedron = true;
118}
119
120void G4UHype::SetOuterRadius (G4double newORad)
121{
122 SetParameters(GetRmin(), newORad, GetStIn(), GetStOut(), GetDz());
123 fRebuildPolyhedron = true;
124}
125
126void G4UHype::SetZHalfLength (G4double newHLZ)
127{
128 SetParameters(GetRmin(), GetRmax(), GetStIn(), GetStOut(), newHLZ);
129 fRebuildPolyhedron = true;
130}
131
132void G4UHype::SetInnerStereo (G4double newISte)
133{
134 SetParameters(GetRmin(), GetRmax(), newISte, GetStOut(), GetDz());
135 fRebuildPolyhedron = true;
136}
137
138void G4UHype::SetOuterStereo (G4double newOSte)
139{
140 SetParameters(GetRmin(), GetRmax(), GetStIn(), newOSte, GetDz());
141 fRebuildPolyhedron = true;
142}
143
144
145////////////////////////////////////////////////////////////////////////
146//
147// Dispatch to parameterisation for replication mechanism dimension
148// computation & modification.
149
150void G4UHype::ComputeDimensions(G4VPVParameterisation* p,
151 const G4int n,
152 const G4VPhysicalVolume* pRep)
153{
154 p->ComputeDimensions(*(G4Hype*)this,n,pRep);
155}
156
157
158//////////////////////////////////////////////////////////////////////////
159//
160// Make a clone of the object
161
162G4VSolid* G4UHype::Clone() const
163{
164 return new G4UHype(*this);
165}
166
167//////////////////////////////////////////////////////////////////////////
168//
169// Get bounding box
170
171void G4UHype::BoundingLimits(G4ThreeVector& pMin,
172 G4ThreeVector& pMax) const
173{
174 G4double endORadius = GetEndInnerRadius();
175 pMin.set(-endORadius,-endORadius,-GetDz());
176 pMax.set( endORadius, endORadius, GetDz());
177
178 // Check correctness of the bounding box
179 //
180 if (pMin.x() >= pMax.x() || pMin.y() >= pMax.y() || pMin.z() >= pMax.z())
181 {
182 std::ostringstream message;
183 message << "Bad bounding box (min >= max) for solid: "
184 << GetName() << " !"
185 << "\npMin = " << pMin
186 << "\npMax = " << pMax;
187 G4Exception("G4UHype::BoundingLimits()", "GeomMgt0001",
188 JustWarning, message);
189 StreamInfo(G4cout);
190 }
191}
192
193//////////////////////////////////////////////////////////////////////////
194//
195// Calculate extent under transform and specified limit
196
197G4bool
198G4UHype::CalculateExtent(const EAxis pAxis,
199 const G4VoxelLimits& pVoxelLimit,
200 const G4AffineTransform& pTransform,
201 G4double& pMin, G4double& pMax) const
202{
203 G4ThreeVector bmin, bmax;
204
205 // Get bounding box
206 BoundingLimits(bmin,bmax);
207
208 // Find extent
209 G4BoundingEnvelope bbox(bmin,bmax);
210 return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
211}
212
213////////////////////////////////////////////////////////////////////////
214//
215// CreatePolyhedron
216//
217G4Polyhedron* G4UHype::CreatePolyhedron() const
218{
219 return new G4PolyhedronHype(GetRmin(), GetRmax(),
220 GetTIn2(), GetTOut2(), GetDz());
221}
222
223#endif // G4GEOM_USE_USOLIDS
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
CLHEP::Hep3Vector G4ThreeVector
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
G4GLOB_DLL std::ostream G4cout
double z() const
double x() const
double y() const
void set(double x, double y, double z)
G4AffineTransform is a class for geometric affine transformations. It supports efficient arbitrary ro...
G4BoundingEnvelope is a helper class to facilitate calculation of the extent of a solid within the li...
G4Hype is a tube with hyperbolic profile; it describes an hyperbolic volume with curved sides paralle...
Definition G4Hype.hh:72
G4VPVParameterisation ia an abstract base class for Parameterisation, able to compute the transformat...
virtual void ComputeDimensions(G4Box &, const G4int, const G4VPhysicalVolume *) const
G4VPhysicalVolume is an abstract base class for the representation of a positioned volume....
G4VSolid is an abstract base class for solids, physical shapes that can be tracked through....
Definition G4VSolid.hh:80
G4VoxelLimits represents limitation/restrictions of space, where restrictions are only made perpendic...
EAxis
Definition geomdefs.hh:54