Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ParticleHPElementData.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// particle_hp -- source file
27// J.P. Wellisch, Nov-1996
28// A prototype of the low energy neutron transport model.
29//
30// 02-08-06 Modified Harmonise to reslove cross section trouble at high-end. T. KOI
31//
32// P. Arce, June-2014 Conversion neutron_hp to particle_hp
33//
35
37 {
38 precision = 0.02;
39 theFissionData = new G4ParticleHPVector;
40 theCaptureData = new G4ParticleHPVector;
41 theElasticData = new G4ParticleHPVector;
42 theInelasticData = new G4ParticleHPVector;
43 theIsotopeWiseData = 0;
44 theBuffer = nullptr;
45 }
46
48 {
49 delete theFissionData;
50 delete theCaptureData;
51 delete theElasticData;
52 delete theInelasticData;
53 delete [] theIsotopeWiseData;
54 }
55
56 void G4ParticleHPElementData::Init(G4Element * theElement, G4ParticleDefinition* projectile, const char* dataDirVariable )
57 {
58 G4int count = (G4int)theElement->GetNumberOfIsotopes();
59 if(count == 0)
60 count += theStableOnes.GetNumberOfIsotopes((G4int)theElement->GetZ());
61 theIsotopeWiseData = new G4ParticleHPIsoData[count];
62 // filename = ein data-set je isotope.
63 count = 0;
64 G4int nIso = (G4int)theElement->GetNumberOfIsotopes();
65 G4int Z = (G4int)theElement->GetZ();
66
67 if(nIso!=0)
68 {
69 for (G4int i1=0; i1<nIso; ++i1)
70 {
71 G4int A = theElement->GetIsotope(i1)->GetN();
72 G4int M = theElement->GetIsotope(i1)->Getm();
73 G4double frac = theElement->GetRelativeAbundanceVector()[i1]/CLHEP::perCent;
74 //UpdateData(A, Z, count++, frac);
75 UpdateData(A, Z, M, count++, frac, projectile, dataDirVariable);
76 }
77 }
78 else
79 {
80 G4int first = theStableOnes.GetFirstIsotope(Z);
81 for(G4int i1=0;
82 i1<theStableOnes.GetNumberOfIsotopes((G4int)theElement->GetZ()); ++i1)
83 {
84 G4int A = theStableOnes.GetIsotopeNucleonCount(first+i1);
85 G4double frac = theStableOnes.GetAbundance(first+i1);
86 UpdateData(A, Z, count++, frac, projectile, dataDirVariable);
87 }
88 }
89 theElasticData->ThinOut(precision);
90 if( projectile == G4Neutron::Neutron() ) theInelasticData->ThinOut(precision);
91
92 theCaptureData->ThinOut(precision);
93 theFissionData->ThinOut(precision);
94 }
95
96 void G4ParticleHPElementData::UpdateData(G4int A, G4int Z, G4int M, G4int index, G4double abundance, G4ParticleDefinition* projectile, const char* dataDirVariable )
97 {
98 //Reads in the Data, using G4ParticleHPIsoData[], and its Init
99 //theIsotopeWiseData[index].Init(A, Z, abundance);
100 theIsotopeWiseData[index].Init(A, Z, M, abundance,projectile, dataDirVariable);
101
102 theBuffer = theIsotopeWiseData[index].MakeElasticData();
103 Harmonise(theElasticData, theBuffer);
104 delete theBuffer;
105
106 theBuffer = theIsotopeWiseData[index].MakeInelasticData();
107 Harmonise(theInelasticData, theBuffer);
108 delete theBuffer;
109
110 theBuffer = theIsotopeWiseData[index].MakeCaptureData();
111 Harmonise(theCaptureData, theBuffer);
112 delete theBuffer;
113
114 theBuffer = theIsotopeWiseData[index].MakeFissionData();
115 Harmonise(theFissionData, theBuffer);
116 delete theBuffer;
117 }
118
120 {
121 if(theNew == 0) { return; }
122 G4int s_tmp = 0, n=0, m_tmp=0;
123 G4ParticleHPVector * theMerge = new G4ParticleHPVector(theStore->GetVectorLength());
124 while ( theStore->GetEnergy(s_tmp)<theNew->GetEnergy(0)&&s_tmp<theStore->GetVectorLength() ) // Loop checking, 11.05.2015, T. Koi
125 {
126 theMerge->SetData(m_tmp++, theStore->GetEnergy(s_tmp), theStore->GetXsec(s_tmp));
127 ++s_tmp;
128 }
129 G4ParticleHPVector *active = theStore;
130 G4ParticleHPVector * passive = theNew;
131 G4ParticleHPVector * tmp;
132 G4int a = s_tmp, p = n, t;
133 while (a<active->GetVectorLength()&&p<passive->GetVectorLength()) // Loop checking, 11.05.2015, T. Koi
134 {
135 if(active->GetEnergy(a) <= passive->GetEnergy(p))
136 {
137 theMerge->SetData(m_tmp, active->GetEnergy(a), active->GetXsec(a));
138 G4double x = theMerge->GetEnergy(m_tmp);
139 G4double y = std::max(0., passive->GetXsec(x));
140 theMerge->SetData(m_tmp, x, theMerge->GetXsec(m_tmp)+y);
141 ++m_tmp;
142 ++a;
143 }
144 else
145 {
146 tmp = active; t=a;
147 active = passive; a=p;
148 passive = tmp; p=t;
149 }
150 }
151 while (a!=active->GetVectorLength()) // Loop checking, 11.05.2015, T. Koi
152 {
153 theMerge->SetData(m_tmp++, active->GetEnergy(a), active->GetXsec(a));
154 ++a;
155 }
156 while (p!=passive->GetVectorLength()) // Loop checking, 11.05.2015, T. Koi
157 {
158 G4double x = passive->GetEnergy(p);
159 G4double y = std::max(0., active->GetXsec(x));
160 theMerge->SetData(m_tmp++, x, passive->GetXsec(p)+y);
161 ++p;
162 }
163 delete theStore;
164 theStore = theMerge;
165 }
166
168 G4ParticleDefinition * projectile,
170 char* dataDirVariable)
171 {
172 if(projectile != G4Neutron::Neutron()) throw G4HadronicException(__FILE__, __LINE__, "not a neutron");
173 Init ( theElement, projectile, dataDirVariable );
174 return GetData(theSet);
175 }
177 G4ParticleDefinition * projectile,
179 char* dataDirVariable)
180 {
181 if(projectile != G4Neutron::Neutron()) throw G4HadronicException(__FILE__, __LINE__, "not a neutron");
182 Init ( theElement, projectile, dataDirVariable );
183 return GetData(theSet);
184 }
186 G4ParticleDefinition * projectile,
188 char* dataDirVariable)
189 {
190 if(projectile != G4Neutron::Neutron()) throw G4HadronicException(__FILE__, __LINE__, "not a neutron");
191 Init ( theElement, projectile, dataDirVariable );
192 return GetData(theSet);
193 }
195 G4ParticleDefinition * projectile,
197 char* dataDirVariable)
198 {
199 if(projectile != G4Neutron::Neutron()) throw G4HadronicException(__FILE__, __LINE__, "not a neutron");
200 Init ( theElement, projectile, dataDirVariable );
201 return GetData(theSet);
202 }
#define M(row, col)
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
const G4int Z[17]
const G4double A[17]
G4double * GetRelativeAbundanceVector() const
Definition: G4Element.hh:167
G4double GetZ() const
Definition: G4Element.hh:131
const G4Isotope * GetIsotope(G4int iso) const
Definition: G4Element.hh:170
size_t GetNumberOfIsotopes() const
Definition: G4Element.hh:159
G4int Getm() const
Definition: G4Isotope.hh:99
G4int GetN() const
Definition: G4Isotope.hh:93
static G4Neutron * Neutron()
Definition: G4Neutron.cc:103
G4ParticleHPVector * GetData(G4ParticleHPFissionData *)
void UpdateData(G4int A, G4int Z, G4int index, G4double abundance, G4ParticleDefinition *projectile, const char *dataDirVariable)
G4ParticleHPVector * MakePhysicsVector(G4Element *theElement, G4ParticleDefinition *projectile, G4ParticleHPFissionData *theSet, char *dataDirVariable)
void Harmonise(G4ParticleHPVector *&theStore, G4ParticleHPVector *theNew)
void Init(G4Element *theElement, G4ParticleDefinition *projectile, const char *dataDirVariable)
G4ParticleHPVector * MakeFissionData()
G4bool Init(G4int A, G4int Z, G4double abun, G4String dirName, G4String aFSType)
G4ParticleHPVector * MakeCaptureData()
G4ParticleHPVector * MakeInelasticData()
G4ParticleHPVector * MakeElasticData()
void SetData(G4int i, G4double x, G4double y)
G4double GetXsec(G4int i)
void ThinOut(G4double precision)
G4double GetEnergy(G4int i) const
G4int GetVectorLength() const
G4double GetAbundance(G4int number)
G4int GetFirstIsotope(G4int Z)
G4int GetNumberOfIsotopes(G4int Z)
G4int GetIsotopeNucleonCount(G4int number)