Ignore:
Timestamp:
Jun 18, 2010, 11:42:07 AM (14 years ago)
Author:
garnier
Message:

update geant4-09-04-beta-cand-01 interfaces-V09-03-09 vis-V09-03-08

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4RegionModel.cc

    r819 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4RegionModel.cc,v 1.16 2010/03/19 05:03:23 mkelsey Exp $
     26// Geant4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100319  M. Kelsey -- Eliminate unnecessary use of std::pow()
     29
    2630#include "G4RegionModel.hh"
    2731#include "G4HadronicException.hh"
     32#include "G4InuclSpecialFunctions.hh"
     33
     34using namespace G4InuclSpecialFunctions;
    2835
    2936const G4double G4RegionModel::radius0 = 1.0E-15;
     
    3340{
    3441  //count the radiuses, densities and fermi momenta with A and Z
    35   G4double oneThird = 1.0/3.0;
    36   G4double r = radius0*std::pow(G4double(A), G4double(oneThird));
     42  G4double r = radius0*G4cbrt(A);
    3743
    3844  if(numberOfLayers==1){
    3945    radius.push_back(r);
    4046
    41     G4double rho = G4double(A) / (4.0/3.0*pi*std::pow(r,G4double(3)));
     47    G4double vol = 4.0/3.0 * pi * r*r*r;
     48    G4double rho = G4double(A) / vol;
    4249    density.push_back(rho);
    4350
    4451    G4double protonMass = G4Proton::Proton()->GetPDGMass();
    4552    G4double neutronMass = G4Neutron::Neutron()->GetPDGMass();
    46     G4double protonDensity = G4double(Z) / (4.0/3.0*pi*std::pow(r,G4double(3)));
    47     G4double neutronDensity = G4double(A-Z) / (4.0/3.0*pi*std::pow(r,G4double(3)));
     53    G4double protonDensity = G4double(Z) / vol;
     54    G4double neutronDensity = G4double(A-Z) / vol;
    4855
    4956    protonFermiEnergy.push_back(GetFermiEnergy(protonDensity, protonMass));
     
    123130G4double G4RegionModel::GetFermiMomentum(G4double aDensity,
    124131                                         G4double aMass){
    125  
    126132  return std::sqrt(2*aMass*GetFermiEnergy(aDensity, aMass));
    127 
    128133}
    129134
    130135G4double G4RegionModel::GetFermiEnergy(G4double aDensity,
    131136                                         G4double aMass){
    132  
    133 G4double twoThirds = 2.0/3.0;
    134     return (std::pow(hbar_Planck,2)/(2.0*aMass)*std::pow((3.0*pi2*aDensity),twoThirds));
     137  G4double densFactor = G4cbrt(3.0*pi2*aDensity);               // 2/3 power
     138  densFactor *= densFactor;
     139
     140  return hbar_Planck*hbar_Planck/(2.0*aMass) * densFactor;
    135141}
    136142
Note: See TracChangeset for help on using the changeset viewer.