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
G4NeutronHPFissionBaseFS.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#include "G4ReactionProduct.hh"
33#include "G4Nucleus.hh"
34#include "G4Proton.hh"
35#include "G4Deuteron.hh"
36#include "G4Triton.hh"
37#include "G4Alpha.hh"
38#include "G4ThreeVector.hh"
39#include "G4LorentzVector.hh"
41
43 {
44 G4String tString = dirName;
45 G4bool dbool;
46 G4NeutronHPDataUsed aFile = theNames.GetName(static_cast<G4int>(A), static_cast<G4int>(Z), M, tString, bit, dbool);
47 G4String filename = aFile.GetName();
48 SetAZMs( A, Z, M, aFile );
49 //theBaseA = aFile.GetA();
50 //theBaseZ = aFile.GetZ();
51 //if(!dbool || ( Z<2.5 && ( std::abs(theBaseZ - Z)>0.0001 || std::abs(theBaseA - A)>0.0001) ) )
52 if ( !dbool || ( Z<2.5 && ( std::abs(theNDLDataZ - Z)>0.0001 || std::abs(theNDLDataA - A)>0.0001)) )
53 {
54 hasAnyData = false;
55 hasFSData = false;
56 hasXsec = false;
57 return; // no data for exactly this isotope.
58 }
59
60 std::ifstream theData(filename, std::ios::in);
61 G4int dummy;
62 if(!(theData))
63 {
64 theData.close();
65 hasFSData = false;
66 hasXsec = false;
67 hasAnyData = false;
68 return; // no data for this FS for this isotope
69 }
70 theData >> dummy>>dummy;
71 G4int total;
72 theData >> total;
73 theXsection->Init(theData, total, eV);
74 if (!(theData >> dummy))
75 {
76 hasFSData = false;
77 theData.close();
78 return;
79 }
80 theData >> dummy;
81
82 theAngularDistribution.Init(theData);
83
84 theData >> dummy >> dummy;
85
86 theEnergyDistribution.Init(theData);
87 theData.close();
88
89 }
90
92 {
93// if therere were no data for this isotope, break out.
94 if(!HasFSData()) { return 0; }
95
96 G4int i;
98 G4ReactionProduct boosted;
99 boosted.Lorentz(theNeutron, theTarget);
100 G4double eKinetic = boosted.GetKineticEnergy();
101
102// Build neutrons
103 G4ReactionProduct * theNeutrons = new G4ReactionProduct[nPrompt];
104 for(i=0; i<nPrompt; i++)
105 {
106 theNeutrons[i].SetDefinition(G4Neutron::Neutron());
107 }
108
109// sample energies
110 G4int dummy;
111 for(i=0; i<nPrompt; i++)
112 {
113 // always in the lab system (if file-5)
114 theNeutrons[i].SetKineticEnergy(theEnergyDistribution.Sample(eKinetic, dummy));
115 }
116
117// sample neutron angular distribution
118 for(i=0; i<nPrompt; i++)
119 {
120 theAngularDistribution.SampleAndUpdate(theNeutrons[i]);
121 }
122
123// already in lab. Add neutrons to dynamic particle vector
124 for(i=0; i<nPrompt; i++)
125 {
127 it->SetDefinition(theNeutrons[i].GetDefinition());
128 it->SetMomentum(theNeutrons[i].GetMomentum());
129 aResult->push_back(it);
130 }
131 delete [] theNeutrons;
132
133// return the result
134 return aResult;
135 }
std::vector< G4DynamicParticle * > G4DynamicParticleVector
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
bool G4bool
Definition: G4Types.hh:67
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
void SetMomentum(const G4ThreeVector &momentum)
void Init(std::ifstream &aDataFile)
void SampleAndUpdate(G4ReactionProduct &aNeutron)
G4double Sample(G4double anEnergy, G4int &it)
void SetAZMs(G4double anA, G4double aZ, G4int aM, G4NeutronHPDataUsed used)
void Init(G4double A, G4double Z, G4int M, G4String &dirName, G4String &bit)
G4DynamicParticleVector * ApplyYourself(G4int Prompt)
G4NeutronHPDataUsed GetName(G4int A, G4int Z, G4String base, G4String rest, G4bool &active)
void Init(std::ifstream &aDataFile, G4int total, G4double ux=1., G4double uy=1.)
static G4Neutron * Neutron()
Definition: G4Neutron.cc:104
G4double GetKineticEnergy() const
void Lorentz(const G4ReactionProduct &p1, const G4ReactionProduct &p2)
void SetKineticEnergy(const G4double en)
void SetDefinition(G4ParticleDefinition *aParticleDefinition)