Geant4 11.4.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"
45
46double MyRNG(void*) { return G4Random::getTheEngine()->flat(); }
47
49 :G4HadronicInteraction( name ), secID(-1)
50{
51
52 proj = NULL; //will be set in an inherited class
53
54 SetMinEnergy( 0.*eV );
55 SetMaxEnergy( 20.*MeV );
56
57 //default_evaluation = "endl99";
58 //default_evaluation = "ENDF.B-VII.0";
59 //default_evaluation = "ENDF/BVII.1";
60 //default_evaluation = "ENDF/B-8.0";
61 //default_evaluation = "ENDF/B-7.1";
62 default_evaluation = "";
63
64 allow_nat = false;
65 allow_any = false;
66
68
70}
71
73{
74 for ( std::map< G4int , G4LENDUsedTarget* >::iterator
75 it = usedTarget_map.begin() ; it != usedTarget_map.end() ; it ++ )
76 {
77 delete it->second;
78 }
79}
80
81
83{
84
85 for ( std::map< G4int , G4LENDUsedTarget* >::iterator
86 it = usedTarget_map.begin() ; it != usedTarget_map.end() ; it ++ )
87 {
88 delete it->second;
89 }
90 usedTarget_map.clear();
91
93
94}
95
96
97
99{
100
101 lend_manager->RequestChangeOfVerboseLevel( verboseLevel );
102
103 std::size_t numberOfElements = G4Element::GetNumberOfElements();
104 static const G4ElementTable* theElementTable = G4Element::GetElementTable();
105
106 for ( std::size_t i = 0 ; i < numberOfElements ; ++i )
107 {
108
109 const G4Element* anElement = (*theElementTable)[i];
110 G4int numberOfIsotope = (G4int)anElement->GetNumberOfIsotopes();
111
112 if ( numberOfIsotope > 0 )
113 {
114 // User Defined Abundances
115 for ( G4int i_iso = 0 ; i_iso < numberOfIsotope ; ++i_iso )
116 {
117 G4int iZ = anElement->GetIsotope( i_iso )->GetZ();
118 G4int iA = anElement->GetIsotope( i_iso )->GetN();
119 G4int iIsomer = anElement->GetIsotope( i_iso )->Getm();
120
121 G4LENDUsedTarget* aTarget = new G4LENDUsedTarget ( proj , default_evaluation , iZ , iA , iIsomer );
122 if ( allow_nat == true ) aTarget->AllowNat();
123 if ( allow_any == true ) aTarget->AllowAny();
124 usedTarget_map.insert( std::pair< G4int , G4LENDUsedTarget* > ( lend_manager->GetNucleusEncoding( iZ , iA , iIsomer ) , aTarget ) );
125 }
126 }
127 else
128 {
129 // Natural Abundances
130 G4NistElementBuilder* nistElementBuild = lend_manager->GetNistElementBuilder();
131 G4int iZ = int ( anElement->GetZ() );
132 //G4cout << nistElementBuild->GetNumberOfNistIsotopes( int ( anElement->GetZ() ) ) << G4endl;
133 G4int numberOfNistIso = nistElementBuild->GetNumberOfNistIsotopes( int ( anElement->GetZ() ) );
134
135 for ( G4int ii = 0 ; ii < numberOfNistIso ; ii++ )
136 {
137 //G4cout << nistElementBuild->GetIsotopeAbundance( iZ , nistElementBuild->GetNistFirstIsotopeN( iZ ) + i ) << G4endl;
138 if ( nistElementBuild->GetIsotopeAbundance( iZ , nistElementBuild->GetNistFirstIsotopeN( iZ ) + ii ) > 0 )
139 {
140 G4int iMass = nistElementBuild->GetNistFirstIsotopeN( iZ ) + ii;
141 //G4cout << iZ << " " << nistElementBuild->GetNistFirstIsotopeN( iZ ) + i << " " << nistElementBuild->GetIsotopeAbundance ( iZ , iMass ) << G4endl;
142 G4int iIsomer = 0;
143
144 G4LENDUsedTarget* aTarget = new G4LENDUsedTarget ( proj , default_evaluation , iZ , iMass );
145 if ( allow_nat == true ) aTarget->AllowNat();
146 if ( allow_any == true ) aTarget->AllowAny();
147 usedTarget_map.insert( std::pair< G4int , G4LENDUsedTarget* > ( lend_manager->GetNucleusEncoding( iZ , iMass , iIsomer ) , aTarget ) );
148
149 }
150
151 }
152
153 }
154 }
155
157}
158
159
160
161#include "G4IonTable.hh"
162
164{
165
166 G4double temp = aTrack.GetMaterial()->GetTemperature();
167
168 //G4int iZ = int ( aTarg.GetZ() );
169 //G4int iA = int ( aTarg.GetN() );
170 //migrate to integer A and Z (GetN_asInt returns number of neutrons in the nucleus since this)
171 G4int iZ = aTarg.GetZ_asInt();
172 G4int iA = aTarg.GetA_asInt();
173 G4int iM = 0;
174 if ( aTarg.GetIsotope() != NULL ) {
175 iM = aTarg.GetIsotope()->Getm();
176 }
177
178 G4double ke = aTrack.GetKineticEnergy();
179
180 G4HadFinalState* theResult = new G4HadFinalState();
181
182 G4GIDI_target* aTarget = usedTarget_map.find( lend_manager->GetNucleusEncoding( iZ , iA , iM ) )->second->GetTarget();
183
184 G4double aMu = aTarget->getElasticFinalState( ke*MeV, temp, NULL, NULL );
185
186 G4double phi = twopi*G4UniformRand();
187 G4double theta = std::acos( aMu );
188 //G4double sinth = std::sin( theta );
189
190 G4ReactionProduct theNeutron( aTrack.GetDefinition() );
191 theNeutron.SetMomentum( aTrack.Get4Momentum().vect() );
192 theNeutron.SetKineticEnergy( ke );
193
194 G4ParticleDefinition* pd = G4IonTable::GetIonTable()->GetIon( iZ , iA , iM );
195 G4ReactionProduct theTarget( pd );
196
197 G4double mass = pd->GetPDGMass();
198
199// add Thermal motion
200 G4double kT = k_Boltzmann*temp;
201 G4ThreeVector v ( G4RandGauss::shoot() * std::sqrt( kT*mass )
202 , G4RandGauss::shoot() * std::sqrt( kT*mass )
203 , G4RandGauss::shoot() * std::sqrt( kT*mass ) );
204
205 theTarget.SetMomentum( v );
206
207
208 G4ThreeVector the3Neutron = theNeutron.GetMomentum();
209 G4double nEnergy = theNeutron.GetTotalEnergy();
210 G4ThreeVector the3Target = theTarget.GetMomentum();
211 G4double tEnergy = theTarget.GetTotalEnergy();
212 G4ReactionProduct theCMS;
213 G4double totE = nEnergy+tEnergy;
214 G4ThreeVector the3CMS = the3Target+the3Neutron;
215 theCMS.SetMomentum(the3CMS);
216 G4double cmsMom = std::sqrt(the3CMS*the3CMS);
217 G4double sqrts = std::sqrt((totE-cmsMom)*(totE+cmsMom));
218 theCMS.SetMass(sqrts);
219 theCMS.SetTotalEnergy(totE);
220
221 theNeutron.Lorentz(theNeutron, theCMS);
222 theTarget.Lorentz(theTarget, theCMS);
223 G4double en = theNeutron.GetTotalMomentum(); // already in CMS.
224 G4ThreeVector cms3Mom=theNeutron.GetMomentum(); // for neutron direction in CMS
225 G4double cms_theta=cms3Mom.theta();
226 G4double cms_phi=cms3Mom.phi();
227 G4ThreeVector tempVector;
228 tempVector.setX(std::cos(theta)*std::sin(cms_theta)*std::cos(cms_phi)
229 +std::sin(theta)*std::cos(phi)*std::cos(cms_theta)*std::cos(cms_phi)
230 -std::sin(theta)*std::sin(phi)*std::sin(cms_phi) );
231 tempVector.setY(std::cos(theta)*std::sin(cms_theta)*std::sin(cms_phi)
232 +std::sin(theta)*std::cos(phi)*std::cos(cms_theta)*std::sin(cms_phi)
233 +std::sin(theta)*std::sin(phi)*std::cos(cms_phi) );
234 tempVector.setZ(std::cos(theta)*std::cos(cms_theta)
235 -std::sin(theta)*std::cos(phi)*std::sin(cms_theta) );
236 tempVector *= en;
237 theNeutron.SetMomentum(tempVector);
238 theTarget.SetMomentum(-tempVector);
239 G4double tP = theTarget.GetTotalMomentum();
240 G4double tM = theTarget.GetMass();
241 theTarget.SetTotalEnergy(std::sqrt((tP+tM)*(tP+tM)-2.*tP*tM));
242 theNeutron.Lorentz(theNeutron, -1.*theCMS);
243 theTarget.Lorentz(theTarget, -1.*theCMS);
244
245 theResult->SetEnergyChange(theNeutron.GetKineticEnergy());
246 theResult->SetMomentumChange(theNeutron.GetMomentum().unit());
247 G4DynamicParticle* theRecoil = new G4DynamicParticle;
248
249 theRecoil->SetDefinition( G4IonTable::GetIonTable()->GetIon( iZ , iA , iM , iZ ) );
250 theRecoil->SetMomentum( theTarget.GetMomentum() );
251
252 theResult->AddSecondary( theRecoil );
253
254 return theResult;
255
256}
257
259 if ( lend_manager->GetVerboseLevel() >= 1 ) {
260 G4String message;
261 message = "Produce unchanged final state is requested in ";
262 message += this->GetModelName();
263 message += ". Cross section and model likely have an inconsistency.";
264 G4Exception( "G4LENDModel::returnUnchanged(,)" , "LENDModel-01" , JustWarning ,
265 message );
266 }
267 theResult->SetEnergyChange( aTrack.GetKineticEnergy() );
268 theResult->SetMomentumChange( aTrack.Get4Momentum().getV().unit() );
269 return theResult;
270}
271
273 G4GIDI_target* target = NULL;
274 if ( usedTarget_map.find( nuclear_code ) != usedTarget_map.end() ) {
275 target = usedTarget_map.find( nuclear_code )->second->GetTarget();
276 }
277 return target;
278}
279
281
282 if ( lend_manager->GetVerboseLevel() >= 1 || force ) {
283 if ( usedTarget_map.size() == 0 ) create_used_target_map();
284 G4cout << "Dumping UsedTarget of " << GetModelName() << " for " << proj->GetParticleName() << G4endl;
285 G4cout << "Requested Evaluation, Z , A -> Actual Evaluation, Z , A(0=Nat) " << G4endl;
286 for ( std::map< G4int , G4LENDUsedTarget* >::iterator
287 it = usedTarget_map.begin() ; it != usedTarget_map.end() ; it ++ ) {
288 G4cout
289 << " " << it->second->GetWantedEvaluation()
290 << ", " << it->second->GetWantedZ()
291 << ", " << it->second->GetWantedA()
292 << " -> " << it->second->GetActualEvaluation()
293 << ", " << it->second->GetActualZ()
294 << ", " << it->second->GetActualA()
295 << G4endl;
296 }
297 }
298}
std::vector< G4Element * > G4ElementTable
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
double MyRNG(void *)
CLHEP::Hep3Vector G4ThreeVector
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
#define G4UniformRand()
Definition Randomize.hh:52
Hep3Vector unit() const
double phi() const
double theta() const
void setY(double)
void setZ(double)
void setX(double)
Hep3Vector getV() const
Hep3Vector vect() const
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
void SetMomentum(const G4ThreeVector &momentum)
G4double GetZ() const
Definition G4Element.hh:119
static std::size_t GetNumberOfElements()
Definition G4Element.cc:408
std::size_t GetNumberOfIsotopes() const
Definition G4Element.hh:143
const G4Isotope * GetIsotope(G4int iso) const
Definition G4Element.hh:151
static const G4ElementTable * GetElementTable()
Definition G4Element.cc:401
double getElasticFinalState(double a_energy, double a_temperature, double(*a_rng)(void *), void *a_rngState) const
void AddSecondary(G4DynamicParticle *aP, G4int mod=-1)
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)
G4HadronicInteraction(const G4String &modelName="HadronicModel")
const G4String & GetModelName() const
void SetMaxEnergy(const G4double anEnergy)
G4ParticleDefinition * GetIon(G4int Z, G4int A, G4int lvl=0)
static G4IonTable * GetIonTable()
G4int GetZ() const
Definition G4Isotope.hh:80
G4int Getm() const
Definition G4Isotope.hh:89
G4int GetN() const
Definition G4Isotope.hh:83
static G4LENDManager * GetInstance()
std::map< G4int, G4LENDUsedTarget * > usedTarget_map
virtual G4HadFinalState * ApplyYourself(const G4HadProjectile &aTrack, G4Nucleus &aTargetNucleus)
G4LENDManager * lend_manager
void DumpLENDTargetInfo(G4bool force=false)
G4LENDModel(G4String name="LENDModel")
void recreate_used_target_map()
void create_used_target_map()
G4HadFinalState * returnUnchanged(const G4HadProjectile &aTrack, G4HadFinalState *theResult)
G4ParticleDefinition * proj
G4GIDI_target * get_target_from_map(G4int nuclear_code)
G4double GetTemperature() const
G4int GetNumberOfNistIsotopes(G4int Z) const
G4double GetIsotopeAbundance(G4int Z, G4int N) const
G4int GetNistFirstIsotopeN(G4int Z) const
G4int GetA_asInt() const
Definition G4Nucleus.hh:78
G4int GetZ_asInt() const
Definition G4Nucleus.hh:84
const G4Isotope * GetIsotope()
Definition G4Nucleus.hh:90
static G4int GetModelID(const G4int modelIndex)
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)