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