Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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"
41 #include "G4PhysicalConstants.hh"
42 #include "G4SystemOfUnits.hh"
43 #include "G4NistManager.hh"
44 
46 :G4HadronicInteraction( name )
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 
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 }