Geant4  10.02.p02
G4UTubs.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 G4UTubs wrapper class
31 // --------------------------------------------------------------------
32 
33 #include "G4Tubs.hh"
34 #include "G4UTubs.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 G4UTubs::G4UTubs( const G4String& pName,
46  G4double pRMin, G4double pRMax,
47  G4double pDz,
48  G4double pSPhi, G4double pDPhi )
49  : G4USolid(pName, new UTubs(pName, pRMin, pRMax, pDz, pSPhi, pDPhi))
50 {
51 }
52 
54 //
55 // Fake default constructor - sets only member data and allocates memory
56 // for usage restricted to object persistency.
57 //
58 G4UTubs::G4UTubs( __void__& a )
59  : G4USolid(a)
60 {
61 }
62 
64 //
65 // Destructor
66 
67 G4UTubs::~G4UTubs()
68 {
69 }
70 
72 //
73 // Copy constructor
74 
75 G4UTubs::G4UTubs(const G4UTubs& rhs)
76  : G4USolid(rhs)
77 {
78 }
79 
81 //
82 // Assignment operator
83 
84 G4UTubs& G4UTubs::operator = (const G4UTubs& rhs)
85 {
86  // Check assignment to self
87  //
88  if (this == &rhs) { return *this; }
89 
90  // Copy base class data
91  //
92  G4USolid::operator=(rhs);
93 
94  return *this;
95 }
96 
98 //
99 // Accessors and modifiers
100 
101 G4double G4UTubs::GetInnerRadius() const
102 {
103  return GetShape()->GetInnerRadius();
104 }
105 G4double G4UTubs::GetOuterRadius() const
106 {
107  return GetShape()->GetOuterRadius();
108 }
109 G4double G4UTubs::GetZHalfLength() const
110 {
111  return GetShape()->GetZHalfLength();
112 }
113 G4double G4UTubs::GetStartPhiAngle() const
114 {
115  return GetShape()->GetStartPhiAngle();
116 }
117 G4double G4UTubs::GetDeltaPhiAngle() const
118 {
119  return GetShape()->GetDeltaPhiAngle();
120 }
121 
122 void G4UTubs::SetInnerRadius(G4double newRMin)
123 {
124  GetShape()->SetInnerRadius(newRMin);
125  fRebuildPolyhedron = true;
126 }
127 void G4UTubs::SetOuterRadius(G4double newRMax)
128 {
129  GetShape()->SetOuterRadius(newRMax);
130  fRebuildPolyhedron = true;
131 }
132 void G4UTubs::SetZHalfLength(G4double newDz)
133 {
134  GetShape()->SetZHalfLength(newDz);
135  fRebuildPolyhedron = true;
136 }
137 void G4UTubs::SetStartPhiAngle(G4double newSPhi, G4bool trig)
138 {
139  GetShape()->SetStartPhiAngle(newSPhi, trig);
140  fRebuildPolyhedron = true;
141 }
142 void G4UTubs::SetDeltaPhiAngle(G4double newDPhi)
143 {
144  GetShape()->SetDeltaPhiAngle(newDPhi);
145  fRebuildPolyhedron = true;
146 }
147 
149 //
150 // Dispatch to parameterisation for replication mechanism dimension
151 // computation & modification.
152 
153 void G4UTubs::ComputeDimensions( G4VPVParameterisation* p,
154  const G4int n,
155  const G4VPhysicalVolume* pRep )
156 {
157  p->ComputeDimensions(*(G4Tubs*)this,n,pRep) ;
158 }
159 
161 //
162 // Make a clone of the object
163 
164 G4VSolid* G4UTubs::Clone() const
165 {
166  return new G4UTubs(*this);
167 }
168 
170 //
171 // Create polyhedron for visualization
172 //
173 G4Polyhedron* G4UTubs::CreatePolyhedron() const
174 {
175  return new G4PolyhedronTubs(GetInnerRadius(),
176  GetOuterRadius(),
177  GetZHalfLength(),
178  GetStartPhiAngle(),
179  GetDeltaPhiAngle());
180 }
181 
182 #endif // G4GEOM_USE_USOLIDS
Definition: G4Tubs.hh:85
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