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 | |
---|
38 | inline |
---|
39 | G4double G4Tubs::GetInnerRadius () const |
---|
40 | { |
---|
41 | return fRMin; |
---|
42 | } |
---|
43 | |
---|
44 | inline |
---|
45 | G4double G4Tubs::GetOuterRadius () const |
---|
46 | { |
---|
47 | return fRMax; |
---|
48 | } |
---|
49 | |
---|
50 | inline |
---|
51 | G4double G4Tubs::GetZHalfLength () const |
---|
52 | { |
---|
53 | return fDz; |
---|
54 | } |
---|
55 | |
---|
56 | inline |
---|
57 | G4double G4Tubs::GetStartPhiAngle () const |
---|
58 | { |
---|
59 | return fSPhi; |
---|
60 | } |
---|
61 | |
---|
62 | inline |
---|
63 | G4double G4Tubs::GetDeltaPhiAngle () const |
---|
64 | { |
---|
65 | return fDPhi; |
---|
66 | } |
---|
67 | |
---|
68 | inline |
---|
69 | void G4Tubs::Initialize() |
---|
70 | { |
---|
71 | fCubicVolume = 0.; |
---|
72 | fSurfaceArea = 0.; |
---|
73 | fpPolyhedron = 0; |
---|
74 | } |
---|
75 | |
---|
76 | inline |
---|
77 | void 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 | |
---|
93 | inline |
---|
94 | void G4Tubs::SetInnerRadius (G4double newRMin) |
---|
95 | { |
---|
96 | fRMin= newRMin; |
---|
97 | Initialize(); |
---|
98 | } |
---|
99 | |
---|
100 | inline |
---|
101 | void G4Tubs::SetOuterRadius (G4double newRMax) |
---|
102 | { |
---|
103 | fRMax= newRMax; |
---|
104 | Initialize(); |
---|
105 | } |
---|
106 | |
---|
107 | inline |
---|
108 | void G4Tubs::SetZHalfLength (G4double newDz) |
---|
109 | { |
---|
110 | fDz= newDz; |
---|
111 | Initialize(); |
---|
112 | } |
---|
113 | |
---|
114 | inline |
---|
115 | void G4Tubs::SetStartPhiAngle (G4double newSPhi) |
---|
116 | { |
---|
117 | fSPhi= newSPhi; |
---|
118 | Initialize(); |
---|
119 | InitializeTrigonometry(); |
---|
120 | } |
---|
121 | |
---|
122 | inline |
---|
123 | void 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 | |
---|
147 | inline |
---|
148 | G4double G4Tubs::GetRMin () const |
---|
149 | { |
---|
150 | return GetInnerRadius(); |
---|
151 | } |
---|
152 | |
---|
153 | inline |
---|
154 | G4double G4Tubs::GetRMax () const |
---|
155 | { |
---|
156 | return GetOuterRadius(); |
---|
157 | } |
---|
158 | |
---|
159 | inline |
---|
160 | G4double G4Tubs::GetDz () const |
---|
161 | { |
---|
162 | return GetZHalfLength() ; |
---|
163 | } |
---|
164 | |
---|
165 | inline |
---|
166 | G4double G4Tubs::GetSPhi () const |
---|
167 | { |
---|
168 | return GetStartPhiAngle(); |
---|
169 | } |
---|
170 | |
---|
171 | inline |
---|
172 | G4double G4Tubs::GetDPhi () const |
---|
173 | { |
---|
174 | return GetDeltaPhiAngle(); |
---|
175 | } |
---|
176 | |
---|
177 | inline |
---|
178 | G4double G4Tubs::GetCubicVolume() |
---|
179 | { |
---|
180 | if(fCubicVolume != 0.) {;} |
---|
181 | else { fCubicVolume = fDPhi*fDz*(fRMax*fRMax-fRMin*fRMin); } |
---|
182 | return fCubicVolume; |
---|
183 | } |
---|
184 | |
---|
185 | inline |
---|
186 | G4double 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 | } |
---|