| [831] | 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: G4Paraboloid.icc,v 1.4 2007/08/21 12:58:36 gcosmo Exp $
|
|---|
| [1337] | 28 | // GEANT4 tag $Name: geant4-09-04-beta-01 $
|
|---|
| [831] | 29 | //
|
|---|
| 30 | //
|
|---|
| 31 | // --------------------------------------------------------------------
|
|---|
| 32 | // GEANT 4 inline definitions file
|
|---|
| 33 | //
|
|---|
| 34 | // G4Paraboloid.icc
|
|---|
| 35 | //
|
|---|
| 36 | // Implementation of inline methods of G4Paraboloid
|
|---|
| 37 | // --------------------------------------------------------------------
|
|---|
| 38 |
|
|---|
| 39 | inline
|
|---|
| 40 | G4double G4Paraboloid::GetZHalfLength() const
|
|---|
| 41 | {
|
|---|
| 42 | return dz;
|
|---|
| 43 | }
|
|---|
| 44 |
|
|---|
| 45 | inline
|
|---|
| 46 | G4double G4Paraboloid::GetRadiusPlusZ() const
|
|---|
| 47 | {
|
|---|
| 48 | return r2;
|
|---|
| 49 | }
|
|---|
| 50 |
|
|---|
| 51 | inline
|
|---|
| 52 | G4double G4Paraboloid::GetRadiusMinusZ() const
|
|---|
| 53 | {
|
|---|
| 54 | return r1;
|
|---|
| 55 | }
|
|---|
| 56 |
|
|---|
| 57 | inline
|
|---|
| 58 | void G4Paraboloid::SetZHalfLength(G4double pDz)
|
|---|
| 59 | {
|
|---|
| 60 | if(pDz <= 0)
|
|---|
| 61 | {
|
|---|
| 62 | G4Exception("G4Paraboloid::SetZHalfLength()", "InvalidSetup",
|
|---|
| 63 | FatalException, "Invalid dimensions.");
|
|---|
| 64 | }
|
|---|
| 65 | else
|
|---|
| 66 | {
|
|---|
| 67 | dz = pDz;
|
|---|
| 68 | k1 = (sqr(r2) - sqr(r1)) / (2 * dz);
|
|---|
| 69 | k2 = (sqr(r2) + sqr(r1)) / 2;
|
|---|
| 70 |
|
|---|
| 71 | // This informs GetSurfaceArea() and GetCubicVolume() that it needs
|
|---|
| 72 | // to recalculate buffered value.
|
|---|
| 73 | //
|
|---|
| 74 | fSurfaceArea = 0.;
|
|---|
| 75 | fCubicVolume = 0.;
|
|---|
| 76 | }
|
|---|
| 77 | }
|
|---|
| 78 |
|
|---|
| 79 | inline
|
|---|
| 80 | void G4Paraboloid::SetRadiusPlusZ(G4double pR2)
|
|---|
| 81 | {
|
|---|
| 82 | if(pR2 <= 0 || pR2 <= r1)
|
|---|
| 83 | {
|
|---|
| 84 | G4Exception("G4Paraboloid::SetRadiusPlusZ()", "InvalidSetup",
|
|---|
| 85 | FatalException, "Invalid dimensions.");
|
|---|
| 86 | }
|
|---|
| 87 | else
|
|---|
| 88 | {
|
|---|
| 89 | r2 = pR2;
|
|---|
| 90 | k1 = (sqr(r2) - sqr(r1)) / (2 * dz);
|
|---|
| 91 | k2 = (sqr(r2) + sqr(r1)) / 2;
|
|---|
| 92 |
|
|---|
| 93 | // This informs GetSurfaceArea() and GetCubicVolume() that it needs
|
|---|
| 94 | // to recalculate buffered value.
|
|---|
| 95 | //
|
|---|
| 96 | fSurfaceArea = 0.;
|
|---|
| 97 | fCubicVolume = 0.;
|
|---|
| 98 | }
|
|---|
| 99 | }
|
|---|
| 100 |
|
|---|
| 101 | inline
|
|---|
| 102 | void G4Paraboloid::SetRadiusMinusZ(G4double pR1)
|
|---|
| 103 | {
|
|---|
| 104 | if(pR1 < 0 || pR1 >= r2)
|
|---|
| 105 | {
|
|---|
| 106 | G4Exception("G4Paraboloid::SetRadiusMinusZ()", "InvalidSetup",
|
|---|
| 107 | FatalException, "Invalid dimensions.");
|
|---|
| 108 | }
|
|---|
| 109 | else
|
|---|
| 110 | {
|
|---|
| 111 | r1 = pR1;
|
|---|
| 112 | k1 = (sqr(r2) - sqr(r1)) / (2 * dz);
|
|---|
| 113 | k2 = (sqr(r2) + sqr(r1)) / 2;
|
|---|
| 114 |
|
|---|
| 115 | // This informs GetSurfaceArea() and GetCubicVolume() that it needs
|
|---|
| 116 | // to recalculate buffered value.
|
|---|
| 117 | //
|
|---|
| 118 | fSurfaceArea = 0.;
|
|---|
| 119 | fCubicVolume = 0.;
|
|---|
| 120 | }
|
|---|
| 121 | }
|
|---|
| 122 |
|
|---|
| 123 | inline
|
|---|
| 124 | G4double G4Paraboloid::GetCubicVolume()
|
|---|
| 125 | {
|
|---|
| 126 | if(fCubicVolume != 0 ) {;}
|
|---|
| 127 | else
|
|---|
| 128 | {
|
|---|
| 129 | fCubicVolume = pi * 2. * k2 * dz;
|
|---|
| 130 | }
|
|---|
| 131 | return fCubicVolume;
|
|---|
| 132 | }
|
|---|
| 133 |
|
|---|
| 134 |
|
|---|
| 135 | inline
|
|---|
| 136 | G4double G4Paraboloid::CalculateSurfaceArea() const
|
|---|
| 137 | {
|
|---|
| 138 | G4double h1, h2, A1, A2;
|
|---|
| 139 |
|
|---|
| 140 | h1 = k2/k1 + dz;
|
|---|
| 141 | h2 = k2/k1 - dz;
|
|---|
| 142 |
|
|---|
| 143 | // Calculate surface area for the paraboloid full paraboloid
|
|---|
| 144 | // cutoff at z = dz (not the cutoff area though).
|
|---|
| 145 |
|
|---|
| 146 | A1 = sqr(r2) + 4 * sqr(h1);
|
|---|
| 147 | A1 *= sqr(A1); // Sets A1 = A1^3
|
|---|
| 148 | A1 = pi * r2 /6 / sqr(h1) * ( std::sqrt(A1) - r2 * r2 * r2);
|
|---|
| 149 |
|
|---|
| 150 | // Calculate surface area for the paraboloid full paraboloid
|
|---|
| 151 | // cutoff at z = -dz (not the cutoff area though).
|
|---|
| 152 |
|
|---|
| 153 | A2 = sqr(r1) + 4 * sqr(h2);
|
|---|
| 154 | A2 *= sqr(A2);// Sets A2 = A2^3
|
|---|
| 155 |
|
|---|
| 156 | if(h2 != 0)
|
|---|
| 157 | { A2 = pi * r1 /6 / sqr(h2) * ( std::sqrt(A2) - r1 * r1 * r1); }
|
|---|
| 158 | else
|
|---|
| 159 | { A2 = 0.; }
|
|---|
| 160 |
|
|---|
| 161 | return fSurfaceArea = A1 - A2 + (sqr(r1) + sqr(r2))*pi;
|
|---|
| 162 | }
|
|---|
| 163 |
|
|---|
| 164 | inline
|
|---|
| 165 | G4double G4Paraboloid::GetSurfaceArea()
|
|---|
| 166 | {
|
|---|
| 167 | if(fSurfaceArea == 0.) CalculateSurfaceArea();
|
|---|
| 168 |
|
|---|
| 169 | return fSurfaceArea;
|
|---|
| 170 | }
|
|---|