G4Ellipsoid.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: G4Ellipsoid.icc 67011 2013-01-29 16:17:41Z gcosmo $
00028 //
00029 //
00030 // --------------------------------------------------------------------
00031 // GEANT 4 inline definitions file
00032 //
00033 // G4Ellipsoid.icc
00034 //
00035 // Implementation of inline methods of G4Ellipsoid
00036 // --------------------------------------------------------------------
00037 
00038 inline
00039 G4double G4Ellipsoid::GetSemiAxisMax (G4int i) const
00040 {
00041   return (i==0) ? xSemiAxis
00042        : (i==1) ? ySemiAxis
00043        : zSemiAxis;
00044 }
00045 
00046 inline
00047 G4double G4Ellipsoid::GetZBottomCut() const
00048 {
00049   return zBottomCut;
00050 }
00051 
00052 inline
00053 G4double G4Ellipsoid::GetZTopCut() const
00054 {
00055   return zTopCut;
00056 }
00057 
00058 inline
00059 void G4Ellipsoid::SetSemiAxis (G4double newxSemiAxis,
00060                                G4double newySemiAxis,
00061                                G4double newzSemiAxis)
00062 {
00063   xSemiAxis= newxSemiAxis; ySemiAxis= newySemiAxis; zSemiAxis= newzSemiAxis;
00064   semiAxisMax = xSemiAxis > ySemiAxis ? xSemiAxis : ySemiAxis;
00065   if (zSemiAxis > semiAxisMax) { semiAxisMax= zSemiAxis; }
00066   if (zBottomCut < -zSemiAxis) { zBottomCut = -zSemiAxis; }
00067   if (zTopCut > +zSemiAxis) { zTopCut = +zSemiAxis; }
00068 }
00069 
00070 inline
00071 void G4Ellipsoid::SetZCuts (G4double newzBottomCut, G4double newzTopCut)
00072 {
00073   if (newzBottomCut < -zSemiAxis)
00074     { zBottomCut = -zSemiAxis; }
00075   else
00076     { zBottomCut = newzBottomCut; }
00077 
00078   if (newzTopCut > +zSemiAxis)
00079     { zTopCut = +zSemiAxis; }
00080   else
00081     { zTopCut = newzTopCut; }
00082 }
00083 
00084 inline
00085 G4double G4Ellipsoid::GetCubicVolume()
00086 {
00087   if(fCubicVolume != 0 ) {;}
00088   else
00089   {
00090     if ((zTopCut > +zSemiAxis && zBottomCut < -zSemiAxis)
00091      || (zTopCut == 0 && zBottomCut == 0) )
00092     {
00093       fCubicVolume = (4./3.)*CLHEP::pi*xSemiAxis*ySemiAxis*zSemiAxis;
00094     }
00095     else 
00096     {   
00097       fCubicVolume = CLHEP::pi*xSemiAxis*ySemiAxis
00098                    * ((zTopCut-std::pow(zTopCut,3.)/(3.*sqr(zSemiAxis)))
00099                    - (zBottomCut-std::pow(zBottomCut,3.)/(3.*sqr(zSemiAxis))));
00100     }
00101   }
00102   return fCubicVolume;
00103 }
00104 
00105 inline
00106 G4double G4Ellipsoid::GetSurfaceArea()
00107 {
00108   if(fSurfaceArea != 0.) {;}
00109   else   { fSurfaceArea = G4VSolid::GetSurfaceArea(); }
00110   return fSurfaceArea;
00111 }

Generated on Mon May 27 17:48:07 2013 for Geant4 by  doxygen 1.4.7