Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
G4NeutronHPFFFissionFS.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// neutron_hp -- source file
27// J.P. Wellisch, Nov-1996
28// A prototype of the low energy neutron transport model.
29//
31#include "G4SystemOfUnits.hh"
32
34{
35 //G4cout << "G4NeutronHPFFFissionFS::Init" << G4endl;
36 G4String aString = "FF";
37
38 G4String tString = dirName;
39 G4bool dbool;
40 G4NeutronHPDataUsed aFile = theNames.GetName(static_cast<G4int>(A), static_cast<G4int>(Z), M, tString, aString , dbool);
41 G4String filename = aFile.GetName();
42 theBaseA = aFile.GetA();
43 theBaseZ = aFile.GetZ();
44
45//3456
46 if ( !dbool || ( Z < 2.5 && ( std::abs(theBaseZ-Z)>0.0001 || std::abs(theBaseA-A)>0.0001) ) )
47 {
48 hasAnyData = false;
49 hasFSData = false;
50 hasXsec = false;
51 return; // no data for exactly this isotope.
52 }
53 std::ifstream theData(filename, std::ios::in);
54 G4double dummy;
55 if ( !theData )
56 {
57 theData.close();
58 hasFSData = false;
59 hasXsec = false;
60 hasAnyData = false;
61 return; // no data for this FS for this isotope
62 }
63
64
65 hasFSData = true;
66 // MT Energy FPS Yield
67 //std::map< int , std::map< double , std::map< int , double >* >* > FisionProductYieldData;
68 while ( theData.good() )
69 {
70 G4int iMT, iMF;
71 G4int imax;
72 //Reading the data
73 // MT MF AWR
74 theData >> iMT >> iMF >> dummy;
75 // nBlock
76 theData >> imax;
77 //if ( !theData.good() ) continue;
78 // Ei FPS Yield
79 std::map< G4double , std::map< G4int , G4double >* >* mEnergyFSPData = new std::map< G4double , std::map< G4int , G4double >* >;
80
81 std::map< G4double , G4int >* mInterporation = new std::map< G4double , G4int >;
82 for ( G4int i = 0 ; i <= imax ; i++ )
83 {
84
85 G4double YY=0.0;
86 G4double Ei;
87 G4int jmax;
88 G4int ip;
89 // energy of incidnece neutron
90 theData >> Ei;
91 // Number of data set followings
92 theData >> jmax;
93 // interpolation scheme
94 theData >> ip;
95 mInterporation->insert( std::pair<G4double,G4int>(Ei*eV,ip) );
96 // nNumber nIP
97 std::map<G4int,G4double>* mFSPYieldData = new std::map<G4int,G4double>;
98 for ( G4int j = 0 ; j < jmax ; j++ )
99 {
100 G4int FSP;
101 G4int mFSP;
102 G4double Y;
103 theData >> FSP >> mFSP >> Y;
104 G4int k = FSP*100+mFSP;
105 YY = YY + Y;
106 //if ( iMT == 454 )G4cout << iMT << " " << i << " " << j << " " << k << " " << Y << " " << YY << G4endl;
107 mFSPYieldData->insert( std::pair<G4int,G4double>( k , YY ) );
108 }
109 mEnergyFSPData->insert( std::pair<G4double,std::map<G4int,G4double>*>(Ei*eV,mFSPYieldData) );
110 }
111
112 FissionProductYieldData.insert( std::pair< G4int , std::map< G4double , std::map< G4int , G4double >* >* > (iMT,mEnergyFSPData));
113 mMTInterpolation.insert( std::pair<G4int,std::map<G4double,G4int>*> (iMT,mInterporation) );
114 }
115 theData.close();
116}
117
119{
120 G4DynamicParticleVector * aResult;
121// G4cout <<"G4NeutronHPFFFissionFS::ApplyYourself +"<<G4endl;
122 aResult = G4NeutronHPFissionBaseFS::ApplyYourself(nNeutrons);
123 return aResult;
124}
125
127{
128 //G4cout << "G4NeutronHPFFFissionFS::GetAFissionFragment " << G4endl;
129
130 G4double rand =G4UniformRand();
131 //G4cout << rand << G4endl;
132
133 std::map< G4double , std::map< G4int , G4double >* >* mEnergyFSPData = FissionProductYieldData.find( 454 )->second;
134
135 //It is not clear that the treatment of the scheme 2 on two-dimensional interpolation.
136 //So, here just use the closest energy point array of yield data.
137 //TK120531
138 G4double key_energy = DBL_MAX;
139 if ( mEnergyFSPData->size() == 1 )
140 {
141 key_energy = mEnergyFSPData->begin()->first;
142 }
143 else
144 {
145 //Find closest energy point
146 G4double Dmin=DBL_MAX;
147 G4int i = 0;
148 for ( std::map< G4double , std::map< G4int , G4double >* >::iterator it = mEnergyFSPData->begin() ;
149 it != mEnergyFSPData->end() ; it++ )
150 {
151 G4double e = (it->first);
152 G4double d = std::fabs ( energy - e );
153 if ( d < Dmin )
154 {
155 Dmin = d;
156 key_energy = e;
157 }
158 i++;
159 }
160 }
161
162 std::map<G4int,G4double>* mFSPYieldData = (*mEnergyFSPData)[key_energy];
163
164 G4int ifrag=0;
165 G4double ceilling = mFSPYieldData->rbegin()->second; // Becaseu of numerical accuracy, this is not always 2
166 for ( std::map<G4int,G4double>::iterator it = mFSPYieldData->begin() ; it != mFSPYieldData->end() ; it++ )
167 {
168 //if ( ( rand - it->second/ceilling ) < 1.0e-6 ) std::cout << rand - it->second/ceilling << std::endl;
169 if ( rand <= it->second/ceilling )
170 {
171 //G4cout << it->first << " " << it->second/ceilling << G4endl;
172 ifrag = it->first;
173 break;
174 }
175 }
176
177 fragZ = ifrag/100000;
178 fragA = (ifrag%100000)/100;
179 fragM = (ifrag%100);
180
181 //G4cout << fragZ << " " << fragA << " " << fragM << G4endl;
182}
std::vector< G4DynamicParticle * > G4DynamicParticleVector
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
bool G4bool
Definition: G4Types.hh:67
#define G4UniformRand()
Definition: Randomize.hh:53
void Init(G4double A, G4double Z, G4int M, G4String &dirName, G4String &aFSType)
void GetAFissionFragment(G4double, G4int &, G4int &, G4int &)
G4DynamicParticleVector * ApplyYourself(G4int nNeutrons)
G4DynamicParticleVector * ApplyYourself(G4int Prompt)
G4NeutronHPDataUsed GetName(G4int A, G4int Z, G4String base, G4String rest, G4bool &active)
#define DBL_MAX
Definition: templates.hh:83