Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4UHype.cc
이 파일의 문서화 페이지로 가기
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:$
28 //
29 // Implementation for G4UHype wrapper class
30 //
31 // 16-10-2017 G.Cosmo, CERN
32 //
33 // --------------------------------------------------------------------
34 
35 #include "G4Hype.hh"
36 
37 #include "G4UHype.hh"
38 
39 #if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
40 
41 #include "G4AffineTransform.hh"
42 #include "G4VPVParameterisation.hh"
43 #include "G4BoundingEnvelope.hh"
44 #include "G4Polyhedron.hh"
45 
47 //
48 // Constructor
49 
50 G4UHype::G4UHype(const G4String& pName,
51  G4double newInnerRadius,
52  G4double newOuterRadius,
53  G4double newInnerStereo,
54  G4double newOuterStereo,
55  G4double newHalfLenZ)
56  : Base_t(pName, newInnerRadius, newOuterRadius,
57  newInnerStereo, newOuterStereo, newHalfLenZ)
58 { }
59 
61 //
62 // Fake default constructor - sets only member data and allocates memory
63 // for usage restricted to object persistency.
64 
65 G4UHype::G4UHype( __void__& a )
66  : Base_t(a)
67 { }
68 
70 //
71 // Destructor
72 
73 G4UHype::~G4UHype() { }
74 
76 //
77 // Copy constructor
78 
79 G4UHype::G4UHype(const G4UHype& rhs)
80  : Base_t(rhs)
81 { }
82 
84 //
85 // Assignment operator
86 
87 G4UHype& G4UHype::operator = (const G4UHype& rhs)
88 {
89  // Check assignment to self
90  //
91  if (this == &rhs) { return *this; }
92 
93  // Copy base class data
94  //
95  Base_t::operator=(rhs);
96 
97  return *this;
98 }
99 
101 //
102 // Accessors
103 
104 G4double G4UHype::GetInnerRadius () const
105 {
106  return GetRmin();
107 }
108 
109 G4double G4UHype::GetOuterRadius () const
110 {
111  return GetRmax();
112 }
113 
114 G4double G4UHype::GetZHalfLength () const
115 {
116  return GetDz();
117 }
118 
119 G4double G4UHype::GetInnerStereo () const
120 {
121  return GetStIn();
122 }
123 
124 G4double G4UHype::GetOuterStereo () const
125 {
126  return GetStOut();
127 }
128 
130 //
131 // Modifiers
132 
133 void G4UHype::SetInnerRadius (G4double newIRad)
134 {
135  SetParameters(newIRad, GetRmax(), GetStIn(), GetStOut(), GetDz());
136  fRebuildPolyhedron = true;
137 }
138 
139 void G4UHype::SetOuterRadius (G4double newORad)
140 {
141  SetParameters(GetRmin(), newORad, GetStIn(), GetStOut(), GetDz());
142  fRebuildPolyhedron = true;
143 }
144 
145 void G4UHype::SetZHalfLength (G4double newHLZ)
146 {
147  SetParameters(GetRmin(), GetRmax(), GetStIn(), GetStOut(), newHLZ);
148  fRebuildPolyhedron = true;
149 }
150 
151 void G4UHype::SetInnerStereo (G4double newISte)
152 {
153  SetParameters(GetRmin(), GetRmax(), newISte, GetStOut(), GetDz());
154  fRebuildPolyhedron = true;
155 }
156 
157 void G4UHype::SetOuterStereo (G4double newOSte)
158 {
159  SetParameters(GetRmin(), GetRmax(), GetStIn(), newOSte, GetDz());
160  fRebuildPolyhedron = true;
161 }
162 
163 
165 //
166 // Dispatch to parameterisation for replication mechanism dimension
167 // computation & modification.
168 
169 void G4UHype::ComputeDimensions(G4VPVParameterisation* p,
170  const G4int n,
171  const G4VPhysicalVolume* pRep)
172 {
173  p->ComputeDimensions(*(G4Hype*)this,n,pRep);
174 }
175 
176 
178 //
179 // Make a clone of the object
180 
181 G4VSolid* G4UHype::Clone() const
182 {
183  return new G4UHype(*this);
184 }
185 
187 //
188 // Get bounding box
189 
190 void G4UHype::BoundingLimits(G4ThreeVector& pMin,
191  G4ThreeVector& pMax) const
192 {
193  G4double endORadius = GetEndInnerRadius();
194  pMin.set(-endORadius,-endORadius,-GetDz());
195  pMax.set( endORadius, endORadius, GetDz());
196 
197  // Check correctness of the bounding box
198  //
199  if (pMin.x() >= pMax.x() || pMin.y() >= pMax.y() || pMin.z() >= pMax.z())
200  {
201  std::ostringstream message;
202  message << "Bad bounding box (min >= max) for solid: "
203  << GetName() << " !"
204  << "\npMin = " << pMin
205  << "\npMax = " << pMax;
206  G4Exception("G4UHype::BoundingLimits()", "GeomMgt0001",
207  JustWarning, message);
208  StreamInfo(G4cout);
209  }
210 }
211 
213 //
214 // Calculate extent under transform and specified limit
215 
216 G4bool
217 G4UHype::CalculateExtent(const EAxis pAxis,
218  const G4VoxelLimits& pVoxelLimit,
219  const G4AffineTransform& pTransform,
220  G4double& pMin, G4double& pMax) const
221 {
222  G4ThreeVector bmin, bmax;
223 
224  // Get bounding box
225  BoundingLimits(bmin,bmax);
226 
227  // Find extent
228  G4BoundingEnvelope bbox(bmin,bmax);
229  return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
230 }
231 
233 //
234 // CreatePolyhedron
235 //
236 G4Polyhedron* G4UHype::CreatePolyhedron() const
237 {
238  return new G4PolyhedronHype(GetRmin(), GetRmax(),
239  GetTIn2(), GetTOut2(), GetDz());
240 }
241 
242 #endif // G4GEOM_USE_USOLIDS
void set(double x, double y, double z)
std::vector< ExP01TrackerHit * > a
Definition: ExP01Classes.hh:33
virtual void ComputeDimensions(G4Box &, const G4int, const G4VPhysicalVolume *) const
const char * p
Definition: xmltok.h:285
void message(RunManager *runmanager)
Definition: ts_scorers.cc:72
double z() const
double G4double
Definition: G4Types.hh:76
bool G4bool
Definition: G4Types.hh:79
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.hh:65
int G4int
Definition: G4Types.hh:78
EAxis
Definition: geomdefs.hh:54
G4GLOB_DLL std::ostream G4cout
double x() const
Char_t n[5]
double y() const
Definition: G4Hype.hh:76