- Timestamp:
- Jun 18, 2010, 11:42:07 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/processes/hadronic/models/cascade/cascade/src/G4RegionModel.cc
r819 r1315 23 23 // * acceptance of all terms of the Geant4 Software license. * 24 24 // ******************************************************************** 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 $ 25 27 // 28 // 20100319 M. Kelsey -- Eliminate unnecessary use of std::pow() 29 26 30 #include "G4RegionModel.hh" 27 31 #include "G4HadronicException.hh" 32 #include "G4InuclSpecialFunctions.hh" 33 34 using namespace G4InuclSpecialFunctions; 28 35 29 36 const G4double G4RegionModel::radius0 = 1.0E-15; … … 33 40 { 34 41 //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); 37 43 38 44 if(numberOfLayers==1){ 39 45 radius.push_back(r); 40 46 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; 42 49 density.push_back(rho); 43 50 44 51 G4double protonMass = G4Proton::Proton()->GetPDGMass(); 45 52 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; 48 55 49 56 protonFermiEnergy.push_back(GetFermiEnergy(protonDensity, protonMass)); … … 123 130 G4double G4RegionModel::GetFermiMomentum(G4double aDensity, 124 131 G4double aMass){ 125 126 132 return std::sqrt(2*aMass*GetFermiEnergy(aDensity, aMass)); 127 128 133 } 129 134 130 135 G4double G4RegionModel::GetFermiEnergy(G4double aDensity, 131 136 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; 135 141 } 136 142
Note: See TracChangeset
for help on using the changeset viewer.