Geant4  10.02.p02
G4USphere.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 //
27 // $Id:$
28 //
29 //
30 // Implementation for G4USphere wrapper class
31 // --------------------------------------------------------------------
32 
33 #include "G4Sphere.hh"
34 #include "G4USphere.hh"
35 
36 #if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
37 
38 #include "G4VPVParameterisation.hh"
39 
41 //
42 // constructor - check parameters, convert angles so 0<sphi+dpshi<=2_PI
43 // - note if pDPhi>2PI then reset to 2PI
44 
45 G4USphere::G4USphere( const G4String& pName,
46  G4double pRmin, G4double pRmax,
47  G4double pSPhi, G4double pDPhi,
48  G4double pSTheta, G4double pDTheta )
49  : G4USolid(pName, new USphere(pName, pRmin, pRmax, pSPhi, pDPhi,
50  pSTheta, pDTheta))
51 {
52 }
53 
55 //
56 // Fake default constructor - sets only member data and allocates memory
57 // for usage restricted to object persistency.
58 //
59 G4USphere::G4USphere( __void__& a )
60  : G4USolid(a)
61 {
62 }
63 
65 //
66 // Destructor
67 
68 G4USphere::~G4USphere()
69 {
70 }
71 
73 //
74 // Copy constructor
75 
76 G4USphere::G4USphere(const G4USphere& rhs)
77  : G4USolid(rhs)
78 {
79 }
80 
82 //
83 // Assignment operator
84 
85 G4USphere& G4USphere::operator = (const G4USphere& rhs)
86 {
87  // Check assignment to self
88  //
89  if (this == &rhs) { return *this; }
90 
91  // Copy base class data
92  //
93  G4USolid::operator=(rhs);
94 
95  return *this;
96 }
97 
99 //
100 // Accessors & modifiers
101 
102 G4double G4USphere::GetInnerRadius() const
103 {
104  return GetShape()->GetInnerRadius();
105 }
106 G4double G4USphere::GetOuterRadius() const
107 {
108  return GetShape()->GetOuterRadius();
109 }
110 G4double G4USphere::GetStartPhiAngle() const
111 {
112  return GetShape()->GetStartPhiAngle();
113 }
114 G4double G4USphere::GetDeltaPhiAngle() const
115 {
116  return GetShape()->GetDeltaPhiAngle();
117 }
118 G4double G4USphere::GetStartThetaAngle() const
119 {
120  return GetShape()->GetStartThetaAngle();
121 }
122 G4double G4USphere::GetDeltaThetaAngle() const
123 {
124  return GetShape()->GetDeltaThetaAngle();
125 }
126 
127 void G4USphere::SetInnerRadius(G4double newRMin)
128 {
129  GetShape()->SetInnerRadius(newRMin);
130  fRebuildPolyhedron = true;
131 }
132 void G4USphere::SetOuterRadius(G4double newRmax)
133 {
134  GetShape()->SetOuterRadius(newRmax);
135  fRebuildPolyhedron = true;
136 }
137 void G4USphere::SetStartPhiAngle(G4double newSphi, G4bool trig)
138 {
139  GetShape()->SetStartPhiAngle(newSphi, trig);
140  fRebuildPolyhedron = true;
141 }
142 void G4USphere::SetDeltaPhiAngle(G4double newDphi)
143 {
144  GetShape()->SetDeltaPhiAngle(newDphi);
145  fRebuildPolyhedron = true;
146 }
147 void G4USphere::SetStartThetaAngle(G4double newSTheta)
148 {
149  GetShape()->SetStartThetaAngle(newSTheta);
150  fRebuildPolyhedron = true;
151 }
152 void G4USphere::SetDeltaThetaAngle(G4double newDTheta)
153 {
154  GetShape()->SetDeltaThetaAngle(newDTheta);
155  fRebuildPolyhedron = true;
156 }
157 
159 //
160 // Dispatch to parameterisation for replication mechanism dimension
161 // computation & modification.
162 
163 void G4USphere::ComputeDimensions( G4VPVParameterisation* p,
164  const G4int n,
165  const G4VPhysicalVolume* pRep)
166 {
167  p->ComputeDimensions(*(G4Sphere*)this,n,pRep);
168 }
169 
171 //
172 // Make a clone of the object
173 
174 G4VSolid* G4USphere::Clone() const
175 {
176  return new G4USphere(*this);
177 }
178 
180 //
181 // Create polyhedron for visualization
182 
183 G4Polyhedron* G4USphere::CreatePolyhedron() const
184 {
185  return new G4PolyhedronSphere(GetInnerRadius(),
186  GetOuterRadius(),
187  GetStartPhiAngle(),
188  GetDeltaPhiAngle(),
189  GetStartThetaAngle(),
190  GetDeltaThetaAngle());
191 }
192 
193 #endif // G4GEOM_USE_USOLIDS
G4double a
Definition: TRTMaterials.hh:39
int G4int
Definition: G4Types.hh:78
bool G4bool
Definition: G4Types.hh:79
const G4int n
virtual void ComputeDimensions(G4Box &, const G4int, const G4VPhysicalVolume *) const
double G4double
Definition: G4Types.hh:76