Geant4  10.02.p02
G4UCons.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 G4UCons wrapper class
31 // --------------------------------------------------------------------
32 
33 #include "G4Cons.hh"
34 #include "G4UCons.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 G4UCons::G4UCons( const G4String& pName,
46  G4double pRmin1, G4double pRmax1,
47  G4double pRmin2, G4double pRmax2,
48  G4double pDz,
49  G4double pSPhi, G4double pDPhi)
50  : G4USolid(pName, new UCons(pName, pRmin1, pRmax1, pRmin2, pRmax2,
51  pDz, pSPhi, pDPhi))
52 {
53 }
54 
56 //
57 // Fake default constructor - sets only member data and allocates memory
58 // for usage restricted to object persistency.
59 //
60 G4UCons::G4UCons( __void__& a )
61  : G4USolid(a)
62 {
63 }
64 
66 //
67 // Destructor
68 
69 G4UCons::~G4UCons()
70 {
71 }
72 
74 //
75 // Copy constructor
76 
77 G4UCons::G4UCons(const G4UCons& rhs)
78  : G4USolid(rhs)
79 {
80 }
81 
83 //
84 // Assignment operator
85 
86 G4UCons& G4UCons::operator = (const G4UCons& rhs)
87 {
88  // Check assignment to self
89  //
90  if (this == &rhs) { return *this; }
91 
92  // Copy base class data
93  //
94  G4USolid::operator=(rhs);
95 
96  return *this;
97 }
98 
100 //
101 // Accessors and modifiers
102 
103 G4double G4UCons::GetInnerRadiusMinusZ() const
104 {
105  return GetShape()->GetInnerRadiusMinusZ();
106 }
107 G4double G4UCons::GetOuterRadiusMinusZ() const
108 {
109  return GetShape()->GetOuterRadiusMinusZ();
110 }
111 G4double G4UCons::GetInnerRadiusPlusZ() const
112 {
113  return GetShape()->GetInnerRadiusPlusZ();
114 }
115 G4double G4UCons::GetOuterRadiusPlusZ() const
116 {
117  return GetShape()->GetOuterRadiusPlusZ();
118 }
119 G4double G4UCons::GetZHalfLength() const
120 {
121  return GetShape()->GetZHalfLength();
122 }
123 G4double G4UCons::GetStartPhiAngle() const
124 {
125  return GetShape()->GetStartPhiAngle();
126 }
127 G4double G4UCons::GetDeltaPhiAngle() const
128 {
129  return GetShape()->GetDeltaPhiAngle();
130 }
131 
132 void G4UCons::SetInnerRadiusMinusZ(G4double Rmin1)
133 {
134  GetShape()->SetInnerRadiusMinusZ(Rmin1);
135  fRebuildPolyhedron = true;
136 }
137 void G4UCons::SetOuterRadiusMinusZ(G4double Rmax1)
138 {
139  GetShape()->SetOuterRadiusMinusZ(Rmax1);
140  fRebuildPolyhedron = true;
141 }
142 void G4UCons::SetInnerRadiusPlusZ(G4double Rmin2)
143 {
144  GetShape()->SetInnerRadiusPlusZ(Rmin2);
145  fRebuildPolyhedron = true;
146 }
147 void G4UCons::SetOuterRadiusPlusZ(G4double Rmax2)
148 {
149  GetShape()->SetOuterRadiusPlusZ(Rmax2);
150  fRebuildPolyhedron = true;
151 }
152 void G4UCons::SetZHalfLength(G4double newDz)
153 {
154  GetShape()->SetZHalfLength(newDz);
155  fRebuildPolyhedron = true;
156 }
157 void G4UCons::SetStartPhiAngle(G4double newSPhi, G4bool trig)
158 {
159  GetShape()->SetStartPhiAngle(newSPhi, trig);
160  fRebuildPolyhedron = true;
161 }
162 void G4UCons::SetDeltaPhiAngle(G4double newDPhi)
163 {
164  GetShape()->SetDeltaPhiAngle(newDPhi);
165  fRebuildPolyhedron = true;
166 }
167 
169 //
170 // Dispatch to parameterisation for replication mechanism dimension
171 // computation & modification.
172 
173 void G4UCons::ComputeDimensions( G4VPVParameterisation* p,
174  const G4int n,
175  const G4VPhysicalVolume* pRep )
176 {
177  p->ComputeDimensions(*(G4Cons*)this,n,pRep);
178 }
179 
181 //
182 // Make a clone of the object
183 
184 G4VSolid* G4UCons::Clone() const
185 {
186  return new G4UCons(*this);
187 }
188 
190 //
191 // Create polyhedron for visualization
192 
193 G4Polyhedron* G4UCons::CreatePolyhedron() const
194 {
195  return new G4PolyhedronCons(GetInnerRadiusMinusZ(),
196  GetOuterRadiusMinusZ(),
197  GetInnerRadiusPlusZ(),
198  GetOuterRadiusPlusZ(),
199  GetZHalfLength(),
200  GetStartPhiAngle(),
201  GetDeltaPhiAngle());
202 }
203 
204 #endif // G4GEOM_USE_USOLIDS
G4double a
Definition: TRTMaterials.hh:39
int G4int
Definition: G4Types.hh:78
bool G4bool
Definition: G4Types.hh:79
Definition: G4Cons.hh:83
const G4int n
virtual void ComputeDimensions(G4Box &, const G4int, const G4VPhysicalVolume *) const
double G4double
Definition: G4Types.hh:76