source: trunk/source/geometry/solids/CSG/include/G4Tubs.icc@ 1036

Last change on this file since 1036 was 921, checked in by garnier, 17 years ago

en test de gl2ps. Problemes de libraries

File size: 4.6 KB
Line 
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: G4Tubs.icc,v 1.11 2008/11/06 10:55:40 gcosmo Exp $
28// GEANT4 tag $Name: geant4-09-02-cand-01 $
29//
30// --------------------------------------------------------------------
31// GEANT 4 inline definitions file
32//
33// G4Tubs.icc
34//
35// Implementation of inline methods of G4Tubs
36// --------------------------------------------------------------------
37
38inline
39G4double G4Tubs::GetInnerRadius () const
40{
41 return fRMin;
42}
43
44inline
45G4double G4Tubs::GetOuterRadius () const
46{
47 return fRMax;
48}
49
50inline
51G4double G4Tubs::GetZHalfLength () const
52{
53 return fDz;
54}
55
56inline
57G4double G4Tubs::GetStartPhiAngle () const
58{
59 return fSPhi;
60}
61
62inline
63G4double G4Tubs::GetDeltaPhiAngle () const
64{
65 return fDPhi;
66}
67
68inline
69void G4Tubs::Initialize()
70{
71 fCubicVolume = 0.;
72 fSurfaceArea = 0.;
73 fpPolyhedron = 0;
74}
75
76inline
77void G4Tubs::InitializeTrigonometry()
78{
79 G4double hDPhi = 0.5*fDPhi; // half delta phi
80 G4double cPhi = fSPhi + hDPhi;
81 G4double ePhi = fSPhi + fDPhi;
82
83 sinCPhi = std::sin(cPhi);
84 cosCPhi = std::cos(cPhi);
85 cosHDPhiIT = std::cos(hDPhi - 0.5*kAngTolerance); // inner/outer tol half dphi
86 cosHDPhiOT = std::cos(hDPhi + 0.5*kAngTolerance);
87 sinSPhi = std::sin(fSPhi);
88 cosSPhi = std::cos(fSPhi);
89 sinEPhi = std::sin(ePhi);
90 cosEPhi = std::cos(ePhi);
91}
92
93inline
94void G4Tubs::SetInnerRadius (G4double newRMin)
95{
96 fRMin= newRMin;
97 Initialize();
98}
99
100inline
101void G4Tubs::SetOuterRadius (G4double newRMax)
102{
103 fRMax= newRMax;
104 Initialize();
105}
106
107inline
108void G4Tubs::SetZHalfLength (G4double newDz)
109{
110 fDz= newDz;
111 Initialize();
112}
113
114inline
115void G4Tubs::SetStartPhiAngle (G4double newSPhi)
116{
117 fSPhi= newSPhi;
118 Initialize();
119 InitializeTrigonometry();
120}
121
122inline
123void G4Tubs::SetDeltaPhiAngle (G4double newDPhi)
124{
125 if ( newDPhi >= twopi-kAngTolerance*0.5 )
126 {
127 fPhiFullTube = true;
128 }
129 else if ( newDPhi > 0 )
130 {
131 fPhiFullTube = false;
132 }
133 else
134 {
135 G4cerr << "ERROR - G4Tubs()::SetDeltaPhiAngle() : " << GetName() << G4endl
136 << " Negative delta-Phi ! - " << newDPhi << G4endl;
137 G4Exception("G4Tubs::SetDeltaPhiAngle()", "InvalidSetup",
138 FatalException, "Invalid dphi.");
139 }
140 fDPhi= newDPhi;
141 Initialize();
142 InitializeTrigonometry();
143}
144
145// Older names for access functions
146
147inline
148G4double G4Tubs::GetRMin () const
149{
150 return GetInnerRadius();
151}
152
153inline
154G4double G4Tubs::GetRMax () const
155{
156 return GetOuterRadius();
157}
158
159inline
160G4double G4Tubs::GetDz () const
161{
162 return GetZHalfLength() ;
163}
164
165inline
166G4double G4Tubs::GetSPhi () const
167{
168 return GetStartPhiAngle();
169}
170
171inline
172G4double G4Tubs::GetDPhi () const
173{
174 return GetDeltaPhiAngle();
175}
176
177inline
178G4double G4Tubs::GetCubicVolume()
179{
180 if(fCubicVolume != 0.) {;}
181 else { fCubicVolume = fDPhi*fDz*(fRMax*fRMax-fRMin*fRMin); }
182 return fCubicVolume;
183}
184
185inline
186G4double G4Tubs::GetSurfaceArea()
187{
188 if(fSurfaceArea != 0.) {;}
189 else
190 {
191 fSurfaceArea = fDPhi*(fRMin+fRMax)*(2*fDz+fRMax-fRMin);
192 if (!fPhiFullTube)
193 {
194 fSurfaceArea = fSurfaceArea + 4*fDz*(fRMax-fRMin);
195 }
196 }
197 return fSurfaceArea;
198}
Note: See TracBrowser for help on using the repository browser.