Geant4-11
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
34
37
39
41
44{
45 // Set the default verbosity
47
48 // Set the creator model ID
49 secID = G4PhysicsModelCatalog::GetModelID( "model_NeutronHPFission" );
50}
51/*
52G4WendtFissionFragmentGenerator* G4WendtFissionFragmentGenerator::
53GetInstance()
54{
55 //static G4WendtFissionFragmentGenerator newMe;
56 //
57 //return &newMe;
58
59 if ( instance == NULL) instance = new G4WendtFissionFragmentGenerator();
60
61 return instance;
62}
63*/
65ApplyYourself(const G4HadProjectile& projectile, G4int Z, G4int A)
66{
68
69 G4HadFinalState* finalState = NULL;
70 G4DynamicParticleVector* finalParticles = NULL;
71 G4int isotope;
72 std::map< const G4int, G4FissionFragmentGenerator* >::iterator fissionGenerator;
73
74 // Look for the first available isomer since no M is provided for ApplyYourself()
75 for(unsigned int M = 0; M < 10; ++M)
76 {
78 fissionGenerator = fissionIsotopes.find(isotope);
79
80 if(fissionGenerator != fissionIsotopes.end())
81 {
82 // Only generate particles if the generator was constructed
83 if(fissionGenerator->second)
84 {
85 finalParticles = fissionGenerator->second->G4GenerateFission(projectile);
86 }
87
88 break;
89 }
90 }
91
92 if(finalParticles)
93 {
94 finalState = new G4HadFinalState();
95
96 for(unsigned int i = 0; i < finalParticles->size(); ++i)
97 {
98 finalState->AddSecondary((*finalParticles)[i], secID);
99 }
100 }
101
102 //TK modified 131108 add next line
103 //TK 160112 fix for coverity #53481
104 if ( finalState != NULL ) finalState->SetStatusChange(stopAndKill);
106 return finalState;
107}
108
110InitializeANucleus(const G4int A, const G4int Z, const G4int M, const G4String& dataDirectory)
111{
112//G4FFG_FUNCTIONENTER__
113
116 std::pair< std::map< const G4int, G4FissionFragmentGenerator* >::iterator, bool > newIsotope;
117
118 // Check to see if the isotope/isomer alread exists in the table
119 newIsotope = fissionIsotopes.insert(std::make_pair(isotope, (G4FissionFragmentGenerator*)NULL));
120
121 if(newIsotope.second || newIsotope.first->second == NULL)
122 {
123 // Get the data file
124 G4bool flag;
125 G4ParticleHPDataUsed dataFile = fileNames.GetName(A, Z, M, dataDirectory, "FF", flag);
126 G4String dataFileName = dataFile.GetName();
127
128 // Check if the file exists, and do not create a fission object if it doesn't
129 // G4cout << "*** Z = " << Z << "\tA = " << A << "\t\t\t Directory: "<< dataDirectory << " DATA FILE: " << dataFileName << G4endl;
130 std::istringstream dataStream(std::ios::in);
131 G4ParticleHPManager::GetInstance()->GetDataStream(dataFileName, dataStream);
132 if(!dataStream)
133 {
134 //G4FFG_FUNCTIONLEAVE__
135 // G4cerr << "*** Stream error" << G4endl;
136 return;
137 }
138
139 // Check the data file parameters
140 if(!flag
141 || ( Z < 2.5 && ( (G4double)abs( dataFile.GetZ() - Z ) > 0.001 || (G4double)abs( (G4int)dataFile.GetA() - A ) > 0.0001 ) ) )
142 {
143 //G4cerr << "*** Something wrong with the data request.\tFlag :" << flag << G4endl;
144 //G4FFG_FUNCTIONLEAVE__
145 return;
146 }
147
148 G4FissionFragmentGenerator* const fissionGenerator = new G4FissionFragmentGenerator();
149 newIsotope.first->second = fissionGenerator;
150
151 switch(M)
152 {
153 case 1:
154 metaState = G4FFGEnumerations::META_1;
155 break;
156
157 case 2:
158 metaState = G4FFGEnumerations::META_2;
159 break;
160
161 default:
162 // TODO Display a warning message here indicating that an invalid metastate was passed in
163 // Fall through to the ground state by default
164 case 0:
166 break;
167 }
168
169 fissionGenerator->G4SetIsotope(isotope);
170 fissionGenerator->G4SetMetaState(metaState);
172 // TODO Load all the fission data and use the projectile energy instead
176
177
178 // TODO Remove the need for forcing a load in the initialization phase,
179 // i.e. remove the ability to dynamically change the fission parameters
180 // that cause reload because a G4FissionFragmentGenerator class for
181 // each isotope should be loaded in the initialization phase
182 if(!fissionGenerator->InitializeFissionProductYieldClass(dataStream))
183 {
184 // Delete if the initialization fails
185 delete fissionGenerator;
186
187 fissionIsotopes.erase(newIsotope.first);
188 }
189 }
190
191//G4FFG_FUNCTIONLEAVE__
192}
193
196{
197 std::map< const G4int, G4FissionFragmentGenerator* >::iterator fissionGenerator;
198
199 for(fissionGenerator = fissionIsotopes.begin(); fissionGenerator != fissionIsotopes.end(); ++fissionGenerator)
200 {
201 delete fissionGenerator->second;
202 }
203}
std::vector< G4DynamicParticle * > G4DynamicParticleVector
#define G4FFG_FUNCTIONLEAVE__
#define G4FFG_FUNCTIONENTER__
@ stopAndKill
#define M(row, col)
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
const G4int Z[17]
const G4double A[17]
bool InitializeFissionProductYieldClass(std::istringstream &dataFile)
void G4SetYieldType(G4FFGEnumerations::YieldType WhichYieldType)
void G4SetMetaState(G4FFGEnumerations::MetaState WhichMetaState)
void G4SetSamplingScheme(G4FFGEnumerations::FissionSamplingScheme NewScheme)
static G4int G4MakeIsotopeCode(G4int Z, G4int A, G4int M)
void G4SetCause(G4FFGEnumerations::FissionCause WhichCause)
void G4SetIsotope(G4int WhichIsotope)
void G4SetIncidentEnergy(G4double WhatIncidentEnergy)
static G4ParticleHPManager * GetInstance()
void GetDataStream(G4String, std::istringstream &iss)
G4ParticleHPDataUsed GetName(G4int A, G4int Z, G4String base, G4String rest, G4bool &active)
static G4int GetModelID(const G4int modelIndex)
void InitializeANucleus(const G4int A, const G4int Z, const G4int M, const G4String &dataDirectory)
G4HadFinalState * ApplyYourself(const G4HadProjectile &projectile, G4int Z, G4int A)
std::map< const G4int, G4FissionFragmentGenerator * > fissionIsotopes
static G4ThreadLocal G4WendtFissionFragmentGenerator * instance
static const G4double ThermalNeutronEnergy
static const G4FFGEnumerations::Verbosity Verbosity
#define G4ThreadLocal
Definition: tls.hh:77