Geant4  10.02.p02
G4UTorus.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 // Implementation for G4UTorus wrapper class
30 //
31 // 19-08-2015 Guilherme Lima, FNAL
32 //
33 // --------------------------------------------------------------------
34 
35 #include "G4Torus.hh"
36 #include "G4UTorus.hh"
37 
38 #if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
39 
40 #include "G4VPVParameterisation.hh"
41 
43 //
44 // Constructor - check & set half widths
45 
46 
47 G4UTorus::G4UTorus(const G4String& pName,
48  G4double rmin, G4double rmax, G4double rtor,
49  G4double sphi, G4double dphi)
50  : G4USolid(pName, new UTorus(pName, rmin, rmax, rtor, sphi, dphi))
51 { }
52 
54 //
55 // Fake default constructor - sets only member data and allocates memory
56 // for usage restricted to object persistency.
57 
58 G4UTorus::G4UTorus( __void__& a )
59  : G4USolid(a)
60 { }
61 
63 //
64 // Destructor
65 
66 G4UTorus::~G4UTorus() { }
67 
69 //
70 // Copy constructor
71 
72 G4UTorus::G4UTorus(const G4UTorus& rhs)
73  : G4USolid(rhs)
74 { }
75 
77 //
78 // Assignment operator
79 
80 G4UTorus& G4UTorus::operator = (const G4UTorus& rhs)
81 {
82  // Check assignment to self
83  //
84  if (this == &rhs) { return *this; }
85 
86  // Copy base class data
87  //
88  G4USolid::operator=(rhs);
89 
90  return *this;
91 }
92 
94 //
95 // Accessors & modifiers
96 
97 G4double G4UTorus::GetRmin() const
98 {
99  return GetShape()->GetRmin();
100 }
101 
102 G4double G4UTorus::GetRmax() const
103 {
104  return GetShape()->GetRmax();
105 }
106 
107 G4double G4UTorus::GetRtor() const
108 {
109  return GetShape()->GetRtor();
110 }
111 
112 G4double G4UTorus::GetSPhi() const
113 {
114  return GetShape()->GetSPhi();
115 }
116 
117 G4double G4UTorus::GetDPhi() const
118 {
119  return GetShape()->GetDPhi();
120 }
121 
122 void G4UTorus::SetRmin(G4double arg)
123 {
124  GetShape()->SetRmin(arg);
125  fRebuildPolyhedron = true;
126 }
127 
128 void G4UTorus::SetRmax(G4double arg)
129 {
130  GetShape()->SetRmax(arg);
131  fRebuildPolyhedron = true;
132 }
133 
134 void G4UTorus::SetRtor(G4double arg)
135 {
136  GetShape()->SetRtor(arg);
137  fRebuildPolyhedron = true;
138 }
139 
140 void G4UTorus::SetSPhi(G4double arg)
141 {
142  GetShape()->SetSPhi(arg);
143  fRebuildPolyhedron = true;
144 }
145 
146 void G4UTorus::SetDPhi(G4double arg)
147 {
148  GetShape()->SetDPhi(arg);
149  fRebuildPolyhedron = true;
150 }
151 
152 void G4UTorus::SetAllParameters(G4double arg1, G4double arg2,
153  G4double arg3, G4double arg4, G4double arg5)
154 {
155  GetShape()->SetRmin(arg1);
156  GetShape()->SetRmax(arg2);
157  GetShape()->SetRtor(arg3);
158  GetShape()->SetSPhi(arg4);
159  GetShape()->SetDPhi(arg5);
160  fRebuildPolyhedron = true;
161 }
162 
164 //
165 // Dispatch to parameterisation for replication mechanism dimension
166 // computation & modification.
167 
168 void G4UTorus::ComputeDimensions(G4VPVParameterisation* p,
169  const G4int n,
170  const G4VPhysicalVolume* pRep)
171 {
172  p->ComputeDimensions(*(G4Torus*)this,n,pRep);
173 }
174 
176 //
177 // Make a clone of the object
178 
179 G4VSolid* G4UTorus::Clone() const
180 {
181  return new G4UTorus(*this);
182 }
183 
185 //
186 // Create polyhedron for visualization
187 
188 G4Polyhedron* G4UTorus::CreatePolyhedron() const
189 {
190  return new G4PolyhedronTorus(GetRmin(),
191  GetRmax(),
192  GetRtor(),
193  GetSPhi(),
194  GetDPhi());
195 }
196 
197 #endif // G4GEOM_USE_USOLIDS
G4double a
Definition: TRTMaterials.hh:39
int G4int
Definition: G4Types.hh:78
const G4int n
virtual void ComputeDimensions(G4Box &, const G4int, const G4VPhysicalVolume *) const
double G4double
Definition: G4Types.hh:76