G4Paraboloid.icc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id: G4Paraboloid.icc 67011 2013-01-29 16:17:41Z gcosmo $
00028 //
00029 //
00030 // --------------------------------------------------------------------
00031 // GEANT 4 inline definitions file
00032 //
00033 // G4Paraboloid.icc
00034 //
00035 // Implementation of inline methods of G4Paraboloid
00036 // --------------------------------------------------------------------
00037 
00038 inline 
00039 G4double G4Paraboloid::GetZHalfLength() const
00040 {
00041   return dz;
00042 }
00043 
00044 inline 
00045 G4double G4Paraboloid::GetRadiusPlusZ() const
00046 {
00047   return r2;
00048 }
00049 
00050 inline
00051 G4double G4Paraboloid::GetRadiusMinusZ() const
00052 {
00053   return r1;
00054 }
00055 
00056 inline
00057 void G4Paraboloid::SetZHalfLength(G4double pDz)
00058 {
00059   if(pDz <= 0)
00060   {
00061     G4Exception("G4Paraboloid::SetZHalfLength()", "GeomSolids0002", 
00062                 FatalException, "Invalid dimensions.");
00063   }
00064   else
00065   {
00066     dz = pDz;
00067     k1 = (sqr(r2) - sqr(r1)) / (2 * dz);
00068     k2 = (sqr(r2) + sqr(r1)) / 2;
00069 
00070     // This informs GetSurfaceArea() and GetCubicVolume() that it needs
00071     // to recalculate buffered value.
00072     //
00073     fSurfaceArea = 0.; 
00074     fCubicVolume = 0.;
00075   }
00076 }
00077 
00078 inline
00079 void G4Paraboloid::SetRadiusPlusZ(G4double pR2)
00080 {
00081   if(pR2 <= 0 || pR2 <= r1)
00082   {
00083     G4Exception("G4Paraboloid::SetRadiusPlusZ()", "GeomSolids0002", 
00084                 FatalException, "Invalid dimensions.");
00085   }
00086   else
00087   {
00088     r2 = pR2;
00089     k1 = (sqr(r2) - sqr(r1)) / (2 * dz);
00090     k2 = (sqr(r2) + sqr(r1)) / 2;
00091 
00092     // This informs GetSurfaceArea() and GetCubicVolume() that it needs
00093     // to recalculate buffered value.
00094     //
00095     fSurfaceArea = 0.; 
00096     fCubicVolume = 0.;
00097   }
00098 }
00099 
00100 inline
00101 void G4Paraboloid::SetRadiusMinusZ(G4double pR1)
00102 {
00103   if(pR1 < 0 || pR1 >= r2)
00104   {
00105     G4Exception("G4Paraboloid::SetRadiusMinusZ()", "GeomSolids0002", 
00106                 FatalException, "Invalid dimensions.");
00107   }
00108   else
00109   {
00110     r1 = pR1;
00111     k1 = (sqr(r2) - sqr(r1)) / (2 * dz);
00112     k2 = (sqr(r2) + sqr(r1)) / 2;
00113 
00114     // This informs GetSurfaceArea() and GetCubicVolume() that it needs
00115     // to recalculate buffered value.
00116     //
00117     fSurfaceArea = 0.; 
00118     fCubicVolume = 0.;
00119   }
00120 }
00121 
00122 inline
00123 G4double G4Paraboloid::GetCubicVolume()
00124 {
00125   if(fCubicVolume != 0 ) {;}
00126   else
00127   {
00128     fCubicVolume = CLHEP::twopi * k2 * dz;
00129   }
00130   return fCubicVolume;
00131 }
00132 
00133 
00134 inline
00135 G4double G4Paraboloid::CalculateSurfaceArea() const
00136 {
00137   G4double h1, h2, A1, A2;
00138 
00139   h1 = k2/k1 + dz;
00140   h2 = k2/k1 - dz;
00141 
00142   // Calculate surface area for the paraboloid full paraboloid
00143   // cutoff at z = dz (not the cutoff area though).
00144 
00145   A1 = sqr(r2) + 4 * sqr(h1);
00146   A1 *= sqr(A1); // Sets A1 = A1^3
00147   A1 = CLHEP::pi * r2 /6 / sqr(h1) * ( std::sqrt(A1) - r2 * r2 * r2);
00148 
00149   // Calculate surface area for the paraboloid full paraboloid
00150   // cutoff at z = -dz (not the cutoff area though).
00151 
00152   A2 = sqr(r1) + 4 * sqr(h2);
00153   A2 *= sqr(A2);// Sets A2 = A2^3
00154 
00155   if(h2 != 0)
00156     { A2 = CLHEP::pi * r1 /6 / sqr(h2) * ( std::sqrt(A2) - r1 * r1 * r1); }
00157   else
00158     { A2 = 0.; }
00159 
00160   return fSurfaceArea = A1 - A2 + (sqr(r1) + sqr(r2))*CLHEP::pi;
00161 }
00162 
00163 inline
00164 G4double G4Paraboloid::GetSurfaceArea()
00165 {
00166   if(fSurfaceArea == 0.) CalculateSurfaceArea();
00167 
00168   return fSurfaceArea;
00169 }

Generated on Mon May 27 17:49:14 2013 for Geant4 by  doxygen 1.4.7