Geant4  10.02
G4ParticleHPInelasticBaseFS.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 // particle_hp -- source file
27 // J.P. Wellisch, Nov-1996
28 // A prototype of the low energy neutron transport model.
29 //
30 // 080801 Give a warning message for irregular mass value in data file by T. Koi
31 // Introduce theNDLDataA,Z which has A and Z of NDL data by T. Koi
32 // 081024 G4NucleiPropertiesTable:: to G4NucleiProperties::
33 // 101111 Add Special treatment for Be9(n,2n)Be8(2a) case by T. Koi
34 //
35 // P. Arce, June-2014 Conversion neutron_hp to particle_hp
36 //
38 #include "G4ParticleHPManager.hh"
39 #include "G4Nucleus.hh"
40 #include "G4NucleiProperties.hh"
41 #include "G4He3.hh"
42 #include "G4Alpha.hh"
43 #include "G4Electron.hh"
44 #include "G4ParticleHPDataUsed.hh"
45 
46 #include "G4IonTable.hh"
47 
49 {
50  // char the[100] = {""};
51  // std::ostrstream ost(the, 100, std::ios::out);
52  // ost <<gammaPath<<"z"<<ZR<<".a"<<AR;
53  // G4String * aName = new G4String(the);
54  // std::ifstream from(*aName, std::ios::in);
55 
56  std::ostringstream ost;
57  ost <<gammaPath<<"z"<<ZR<<".a"<<AR;
58  G4String aName = ost.str();
59  std::ifstream from(aName, std::ios::in);
60 
61  if(!from) return; // no data found for this isotope
62  // std::ifstream theGammaData(*aName, std::ios::in);
63  std::ifstream theGammaData(aName, std::ios::in);
64 
65  G4double eps = 0.001;
67  G4NucleiProperties::GetBindingEnergy(static_cast<G4int>(AR+eps),static_cast<G4int>(ZR+eps)) -
68  G4NucleiProperties::GetBindingEnergy(static_cast<G4int>(theBaseA+eps), static_cast<G4int>(theBaseZ+eps));
69  theGammas.Init(theGammaData);
70  // delete aName;
71 
72 }
73 
75 {
76  gammaPath = "/Inelastic/Gammas/";
77  if(!getenv("G4NEUTRONHPDATA"))
78  throw G4HadronicException(__FILE__, __LINE__, "Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files where Inelastic/Gammas data is found.");
79  G4String tBase = getenv("G4NEUTRONHPDATA");
80  gammaPath = tBase+gammaPath;
81  G4String tString = dirName;
82  G4bool dbool;
83  G4ParticleHPDataUsed aFile = theNames.GetName(static_cast<G4int>(A), static_cast<G4int>(Z), M,tString, bit, dbool);
84  G4String filename = aFile.GetName();
85 #ifdef G4PHPDEBUG
86  if( getenv("G4ParticleHPDebug") ) G4cout << " G4ParticleHPInelasticBaseFS::Init FILE " << filename << G4endl;
87 #endif
88  SetAZMs( A, Z, M, aFile);
89  //theBaseA = aFile.GetA();
90  //theBaseZ = aFile.GetZ();
91  // theNDLDataA = (int)aFile.GetA();
92  // theNDLDataZ = aFile.GetZ();
93  //if(!dbool || ( Z<2.5 && ( std::abs(theBaseZ - Z)>0.0001 || std::abs(theBaseA - A)>0.0001)))
94  if ( !dbool || ( Z<2.5 && ( std::abs(theNDLDataZ - Z)>0.0001 || std::abs(theNDLDataA - A)>0.0001)) )
95  {
96 #ifdef G4PHPDEBUG
97  if(getenv("G4ParticleHPDebug_NamesLogging")) G4cout << "Skipped = "<< filename <<" "<<A<<" "<<Z<<G4endl;
98 #endif
99  hasAnyData = false;
100  hasFSData = false;
101  hasXsec = false;
102  return;
103  }
104  // theBaseA = A;
105  // theBaseZ = G4int(Z+.5);
106  //std::ifstream theData(filename, std::ios::in);
107  //130205 For compressed data files
108  std::istringstream theData(std::ios::in);
109  G4ParticleHPManager::GetInstance()->GetDataStream(filename,theData);
110  //130205 END
111  if(!theData) //"!" is a operator of ios
112  {
113  hasAnyData = false;
114  hasFSData = false;
115  hasXsec = false;
116  // theData.close();
117  return; // no data for exactly this isotope and FS
118  }
119  // here we go
120  G4int infoType, dataType, dummy=INT_MAX;
121  hasFSData = false;
122  while (theData >> infoType) // Loop checking, 11.05.2015, T. Koi
123  {
124  theData >> dataType;
125 
126  if(dummy==INT_MAX) theData >> dummy >> dummy;
127  if(dataType==3)
128  {
129  G4int total;
130  theData >> total;
131  theXsection->Init(theData, total, CLHEP::eV);
132  }
133  else if(dataType==4)
134  {
136  theAngularDistribution->Init(theData);
137  hasFSData = true;
138  }
139  else if(dataType==5)
140  {
142  theEnergyDistribution->Init(theData);
143  hasFSData = true;
144  }
145  else if(dataType==6)
146  {
148  //- G4cout << this << " BaseFS theEnergyAngData " << theEnergyAngData << G4endl; //GDEB
149  theEnergyAngData->Init(theData);
150  hasFSData = true;
151  }
152  else if(dataType==12)
153  {
155  theFinalStatePhotons->InitMean(theData);
156  hasFSData = true;
157  }
158  else if(dataType==13)
159  {
162  hasFSData = true;
163  }
164  else if(dataType==14)
165  {
167  hasFSData = true;
168  }
169  else if(dataType==15)
170  {
172  hasFSData = true;
173  }
174  else
175  {
176  throw G4HadronicException(__FILE__, __LINE__, "Data-type unknown to G4ParticleHPInelasticBaseFS");
177  }
178  }
179  // theData.close();
180 }
181 
183  G4ParticleDefinition ** theDefs,
184  G4int nDef)
185 {
186 
187 // prepare neutron
188  if ( theResult.Get() == NULL ) theResult.Put( new G4HadFinalState );
189  theResult.Get()->Clear();
190  G4double eKinetic = theTrack.GetKineticEnergy();
191  const G4HadProjectile *hadProjectile = &theTrack;
192  G4ReactionProduct incidReactionProduct( const_cast<G4ParticleDefinition *>(hadProjectile->GetDefinition()) );
193  incidReactionProduct.SetMomentum( hadProjectile->Get4Momentum().vect() );
194  incidReactionProduct.SetKineticEnergy( eKinetic );
195 
196 // prepare target
197  G4double targetMass;
198  G4double eps = 0.0001;
199  targetMass = ( G4NucleiProperties::GetNuclearMass(static_cast<G4int>(theBaseA+eps), static_cast<G4int>(theBaseZ+eps))) /
201 
202  if(theEnergyAngData!=0)
203  { targetMass = theEnergyAngData->GetTargetMass(); }
205  { targetMass = theAngularDistribution->GetTargetMass(); }
206 
207 //080731a
208 //110512 TKDB ENDF-VII.0 21Sc45 has trouble in MF4MT22 (n,np) targetMass is not properly recorded.
209 //if ( targetMass == 0 ) G4cout << "080731a It looks like something wrong value in G4NDL, please update the latest version. If you use the latest, then please report this problem to Geant4 Hyper news." << G4endl;
210  if ( targetMass == 0 )
211  {
212  //G4cout << "TKDB targetMass = 0; ENDF-VII.0 21Sc45 has trouble in MF4MT22 (n,np) targetMass is not properly recorded. This could be a similar situation." << G4endl;
213  targetMass = ( G4NucleiProperties::GetNuclearMass(static_cast<G4int>(theBaseA+eps), static_cast<G4int>(theBaseZ+eps))) / theProjectile->GetPDGMass();
214  }
215 
216  G4Nucleus aNucleus;
218  G4ThreeVector neuVelo = (1./hadProjectile->GetDefinition()->GetPDGMass())*incidReactionProduct.GetMomentum();
219  theTarget = aNucleus.GetBiasedThermalNucleus( targetMass, neuVelo, theTrack.GetMaterial()->GetTemperature());
220 
221  theTarget.SetDefinition( G4IonTable::GetIonTable()->GetIon( G4int(theBaseZ), G4int(theBaseA) , 0.0 ) );
222 
223 // prepare energy in target rest frame
224  G4ReactionProduct boosted;
225  boosted.Lorentz(incidReactionProduct, theTarget);
226  eKinetic = boosted.GetKineticEnergy();
227  G4double orgMomentum = boosted.GetMomentum().mag();
228 
229 // Take N-body phase-space distribution, if no other data present.
230  if(!HasFSData()) // adding the residual is trivial here @@@
231  {
232  G4ParticleHPNBodyPhaseSpace thePhaseSpaceDistribution;
233  G4double aPhaseMass=0;
234  G4int ii;
235  for(ii=0; ii<nDef; ii++)
236  {
237  aPhaseMass+=theDefs[ii]->GetPDGMass();
238  }
239  thePhaseSpaceDistribution.Init(aPhaseMass, nDef);
240  thePhaseSpaceDistribution.SetProjectileRP(&incidReactionProduct);
241  thePhaseSpaceDistribution.SetTarget(&theTarget);
242  for(ii=0; ii<nDef; ii++)
243  {
244  G4double massCode = 1000.*std::abs(theDefs[ii]->GetPDGCharge());
245  massCode += theDefs[ii]->GetBaryonNumber();
246  G4double dummy = 0;
247  G4ReactionProduct * aSec = thePhaseSpaceDistribution.Sample(eKinetic, massCode, dummy);
248  aSec->Lorentz(*aSec, -1.*theTarget);
249  G4DynamicParticle * aPart = new G4DynamicParticle();
250  aPart->SetDefinition(aSec->GetDefinition());
251  aPart->SetMomentum(aSec->GetMomentum());
252  delete aSec;
253  theResult.Get()->AddSecondary(aPart);
254 #ifdef G4PHPDEBUG
255  if( getenv("G4ParticleHPDebug")) G4cout << this << " G4ParticleHPInelasticBaseFS::BaseApply NoFSData add secondary " << aPart->GetParticleDefinition()->GetParticleName() << " E= " << aPart->GetKineticEnergy() << " NSECO " << theResult.Get()->GetNumberOfSecondaries() << G4endl;
256 #endif
257  }
259  //TK120607
260  //Final momentum check should be done before return
262  G4LorentzVector targ_4p_lab ( theTarget.GetMomentum() , std::sqrt( targ_pd->GetPDGMass()*targ_pd->GetPDGMass() + theTarget.GetMomentum().mag2() ) );
263  G4LorentzVector proj_4p_lab = theTrack.Get4Momentum();
264  G4LorentzVector init_4p_lab = proj_4p_lab + targ_4p_lab;
265  adjust_final_state ( init_4p_lab );
266 
267  return;
268  }
269 
270 // set target and neutron in the relevant exit channel
271  if(theAngularDistribution!=0)
272  {
273  theAngularDistribution->SetTarget(theTarget);
274  theAngularDistribution->SetProjectileRP(incidReactionProduct);
275  }
276  else if(theEnergyAngData!=0)
277  {
278  theEnergyAngData->SetTarget(theTarget);
279  theEnergyAngData->SetProjectileRP(incidReactionProduct);
280  }
281 
282  G4ReactionProductVector * tmpHadrons = 0;
283  G4int ii = 0, dummy;
284  unsigned int i;
285 
286  if(theEnergyAngData != 0)
287  {
288  tmpHadrons = theEnergyAngData->Sample(eKinetic);
289 
290  //141017 Fix BEGIN
291  //Adjust A and Z in the case of miss much between selected data and target nucleus
292  if ( tmpHadrons != NULL ) {
293  G4int sumA = 0;
294  G4int sumZ = 0;
295  G4int maxA = 0;
296  G4int jAtMaxA = 0;
297  for ( G4int j = 0 ; j != (G4int)tmpHadrons->size() ; j++ ) {
298  if ( tmpHadrons->at(j)->GetDefinition()->GetBaryonNumber() > maxA ) {
299  maxA = tmpHadrons->at(j)->GetDefinition()->GetBaryonNumber();
300  jAtMaxA = j;
301  }
302  sumA += tmpHadrons->at(j)->GetDefinition()->GetBaryonNumber();
303  sumZ += G4int( tmpHadrons->at(j)->GetDefinition()->GetPDGCharge() + eps );
304  }
305  G4int dA = (G4int)theBaseA + hadProjectile->GetDefinition()->GetBaryonNumber() - sumA;
306  G4int dZ = (G4int)theBaseZ + G4int( hadProjectile->GetDefinition()->GetPDGCharge() + eps ) - sumZ;
307  if ( dA < 0 || dZ < 0 ) {
308  G4int newA = tmpHadrons->at(jAtMaxA)->GetDefinition()->GetBaryonNumber() + dA ;
309  G4int newZ = G4int( tmpHadrons->at(jAtMaxA)->GetDefinition()->GetPDGCharge() + eps ) + dZ;
310  G4ParticleDefinition* pd = G4IonTable::GetIonTable()->GetIon ( newZ , newA );
311  tmpHadrons->at( jAtMaxA )->SetDefinition( pd );
312  }
313  }
314  //141017 Fix END
315 
316  }
317  else if(theAngularDistribution!= 0)
318  {
319  G4bool * Done = new G4bool[nDef];
320  G4int i0;
321  for(i0=0; i0<nDef; i0++) Done[i0] = false;
322  if(tmpHadrons == 0)
323  {
324  tmpHadrons = new G4ReactionProductVector;
325  }
326  else
327  {
328  for(i=0; i<tmpHadrons->size(); i++)
329  {
330  for(ii=0; ii<nDef; ii++)
331  if(!Done[ii] && tmpHadrons->operator[](i)->GetDefinition() == theDefs[ii])
332  Done[ii] = true;
333  }
334 #ifdef G4PHPDEBUG
335  if( getenv("G4ParticleHPDebug")) G4cout << " G4ParticleHPInelasticBaseFS::BaseApply secondary previously added " << tmpHadrons->operator[](i)->GetDefinition()->GetParticleName() << " E= " << tmpHadrons->operator[](i)->GetKineticEnergy() << G4endl;
336 #endif
337  }
338  G4ReactionProduct * aHadron;
339  G4double localMass = ( G4NucleiProperties::GetNuclearMass(static_cast<G4int>(theBaseA+eps), static_cast<G4int>(theBaseZ+eps)));
340  G4ThreeVector bufferedDirection(0,0,0);
341  for(i0=0; i0<nDef; i0++)
342  {
343  if(!Done[i0])
344  {
345  aHadron = new G4ReactionProduct;
346  if(theEnergyDistribution!=0)
347  {
348  aHadron->SetDefinition(theDefs[i0]);
349  aHadron->SetKineticEnergy(theEnergyDistribution->Sample(eKinetic, dummy));
350  }
351  else if(nDef == 1)
352  {
353  aHadron->SetDefinition(theDefs[i0]);
354  aHadron->SetKineticEnergy(eKinetic);
355  }
356  else if(nDef == 2)
357  {
358  aHadron->SetDefinition(theDefs[i0]);
359  aHadron->SetKineticEnergy(50*CLHEP::MeV);
360  }
361  else
362  {
363  throw G4HadronicException(__FILE__, __LINE__, "No energy distribution to sample from in InelasticBaseFS::BaseApply");
364  }
366  if(theEnergyDistribution==0 && nDef == 2)
367  {
368  if(i0==0)
369  {
370  G4double mass1 = theDefs[0]->GetPDGMass();
371  G4double mass2 = theDefs[1]->GetPDGMass();
372  G4double massn = theProjectile->GetPDGMass();
373  G4int z1 = static_cast<G4int>(theBaseZ+eps-theDefs[0]->GetPDGCharge()-theDefs[1]->GetPDGCharge());
374  G4int a1 = static_cast<G4int>(theBaseA+eps)-theDefs[0]->GetBaryonNumber()-theDefs[1]->GetBaryonNumber();
375  G4double concreteMass = G4NucleiProperties::GetNuclearMass(a1, z1);
376  G4double availableEnergy = eKinetic+massn+localMass-mass1-mass2-concreteMass;
377  // available kinetic energy in CMS (non relativistic)
378  G4double emin = availableEnergy+mass1+mass2 - std::sqrt((mass1+mass2)*(mass1+mass2)+orgMomentum*orgMomentum);
379  G4double p1=std::sqrt(2.*mass2*emin);
380  bufferedDirection = p1*aHadron->GetMomentum().unit();
381 #ifdef G4PHPDEBUG
382  if(getenv("G4ParticleHPDebug")) // @@@@@ verify the nucleon counting...
383  {
384  G4cout << "G4ParticleHPInelasticBaseFS "<<z1<<" "<<theBaseZ<<" "<<a1<<" "<<theBaseA<<" "<<availableEnergy<<" "
385  << emin<<G4endl;
386  }
387 #endif
388  }
389  else
390  {
391  bufferedDirection = -bufferedDirection;
392  }
393  // boost from cms to lab
394 #ifdef G4PHPDEBUG
395  if(getenv("G4ParticleHPDebug"))
396  {
397  G4cout << " G4ParticleHPInelasticBaseFS "<<bufferedDirection.mag2()<<G4endl;
398  }
399 #endif
400  aHadron->SetTotalEnergy( std::sqrt(aHadron->GetMass()*aHadron->GetMass()
401  +bufferedDirection.mag2()) );
402  aHadron->SetMomentum(bufferedDirection);
403  aHadron->Lorentz(*aHadron, -1.*(theTarget+incidReactionProduct));
404 #ifdef G4PHPDEBUG
405  if(getenv("G4ParticleHPDebug"))
406  {
407  G4cout << " G4ParticleHPInelasticBaseFS "<<aHadron->GetTotalEnergy()<<" "<<aHadron->GetMomentum()<<G4endl;
408  }
409 #endif
410  }
411  tmpHadrons->push_back(aHadron);
412 #ifdef G4PHPDEBUG
413  if( getenv("G4ParticleHPDebug")) G4cout << " G4ParticleHPInelasticBaseFS::BaseApply FSData add secondary " << aHadron->GetDefinition()->GetParticleName() << " E= " << aHadron->GetKineticEnergy() << G4endl;
414 #endif
415  }
416  }
417  delete [] Done;
418  }
419  else
420  {
421  throw G4HadronicException(__FILE__, __LINE__, "No data to create the neutrons in NInelasticFS");
422  }
423 
424  G4ReactionProductVector * thePhotons = 0;
425  if(theFinalStatePhotons!=0)
426  {
427  // the photon distributions are in the Nucleus rest frame.
428  G4ReactionProduct boosted_tmp;
429  boosted_tmp.Lorentz(incidReactionProduct, theTarget);
430  G4double anEnergy = boosted_tmp.GetKineticEnergy();
431  thePhotons = theFinalStatePhotons->GetPhotons(anEnergy);
432  if(thePhotons!=0)
433  {
434  for(i=0; i<thePhotons->size(); i++)
435  {
436  // back to lab
437  thePhotons->operator[](i)->Lorentz(*(thePhotons->operator[](i)), -1.*theTarget);
438  }
439  }
440  }
441  else if(theEnergyAngData!=0)
442  {
443 
444  // PA130927: do not create photons to adjust binding energy
445  G4bool bAdjustPhotons = true;
446 #ifdef PHP_AS_HP
447  bAdjustPhotons = true;
448 #else
449  if ( getenv( "G4PHP_DO_NOT_ADJUST_FINAL_STATE" ) ) bAdjustPhotons = false;
450 #endif
451 
452  if( bAdjustPhotons ) {
453  G4double theGammaEnergy = theEnergyAngData->GetTotalMeanEnergy();
454  G4double anEnergy = boosted.GetKineticEnergy();
455  theGammaEnergy = anEnergy-theGammaEnergy;
456  theGammaEnergy += theNuclearMassDifference;
457  G4double eBindProducts = 0;
458  G4double eBindN = 0;
459  G4double eBindP = 0;
464  G4int ia=0;
465  for(i=0; i<tmpHadrons->size(); i++)
466  {
467  if(tmpHadrons->operator[](i)->GetDefinition() == G4Neutron::Neutron())
468  {
469  eBindProducts+=eBindN;
470  }
471  else if(tmpHadrons->operator[](i)->GetDefinition() == G4Proton::Proton())
472  {
473  eBindProducts+=eBindP;
474  }
475  else if(tmpHadrons->operator[](i)->GetDefinition() == G4Deuteron::Deuteron())
476  {
477  eBindProducts+=eBindD;
478  }
479  else if(tmpHadrons->operator[](i)->GetDefinition() == G4Triton::Triton())
480  {
481  eBindProducts+=eBindT;
482  }
483  else if(tmpHadrons->operator[](i)->GetDefinition() == G4He3::He3())
484  {
485  eBindProducts+=eBindHe3;
486  }
487  else if(tmpHadrons->operator[](i)->GetDefinition() == G4Alpha::Alpha())
488  {
489  eBindProducts+=eBindA;
490  ia++;
491  }
492  }
493 
494  theGammaEnergy += eBindProducts;
495 
496 #ifdef G4PHPDEBUG
497  if( getenv("G4ParticleHPDebug")) G4cout << " G4ParticleHPInelasticBaseFS::BaseApply gamma Energy " << theGammaEnergy << " eBindProducts " << eBindProducts << G4endl;
498 #endif
499 
500  //101111
501  //Special treatment for Be9 + n -> 2n + Be8 -> 2n + a + a
502  if ( (G4int)(theBaseZ+eps) == 4 && (G4int)(theBaseA+eps) == 9 )
503  {
504  // This only valid for G4NDL3.13,,,
505  if ( std::abs( theNuclearMassDifference -
508  && ia == 2 )
509  {
510  theGammaEnergy -= (2*eBindA);
511  }
512  }
513 
514  G4ReactionProductVector * theOtherPhotons = 0;
515  G4int iLevel;
516  while(theGammaEnergy>=theGammas.GetLevelEnergy(0)) // Loop checking, 11.05.2015, T. Koi
517  {
518  for(iLevel=theGammas.GetNumberOfLevels()-1; iLevel>=0; iLevel--)
519  {
520  if(theGammas.GetLevelEnergy(iLevel)<theGammaEnergy) break;
521  }
522  if(iLevel==0||iLevel==theGammas.GetNumberOfLevels()-1)
523  {
524  theOtherPhotons = theGammas.GetDecayGammas(iLevel);
525 #ifdef G4PHPDEBUG
526  if( getenv("G4ParticleHPDebug")) G4cout << " G4ParticleHPInelasticBaseFS::BaseApply adding gamma from level " << iLevel << theOtherPhotons->operator[](ii)->GetKineticEnergy() << G4endl;
527 #endif
528  }
529  else
530  {
531  G4double random = G4UniformRand();
532  G4double eLow = theGammas.GetLevelEnergy(iLevel);
533  G4double eHigh = theGammas.GetLevelEnergy(iLevel+1);
534  if(random > (eHigh-eLow)/(theGammaEnergy-eLow)) iLevel++;
535  theOtherPhotons = theGammas.GetDecayGammas(iLevel);
536  }
537  if(thePhotons==0) thePhotons = new G4ReactionProductVector;
538  if(theOtherPhotons != 0)
539  {
540  for(unsigned int iii=0; iii<theOtherPhotons->size(); iii++)
541  {
542  thePhotons->push_back(theOtherPhotons->operator[](iii));
543 #ifdef G4PHPDEBUG
544  if( getenv("G4ParticleHPDebug"))
545  G4cout << iii << " G4ParticleHPInelasticBaseFS::BaseApply adding gamma " << theOtherPhotons->operator[](iii)->GetKineticEnergy() << G4endl;
546 #endif
547  }
548  delete theOtherPhotons;
549  }
550  theGammaEnergy -= theGammas.GetLevelEnergy(iLevel);
551  if(iLevel == -1) break;
552  }
553  }
554  }
555 
556  // fill the result
557  unsigned int nSecondaries = tmpHadrons->size();
558  unsigned int nPhotons = 0;
559  if(thePhotons!=0) { nPhotons = thePhotons->size(); }
560  nSecondaries += nPhotons;
561  G4DynamicParticle * theSec;
562 #ifdef G4PHPDEBUG
563  if( getenv("G4ParticleHPDebug")) G4cout << " G4ParticleHPInelasticBaseFS::BaseApply N hadrons " << nSecondaries-nPhotons << G4endl;
564 #endif
565 
566  for(i=0; i<nSecondaries-nPhotons; i++)
567  {
568  theSec = new G4DynamicParticle;
569  theSec->SetDefinition(tmpHadrons->operator[](i)->GetDefinition());
570  theSec->SetMomentum(tmpHadrons->operator[](i)->GetMomentum());
571  theResult.Get()->AddSecondary(theSec);
572 #ifdef G4PHPDEBUG
573  if( getenv("G4ParticleHPDebug")) G4cout << this << " G4ParticleHPInelasticBaseFS::BaseApply add secondary2 " << theSec->GetParticleDefinition()->GetParticleName() << " E= " << theSec->GetKineticEnergy() << " NSECO " << theResult.Get()->GetNumberOfSecondaries() << G4endl;
574 #endif
575  if( getenv("G4PHPTEST") ) G4cout << " InelasticBaseFS COS THETA " << std::cos(theSec->GetMomentum().theta()) << " " << (theSec->GetMomentum().theta()) << " " << theSec->GetMomentum() << " E "<< theSec->GetKineticEnergy() << " " << theSec->GetDefinition()->GetParticleName() << G4endl; //GDEB
576  delete tmpHadrons->operator[](i);
577  }
578 #ifdef G4PHPDEBUG
579  if( getenv("G4ParticleHPDebug")) G4cout << " G4ParticleHPInelasticBaseFS::BaseApply N photons " << nPhotons << G4endl;
580 #endif
581  if(thePhotons != 0)
582  {
583  for(i=0; i<nPhotons; i++)
584  {
585  theSec = new G4DynamicParticle;
586  theSec->SetDefinition(thePhotons->operator[](i)->GetDefinition());
587  theSec->SetMomentum(thePhotons->operator[](i)->GetMomentum());
588  theResult.Get()->AddSecondary(theSec);
589 #ifdef G4PHPDEBUG
590  if( getenv("G4ParticleHPDebug")) G4cout << this << " G4ParticleHPInelasticBaseFS::BaseApply add secondary3 " << theSec->GetParticleDefinition()->GetParticleName() << " E= " << theSec->GetKineticEnergy() << " NSECO " << theResult.Get()->GetNumberOfSecondaries() << G4endl;
591 #endif
592  delete thePhotons->operator[](i);
593  }
594  }
595 
596 // some garbage collection
597  delete thePhotons;
598  delete tmpHadrons;
599 
600 //080721
602  G4LorentzVector targ_4p_lab ( theTarget.GetMomentum() , std::sqrt( targ_pd->GetPDGMass()*targ_pd->GetPDGMass() + theTarget.GetMomentum().mag2() ) );
603  G4LorentzVector proj_4p_lab = theTrack.Get4Momentum();
604  G4LorentzVector init_4p_lab = proj_4p_lab + targ_4p_lab;
605  adjust_final_state ( init_4p_lab );
606 
607 // clean up the primary neutron
609 }
static G4ParticleHPManager * GetInstance()
G4ReactionProduct * Sample(G4double anEnergy, G4double massCode, G4double mass)
G4ReactionProductVector * GetDecayGammas(G4int aLevel)
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)
G4double GetKineticEnergy() const
CLHEP::Hep3Vector G4ThreeVector
void SetKineticEnergy(const G4double en)
static const G4double a1
void SetMomentum(const G4double x, const G4double y, const G4double z)
void SetProjectileRP(G4ReactionProduct &aIncidentPart)
G4ParticleDefinition * GetIon(G4int Z, G4int A, G4int lvl=0)
Definition: G4IonTable.cc:491
value_type & Get() const
Definition: G4Cache.hh:282
void SetAZMs(G4double anA, G4double aZ, G4int aM, G4ParticleHPDataUsed used)
void GetDataStream(G4String, std::istringstream &iss)
G4ParticleHPEnAngCorrelation * theEnergyAngData
static const G4double eps
G4ParticleDefinition * GetDefinition() const
int G4int
Definition: G4Types.hh:78
G4double Sample(G4double anEnergy, G4int &it)
G4ReactionProductVector * Sample(G4double anEnergy)
const G4String & GetParticleName() const
void InitPartials(std::istream &aDataFile)
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
void SetProjectileRP(const G4ReactionProduct &anIncidentParticleRP)
G4ParticleDefinition * theProjectile
void Init(G4double aMass, G4int aCount)
void BaseApply(const G4HadProjectile &theTrack, G4ParticleDefinition **theDefs, G4int nDef)
void SetStatusChange(G4HadFinalStateStatus aS)
std::vector< G4ReactionProduct * > G4ReactionProductVector
void SetTarget(const G4ReactionProduct &aTarget)
void adjust_final_state(G4LorentzVector)
void Init(std::istream &aDataFile, G4int total, G4double ux=1., G4double uy=1.)
const G4ParticleDefinition * GetDefinition() const
G4ReactionProduct GetBiasedThermalNucleus(G4double aMass, G4ThreeVector aVelocity, G4double temp=-1) const
Definition: G4Nucleus.cc:113
#define G4UniformRand()
Definition: Randomize.hh:97
G4GLOB_DLL std::ostream G4cout
double A(double temperature)
void SampleAndUpdate(G4ReactionProduct &anIncidentParticle)
const G4ParticleDefinition * GetDefinition() const
G4bool InitMean(std::istream &aDataFile)
bool G4bool
Definition: G4Types.hh:79
G4double GetKineticEnergy() const
void SetTotalEnergy(const G4double en)
G4ErrorTarget * theTarget
Definition: errprop.cc:59
static G4Triton * Triton()
Definition: G4Triton.cc:95
static G4Proton * Proton()
Definition: G4Proton.cc:93
static G4Neutron * Neutron()
Definition: G4Neutron.cc:104
void Init(std::istream &aDataFile)
const G4ParticleDefinition * GetParticleDefinition() const
const G4LorentzVector & Get4Momentum() const
void SetProjectileRP(G4ReactionProduct *aIncidentParticleRP)
static G4Deuteron * Deuteron()
Definition: G4Deuteron.cc:94
static G4IonTable * GetIonTable()
Definition: G4IonTable.hh:78
#define INT_MAX
Definition: templates.hh:111
G4double GetKineticEnergy() const
static const double eV
Definition: G4SIunits.hh:212
G4double GetTotalEnergy() const
void SetTarget(G4ReactionProduct *aTarget)
G4double total(Particle const *const p1, Particle const *const p2)
void InitGammas(G4double AR, G4double ZR)
G4double GetPDGMass() const
static G4double GetBindingEnergy(const G4int A, const G4int Z)
G4ParticleHPEnergyDistribution * theEnergyDistribution
void SetTarget(G4ReactionProduct &aTarget)
G4ReactionProductVector * GetPhotons(G4double anEnergy)
G4ThreeVector GetMomentum() const
G4double GetTemperature() const
Definition: G4Material.hh:182
#define G4endl
Definition: G4ios.hh:61
G4ParticleHPDataUsed GetName(G4int A, G4int Z, G4String base, G4String rest, G4bool &active)
const G4Material * GetMaterial() const
static G4Alpha * Alpha()
Definition: G4Alpha.cc:89
void AddSecondary(G4DynamicParticle *aP, G4int mod=-1)
static const double keV
Definition: G4SIunits.hh:213
void InitEnergies(std::istream &aDataFile)
void Init(G4double A, G4double Z, G4int M, G4String &dirName, G4String &bit, G4ParticleDefinition *)
double G4double
Definition: G4Types.hh:76
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
G4ParticleHPPhotonDist * theFinalStatePhotons
void Init(std::istream &aDataFile)
void InitAngular(std::istream &aDataFile)
G4double GetPDGCharge() const
static G4He3 * He3()
Definition: G4He3.cc:94
void Put(const value_type &val) const
Definition: G4Cache.hh:286
G4double GetLevelEnergy(G4int aLevel)
G4double GetMass() const
G4int GetNumberOfSecondaries() const
G4ParticleHPAngular * theAngularDistribution
G4ThreeVector GetMomentum() const
void Init(std::istream &aDataFile)
CLHEP::HepLorentzVector G4LorentzVector