Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4UParaboloid.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 G4UParaboloid wrapper class
30 //
31 // 19-08-2015 Guilherme Lima, FNAL
32 //
33 // --------------------------------------------------------------------
34 
35 #include "G4Paraboloid.hh"
36 #include "G4UParaboloid.hh"
37 
38 #if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
39 
40 #include "G4AffineTransform.hh"
41 #include "G4VPVParameterisation.hh"
42 #include "G4PhysicalConstants.hh"
43 #include "G4BoundingEnvelope.hh"
44 #include "G4Polyhedron.hh"
45 
47 //
48 // Constructor - check & set half widths
49 
50 
51 G4UParaboloid::G4UParaboloid(const G4String& pName,
52  G4double dz,
53  G4double rlo,
54  G4double rhi )
55  : Base_t(pName, rlo, rhi, dz)
56 { }
57 
59 //
60 // Fake default constructor - sets only member data and allocates memory
61 // for usage restricted to object persistency.
62 
63 G4UParaboloid::G4UParaboloid( __void__& a )
64  : Base_t(a)
65 { }
66 
68 //
69 // Destructor
70 
71 G4UParaboloid::~G4UParaboloid() { }
72 
74 //
75 // Copy constructor
76 
77 G4UParaboloid::G4UParaboloid(const G4UParaboloid& rhs)
78  : Base_t(rhs)
79 { }
80 
82 //
83 // Assignment operator
84 
85 G4UParaboloid& G4UParaboloid::operator = (const G4UParaboloid& rhs)
86 {
87  // Check assignment to self
88  //
89  if (this == &rhs) { return *this; }
90 
91  // Copy base class data
92  //
93  Base_t::operator=(rhs);
94 
95  return *this;
96 }
97 
99 //
100 // Accessors
101 
102 G4double G4UParaboloid::GetZHalfLength() const
103 {
104  return GetDz();
105 }
106 
107 G4double G4UParaboloid::GetRadiusMinusZ() const
108 {
109  return GetRlo();
110 }
111 
112 G4double G4UParaboloid::GetRadiusPlusZ() const
113 {
114  return GetRhi();
115 }
116 
118 //
119 // Modifiers
120 
121 void G4UParaboloid::SetZHalfLength(G4double dz)
122 {
123  SetDz(dz);
124 }
125 
126 void G4UParaboloid::SetRadiusMinusZ(G4double r1)
127 {
128  SetRlo(r1);
129 }
130 
131 void G4UParaboloid::SetRadiusPlusZ(G4double r2)
132 {
133  SetRhi(r2);
134 }
135 
137 //
138 // Make a clone of the object
139 
140 G4VSolid* G4UParaboloid::Clone() const
141 {
142  return new G4UParaboloid(*this);
143 }
144 
146 //
147 // Get bounding box
148 
149 void G4UParaboloid::BoundingLimits(G4ThreeVector& pMin,
150  G4ThreeVector& pMax) const
151 {
152  static G4bool checkBBox = true;
153 
154  G4double r2 = GetRadiusPlusZ();
155  G4double dz = GetZHalfLength();
156  pMin.set(-r2,-r2,-dz);
157  pMax.set( r2, r2, dz);
158 
159  // Check correctness of the bounding box
160  //
161  if (pMin.x() >= pMax.x() || pMin.y() >= pMax.y() || pMin.z() >= pMax.z())
162  {
163  std::ostringstream message;
164  message << "Bad bounding box (min >= max) for solid: "
165  << GetName() << " !"
166  << "\npMin = " << pMin
167  << "\npMax = " << pMax;
168  G4Exception("G4UParaboloid::BoundingLimits()", "GeomMgt0001",
169  JustWarning, message);
170  StreamInfo(G4cout);
171  }
172 
173  // Check consistency of bounding boxes
174  //
175  if (checkBBox)
176  {
177  U3Vector vmin, vmax;
178  Extent(vmin,vmax);
179  if (std::abs(pMin.x()-vmin.x()) > kCarTolerance ||
180  std::abs(pMin.y()-vmin.y()) > kCarTolerance ||
181  std::abs(pMin.z()-vmin.z()) > kCarTolerance ||
182  std::abs(pMax.x()-vmax.x()) > kCarTolerance ||
183  std::abs(pMax.y()-vmax.y()) > kCarTolerance ||
184  std::abs(pMax.z()-vmax.z()) > kCarTolerance)
185  {
186  std::ostringstream message;
187  message << "Inconsistency in bounding boxes for solid: "
188  << GetName() << " !"
189  << "\nBBox min: wrapper = " << pMin << " solid = " << vmin
190  << "\nBBox max: wrapper = " << pMax << " solid = " << vmax;
191  G4Exception("G4UParaboloid::BoundingLimits()", "GeomMgt0001",
192  JustWarning, message);
193  checkBBox = false;
194  }
195  }
196 }
197 
199 //
200 // Calculate extent under transform and specified limit
201 
202 G4bool
203 G4UParaboloid::CalculateExtent(const EAxis pAxis,
204  const G4VoxelLimits& pVoxelLimit,
205  const G4AffineTransform& pTransform,
206  G4double& pMin, G4double& pMax) const
207 {
208  G4ThreeVector bmin, bmax;
209 
210  // Get bounding box
211  BoundingLimits(bmin,bmax);
212 
213  // Find extent
214  G4BoundingEnvelope bbox(bmin,bmax);
215  return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
216 }
217 
219 //
220 // CreatePolyhedron
221 //
222 G4Polyhedron* G4UParaboloid::CreatePolyhedron() const
223 {
224  return new G4PolyhedronParaboloid(GetRadiusMinusZ(),
225  GetRadiusPlusZ(),
226  GetZHalfLength(), 0., twopi);
227 }
228 
229 #endif // G4GEOM_USE_USOLIDS
void set(double x, double y, double z)
std::vector< ExP01TrackerHit * > a
Definition: ExP01Classes.hh:33
void message(RunManager *runmanager)
Definition: ts_scorers.cc:72
double z() const
const G4double kCarTolerance
double G4double
Definition: G4Types.hh:76
bool G4bool
Definition: G4Types.hh:79
static constexpr double twopi
Definition: G4SIunits.hh:76
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.hh:65
EAxis
Definition: geomdefs.hh:54
G4GLOB_DLL std::ostream G4cout
double x() const
double y() const