G4RegionModel.cc

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 // $Id$
00027 //
00028 // 20100319  M. Kelsey -- Eliminate unnecessary use of std::pow()
00029 // 20101019  M. Kelsey -- CoVerity report: unitialized constructor
00030 
00031 #include "G4RegionModel.hh"
00032 #include "G4PhysicalConstants.hh"
00033 #include "G4HadronicException.hh"
00034 #include "G4InuclSpecialFunctions.hh"
00035 
00036 using namespace G4InuclSpecialFunctions;
00037 
00038 const G4double G4RegionModel::radius0 = 1.0E-15; 
00039 const G4double G4RegionModel::BE = 7;
00040 
00041 G4RegionModel::G4RegionModel(const G4int numberOfLayers,
00042                              const G4int A, const G4int Z)
00043   : massNumber(A), protonNumber(Z)
00044 {
00045   //count the radiuses, densities and fermi momenta with A and Z
00046   G4double r = radius0*G4cbrt(A);
00047 
00048   if(numberOfLayers==1){ 
00049     radius.push_back(r);
00050 
00051     G4double vol = 4.0/3.0 * pi * r*r*r;
00052     G4double rho = G4double(A) / vol;
00053     density.push_back(rho);
00054 
00055     G4double protonMass = G4Proton::Proton()->GetPDGMass();
00056     G4double neutronMass = G4Neutron::Neutron()->GetPDGMass();
00057     G4double protonDensity = G4double(Z) / vol;
00058     G4double neutronDensity = G4double(A-Z) / vol;
00059 
00060     protonFermiEnergy.push_back(GetFermiEnergy(protonDensity, protonMass));
00061     neutronFermiEnergy.push_back(GetFermiEnergy(neutronDensity, neutronMass));
00062     
00063     protonFermiMomentum.push_back(GetFermiMomentum(protonDensity, protonMass));
00064     neutronFermiMomentum.push_back(GetFermiMomentum(neutronDensity, neutronMass));
00065 
00066     G4double fermiEP = *protonFermiEnergy.begin();
00067     G4double fermiEN = *neutronFermiEnergy.begin();
00068     protonPotentialEnergy.push_back(-(fermiEP + BE));
00069     neutronPotentialEnergy.push_back(-(fermiEN + BE));
00070   }
00071   else{
00072   if(numberOfLayers==3){
00073     radius.push_back(0.1*r);
00074     radius.push_back(0.2*r);
00075     radius.push_back(0.9*r);
00076     
00077   }
00078   }
00079 }
00080 
00081 G4RegionModel::~G4RegionModel(){}
00082 
00083 G4double G4RegionModel::GetDensity(G4double r){
00084   my_iterator j=density.begin();
00085      for(my_iterator i=radius.begin(); i<radius.end(); i++){
00086      if(r <= *i) return *j;
00087      j++;
00088    }
00089    return 0;
00090 }
00091 
00092 G4double G4RegionModel::GetPotentialEnergy(G4double r, G4int particle){
00093   if(particle == 0){ //proton
00094     my_iterator j=protonPotentialEnergy.begin();
00095      for(my_iterator i=radius.begin(); i<radius.end(); i++){
00096      if(r <= *i) return *j;
00097      j++;
00098    }
00099      return 0;
00100   }
00101   
00102   if(particle == 1){ //neutron
00103     my_iterator j=neutronPotentialEnergy.begin();
00104      for(my_iterator i=radius.begin(); i<radius.end(); i++){
00105      if(r <= *i) return *j;
00106      j++;
00107    }
00108      return 0;
00109   }
00110   return 0;
00111 }
00112 
00113 G4double G4RegionModel::GetMaximumNucleonMomentum(G4double r,
00114                                                   G4int nucleon){ 
00115   if(nucleon == 0){
00116      my_iterator j=protonFermiMomentum.begin();
00117      for(my_iterator i=radius.begin(); i<radius.end(); i++){
00118      if(r <= *i)  return *j;
00119      j++;
00120      }
00121   }
00122   if(nucleon==1){
00123      my_iterator j=neutronFermiMomentum.begin();
00124      for(my_iterator i=radius.begin(); i<radius.end(); i++){
00125      if(r <= *i)  return *j;
00126      j++;
00127      }
00128   }
00129   throw G4HadronicException(__FILE__, __LINE__, "G4RegionModel::GetMaximumNucleonMomentum - return value undefined");
00130   return 0;
00131 
00132 }
00133 
00134 G4double G4RegionModel::GetFermiMomentum(G4double aDensity,
00135                                          G4double aMass){
00136   return std::sqrt(2*aMass*GetFermiEnergy(aDensity, aMass));
00137 }
00138 
00139 G4double G4RegionModel::GetFermiEnergy(G4double aDensity,
00140                                          G4double aMass){
00141   G4double densFactor = G4cbrt(3.0*pi2*aDensity);               // 2/3 power
00142   densFactor *= densFactor;
00143 
00144   return hbar_Planck*hbar_Planck/(2.0*aMass) * densFactor;
00145 }
00146 
00147 
00148 
00149 
00150 
00151 
00152 
00153 
00154 
00155 
00156 
00157 
00158 
00159 

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