Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4NeutronHPCaptureFS.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 //
30 // 12-April-06 Enable IC electron emissions T. Koi
31 // 26-January-07 Add G4NEUTRONHP_USE_ONLY_PHOTONEVAPORATION flag
32 // 081024 G4NucleiPropertiesTable:: to G4NucleiProperties::
33 // 101203 Bugzilla/Geant4 Problem 1155 Lack of residual in some case
34 // 110430 Temporary solution in the case of being MF6 final state in Capture reaction (MT102)
35 //
36 #include "G4NeutronHPCaptureFS.hh"
37 #include "G4NeutronHPManager.hh"
38 #include "G4PhysicalConstants.hh"
39 #include "G4SystemOfUnits.hh"
40 #include "G4Gamma.hh"
41 #include "G4ReactionProduct.hh"
42 #include "G4Nucleus.hh"
43 #include "G4PhotonEvaporation.hh"
44 #include "G4Fragment.hh"
45 #include "G4IonTable.hh"
46 #include "G4NeutronHPDataUsed.hh"
47 
49  {
50 
51  G4int i;
52  theResult.Clear();
53 // prepare neutron
54  G4double eKinetic = theTrack.GetKineticEnergy();
55  const G4HadProjectile *incidentParticle = &theTrack;
56  G4ReactionProduct theNeutron( const_cast<G4ParticleDefinition *>(incidentParticle->GetDefinition()) );
57  theNeutron.SetMomentum( incidentParticle->Get4Momentum().vect() );
58  theNeutron.SetKineticEnergy( eKinetic );
59 
60 // prepare target
62  G4Nucleus aNucleus;
63  G4double eps = 0.0001;
64  if(targetMass<500*MeV)
65  targetMass = ( G4NucleiProperties::GetNuclearMass( static_cast<G4int>(theBaseA+eps) , static_cast<G4int>(theBaseZ+eps) )) /
67  G4ThreeVector neutronVelocity = 1./G4Neutron::Neutron()->GetPDGMass()*theNeutron.GetMomentum();
68  G4double temperature = theTrack.GetMaterial()->GetTemperature();
69  theTarget = aNucleus.GetBiasedThermalNucleus(targetMass, neutronVelocity, temperature);
70 
71 // go to nucleus rest system
72  theNeutron.Lorentz(theNeutron, -1*theTarget);
73  eKinetic = theNeutron.GetKineticEnergy();
74 
75 // dice the photons
76 
77  G4ReactionProductVector * thePhotons = 0;
78  if ( HasFSData() && !getenv ( "G4NEUTRONHP_USE_ONLY_PHOTONEVAPORATION" ) )
79  {
80  //TK110430
81  if ( hasExactMF6 )
82  {
83  theMF6FinalState.SetTarget(theTarget);
84  theMF6FinalState.SetNeutron(theNeutron);
85  thePhotons = theMF6FinalState.Sample( eKinetic );
86  }
87  else
88  thePhotons = theFinalStatePhotons.GetPhotons(eKinetic);
89  }
90  else
91  {
92  G4ThreeVector aCMSMomentum = theNeutron.GetMomentum()+theTarget.GetMomentum();
93  G4LorentzVector p4(aCMSMomentum, theTarget.GetTotalEnergy() + theNeutron.GetTotalEnergy());
94  G4Fragment nucleus(static_cast<G4int>(theBaseA+1), static_cast<G4int>(theBaseZ) ,p4);
95  G4PhotonEvaporation photonEvaporation;
96  // T. K. add
97  photonEvaporation.SetICM( TRUE );
98  G4FragmentVector* products = photonEvaporation.BreakItUp(nucleus);
99  G4FragmentVector::iterator it;
100  thePhotons = new G4ReactionProductVector;
101  for(it=products->begin(); it!=products->end(); it++)
102  {
103  G4ReactionProduct * theOne = new G4ReactionProduct;
104  // T. K. add
105  if ( (*it)->GetParticleDefinition() != 0 )
106  theOne->SetDefinition( (*it)->GetParticleDefinition() );
107  else
108  theOne->SetDefinition( G4Gamma::Gamma() ); // this definiion will be over writen
109 
110  // T. K. comment out below line
111  //theOne->SetDefinition( G4Gamma::Gamma() );
112  G4IonTable* theTable = G4IonTable::GetIonTable();
113  //if( (*it)->GetMomentum().mag() > 10*MeV ) theOne->SetDefinition( theTable->FindIon(static_cast<G4int>(theBaseZ), static_cast<G4int>(theBaseA+1), 0, static_cast<G4int>(theBaseZ)) );
114  if( (*it)->GetMomentum().mag() > 10*MeV ) theOne->SetDefinition( theTable->GetIon(static_cast<G4int>(theBaseZ), static_cast<G4int>(theBaseA+1), 0 ) );
115 
116  //if ( (*i)->GetExcitationEnergy() > 0 )
117  if ( (*it)->GetExcitationEnergy() > 1.0e-2*eV )
118  {
119  G4double ex = (*it)->GetExcitationEnergy();
120  G4ReactionProduct* aPhoton = new G4ReactionProduct;
121  aPhoton->SetDefinition( G4Gamma::Gamma() );
122  aPhoton->SetMomentum( (*it)->GetMomentum().vect().unit() * ex );
123  //aPhoton->SetTotalEnergy( ex ); //will be calculated from momentum
124  thePhotons->push_back(aPhoton);
125  }
126 
127  theOne->SetMomentum( (*it)->GetMomentum().vect() * ( (*it)->GetMomentum().t() - (*it)->GetExcitationEnergy() ) / (*it)->GetMomentum().t() ) ;
128  //theOne->SetTotalEnergy( (*i)->GetMomentum().t() - (*i)->GetExcitationEnergy() ); //will be calculated from momentum
129  thePhotons->push_back(theOne);
130  delete *it;
131  }
132  delete products;
133  }
134 
135 // add them to the final state
136 
137  G4int nPhotons = 0;
138  if(thePhotons!=0) nPhotons=thePhotons->size();
139 
140 ///*
141  if ( DoNotAdjustFinalState() ) {
142 //Make at least one photon
143 //101203 TK
144  if ( nPhotons == 0 )
145  {
146  G4ReactionProduct * theOne = new G4ReactionProduct;
147  theOne->SetDefinition( G4Gamma::Gamma() );
148  G4double theta = pi*G4UniformRand();
149  G4double phi = twopi*G4UniformRand();
150  G4double sinth = std::sin(theta);
151  G4ThreeVector direction( sinth*std::cos(phi), sinth*std::sin(phi), std::cos(theta) );
152  theOne->SetMomentum( direction ) ;
153  thePhotons->push_back(theOne);
154  nPhotons++; // 0 -> 1
155  }
156 //One photon case: energy set to Q-value
157 //101203 TK
158  //if ( nPhotons == 1 )
159  if ( nPhotons == 1 && thePhotons->operator[](0)->GetDefinition()->GetBaryonNumber() == 0 )
160  {
161  G4ThreeVector direction = thePhotons->operator[](0)->GetMomentum().unit();
162 
163  //G4double Q = G4ParticleTable::GetParticleTable()->FindIon(static_cast<G4int>(theBaseZ), static_cast<G4int>(theBaseA), 0, static_cast<G4int>(theBaseZ))->GetPDGMass() + G4Neutron::Neutron()->GetPDGMass()
164  // - G4ParticleTable::GetParticleTable()->FindIon(static_cast<G4int>(theBaseZ), static_cast<G4int>(theBaseA+1), 0, static_cast<G4int>(theBaseZ))->GetPDGMass();
165  G4double Q = G4IonTable::GetIonTable()->GetIonMass(static_cast<G4int>(theBaseZ), static_cast<G4int>(theBaseA), 0) + G4Neutron::Neutron()->GetPDGMass()
166  - G4IonTable::GetIonTable()->GetIonMass(static_cast<G4int>(theBaseZ), static_cast<G4int>(theBaseA+1), 0);
167 
168  thePhotons->operator[](0)->SetMomentum( Q*direction );
169  }
170 //
171  }
172 
173  // back to lab system
174  for(i=0; i<nPhotons; i++)
175  {
176  thePhotons->operator[](i)->Lorentz(*(thePhotons->operator[](i)), theTarget);
177  }
178 
179  // Recoil, if only one gamma
180  //if (1==nPhotons)
181  if ( nPhotons == 1 && thePhotons->operator[](0)->GetDefinition()->GetBaryonNumber() == 0 )
182  {
183  G4DynamicParticle * theOne = new G4DynamicParticle;
184  //G4ParticleDefinition * aRecoil = G4ParticleTable::GetParticleTable()
185  // ->FindIon(static_cast<G4int>(theBaseZ), static_cast<G4int>(theBaseA+1), 0, static_cast<G4int>(theBaseZ));
187  ->GetIon(static_cast<G4int>(theBaseZ), static_cast<G4int>(theBaseA+1), 0);
188  theOne->SetDefinition(aRecoil);
189  // Now energy;
190  // Can be done slightly better @
191  G4ThreeVector aMomentum = theTrack.Get4Momentum().vect()
192  +theTarget.GetMomentum()
193  -thePhotons->operator[](0)->GetMomentum();
194 
195  G4ThreeVector theMomUnit = aMomentum.unit();
196  G4double aKinEnergy = theTrack.GetKineticEnergy()
197  +theTarget.GetKineticEnergy(); // gammas come from Q-value
198  G4double theResMass = aRecoil->GetPDGMass();
199  G4double theResE = aRecoil->GetPDGMass()+aKinEnergy;
200  G4double theAbsMom = std::sqrt(theResE*theResE - theResMass*theResMass);
201  G4ThreeVector theMomentum = theAbsMom*theMomUnit;
202  theOne->SetMomentum(theMomentum);
203  theResult.AddSecondary(theOne);
204  }
205 
206  // Now fill in the gammas.
207  for(i=0; i<nPhotons; i++)
208  {
209  // back to lab system
210  G4DynamicParticle * theOne = new G4DynamicParticle;
211  theOne->SetDefinition(thePhotons->operator[](i)->GetDefinition());
212  theOne->SetMomentum(thePhotons->operator[](i)->GetMomentum());
213  theResult.AddSecondary(theOne);
214  delete thePhotons->operator[](i);
215  }
216  delete thePhotons;
217 
218 //101203TK
219  G4bool residual = false;
220  //G4ParticleDefinition * aRecoil = G4ParticleTable::GetParticleTable()
221  // ->FindIon(static_cast<G4int>(theBaseZ), static_cast<G4int>(theBaseA+1), 0, static_cast<G4int>(theBaseZ));
223  ->GetIon(static_cast<G4int>(theBaseZ), static_cast<G4int>(theBaseA+1), 0);
224  for ( G4int j = 0 ; j != theResult.GetNumberOfSecondaries() ; j++ )
225  {
226  if ( theResult.GetSecondary(j)->GetParticle()->GetDefinition() == aRecoil ) residual = true;
227  }
228 
229  if ( residual == false )
230  {
231  //G4ParticleDefinition * aRecoil = G4ParticleTable::GetParticleTable()
232  // ->FindIon(static_cast<G4int>(theBaseZ), static_cast<G4int>(theBaseA+1), 0, static_cast<G4int>(theBaseZ));
233  G4int nNonZero = 0;
234  G4LorentzVector p_photons(0,0,0,0);
235  for ( G4int j = 0 ; j != theResult.GetNumberOfSecondaries() ; j++ )
236  {
237  p_photons += theResult.GetSecondary(j)->GetParticle()->Get4Momentum();
238  // To many 0 momentum photons -> Check PhotonDist
239  if ( theResult.GetSecondary(j)->GetParticle()->Get4Momentum().e() > 0 ) nNonZero++;
240  }
241 
242  // Can we include kinetic energy here?
243  G4double deltaE = ( theTrack.Get4Momentum().e() + theTarget.GetTotalEnergy() )
244  - ( p_photons.e() + aRecoil->GetPDGMass() );
245 
246 //Add photons
247  if ( nPhotons - nNonZero > 0 )
248  {
249  //G4cout << "TKDB G4NeutronHPCaptureFS::ApplyYourself we will create additional " << nPhotons - nNonZero << " photons" << G4endl;
250  std::vector<G4double> vRand;
251  vRand.push_back( 0.0 );
252  for ( G4int j = 0 ; j != nPhotons - nNonZero - 1 ; j++ )
253  {
254  vRand.push_back( G4UniformRand() );
255  }
256  vRand.push_back( 1.0 );
257  std::sort( vRand.begin(), vRand.end() );
258 
259  std::vector<G4double> vEPhoton;
260  for ( G4int j = 0 ; j < (G4int)vRand.size() - 1 ; j++ )
261  {
262  vEPhoton.push_back( deltaE * ( vRand[j+1] - vRand[j] ) );
263  }
264  std::sort( vEPhoton.begin(), vEPhoton.end() );
265 
266  for ( G4int j = 0 ; j < nPhotons - nNonZero - 1 ; j++ )
267  {
268  //Isotopic in LAB OK?
269  G4double theta = pi*G4UniformRand();
270  G4double phi = twopi*G4UniformRand();
271  G4double sinth = std::sin(theta);
272  G4double en = vEPhoton[j];
273  G4ThreeVector tempVector(en*sinth*std::cos(phi), en*sinth*std::sin(phi), en*std::cos(theta) );
274 
275  p_photons += G4LorentzVector ( tempVector, tempVector.mag() );
276  G4DynamicParticle * theOne = new G4DynamicParticle;
277  theOne->SetDefinition( G4Gamma::Gamma() );
278  theOne->SetMomentum( tempVector );
279  theResult.AddSecondary(theOne);
280  }
281 
282 // Add last photon
283  G4DynamicParticle * theOne = new G4DynamicParticle;
284  theOne->SetDefinition( G4Gamma::Gamma() );
285 // For better momentum conservation
286  G4ThreeVector lastPhoton = -p_photons.vect().unit()*vEPhoton.back();
287  p_photons += G4LorentzVector( lastPhoton , lastPhoton.mag() );
288  theOne->SetMomentum( lastPhoton );
289  theResult.AddSecondary(theOne);
290  }
291 
292 //Add residual
293  G4DynamicParticle * theOne = new G4DynamicParticle;
294  G4ThreeVector aMomentum = theTrack.Get4Momentum().vect() + theTarget.GetMomentum()
295  - p_photons.vect();
296  theOne->SetDefinition(aRecoil);
297  theOne->SetMomentum( aMomentum );
298  theResult.AddSecondary(theOne);
299 
300  }
301 //101203TK END
302 
303 // clean up the primary neutron
305  return &theResult;
306  }
307 
308 #include <sstream>
310  {
311 
312  //TK110430 BEGIN
313  std::stringstream ss;
314  ss << static_cast<G4int>(Z);
315  G4String sZ;
316  ss >> sZ;
317  ss.clear();
318  ss << static_cast<G4int>(A);
319  G4String sA;
320  ss >> sA;
321 
322  ss.clear();
323  G4String sM;
324  if ( M > 0 )
325  {
326  ss << "m";
327  ss << M;
328  ss >> sM;
329  ss.clear();
330  }
331 
332  G4String element_name = theNames.GetName( static_cast<G4int>(Z)-1 );
333  G4String filenameMF6 = dirName+"/FSMF6/"+sZ+"_"+sA+sM+"_"+element_name;
334  //std::ifstream dummyIFS(filenameMF6, std::ios::in);
335  //if ( dummyIFS.good() == true ) hasExactMF6=true;
336  std::istringstream theData(std::ios::in);
337  G4NeutronHPManager::GetInstance()->GetDataStream(filenameMF6,theData);
338 
339  //TK110430 Only use MF6MT102 which has exactly same A and Z
340  //Even _nat_ do not select and there is no _nat_ case in ENDF-VII.0
341  if ( theData.good() == true ) {
342  hasExactMF6=true;
343  theMF6FinalState.Init(theData);
344  //theData.close();
345  return;
346  }
347  //TK110430 END
348 
349 
350  G4String tString = "/FS";
351  G4bool dbool;
352  G4NeutronHPDataUsed aFile = theNames.GetName(static_cast<G4int>(A), static_cast<G4int>(Z), M, dirName, tString, dbool);
353 
354  G4String filename = aFile.GetName();
355  SetAZMs( A, Z, M, aFile );
356  //theBaseA = A;
357  //theBaseZ = G4int(Z+.5);
358  if(!dbool || ( Z<2.5 && ( std::abs(theBaseZ - Z)>0.0001 || std::abs(theBaseA - A)>0.0001)))
359  {
360  hasAnyData = false;
361  hasFSData = false;
362  hasXsec = false;
363  return;
364  }
365  //std::ifstream theData(filename, std::ios::in);
366  //std::istringstream theData(std::ios::in);
367  theData.clear();
368  G4NeutronHPManager::GetInstance()->GetDataStream(filename,theData);
369  hasFSData = theFinalStatePhotons.InitMean(theData);
370  if(hasFSData)
371  {
372  targetMass = theFinalStatePhotons.GetTargetMass();
373  theFinalStatePhotons.InitAngular(theData);
374  theFinalStatePhotons.InitEnergies(theData);
375  }
376  //theData.close();
377  }
G4ReactionProductVector * GetPhotons(G4double anEnergy)
void SetTarget(G4ReactionProduct &aTarget)
static G4double GetNuclearMass(const G4double A, const G4double Z)
void SetMomentum(const G4ThreeVector &momentum)
void Lorentz(const G4ReactionProduct &p1, const G4ReactionProduct &p2)
G4HadSecondary * GetSecondary(size_t i)
G4HadFinalState * ApplyYourself(const G4HadProjectile &theTrack)
void SetKineticEnergy(const G4double en)
static G4NeutronHPManager * GetInstance()
void SetMomentum(const G4double x, const G4double y, const G4double z)
G4ParticleDefinition * GetIon(G4int Z, G4int A, G4int lvl=0)
Definition: G4IonTable.cc:449
G4ParticleDefinition * GetDefinition() const
subroutine sort(A, N)
Definition: dpm25nuc7.f:4670
void GetDataStream(G4String, std::istringstream &iss)
G4NeutronHPDataUsed GetName(G4int A, G4int Z, G4String base, G4String rest, G4bool &active)
int G4int
Definition: G4Types.hh:78
void SetStatusChange(G4HadFinalStateStatus aS)
std::vector< G4ReactionProduct * > G4ReactionProductVector
void InitAngular(std::istream &aDataFile)
G4ReactionProduct GetBiasedThermalNucleus(G4double aMass, G4ThreeVector aVelocity, G4double temp=-1) const
Definition: G4Nucleus.cc:108
Hep3Vector vect() const
#define G4UniformRand()
Definition: Randomize.hh:87
const G4ParticleDefinition * GetDefinition() const
bool G4bool
Definition: G4Types.hh:79
G4double GetIonMass(G4int Z, G4int A, G4int L=0, G4int lvl=0) const
Definition: G4IonTable.cc:1232
void SetNeutron(G4ReactionProduct &aNeutron)
G4double GetKineticEnergy() const
G4ErrorTarget * theTarget
Definition: errprop.cc:59
void InitEnergies(std::istream &aDataFile)
std::vector< G4Fragment * > G4FragmentVector
Definition: G4Fragment.hh:65
#define TRUE
Definition: globals.hh:55
static G4Neutron * Neutron()
Definition: G4Neutron.cc:104
static G4Gamma * Gamma()
Definition: G4Gamma.cc:86
void Init(G4double A, G4double Z, G4int M, G4String &dirName, G4String &aFSType)
const G4LorentzVector & Get4Momentum() const
G4LorentzVector Get4Momentum() const
static G4IonTable * GetIonTable()
Definition: G4IonTable.hh:80
G4double GetKineticEnergy() const
G4double GetTotalEnergy() const
G4bool InitMean(std::istream &aDataFile)
G4double GetPDGMass() const
Hep3Vector unit() const
G4DynamicParticle * GetParticle()
void SetDefinition(G4ParticleDefinition *aParticleDefinition)
G4ThreeVector GetMomentum() const
G4double GetTemperature() const
Definition: G4Material.hh:180
virtual G4FragmentVector * BreakItUp(const G4Fragment &nucleus)
const G4Material * GetMaterial() const
G4ReactionProductVector * Sample(G4double anEnergy)
void SetAZMs(G4double anA, G4double aZ, G4int aM, G4NeutronHPDataUsed used)
double G4double
Definition: G4Types.hh:76
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
double mag() const
G4int GetNumberOfSecondaries() const
void AddSecondary(G4DynamicParticle *aP)
void Init(std::istream &aDataFile)
CLHEP::HepLorentzVector G4LorentzVector