Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4RegionModel.cc
Go to the documentation of this file.
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//
26// $Id$
27//
28// 20100319 M. Kelsey -- Eliminate unnecessary use of std::pow()
29// 20101019 M. Kelsey -- CoVerity report: unitialized constructor
30
31#include "G4RegionModel.hh"
35
36using namespace G4InuclSpecialFunctions;
37
38const G4double G4RegionModel::radius0 = 1.0E-15;
39const G4double G4RegionModel::BE = 7;
40
42 const G4int A, const G4int Z)
43 : massNumber(A), protonNumber(Z)
44{
45 //count the radiuses, densities and fermi momenta with A and Z
46 G4double r = radius0*G4cbrt(A);
47
48 if(numberOfLayers==1){
49 radius.push_back(r);
50
51 G4double vol = 4.0/3.0 * pi * r*r*r;
52 G4double rho = G4double(A) / vol;
53 density.push_back(rho);
54
55 G4double protonMass = G4Proton::Proton()->GetPDGMass();
56 G4double neutronMass = G4Neutron::Neutron()->GetPDGMass();
57 G4double protonDensity = G4double(Z) / vol;
58 G4double neutronDensity = G4double(A-Z) / vol;
59
60 protonFermiEnergy.push_back(GetFermiEnergy(protonDensity, protonMass));
61 neutronFermiEnergy.push_back(GetFermiEnergy(neutronDensity, neutronMass));
62
63 protonFermiMomentum.push_back(GetFermiMomentum(protonDensity, protonMass));
64 neutronFermiMomentum.push_back(GetFermiMomentum(neutronDensity, neutronMass));
65
66 G4double fermiEP = *protonFermiEnergy.begin();
67 G4double fermiEN = *neutronFermiEnergy.begin();
68 protonPotentialEnergy.push_back(-(fermiEP + BE));
69 neutronPotentialEnergy.push_back(-(fermiEN + BE));
70 }
71 else{
72 if(numberOfLayers==3){
73 radius.push_back(0.1*r);
74 radius.push_back(0.2*r);
75 radius.push_back(0.9*r);
76
77 }
78 }
79}
80
82
84 my_iterator j=density.begin();
85 for(my_iterator i=radius.begin(); i<radius.end(); i++){
86 if(r <= *i) return *j;
87 j++;
88 }
89 return 0;
90}
91
93 if(particle == 0){ //proton
94 my_iterator j=protonPotentialEnergy.begin();
95 for(my_iterator i=radius.begin(); i<radius.end(); i++){
96 if(r <= *i) return *j;
97 j++;
98 }
99 return 0;
100 }
101
102 if(particle == 1){ //neutron
103 my_iterator j=neutronPotentialEnergy.begin();
104 for(my_iterator i=radius.begin(); i<radius.end(); i++){
105 if(r <= *i) return *j;
106 j++;
107 }
108 return 0;
109 }
110 return 0;
111}
112
114 G4int nucleon){
115 if(nucleon == 0){
116 my_iterator j=protonFermiMomentum.begin();
117 for(my_iterator i=radius.begin(); i<radius.end(); i++){
118 if(r <= *i) return *j;
119 j++;
120 }
121 }
122 if(nucleon==1){
123 my_iterator j=neutronFermiMomentum.begin();
124 for(my_iterator i=radius.begin(); i<radius.end(); i++){
125 if(r <= *i) return *j;
126 j++;
127 }
128 }
129 throw G4HadronicException(__FILE__, __LINE__, "G4RegionModel::GetMaximumNucleonMomentum - return value undefined");
130 return 0;
131
132}
133
134G4double G4RegionModel::GetFermiMomentum(G4double aDensity,
135 G4double aMass){
136 return std::sqrt(2*aMass*GetFermiEnergy(aDensity, aMass));
137}
138
139G4double G4RegionModel::GetFermiEnergy(G4double aDensity,
140 G4double aMass){
141 G4double densFactor = G4cbrt(3.0*pi2*aDensity); // 2/3 power
142 densFactor *= densFactor;
143
144 return hbar_Planck*hbar_Planck/(2.0*aMass) * densFactor;
145}
146
147
148
149
150
151
152
153
154
155
156
157
158
159
std::vector< G4double >::const_iterator my_iterator
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
static G4Neutron * Neutron()
Definition: G4Neutron.cc:104
static G4Proton * Proton()
Definition: G4Proton.cc:93
G4double GetDensity(G4double radius)
G4double GetMaximumNucleonMomentum(G4double radius, G4int nucleon)
G4RegionModel(const G4int numberOfLayers, const G4int A, const G4int Z)
G4double GetPotentialEnergy(G4double r, G4int particle)