Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4LENDModel.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// Class Description
27// Final state production model for a LEND (Low Energy Nuclear Data)
28// LEND is Geant4 interface for GIDI (General Interaction Data Interface)
29// which gives a discription of nuclear and atomic reactions, such as
30// Binary collision cross sections
31// Particle number multiplicity distributions of reaction products
32// Energy and angular distributions of reaction products
33// Derived calculational constants
34// GIDI is developped at Lawrence Livermore National Laboratory
35// Class Description - End
36
37// 071025 First implementation done by T. Koi (SLAC/SCCS)
38// 101118 Name modifications for release T. Koi (SLAC/PPA)
39
40#include "G4LENDModel.hh"
42#include "G4SystemOfUnits.hh"
43#include "G4NistManager.hh"
44
47{
48
49 SetMinEnergy( 0.*eV );
50 SetMaxEnergy( 20.*MeV );
51
52 default_evaluation = "endl99";
53 allow_nat = false;
54 allow_any = false;
55
57
58}
59
61{
62 for ( std::map< G4int , G4LENDUsedTarget* >::iterator
63 it = usedTarget_map.begin() ; it != usedTarget_map.end() ; it ++ )
64 {
65 delete it->second;
66 }
67}
68
69
71{
72
73 for ( std::map< G4int , G4LENDUsedTarget* >::iterator
74 it = usedTarget_map.begin() ; it != usedTarget_map.end() ; it ++ )
75 {
76 delete it->second;
77 }
78 usedTarget_map.clear();
79
81
82}
83
84
85
87{
88
90
91 size_t numberOfElements = G4Element::GetNumberOfElements();
92 static const G4ElementTable* theElementTable = G4Element::GetElementTable();
93
94 for ( size_t i = 0 ; i < numberOfElements ; ++i )
95 {
96
97 const G4Element* anElement = (*theElementTable)[i];
98 G4int numberOfIsotope = anElement->GetNumberOfIsotopes();
99
100 if ( numberOfIsotope > 0 )
101 {
102 // User Defined Abundances
103 for ( G4int i_iso = 0 ; i_iso < numberOfIsotope ; i_iso++ )
104 {
105 G4int iZ = anElement->GetIsotope( i_iso )->GetZ();
106 G4int iA = anElement->GetIsotope( i_iso )->GetN();
107
108 G4LENDUsedTarget* aTarget = new G4LENDUsedTarget ( proj , default_evaluation , iZ , iA );
109 if ( allow_nat == true ) aTarget->AllowNat();
110 if ( allow_any == true ) aTarget->AllowAny();
111 usedTarget_map.insert( std::pair< G4int , G4LENDUsedTarget* > ( lend_manager->GetNucleusEncoding( iZ , iA ) , aTarget ) );
112 }
113 }
114 else
115 {
116 // Natural Abundances
118 G4int iZ = int ( anElement->GetZ() );
119 //G4cout << nistElementBuild->GetNumberOfNistIsotopes( int ( anElement->GetZ() ) ) << G4endl;
120 G4int numberOfNistIso = nistElementBuild->GetNumberOfNistIsotopes( int ( anElement->GetZ() ) );
121
122 for ( G4int ii = 0 ; ii < numberOfNistIso ; ii++ )
123 {
124 //G4cout << nistElementBuild->GetIsotopeAbundance( iZ , nistElementBuild->GetNistFirstIsotopeN( iZ ) + i ) << G4endl;
125 if ( nistElementBuild->GetIsotopeAbundance( iZ , nistElementBuild->GetNistFirstIsotopeN( iZ ) + ii ) > 0 )
126 {
127 G4int iMass = nistElementBuild->GetNistFirstIsotopeN( iZ ) + ii;
128 //G4cout << iZ << " " << nistElementBuild->GetNistFirstIsotopeN( iZ ) + i << " " << nistElementBuild->GetIsotopeAbundance ( iZ , iMass ) << G4endl;
129
130 G4LENDUsedTarget* aTarget = new G4LENDUsedTarget ( proj , default_evaluation , iZ , iMass );
131 if ( allow_nat == true ) aTarget->AllowNat();
132 if ( allow_any == true ) aTarget->AllowAny();
133 usedTarget_map.insert( std::pair< G4int , G4LENDUsedTarget* > ( lend_manager->GetNucleusEncoding( iZ , iMass ) , aTarget ) );
134
135 }
136
137 }
138
139 }
140 }
141
142
143
144 G4cout << "Dump UsedTarget for " << GetModelName() << G4endl;
145 G4cout << "Requested Evaluation, Z , A -> Actual Evaluation, Z , A(0=Nat) , Pointer of Target" << G4endl;
146 for ( std::map< G4int , G4LENDUsedTarget* >::iterator
147 it = usedTarget_map.begin() ; it != usedTarget_map.end() ; it ++ )
148 {
149 G4cout
150 << " " << it->second->GetWantedEvaluation()
151 << ", " << it->second->GetWantedZ()
152 << ", " << it->second->GetWantedA()
153 << " -> " << it->second->GetActualEvaluation()
154 << ", " << it->second->GetActualZ()
155 << ", " << it->second->GetActualA()
156 << ", " << it->second->GetTarget()
157 << G4endl;
158 }
159
160}
161
162
163
164#include "G4ParticleTable.hh"
165
167{
168
169 G4double temp = aTrack.GetMaterial()->GetTemperature();
170
171 //G4int iZ = int ( aTarg.GetZ() );
172 //G4int iA = int ( aTarg.GetN() );
173 //migrate to integer A and Z (GetN_asInt returns number of neutrons in the nucleus since this)
174 G4int iZ = aTarg.GetZ_asInt();
175 G4int iA = aTarg.GetA_asInt();
176
177 G4double ke = aTrack.GetKineticEnergy();
178
179 G4HadFinalState* theResult = new G4HadFinalState();
180
181 G4GIDI_target* aTarget = usedTarget_map.find( lend_manager->GetNucleusEncoding( iZ , iA ) )->second->GetTarget();
182
183 G4double aMu = aTarget->getElasticFinalState( ke*MeV, temp, NULL, NULL );
184
185 G4double phi = twopi*G4UniformRand();
186 G4double theta = std::acos( aMu );
187 //G4double sinth = std::sin( theta );
188
189 G4ReactionProduct theNeutron( const_cast<G4ParticleDefinition *>( aTrack.GetDefinition() ) );
190 theNeutron.SetMomentum( aTrack.Get4Momentum().vect() );
191 theNeutron.SetKineticEnergy( ke );
192
193 G4ReactionProduct theTarget( G4ParticleTable::GetParticleTable()->FindIon( iZ , iA , 0 , iZ ) );
194
195 G4double mass = G4ParticleTable::GetParticleTable()->FindIon( iZ , iA , 0 , iZ )->GetPDGMass();
196
197// add Thermal motion
198 G4double kT = k_Boltzmann*temp;
199 G4ThreeVector v ( G4RandGauss::shoot() * std::sqrt( kT*mass )
200 , G4RandGauss::shoot() * std::sqrt( kT*mass )
201 , G4RandGauss::shoot() * std::sqrt( kT*mass ) );
202
203 theTarget.SetMomentum( v );
204
205
206 G4ThreeVector the3Neutron = theNeutron.GetMomentum();
207 G4double nEnergy = theNeutron.GetTotalEnergy();
208 G4ThreeVector the3Target = theTarget.GetMomentum();
209 G4double tEnergy = theTarget.GetTotalEnergy();
210 G4ReactionProduct theCMS;
211 G4double totE = nEnergy+tEnergy;
212 G4ThreeVector the3CMS = the3Target+the3Neutron;
213 theCMS.SetMomentum(the3CMS);
214 G4double cmsMom = std::sqrt(the3CMS*the3CMS);
215 G4double sqrts = std::sqrt((totE-cmsMom)*(totE+cmsMom));
216 theCMS.SetMass(sqrts);
217 theCMS.SetTotalEnergy(totE);
218
219 theNeutron.Lorentz(theNeutron, theCMS);
220 theTarget.Lorentz(theTarget, theCMS);
221 G4double en = theNeutron.GetTotalMomentum(); // already in CMS.
222 G4ThreeVector cms3Mom=theNeutron.GetMomentum(); // for neutron direction in CMS
223 G4double cms_theta=cms3Mom.theta();
224 G4double cms_phi=cms3Mom.phi();
225 G4ThreeVector tempVector;
226 tempVector.setX(std::cos(theta)*std::sin(cms_theta)*std::cos(cms_phi)
227 +std::sin(theta)*std::cos(phi)*std::cos(cms_theta)*std::cos(cms_phi)
228 -std::sin(theta)*std::sin(phi)*std::sin(cms_phi) );
229 tempVector.setY(std::cos(theta)*std::sin(cms_theta)*std::sin(cms_phi)
230 +std::sin(theta)*std::cos(phi)*std::cos(cms_theta)*std::sin(cms_phi)
231 +std::sin(theta)*std::sin(phi)*std::cos(cms_phi) );
232 tempVector.setZ(std::cos(theta)*std::cos(cms_theta)
233 -std::sin(theta)*std::cos(phi)*std::sin(cms_theta) );
234 tempVector *= en;
235 theNeutron.SetMomentum(tempVector);
236 theTarget.SetMomentum(-tempVector);
237 G4double tP = theTarget.GetTotalMomentum();
238 G4double tM = theTarget.GetMass();
239 theTarget.SetTotalEnergy(std::sqrt((tP+tM)*(tP+tM)-2.*tP*tM));
240 theNeutron.Lorentz(theNeutron, -1.*theCMS);
241 theTarget.Lorentz(theTarget, -1.*theCMS);
242
243 theResult->SetEnergyChange(theNeutron.GetKineticEnergy());
244 theResult->SetMomentumChange(theNeutron.GetMomentum().unit());
245 G4DynamicParticle* theRecoil = new G4DynamicParticle;
246
247 theRecoil->SetDefinition( G4ParticleTable::GetParticleTable()->FindIon( iZ, iA , 0, iZ ) );
248 theRecoil->SetMomentum( theTarget.GetMomentum() );
249
250 theResult->AddSecondary( theRecoil );
251
252 return theResult;
253
254}
std::vector< G4Element * > G4ElementTable
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
#define G4UniformRand()
Definition: Randomize.hh:53
Hep3Vector unit() const
double phi() const
double theta() const
void setY(double)
void setZ(double)
void setX(double)
Hep3Vector vect() const
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
void SetMomentum(const G4ThreeVector &momentum)
G4double GetZ() const
Definition: G4Element.hh:131
static size_t GetNumberOfElements()
Definition: G4Element.cc:406
const G4Isotope * GetIsotope(G4int iso) const
Definition: G4Element.hh:169
size_t GetNumberOfIsotopes() const
Definition: G4Element.hh:158
static const G4ElementTable * GetElementTable()
Definition: G4Element.cc:399
double getElasticFinalState(double e_in, double temperature, double(*rng)(void *), void *rngState)
void AddSecondary(G4DynamicParticle *aP)
void SetEnergyChange(G4double anEnergy)
void SetMomentumChange(const G4ThreeVector &aV)
const G4Material * GetMaterial() const
const G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
const G4LorentzVector & Get4Momentum() const
void SetMinEnergy(G4double anEnergy)
const G4String & GetModelName() const
void SetMaxEnergy(const G4double anEnergy)
G4int GetZ() const
Definition: G4Isotope.hh:91
G4int GetN() const
Definition: G4Isotope.hh:94
G4int GetNucleusEncoding(G4int iZ, G4int iA)
G4bool RequestChangeOfVerboseLevel(G4int)
G4NistElementBuilder * GetNistElementBuilder()
static G4LENDManager * GetInstance()
std::map< G4int, G4LENDUsedTarget * > usedTarget_map
Definition: G4LENDModel.hh:79
virtual G4HadFinalState * ApplyYourself(const G4HadProjectile &aTrack, G4Nucleus &aTargetNucleus)
Definition: G4LENDModel.cc:166
G4LENDManager * lend_manager
Definition: G4LENDModel.hh:78
G4LENDModel(G4String name="LENDModel")
Definition: G4LENDModel.cc:45
void recreate_used_target_map()
Definition: G4LENDModel.cc:70
void create_used_target_map()
Definition: G4LENDModel.cc:86
G4ParticleDefinition * proj
Definition: G4LENDModel.hh:77
G4double GetTemperature() const
Definition: G4Material.hh:181
G4int GetNumberOfNistIsotopes(G4int Z)
G4double GetIsotopeAbundance(G4int Z, G4int N)
G4int GetNistFirstIsotopeN(G4int Z)
G4int GetA_asInt() const
Definition: G4Nucleus.hh:109
G4int GetZ_asInt() const
Definition: G4Nucleus.hh:115
G4ParticleDefinition * FindIon(G4int atomicNumber, G4int atomicMass, G4double excitationEnergy)
static G4ParticleTable * GetParticleTable()
void SetMomentum(const G4double x, const G4double y, const G4double z)
void SetTotalEnergy(const G4double en)
G4double GetTotalMomentum() const
G4double GetKineticEnergy() const
G4double GetTotalEnergy() const
G4ThreeVector GetMomentum() const
void Lorentz(const G4ReactionProduct &p1, const G4ReactionProduct &p2)
void SetKineticEnergy(const G4double en)
G4double GetMass() const
void SetMass(const G4double mas)