source: trunk/source/processes/hadronic/models/cascade/cascade/src/G4RegionModel.cc @ 1315

Last change on this file since 1315 was 1315, checked in by garnier, 14 years ago

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

File size: 4.9 KB
Line 
1//
2// ********************************************************************
3// * License and Disclaimer                                           *
4// *                                                                  *
5// * The  Geant4 software  is  copyright of the Copyright Holders  of *
6// * the Geant4 Collaboration.  It is provided  under  the terms  and *
7// * conditions of the Geant4 Software License,  included in the file *
8// * LICENSE and available at  http://cern.ch/geant4/license .  These *
9// * include a list of copyright holders.                             *
10// *                                                                  *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work  make  any representation or  warranty, express or implied, *
14// * regarding  this  software system or assume any liability for its *
15// * use.  Please see the license in the file  LICENSE  and URL above *
16// * for the full disclaimer and the limitation of liability.         *
17// *                                                                  *
18// * This  code  implementation is the result of  the  scientific and *
19// * technical work of the GEANT4 collaboration.                      *
20// * By using,  copying,  modifying or  distributing the software (or *
21// * any work based  on the software)  you  agree  to acknowledge its *
22// * use  in  resulting  scientific  publications,  and indicate your *
23// * acceptance of all terms of the Geant4 Software license.          *
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 $
27//
28// 20100319  M. Kelsey -- Eliminate unnecessary use of std::pow()
29
30#include "G4RegionModel.hh"
31#include "G4HadronicException.hh"
32#include "G4InuclSpecialFunctions.hh"
33
34using namespace G4InuclSpecialFunctions;
35
36const G4double G4RegionModel::radius0 = 1.0E-15; 
37const G4double G4RegionModel::BE = 7;
38
39G4RegionModel::G4RegionModel(const G4int numberOfLayers, const G4int A, const G4int Z)
40{
41  //count the radiuses, densities and fermi momenta with A and Z
42  G4double r = radius0*G4cbrt(A);
43
44  if(numberOfLayers==1){ 
45    radius.push_back(r);
46
47    G4double vol = 4.0/3.0 * pi * r*r*r;
48    G4double rho = G4double(A) / vol;
49    density.push_back(rho);
50
51    G4double protonMass = G4Proton::Proton()->GetPDGMass();
52    G4double neutronMass = G4Neutron::Neutron()->GetPDGMass();
53    G4double protonDensity = G4double(Z) / vol;
54    G4double neutronDensity = G4double(A-Z) / vol;
55
56    protonFermiEnergy.push_back(GetFermiEnergy(protonDensity, protonMass));
57    neutronFermiEnergy.push_back(GetFermiEnergy(neutronDensity, neutronMass));
58   
59    protonFermiMomentum.push_back(GetFermiMomentum(protonDensity, protonMass));
60    neutronFermiMomentum.push_back(GetFermiMomentum(neutronDensity, neutronMass));
61
62    G4double fermiEP = *protonFermiEnergy.begin();
63    G4double fermiEN = *neutronFermiEnergy.begin();
64    protonPotentialEnergy.push_back(-(fermiEP + BE));
65    neutronPotentialEnergy.push_back(-(fermiEN + BE));
66  }
67  else{
68  if(numberOfLayers==3){
69    radius.push_back(0.1*r);
70    radius.push_back(0.2*r);
71    radius.push_back(0.9*r);
72   
73  }
74  }
75}
76
77G4RegionModel::~G4RegionModel(){}
78
79G4double G4RegionModel::GetDensity(G4double r){
80  my_iterator j=density.begin();
81     for(my_iterator i=radius.begin(); i<radius.end(); i++){
82     if(r <= *i) return *j;
83     j++;
84   }
85   return 0;
86}
87
88G4double G4RegionModel::GetPotentialEnergy(G4double r, G4int particle){
89  if(particle == 0){ //proton
90    my_iterator j=protonPotentialEnergy.begin();
91     for(my_iterator i=radius.begin(); i<radius.end(); i++){
92     if(r <= *i) return *j;
93     j++;
94   }
95     return 0;
96  }
97 
98  if(particle == 1){ //neutron
99    my_iterator j=neutronPotentialEnergy.begin();
100     for(my_iterator i=radius.begin(); i<radius.end(); i++){
101     if(r <= *i) return *j;
102     j++;
103   }
104     return 0;
105  }
106  return 0;
107}
108
109G4double G4RegionModel::GetMaximumNucleonMomentum(G4double r,
110                                                  G4int nucleon){ 
111  if(nucleon == 0){
112     my_iterator j=protonFermiMomentum.begin();
113     for(my_iterator i=radius.begin(); i<radius.end(); i++){
114     if(r <= *i)  return *j;
115     j++;
116     }
117  }
118  if(nucleon==1){
119     my_iterator j=neutronFermiMomentum.begin();
120     for(my_iterator i=radius.begin(); i<radius.end(); i++){
121     if(r <= *i)  return *j;
122     j++;
123     }
124  }
125  throw G4HadronicException(__FILE__, __LINE__, "G4RegionModel::GetMaximumNucleonMomentum - return value undefined");
126  return 0;
127
128}
129
130G4double G4RegionModel::GetFermiMomentum(G4double aDensity,
131                                         G4double aMass){
132  return std::sqrt(2*aMass*GetFermiEnergy(aDensity, aMass));
133}
134
135G4double G4RegionModel::GetFermiEnergy(G4double aDensity,
136                                         G4double aMass){
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;
141}
142
143
144
145
146
147
148
149
150
151
152
153
154
155
Note: See TracBrowser for help on using the repository browser.