Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4NeutronIsoIsoCrossSections Class Reference

#include <G4NeutronIsoIsoCrossSections.hh>

Public Member Functions

 G4NeutronIsoIsoCrossSections ()
 
 ~G4NeutronIsoIsoCrossSections ()
 
void Init (G4int A, G4int Z, G4double frac)
 
G4double GetCrossSection (G4double anEnergy)
 
G4String GetProductIsotope (G4double anEnergy)
 
G4int GetZ ()
 
G4int GetA ()
 

Detailed Description

Definition at line 33 of file G4NeutronIsoIsoCrossSections.hh.

Constructor & Destructor Documentation

◆ G4NeutronIsoIsoCrossSections()

G4NeutronIsoIsoCrossSections::G4NeutronIsoIsoCrossSections ( )

Definition at line 31 of file G4NeutronIsoIsoCrossSections.cc.

33: theCrossSection(), theNames()
34{
35 theProductionData = NULL;
36 hasData = false;
37 theNumberOfProducts = 0;
38 theZ = 0;
39 theA = 0;
40 G4cout << "WARNING: G4NeutronIsoIsoCrossSections is deprecated and will be removed with Geant4 version 10"
41 << G4endl;
42}
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout

◆ ~G4NeutronIsoIsoCrossSections()

G4NeutronIsoIsoCrossSections::~G4NeutronIsoIsoCrossSections ( )

Definition at line 44 of file G4NeutronIsoIsoCrossSections.cc.

46{
47 for(G4int i=0; i<theNumberOfProducts; i++)
48 {
49 delete theProductionData[i];
50 }
51 delete [] theProductionData;
52}
int G4int
Definition: G4Types.hh:66

Member Function Documentation

◆ GetA()

G4int G4NeutronIsoIsoCrossSections::GetA ( )
inline

Definition at line 45 of file G4NeutronIsoIsoCrossSections.hh.

45{ return theA; }

◆ GetCrossSection()

G4double G4NeutronIsoIsoCrossSections::GetCrossSection ( G4double  anEnergy)

Definition at line 201 of file G4NeutronIsoIsoCrossSections.cc.

203{
204 G4double result;
205 result = theCrossSection.GetY(anEnergy);
206 return result;
207}
double G4double
Definition: G4Types.hh:64
G4double GetY(G4double x)

◆ GetProductIsotope()

G4String G4NeutronIsoIsoCrossSections::GetProductIsotope ( G4double  anEnergy)

Definition at line 209 of file G4NeutronIsoIsoCrossSections.cc.

211{
212 G4String result = "UNCHANGED";
213
214 G4double totalXSec = theCrossSection.GetY(anEnergy);
215 if(totalXSec==0) return result;
216
217 // now do the isotope changing reactions
218 G4double * xSec = new G4double[theNumberOfProducts];
219 G4double sum = 0;
220 {
221 for(G4int i=0; i<theNumberOfProducts; i++)
222 {
223 xSec[i] = theProductionData[i]->GetProductionCrossSection(anEnergy);
224 sum += xSec[i];
225 }
226 }
227 G4double isoChangeXsec = sum;
228 G4double rand = G4UniformRand();
229 if(rand > isoChangeXsec/totalXSec)
230 {
231 delete [] xSec;
232 return result;
233 }
234 G4double random = G4UniformRand();
235 G4double running = 0;
236 G4int index(0);
237 {
238 for(G4int i=0; i<theNumberOfProducts; i++)
239 {
240 running += xSec[i];
241 index = i;
242 if(random<=running/sum) break;
243 }
244 }
245 delete [] xSec;
246 result = theProductionData[index]->GetProductIsotope();
247
248 return result;
249}
#define G4UniformRand()
Definition: Randomize.hh:53
G4double GetProductionCrossSection(G4double anEnergy)

◆ GetZ()

G4int G4NeutronIsoIsoCrossSections::GetZ ( )
inline

Definition at line 44 of file G4NeutronIsoIsoCrossSections.hh.

44{ return theZ; }

◆ Init()

void G4NeutronIsoIsoCrossSections::Init ( G4int  A,
G4int  Z,
G4double  frac 
)

Definition at line 54 of file G4NeutronIsoIsoCrossSections.cc.

56{
57 frac = frac/100.;
58 // First transmution scattering cross-section
59 // in our definition inelastic and fission.
60
61 theZ = Z;
62 theA = A;
63 theNames.SetMaxOffSet(5);
64 G4NeutronHPDataUsed dataUsed;
65 G4String rest = "/CrossSection/";
66 G4String base = getenv("G4NEUTRONHPDATA");
67 G4String base1 = base + "/Inelastic/";
68 G4bool hasInelasticData = false;
69 dataUsed = theNames.GetName(A, Z, base1, rest, hasInelasticData);
70 G4String aName = dataUsed.GetName();
71 G4NeutronHPVector inelasticData;
72 G4double dummy;
73 G4int total;
74 if(hasInelasticData)
75 {
76 std::ifstream aDataSet(aName, std::ios::in);
77 aDataSet >> dummy >> dummy >> total;
78 inelasticData.Init(aDataSet, total, eV);
79 }
80 base1 = base + "/Capture/";
81 G4bool hasCaptureData = false;
82 dataUsed = theNames.GetName(A, Z, base1, rest, hasCaptureData);
83 aName = dataUsed.GetName();
84 G4NeutronHPVector captureData;
85 if(hasCaptureData)
86 {
87 std::ifstream aDataSet(aName, std::ios::in);
88 aDataSet >> dummy >> dummy >> total;
89 captureData.Init(aDataSet, total, eV);
90 }
91 base1 = base + "/Elastic/";
92 G4bool hasElasticData = false;
93 dataUsed = theNames.GetName(A, Z, base1, rest, hasElasticData);
94 aName = dataUsed.GetName();
95 G4NeutronHPVector elasticData;
96 if(hasElasticData)
97 {
98 std::ifstream aDataSet(aName, std::ios::in);
99 aDataSet >> dummy >> dummy >> total;
100 elasticData.Init(aDataSet, total, eV);
101 }
102 base1 = base + "/Fission/";
103 G4bool hasFissionData = false;
104 if(Z>=91)
105 {
106 dataUsed = theNames.GetName(A, Z, base1, rest, hasFissionData);
107 aName = dataUsed.GetName();
108 }
109 G4NeutronHPVector fissionData;
110 if(hasFissionData)
111 {
112 std::ifstream aDataSet(aName, std::ios::in);
113 aDataSet >> dummy >> dummy >> total;
114 fissionData.Init(aDataSet, total, eV);
115 }
116 hasData = hasFissionData||hasInelasticData||hasElasticData||hasCaptureData;
117 G4NeutronHPVector merged, merged1;
118 if(hasData)
119 {
120 if(hasFissionData&&hasInelasticData)
121 {
122 merged = fissionData + inelasticData;
123 }
124 else if(hasFissionData)
125 {
126 merged = fissionData;
127 }
128 else if(hasInelasticData)
129 {
130 merged = inelasticData;
131 }
132
133 if(hasElasticData&&hasCaptureData)
134 {
135 merged1=elasticData + captureData;
136 }
137 else if(hasCaptureData)
138 {
139 merged1 = captureData;
140 }
141 else if(hasElasticData)
142 {
143 merged1 = elasticData;
144 }
145
146 if((hasElasticData||hasCaptureData)&&(hasFissionData||hasInelasticData))
147 {
148 theCrossSection = merged + merged1;
149 }
150 else if(hasElasticData||hasCaptureData)
151 {
152 theCrossSection = merged1;
153 }
154 else if(hasFissionData||hasInelasticData)
155 {
156 theCrossSection = merged;
157 }
158 theCrossSection.Times(frac);
159 }
160
161 // now isotope-production cross-sections
162 theNames.SetMaxOffSet(1);
163 rest = "/CrossSection/";
164 base1 = base + "/IsotopeProduction/";
165 G4bool hasIsotopeProductionData;
166 dataUsed = theNames.GetName(A, Z, base1, rest, hasIsotopeProductionData);
167 aName = dataUsed.GetName();
168 if(hasIsotopeProductionData)
169 {
170 std::ifstream aDataSet(aName, std::ios::in);
171 aDataSet>>theNumberOfProducts;
172 theProductionData = new G4IsoProdCrossSections * [theNumberOfProducts];
173 for(G4int i=0; i<theNumberOfProducts; i++)
174 {
175 G4String dName;
176 aDataSet >> dName;
177 aDataSet >> dummy >> dummy;
178 theProductionData[i] = new G4IsoProdCrossSections(dName);
179 theProductionData[i]->Init(aDataSet);
180 }
181 }
182 else
183 {
184 hasData = false;
185 }
186 G4NeutronInelasticCrossSection theParametrization;
187 G4double lastEnergy = theCrossSection.GetX(theCrossSection.GetVectorLength()-1);
188 G4double lastValue = theCrossSection.GetY(theCrossSection.GetVectorLength()-1);
189 G4double norm = theParametrization.GetCrossSection(lastEnergy, Z, A);
190 G4double increment = 1*MeV;
191 while(lastEnergy+increment<101*MeV)
192 {
193 G4double currentEnergy = lastEnergy+increment;
194 G4double value = theParametrization.GetCrossSection(currentEnergy, Z, A)*(lastValue/norm);
195 G4int position = theCrossSection.GetVectorLength();
196 theCrossSection.SetData(position, currentEnergy, value);
197 increment+=1*MeV;
198 }
199}
bool G4bool
Definition: G4Types.hh:67
void Init(std::ifstream &aDataSet)
G4NeutronHPDataUsed GetName(G4int A, G4int Z, G4String base, G4String rest, G4bool &active)
void SetMaxOffSet(G4int anOffset)
void Init(std::ifstream &aDataFile, G4int total, G4double ux=1., G4double uy=1.)
G4int GetVectorLength() const
G4double GetX(G4int i) const
void SetData(G4int i, G4double x, G4double y)
void Times(G4double factor)
G4double GetCrossSection(G4double kineticEnergy, G4int Z, G4int A)

The documentation for this class was generated from the following files: