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 // ********************************************************************
27 // $Id: G4Paraboloid.icc 81641 2014-06-04 09:11:38Z gcosmo $
30 // --------------------------------------------------------------------
31 // GEANT 4 inline definitions file
35 // Implementation of inline methods of G4Paraboloid
36 // --------------------------------------------------------------------
39 G4double G4Paraboloid::GetZHalfLength() const
45 G4double G4Paraboloid::GetRadiusPlusZ() const
51 G4double G4Paraboloid::GetRadiusMinusZ() const
57 void G4Paraboloid::SetZHalfLength(G4double pDz)
61 G4Exception("G4Paraboloid::SetZHalfLength()", "GeomSolids0002",
62 FatalException, "Invalid dimensions.");
67 k1 = (sqr(r2) - sqr(r1)) / (2 * dz);
68 k2 = (sqr(r2) + sqr(r1)) / 2;
70 // This informs GetSurfaceArea() and GetCubicVolume() that it needs
71 // to recalculate buffered value.
75 delete fpPolyhedron; fpPolyhedron = 0;
80 void G4Paraboloid::SetRadiusPlusZ(G4double pR2)
82 if(pR2 <= 0 || pR2 <= r1)
84 G4Exception("G4Paraboloid::SetRadiusPlusZ()", "GeomSolids0002",
85 FatalException, "Invalid dimensions.");
90 k1 = (sqr(r2) - sqr(r1)) / (2 * dz);
91 k2 = (sqr(r2) + sqr(r1)) / 2;
93 // This informs GetSurfaceArea() and GetCubicVolume() that it needs
94 // to recalculate buffered value.
98 delete fpPolyhedron; fpPolyhedron = 0;
103 void G4Paraboloid::SetRadiusMinusZ(G4double pR1)
105 if(pR1 < 0 || pR1 >= r2)
107 G4Exception("G4Paraboloid::SetRadiusMinusZ()", "GeomSolids0002",
108 FatalException, "Invalid dimensions.");
113 k1 = (sqr(r2) - sqr(r1)) / (2 * dz);
114 k2 = (sqr(r2) + sqr(r1)) / 2;
116 // This informs GetSurfaceArea() and GetCubicVolume() that it needs
117 // to recalculate buffered value.
121 delete fpPolyhedron; fpPolyhedron = 0;
126 G4double G4Paraboloid::GetCubicVolume()
128 if(fCubicVolume != 0 ) {;}
131 fCubicVolume = CLHEP::twopi * k2 * dz;
138 G4double G4Paraboloid::CalculateSurfaceArea() const
140 G4double h1, h2, A1, A2;
145 // Calculate surface area for the paraboloid full paraboloid
146 // cutoff at z = dz (not the cutoff area though).
148 A1 = sqr(r2) + 4 * sqr(h1);
149 A1 *= sqr(A1); // Sets A1 = A1^3
150 A1 = CLHEP::pi * r2 /6 / sqr(h1) * ( std::sqrt(A1) - r2 * r2 * r2);
152 // Calculate surface area for the paraboloid full paraboloid
153 // cutoff at z = -dz (not the cutoff area though).
155 A2 = sqr(r1) + 4 * sqr(h2);
156 A2 *= sqr(A2);// Sets A2 = A2^3
159 { A2 = CLHEP::pi * r1 /6 / sqr(h2) * ( std::sqrt(A2) - r1 * r1 * r1); }
163 return fSurfaceArea = A1 - A2 + (sqr(r1) + sqr(r2))*CLHEP::pi;
167 G4double G4Paraboloid::GetSurfaceArea()
169 if(fSurfaceArea == 0.) CalculateSurfaceArea();