Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4WendtFissionFragmentGenerator.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 /*
27  * File: G4WendtFissionFragmentGenerator.hh
28  * Author: B. Wendt (wendbryc@isu.edu)
29  *
30  * Created on June 21, 2013, 13:58 MST
31  */
32 
33 #include "G4NeutronHPManager.hh"
34 
35 #include "G4FFGDebuggingMacros.hh"
37 
38 G4WendtFissionFragmentGenerator::
39 G4WendtFissionFragmentGenerator()
40 {
41  // Set the default verbosity
42  Verbosity_ = G4FFGDefaultValues::Verbosity;
43 }
44 
47 {
49 
50  return &newMe;
51 }
52 
54 ApplyYourself(const G4HadProjectile& projectile, G4int Z, G4int A)
55 {
57 
58  G4HadFinalState* finalState = NULL;
59  G4DynamicParticleVector* finalParticles = NULL;
60  G4int isotope;
61  std::map< const G4int, G4FissionFragmentGenerator* >::iterator fissionGenerator;
62 
63  // Look for the first available isomer since no M is provided for ApplyYourself()
64  for(unsigned int M = 0; M < 10; ++M)
65  {
67  fissionGenerator = fissionIsotopes.find(isotope);
68 
69  if(fissionGenerator != fissionIsotopes.end())
70  {
71  // Only generate particles if the generator was constructed
72  if(fissionGenerator->second)
73  {
74  finalParticles = fissionGenerator->second->G4GenerateFission(projectile);
75  }
76 
77  break;
78  }
79  }
80 
81  if(finalParticles)
82  {
83  finalState = new G4HadFinalState();
84 
85  for(unsigned int i = 0; i < finalParticles->size(); ++i)
86  {
87  finalState->AddSecondary((*finalParticles)[i]);
88  }
89  }
90 
91  //TK modified 131108 add next line
92  finalState->SetStatusChange(stopAndKill);
94  return finalState;
95 }
96 
98 InitializeANucleus(const G4int A, const G4int Z, const G4int M, const G4String& dataDirectory)
99 {
100 //G4FFG_FUNCTIONENTER__
101 
102  const G4int isotope = G4FissionFragmentGenerator::G4MakeIsotopeCode(Z, A, M);
104  std::pair< std::map< const G4int, G4FissionFragmentGenerator* >::iterator, bool > newIsotope;
105 
106  // Check to see if the isotope/isomer alread exists in the table
107  newIsotope = fissionIsotopes.insert(std::make_pair(isotope, (G4FissionFragmentGenerator*)NULL));
108 
109  if(newIsotope.second || newIsotope.first->second == NULL)
110  {
111  // Get the data file
112  G4bool flag;
113  G4NeutronHPDataUsed dataFile = fileNames.GetName(A, Z, M, dataDirectory, "FF", flag);
114  G4String dataFileName = dataFile.GetName();
115 
116  // Check if the file exists, and do not create a fission object if it doesn't
117  // G4cout << "*** Z = " << Z << "\tA = " << A << "\t\t\t Directory: "<< dataDirectory << " DATA FILE: " << dataFileName << G4endl;
118  std::istringstream dataStream(std::ios::in);
119  G4NeutronHPManager::GetInstance()->GetDataStream(dataFileName, dataStream);
120  if(!dataStream)
121  {
122  //G4FFG_FUNCTIONLEAVE__
123  // G4cerr << "*** Stream error" << G4endl;
124  return;
125  }
126 
127  // Check the data file parameters
128  if(!flag
129  || ( Z < 2.5 && ( (G4double)abs( dataFile.GetZ() - Z ) > 0.001 || (G4double)abs( (G4int)dataFile.GetA() - A ) > 0.0001 ) ) )
130  {
131  //G4cerr << "*** Something wrong with the data request.\tFlag :" << flag << G4endl;
132  //G4FFG_FUNCTIONLEAVE__
133  return;
134  }
135 
136  G4FissionFragmentGenerator* const fissionGenerator = new G4FissionFragmentGenerator();
137  newIsotope.first->second = fissionGenerator;
138 
139  switch(M)
140  {
141  case 1:
142  metaState = G4FFGEnumerations::META_1;
143  break;
144 
145  case 2:
146  metaState = G4FFGEnumerations::META_2;
147  break;
148 
149  default:
150  // TODO Display a warning message here indicating that an invalid metastate was passed in
151  // Fall through to the ground state by default
152  case 0:
154  break;
155  }
156 
157  fissionGenerator->G4SetIsotope(isotope);
158  fissionGenerator->G4SetMetaState(metaState);
160  // TODO Load all the fission data and use the projectile energy instead
161  fissionGenerator->G4SetIncidentEnergy(G4FFGDefaultValues::ThermalNeutronEnergy);
164 
165 
166  // TODO Remove the need for forcing a load in the initialization phase,
167  // i.e. remove the ability to dynamically change the fission parameters
168  // that cause reload because a G4FissionFragmentGenerator class for
169  // each isotope should be loaded in the initialization phase
170  if(!fissionGenerator->InitializeFissionProductYieldClass(dataStream))
171  {
172  // Delete if the initialization fails
173  delete fissionGenerator;
174 
175  fissionIsotopes.erase(newIsotope.first);
176  }
177  }
178 
179 //G4FFG_FUNCTIONLEAVE__
180 }
181 
184 {
185  std::map< const G4int, G4FissionFragmentGenerator* >::iterator fissionGenerator;
186 
187  for(fissionGenerator = fissionIsotopes.begin(); fissionGenerator != fissionIsotopes.end(); ++fissionGenerator)
188  {
189  delete fissionGenerator->second;
190  }
191 }
G4HadFinalState * ApplyYourself(const G4HadProjectile &projectile, G4int Z, G4int A)
void G4SetSamplingScheme(G4FFGEnumerations::FissionSamplingScheme NewScheme)
static G4NeutronHPManager * GetInstance()
void G4SetYieldType(G4FFGEnumerations::YieldType WhichYieldType)
void G4SetMetaState(G4FFGEnumerations::MetaState WhichMetaState)
void GetDataStream(G4String, std::istringstream &iss)
G4NeutronHPDataUsed GetName(G4int A, G4int Z, G4String base, G4String rest, G4bool &active)
int G4int
Definition: G4Types.hh:78
static G4int G4MakeIsotopeCode(G4int Z, G4int A, G4int M)
bool InitializeFissionProductYieldClass(std::istringstream &dataFile)
void InitializeANucleus(const G4int A, const G4int Z, const G4int M, const G4String &dataDirectory)
bool G4bool
Definition: G4Types.hh:79
std::vector< G4DynamicParticle * > G4DynamicParticleVector
void G4SetIsotope(G4int WhichIsotope)
void G4SetCause(G4FFGEnumerations::FissionCause WhichCause)
void G4SetIncidentEnergy(G4double WhatIncidentEnergy)
#define G4FFG_FUNCTIONLEAVE__
double G4double
Definition: G4Types.hh:76
static G4WendtFissionFragmentGenerator * GetInstance()
#define G4FFG_FUNCTIONENTER__