2// ********************************************************************
3// * License and Disclaimer *
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. *
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. *
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// ********************************************************************
26// Implementation of inline methods of G4Paraboloid
27// --------------------------------------------------------------------
30G4double G4Paraboloid::GetZHalfLength() const
36G4double G4Paraboloid::GetRadiusPlusZ() const
42G4double G4Paraboloid::GetRadiusMinusZ() const
48void G4Paraboloid::SetZHalfLength(G4double pDz)
52 G4Exception("G4Paraboloid::SetZHalfLength()", "GeomSolids0002",
53 FatalException, "Invalid dimensions.");
58 k1 = (sqr(r2) - sqr(r1)) / (2 * dz);
59 k2 = (sqr(r2) + sqr(r1)) / 2;
61 // This informs GetSurfaceArea() and GetCubicVolume() that it needs
62 // to recalculate buffered value.
66 fRebuildPolyhedron = true;
71void G4Paraboloid::SetRadiusPlusZ(G4double pR2)
73 if(pR2 <= 0 || pR2 <= r1)
75 G4Exception("G4Paraboloid::SetRadiusPlusZ()", "GeomSolids0002",
76 FatalException, "Invalid dimensions.");
81 k1 = (sqr(r2) - sqr(r1)) / (2 * dz);
82 k2 = (sqr(r2) + sqr(r1)) / 2;
84 // This informs GetSurfaceArea() and GetCubicVolume() that it needs
85 // to recalculate buffered value.
89 fRebuildPolyhedron = true;
94void G4Paraboloid::SetRadiusMinusZ(G4double pR1)
96 if(pR1 < 0 || pR1 >= r2)
98 G4Exception("G4Paraboloid::SetRadiusMinusZ()", "GeomSolids0002",
99 FatalException, "Invalid dimensions.");
104 k1 = (sqr(r2) - sqr(r1)) / (2 * dz);
105 k2 = (sqr(r2) + sqr(r1)) / 2;
107 // This informs GetSurfaceArea() and GetCubicVolume() that it needs
108 // to recalculate buffered value.
112 fRebuildPolyhedron = true;
117G4double G4Paraboloid::GetCubicVolume()
119 if(fCubicVolume != 0. ) {;}
122 fCubicVolume = CLHEP::twopi * k2 * dz;
129G4double G4Paraboloid::CalculateSurfaceArea() const
131 G4double h1, h2, A1, A2;
136 // Calculate surface area for the paraboloid full paraboloid
137 // cutoff at z = dz (not the cutoff area though).
139 A1 = sqr(r2) + 4 * sqr(h1);
140 A1 *= sqr(A1); // Sets A1 = A1^3
141 A1 = CLHEP::pi * r2 /6 / sqr(h1) * ( std::sqrt(A1) - r2 * r2 * r2);
143 // Calculate surface area for the paraboloid full paraboloid
144 // cutoff at z = -dz (not the cutoff area though).
146 A2 = sqr(r1) + 4 * sqr(h2);
147 A2 *= sqr(A2);// Sets A2 = A2^3
150 { A2 = CLHEP::pi * r1 /6 / sqr(h2) * ( std::sqrt(A2) - r1 * r1 * r1); }
154 return fSurfaceArea = A1 - A2 + (sqr(r1) + sqr(r2))*CLHEP::pi;
158G4double G4Paraboloid::GetSurfaceArea()
160 if(fSurfaceArea == 0.) CalculateSurfaceArea();