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