Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Attributes
G4NeutronHPInelasticCompFS Class Referenceabstract

#include <G4NeutronHPInelasticCompFS.hh>

Inheritance diagram for G4NeutronHPInelasticCompFS:
G4NeutronHPFinalState G4NeutronHPAInelasticFS G4NeutronHPDInelasticFS G4NeutronHPHe3InelasticFS G4NeutronHPNInelasticFS G4NeutronHPPInelasticFS G4NeutronHPTInelasticFS

Public Member Functions

 G4NeutronHPInelasticCompFS ()
 
virtual ~G4NeutronHPInelasticCompFS ()
 
void Init (G4double A, G4double Z, G4int M, G4String &dirName, G4String &aSFType)
 
void InitGammas (G4double AR, G4double ZR)
 
virtual G4HadFinalStateApplyYourself (const G4HadProjectile &theTrack)=0
 
virtual G4NeutronHPFinalStateNew ()=0
 
virtual G4double GetXsec (G4double anEnergy)
 
virtual G4NeutronHPVectorGetXsec ()
 
G4int SelectExitChannel (G4double eKinetic)
 
void CompositeApply (const G4HadProjectile &theTrack, G4ParticleDefinition *aHadron)
 
void InitDistributionInitialState (G4ReactionProduct &aNeutron, G4ReactionProduct &aTarget, G4int it)
 
- Public Member Functions inherited from G4NeutronHPFinalState
 G4NeutronHPFinalState ()
 
virtual ~G4NeutronHPFinalState ()
 
void Init (G4double A, G4double Z, G4String &dirName, G4String &aFSType)
 
G4bool HasXsec ()
 
G4bool HasFSData ()
 
G4bool HasAnyData ()
 
void SetA_Z (G4double anA, G4double aZ, G4int aM=0)
 
G4double GetZ ()
 
G4double GetN ()
 
G4int GetM ()
 

Protected Attributes

G4NeutronHPVectortheXsection [51]
 
G4NeutronHPEnergyDistributiontheEnergyDistribution [51]
 
G4NeutronHPAngulartheAngularDistribution [51]
 
G4NeutronHPEnAngCorrelationtheEnergyAngData [51]
 
G4NeutronHPPhotonDisttheFinalStatePhotons [51]
 
G4NeutronHPDeExGammas theGammas
 
G4String gammaPath
 
G4double theCurrentA
 
G4double theCurrentZ
 
std::vector< G4doubleQI
 
std::vector< G4intLR
 
- Protected Attributes inherited from G4NeutronHPFinalState
G4bool hasXsec
 
G4bool hasFSData
 
G4bool hasAnyData
 
G4NeutronHPNames theNames
 
G4HadFinalState theResult
 
G4double theBaseA
 
G4double theBaseZ
 
G4int theBaseM
 
G4int theNDLDataZ
 
G4int theNDLDataA
 
G4int theNDLDataM
 

Additional Inherited Members

- Protected Member Functions inherited from G4NeutronHPFinalState
void SetAZMs (G4double anA, G4double aZ, G4int aM, G4NeutronHPDataUsed used)
 
void adjust_final_state (G4LorentzVector)
 
G4bool DoNotAdjustFinalState ()
 

Detailed Description

Definition at line 41 of file G4NeutronHPInelasticCompFS.hh.

Constructor & Destructor Documentation

G4NeutronHPInelasticCompFS::G4NeutronHPInelasticCompFS ( )
inline

Definition at line 45 of file G4NeutronHPInelasticCompFS.hh.

References G4NeutronHPFinalState::hasXsec, LR, QI, theAngularDistribution, theEnergyAngData, theEnergyDistribution, theFinalStatePhotons, and theXsection.

46  {
47 
48  QI.resize(51);
49  LR.resize(51);
50  for(G4int i=0; i<51; i++)
51  {
52  hasXsec = true;
53  theXsection[i] = 0;
54  theEnergyDistribution[i] = 0;
56  theEnergyAngData[i] = 0;
57  theFinalStatePhotons[i] = 0;
58  QI[i]=0.0;
59  LR[i]=0;
60  }
61 
62  }
int G4int
Definition: G4Types.hh:78
G4NeutronHPEnergyDistribution * theEnergyDistribution[51]
G4NeutronHPEnAngCorrelation * theEnergyAngData[51]
G4NeutronHPAngular * theAngularDistribution[51]
G4NeutronHPPhotonDist * theFinalStatePhotons[51]
virtual G4NeutronHPInelasticCompFS::~G4NeutronHPInelasticCompFS ( )
inlinevirtual

Definition at line 63 of file G4NeutronHPInelasticCompFS.hh.

References theAngularDistribution, theEnergyAngData, theEnergyDistribution, theFinalStatePhotons, and theXsection.

64  {
65  for(G4int i=0; i<51; i++)
66  {
67  if(theXsection[i] != 0) delete theXsection[i];
68  if(theEnergyDistribution[i] != 0) delete theEnergyDistribution[i];
69  if(theAngularDistribution[i] != 0) delete theAngularDistribution[i];
70  if(theEnergyAngData[i] != 0) delete theEnergyAngData[i];
71  if(theFinalStatePhotons[i] != 0) delete theFinalStatePhotons[i];
72  }
73  }
int G4int
Definition: G4Types.hh:78
G4NeutronHPEnergyDistribution * theEnergyDistribution[51]
G4NeutronHPEnAngCorrelation * theEnergyAngData[51]
G4NeutronHPAngular * theAngularDistribution[51]
G4NeutronHPPhotonDist * theFinalStatePhotons[51]

Member Function Documentation

virtual G4HadFinalState* G4NeutronHPInelasticCompFS::ApplyYourself ( const G4HadProjectile theTrack)
pure virtual
void G4NeutronHPInelasticCompFS::CompositeApply ( const G4HadProjectile theTrack,
G4ParticleDefinition aHadron 
)

Definition at line 219 of file G4NeutronHPInelasticCompFS.cc.

References G4HadFinalState::AddSecondary(), G4NeutronHPFinalState::adjust_final_state(), CLHEP::HepLorentzVector::boost(), G4HadFinalState::Clear(), CLHEP::HepLorentzVector::e(), G4UniformRand, G4Gamma::Gamma(), G4HadProjectile::Get4Momentum(), G4DynamicParticle::Get4Momentum(), G4ParticleDefinition::GetBaryonNumber(), G4Nucleus::GetBiasedThermalNucleus(), G4NeutronHPDeExGammas::GetDecayGammas(), G4HadProjectile::GetDefinition(), G4ReactionProduct::GetDefinition(), G4IonTable::GetIon(), G4IonTable::GetIonTable(), G4HadProjectile::GetKineticEnergy(), G4ReactionProduct::GetKineticEnergy(), G4NeutronHPDeExGammas::GetLevel(), G4NeutronHPLevel::GetLevelEnergy(), G4NeutronHPDeExGammas::GetLevelEnergy(), G4NeutronHPPhotonDist::GetLevelEnergy(), G4ReactionProduct::GetMass(), G4HadProjectile::GetMaterial(), G4ReactionProduct::GetMomentum(), G4NucleiProperties::GetNuclearMass(), G4NeutronHPDeExGammas::GetNumberOfLevels(), G4ParticleDefinition::GetPDGCharge(), G4ParticleDefinition::GetPDGMass(), G4NeutronHPPhotonDist::GetPhotons(), G4Material::GetTemperature(), G4ReactionProduct::GetTotalEnergy(), G4ReactionProduct::GetTotalMomentum(), InitDistributionInitialState(), python.hepunit::keV, G4ReactionProduct::Lorentz(), CLHEP::HepLorentzVector::m(), CLHEP::Hep3Vector::mag2(), G4Neutron::Neutron(), QI, G4NeutronHPEnAngCorrelation::Sample(), G4NeutronHPEnergyDistribution::Sample(), G4NeutronHPAngular::SampleAndUpdate(), SelectExitChannel(), G4ReactionProduct::SetDefinition(), G4DynamicParticle::SetDefinition(), G4ReactionProduct::SetKineticEnergy(), G4ReactionProduct::SetMomentum(), G4DynamicParticle::SetMomentum(), G4HadFinalState::SetStatusChange(), stopAndKill, theAngularDistribution, G4NeutronHPFinalState::theBaseA, G4NeutronHPFinalState::theBaseZ, theEnergyAngData, theEnergyDistribution, theFinalStatePhotons, theGammas, G4NeutronHPFinalState::theResult, theTarget, theXsection, python.hepunit::twopi, CLHEP::HepLorentzVector::v(), and CLHEP::HepLorentzVector::vect().

Referenced by G4NeutronHPAInelasticFS::ApplyYourself(), G4NeutronHPTInelasticFS::ApplyYourself(), G4NeutronHPPInelasticFS::ApplyYourself(), G4NeutronHPNInelasticFS::ApplyYourself(), G4NeutronHPHe3InelasticFS::ApplyYourself(), and G4NeutronHPDInelasticFS::ApplyYourself().

220 {
221 
222 // prepare neutron
223  theResult.Clear();
224  G4double eKinetic = theTrack.GetKineticEnergy();
225  const G4HadProjectile *incidentParticle = &theTrack;
226  G4ReactionProduct theNeutron( const_cast<G4ParticleDefinition *>(incidentParticle->GetDefinition()) );
227  theNeutron.SetMomentum( incidentParticle->Get4Momentum().vect() );
228  theNeutron.SetKineticEnergy( eKinetic );
229 
230 // prepare target
231  G4int i;
232  for(i=0; i<50; i++)
233  { if(theXsection[i] != 0) { break; } }
234 
235  G4double targetMass=0;
236  G4double eps = 0.0001;
237  targetMass = ( G4NucleiProperties::GetNuclearMass(static_cast<G4int>(theBaseA+eps), static_cast<G4int>(theBaseZ+eps))) /
239 // if(theEnergyAngData[i]!=0)
240 // targetMass = theEnergyAngData[i]->GetTargetMass();
241 // else if(theAngularDistribution[i]!=0)
242 // targetMass = theAngularDistribution[i]->GetTargetMass();
243 // else if(theFinalStatePhotons[50]!=0)
244 // targetMass = theFinalStatePhotons[50]->GetTargetMass();
245  G4Nucleus aNucleus;
247  G4ThreeVector neuVelo = (1./incidentParticle->GetDefinition()->GetPDGMass())*theNeutron.GetMomentum();
248  theTarget = aNucleus.GetBiasedThermalNucleus( targetMass, neuVelo, theTrack.GetMaterial()->GetTemperature());
249 
250 // prepare the residual mass
251  G4double residualMass=0;
252  G4double residualZ = theBaseZ - aDefinition->GetPDGCharge();
253  G4double residualA = theBaseA - aDefinition->GetBaryonNumber()+1;
254  residualMass = ( G4NucleiProperties::GetNuclearMass(static_cast<G4int>(residualA+eps), static_cast<G4int>(residualZ+eps)) ) /
256 
257 // prepare energy in target rest frame
258  G4ReactionProduct boosted;
259  boosted.Lorentz(theNeutron, theTarget);
260  eKinetic = boosted.GetKineticEnergy();
261 // G4double momentumInCMS = boosted.GetTotalMomentum();
262 
263 // select exit channel for composite FS class.
264  G4int it = SelectExitChannel( eKinetic );
265 
266 // set target and neutron in the relevant exit channel
267  InitDistributionInitialState(theNeutron, theTarget, it);
268 
269  G4ReactionProductVector * thePhotons = 0;
270  G4ReactionProductVector * theParticles = 0;
271  G4ReactionProduct aHadron;
272  aHadron.SetDefinition(aDefinition); // what if only cross-sections exist ==> Na 23 11 @@@@
273  G4double availableEnergy = theNeutron.GetKineticEnergy() + theNeutron.GetMass() - aHadron.GetMass() +
274  (targetMass - residualMass)*G4Neutron::Neutron()->GetPDGMass();
275 //080730c
276  if ( availableEnergy < 0 )
277  {
278  //G4cout << "080730c Adjust availavleEnergy " << G4endl;
279  availableEnergy = 0;
280  }
281  G4int nothingWasKnownOnHadron = 0;
282  G4int dummy;
283  G4double eGamm = 0;
284  G4int iLevel=it-1;
285 
286 // TK without photon has it = 0
287  if( 50 == it )
288  {
289 
290 // TK Excitation level is not determined
291  iLevel=-1;
292  aHadron.SetKineticEnergy(availableEnergy*residualMass*G4Neutron::Neutron()->GetPDGMass()/
293  (aHadron.GetMass()+residualMass*G4Neutron::Neutron()->GetPDGMass()));
294 
295  //aHadron.SetMomentum(theNeutron.GetMomentum()*(1./theNeutron.GetTotalMomentum())*
296  // std::sqrt(aHadron.GetTotalEnergy()*aHadron.GetTotalEnergy()-
297  // aHadron.GetMass()*aHadron.GetMass()));
298 
299  //TK add safty 100909
300  G4double p2 = ( aHadron.GetTotalEnergy()*aHadron.GetTotalEnergy() - aHadron.GetMass()*aHadron.GetMass() );
301  G4double p = 0.0;
302  if ( p2 > 0.0 ) p = std::sqrt( p );
303 
304  aHadron.SetMomentum(theNeutron.GetMomentum()*(1./theNeutron.GetTotalMomentum())*p );
305 
306  }
307  else
308  {
309  while( iLevel!=-1 && theGammas.GetLevel(iLevel) == 0 ) { iLevel--; }
310  }
311 
312 
313  if ( theAngularDistribution[it] != 0 ) // MF4
314  {
315  if(theEnergyDistribution[it]!=0) // MF5
316  {
317  //************************************************************
318  /*
319  aHadron.SetKineticEnergy(theEnergyDistribution[it]->Sample(eKinetic, dummy));
320  G4double eSecN = aHadron.GetKineticEnergy();
321  */
322  //************************************************************
323  //EMendoza --> maximum allowable energy should be taken into account.
324  G4double dqi = 0.0;
325  if ( QI[it] < 0 || 849 < QI[it] ) dqi = QI[it]; //For backword compatibility QI introduced since G4NDL3.15
326  G4double MaxEne=eKinetic+dqi;
327  G4double eSecN;
328  do{
329  eSecN=theEnergyDistribution[it]->Sample(eKinetic, dummy);
330  }while(eSecN>MaxEne);
331  aHadron.SetKineticEnergy(eSecN);
332  //************************************************************
333  eGamm = eKinetic-eSecN;
334  for(iLevel=theGammas.GetNumberOfLevels()-1; iLevel>=0; iLevel--)
335  {
336  if(theGammas.GetLevelEnergy(iLevel)<eGamm) break;
337  }
338  G4double random = 2*G4UniformRand();
339  iLevel+=G4int(random);
340  if(iLevel>theGammas.GetNumberOfLevels()-1)iLevel = theGammas.GetNumberOfLevels()-1;
341  }
342  else
343  {
344  G4double eExcitation = 0;
345  if(iLevel>=0) eExcitation = theGammas.GetLevel(iLevel)->GetLevelEnergy();
346  while (eKinetic-eExcitation < 0 && iLevel>0)
347  {
348  iLevel--;
349  eExcitation = theGammas.GetLevel(iLevel)->GetLevelEnergy();
350  }
351  //110610TK BEGIN
352  //Use QI value for calculating excitation energy of residual.
353  G4bool useQI=false;
354  G4double dqi = QI[it];
355  if ( dqi < 0 || 849 < dqi ) useQI = true; //Former libraies does not have values of this range
356 
357  if ( useQI )
358  {
359  // QI introudced since G4NDL3.15
360  eExcitation = -QI[it];
361  //Re-evluate iLevel based on this eExcitation
362  iLevel = 0;
363  G4bool find = false;
364  G4int imaxEx = 0;
365  while( !theGammas.GetLevel(iLevel+1) == 0 )
366  {
367  G4double maxEx = 0.0;
368  if ( maxEx < theGammas.GetLevel(iLevel)->GetLevelEnergy() )
369  {
370  maxEx = theGammas.GetLevel(iLevel)->GetLevelEnergy();
371  imaxEx = iLevel;
372  }
373  if ( eExcitation < theGammas.GetLevel(iLevel)->GetLevelEnergy() )
374  {
375  find = true;
376  iLevel--;
377  // very small eExcitation, iLevel becomes -1, this is protected below.
378  if ( iLevel == -1 ) iLevel = 0; // But cause energy trouble.
379  break;
380  }
381  iLevel++;
382  }
383  // In case, cannot find proper level, then use the maximum level.
384  if ( !find ) iLevel = imaxEx;
385  }
386  //110610TK END
387 
388  if(getenv("InelasticCompFSLogging") && eKinetic-eExcitation < 0)
389  {
390  throw G4HadronicException(__FILE__, __LINE__, "SEVERE: InelasticCompFS: Consistency of data not good enough, please file report");
391  }
392  if(eKinetic-eExcitation < 0) eExcitation = 0;
393  if(iLevel!= -1) aHadron.SetKineticEnergy(eKinetic - eExcitation);
394 
395  }
397 
398  if( theFinalStatePhotons[it] == 0 )
399  {
400  //G4cout << "110610 USE Gamma Level" << G4endl;
401 // TK comment Most n,n* eneter to this
402  thePhotons = theGammas.GetDecayGammas(iLevel);
403  eGamm -= theGammas.GetLevelEnergy(iLevel);
404  if(eGamm>0) // @ ok for now, but really needs an efficient way of correllated sampling @
405  {
406  G4ReactionProduct * theRestEnergy = new G4ReactionProduct;
407  theRestEnergy->SetDefinition(G4Gamma::Gamma());
408  theRestEnergy->SetKineticEnergy(eGamm);
409  G4double costh = 2.*G4UniformRand()-1.;
410  G4double phi = twopi*G4UniformRand();
411  theRestEnergy->SetMomentum(eGamm*std::sin(std::acos(costh))*std::cos(phi),
412  eGamm*std::sin(std::acos(costh))*std::sin(phi),
413  eGamm*costh);
414  if(thePhotons == 0) { thePhotons = new G4ReactionProductVector; }
415  thePhotons->push_back(theRestEnergy);
416  }
417  }
418  }
419  else if(theEnergyAngData[it] != 0) // MF6
420  {
421  theParticles = theEnergyAngData[it]->Sample(eKinetic);
422  }
423  else
424  {
425  // @@@ what to do, if we have photon data, but no info on the hadron itself
426  nothingWasKnownOnHadron = 1;
427  }
428 
429  //G4cout << "theFinalStatePhotons it " << it << G4endl;
430  //G4cout << "theFinalStatePhotons[it] " << theFinalStatePhotons[it] << G4endl;
431  //G4cout << "theFinalStatePhotons it " << it << G4endl;
432  //G4cout << "theFinalStatePhotons[it] " << theFinalStatePhotons[it] << G4endl;
433  //G4cout << "thePhotons " << thePhotons << G4endl;
434 
435  if ( theFinalStatePhotons[it] != 0 )
436  {
437  // the photon distributions are in the Nucleus rest frame.
438  // TK residual rest frame
439  G4ReactionProduct boosted_tmp;
440  boosted_tmp.Lorentz(theNeutron, theTarget);
441  G4double anEnergy = boosted_tmp.GetKineticEnergy();
442  thePhotons = theFinalStatePhotons[it]->GetPhotons(anEnergy);
443  G4double aBaseEnergy = theFinalStatePhotons[it]->GetLevelEnergy();
444  G4double testEnergy = 0;
445  if(thePhotons!=0 && thePhotons->size()!=0)
446  { aBaseEnergy-=thePhotons->operator[](0)->GetTotalEnergy(); }
447  if(theFinalStatePhotons[it]->NeedsCascade())
448  {
449  while(aBaseEnergy>0.01*keV)
450  {
451  // cascade down the levels
452  G4bool foundMatchingLevel = false;
453  G4int closest = 2;
454  G4double deltaEold = -1;
455  for(G4int j=1; j<it; j++)
456  {
457  if(theFinalStatePhotons[j]!=0)
458  {
459  testEnergy = theFinalStatePhotons[j]->GetLevelEnergy();
460  }
461  else
462  {
463  testEnergy = 0;
464  }
465  G4double deltaE = std::abs(testEnergy-aBaseEnergy);
466  if(deltaE<0.1*keV)
467  {
468  G4ReactionProductVector * theNext =
469  theFinalStatePhotons[j]->GetPhotons(anEnergy);
470  thePhotons->push_back(theNext->operator[](0));
471  aBaseEnergy = testEnergy-theNext->operator[](0)->GetTotalEnergy();
472  delete theNext;
473  foundMatchingLevel = true;
474  break; // ===>
475  }
476  if(theFinalStatePhotons[j]!=0 && ( deltaE<deltaEold||deltaEold<0.) )
477  {
478  closest = j;
479  deltaEold = deltaE;
480  }
481  } // <=== the break goes here.
482  if(!foundMatchingLevel)
483  {
484  G4ReactionProductVector * theNext =
485  theFinalStatePhotons[closest]->GetPhotons(anEnergy);
486  thePhotons->push_back(theNext->operator[](0));
487  aBaseEnergy = aBaseEnergy-theNext->operator[](0)->GetTotalEnergy();
488  delete theNext;
489  }
490  }
491  }
492  }
493  unsigned int i0;
494  if(thePhotons!=0)
495  {
496  for(i0=0; i0<thePhotons->size(); i0++)
497  {
498  // back to lab
499  thePhotons->operator[](i0)->Lorentz(*(thePhotons->operator[](i0)), -1.*theTarget);
500  }
501  }
502  //G4cout << "nothingWasKnownOnHadron " << nothingWasKnownOnHadron << G4endl;
503  if(nothingWasKnownOnHadron)
504  {
505 // TKDB 100405
506 // In this case, hadron should be isotropic in CM
507 // mu and p should be correlated
508 //
509  G4double totalPhotonEnergy = 0.0;
510  if ( thePhotons != 0 )
511  {
512  unsigned int nPhotons = thePhotons->size();
513  unsigned int ii0;
514  for ( ii0=0; ii0<nPhotons; ii0++)
515  {
516  //thePhotons has energies at LAB system
517  totalPhotonEnergy += thePhotons->operator[](ii0)->GetTotalEnergy();
518  }
519  }
520 
521  //isotropic distribution in CM
522  G4double mu = 1.0 - 2 * G4UniformRand();
523 
524  // need momentums in target rest frame;
525  G4LorentzVector target_in_LAB ( theTarget.GetMomentum() , theTarget.GetTotalEnergy() );
526  G4ThreeVector boostToTargetRest = -target_in_LAB.boostVector();
527  G4LorentzVector proj_in_LAB = incidentParticle->Get4Momentum();
528 
529  G4DynamicParticle* proj = new G4DynamicParticle( G4Neutron::Neutron() , proj_in_LAB.boost( boostToTargetRest ) );
530  G4DynamicParticle* targ = new G4DynamicParticle( G4IonTable::GetIonTable()->GetIon ( (G4int)theBaseZ , (G4int)theBaseA , totalPhotonEnergy ) , G4ThreeVector(0) );
531  G4DynamicParticle* hadron = new G4DynamicParticle( aHadron.GetDefinition() , G4ThreeVector(0) ); // will be fill momentum
532 
533  two_body_reaction ( proj , targ , hadron , mu );
534 
535  G4LorentzVector hadron_in_trag_rest = hadron->Get4Momentum();
536  G4LorentzVector hadron_in_LAB = hadron_in_trag_rest.boost ( -boostToTargetRest );
537  aHadron.SetMomentum( hadron_in_LAB.v() );
538  aHadron.SetKineticEnergy ( hadron_in_LAB.e() - hadron_in_LAB.m() );
539 
540  delete proj;
541  delete targ;
542  delete hadron;
543 
544 //TKDB 100405
545 /*
546  G4double totalPhotonEnergy = 0;
547  if(thePhotons!=0)
548  {
549  unsigned int nPhotons = thePhotons->size();
550  unsigned int i0;
551  for(i0=0; i0<nPhotons; i0++)
552  {
553  totalPhotonEnergy += thePhotons->operator[](i0)->GetTotalEnergy();
554  }
555  }
556  availableEnergy -= totalPhotonEnergy;
557  residualMass += totalPhotonEnergy/G4Neutron::Neutron()->GetPDGMass();
558  aHadron.SetKineticEnergy(availableEnergy*residualMass*G4Neutron::Neutron()->GetPDGMass()/
559  (aHadron.GetMass()+residualMass*G4Neutron::Neutron()->GetPDGMass()));
560  G4double CosTheta = 1.0 - 2.0*G4UniformRand();
561  G4double SinTheta = std::sqrt(1.0 - CosTheta*CosTheta);
562  G4double Phi = twopi*G4UniformRand();
563  G4ThreeVector Vector(std::cos(Phi)*SinTheta, std::sin(Phi)*SinTheta, CosTheta);
564  //aHadron.SetMomentum(Vector* std::sqrt(aHadron.GetTotalEnergy()*aHadron.GetTotalEnergy()-
565  // aHadron.GetMass()*aHadron.GetMass()));
566  G4double p2 = aHadron.GetTotalEnergy()*aHadron.GetTotalEnergy()- aHadron.GetMass()*aHadron.GetMass();
567 
568  G4double p = 0.0;
569  if ( p2 > 0.0 )
570  p = std::sqrt ( p2 );
571 
572  aHadron.SetMomentum( Vector*p );
573 */
574 
575  }
576 
577 // fill the result
578 // Beware - the recoil is not necessarily in the particles...
579 // Can be calculated from momentum conservation?
580 // The idea is that the particles ar emitted forst, and the gammas only once the
581 // recoil is on the residual; assumption is that gammas do not contribute to
582 // the recoil.
583 // This needs more design @@@
584 
585  G4int nSecondaries = 2; // the hadron and the recoil
586  G4bool needsSeparateRecoil = false;
587  G4int totalBaryonNumber = 0;
588  G4int totalCharge = 0;
589  G4ThreeVector totalMomentum(0);
590  if(theParticles != 0)
591  {
592  nSecondaries = theParticles->size();
593  G4ParticleDefinition * aDef;
594  unsigned int ii0;
595  for(ii0=0; ii0<theParticles->size(); ii0++)
596  {
597  aDef = theParticles->operator[](ii0)->GetDefinition();
598  totalBaryonNumber+=aDef->GetBaryonNumber();
599  totalCharge+=G4int(aDef->GetPDGCharge()+eps);
600  totalMomentum += theParticles->operator[](ii0)->GetMomentum();
601  }
602  if(totalBaryonNumber!=G4int(theBaseA+eps+incidentParticle->GetDefinition()->GetBaryonNumber()))
603  {
604  needsSeparateRecoil = true;
605  nSecondaries++;
606  residualA = G4int(theBaseA+eps+incidentParticle->GetDefinition()->GetBaryonNumber()
607  -totalBaryonNumber);
608  residualZ = G4int(theBaseZ+eps+incidentParticle->GetDefinition()->GetPDGCharge()
609  -totalCharge);
610  }
611  }
612 
613  G4int nPhotons = 0;
614  if(thePhotons!=0) { nPhotons = thePhotons->size(); }
615  nSecondaries += nPhotons;
616 
617  G4DynamicParticle * theSec;
618 
619  if( theParticles==0 )
620  {
621  theSec = new G4DynamicParticle;
622  theSec->SetDefinition(aHadron.GetDefinition());
623  theSec->SetMomentum(aHadron.GetMomentum());
624  theResult.AddSecondary(theSec);
625 
626  aHadron.Lorentz(aHadron, theTarget);
627  G4ReactionProduct theResidual;
629  ->GetIon(static_cast<G4int>(residualZ), static_cast<G4int>(residualA), 0));
630  theResidual.SetKineticEnergy(aHadron.GetKineticEnergy()*aHadron.GetMass()/theResidual.GetMass());
631 
632  //080612TK contribution from Benoit Pirard and Laurent Desorgher (Univ. Bern) #6
633  //theResidual.SetMomentum(-1.*aHadron.GetMomentum());
634  G4ThreeVector incidentNeutronMomentum = theNeutron.GetMomentum();
635  theResidual.SetMomentum(incidentNeutronMomentum - aHadron.GetMomentum());
636 
637  theResidual.Lorentz(theResidual, -1.*theTarget);
638  G4ThreeVector totalPhotonMomentum(0,0,0);
639  if(thePhotons!=0)
640  {
641  for(i=0; i<nPhotons; i++)
642  {
643  totalPhotonMomentum += thePhotons->operator[](i)->GetMomentum();
644  }
645  }
646  theSec = new G4DynamicParticle;
647  theSec->SetDefinition(theResidual.GetDefinition());
648  theSec->SetMomentum(theResidual.GetMomentum()-totalPhotonMomentum);
649  theResult.AddSecondary(theSec);
650  }
651  else
652  {
653  for(i0=0; i0<theParticles->size(); i0++)
654  {
655  theSec = new G4DynamicParticle;
656  theSec->SetDefinition(theParticles->operator[](i0)->GetDefinition());
657  theSec->SetMomentum(theParticles->operator[](i0)->GetMomentum());
658  theResult.AddSecondary(theSec);
659  delete theParticles->operator[](i0);
660  }
661  delete theParticles;
662  if(needsSeparateRecoil && residualZ!=0)
663  {
664  G4ReactionProduct theResidual;
666  ->GetIon(static_cast<G4int>(residualZ), static_cast<G4int>(residualA), 0));
667  G4double resiualKineticEnergy = theResidual.GetMass()*theResidual.GetMass();
668  resiualKineticEnergy += totalMomentum*totalMomentum;
669  resiualKineticEnergy = std::sqrt(resiualKineticEnergy) - theResidual.GetMass();
670 // cout << "Kinetic energy of the residual = "<<resiualKineticEnergy<<endl;
671  theResidual.SetKineticEnergy(resiualKineticEnergy);
672 
673  //080612TK contribution from Benoit Pirard and Laurent Desorgher (Univ. Bern) #4
674  //theResidual.SetMomentum(-1.*totalMomentum);
675  //G4ThreeVector incidentNeutronMomentum = theNeutron.GetMomentum();
676  //theResidual.SetMomentum(incidentNeutronMomentum - aHadron.GetMomentum());
677 //080717 TK Comment still do NOT include photon's mometum which produce by thePhotons
678  theResidual.SetMomentum( theNeutron.GetMomentum() + theTarget.GetMomentum() - totalMomentum );
679 
680  theSec = new G4DynamicParticle;
681  theSec->SetDefinition(theResidual.GetDefinition());
682  theSec->SetMomentum(theResidual.GetMomentum());
683  theResult.AddSecondary(theSec);
684  }
685  }
686  if(thePhotons!=0)
687  {
688  for(i=0; i<nPhotons; i++)
689  {
690  theSec = new G4DynamicParticle;
691  //Bug reported Chao Zhang (Chao.Zhang@usd.edu), Dongming Mei(Dongming.Mei@usd.edu) Feb. 25, 2009
692  //theSec->SetDefinition(G4Gamma::Gamma());
693  theSec->SetDefinition( thePhotons->operator[](i)->GetDefinition() );
694  //But never cause real effect at least with G4NDL3.13 TK
695  theSec->SetMomentum(thePhotons->operator[](i)->GetMomentum());
696  theResult.AddSecondary(theSec);
697  delete thePhotons->operator[](i);
698  }
699 // some garbage collection
700  delete thePhotons;
701  }
702 
703 //080721
704  G4ParticleDefinition* targ_pd = G4IonTable::GetIonTable()->GetIon ( (G4int)theBaseZ , (G4int)theBaseA , 0.0 );
705  G4LorentzVector targ_4p_lab ( theTarget.GetMomentum() , std::sqrt( targ_pd->GetPDGMass()*targ_pd->GetPDGMass() + theTarget.GetMomentum().mag2() ) );
706  G4LorentzVector proj_4p_lab = theTrack.Get4Momentum();
707  G4LorentzVector init_4p_lab = proj_4p_lab + targ_4p_lab;
708  adjust_final_state ( init_4p_lab );
709 
710 // clean up the primary neutron
712 }
G4ReactionProductVector * GetPhotons(G4double anEnergy)
static G4double GetNuclearMass(const G4double A, const G4double Z)
void SetMomentum(const G4ThreeVector &momentum)
G4NeutronHPLevel * GetLevel(G4int i)
void Lorentz(const G4ReactionProduct &p1, const G4ReactionProduct &p2)
CLHEP::Hep3Vector G4ThreeVector
void SetKineticEnergy(const G4double en)
void SetMomentum(const G4double x, const G4double y, const G4double z)
const char * p
Definition: xmltok.h:285
G4ParticleDefinition * GetIon(G4int Z, G4int A, G4int lvl=0)
Definition: G4IonTable.cc:449
Hep3Vector v() const
G4double Sample(G4double anEnergy, G4int &it)
int G4int
Definition: G4Types.hh:78
G4ParticleDefinition * GetDefinition() const
void SetStatusChange(G4HadFinalStateStatus aS)
std::vector< G4ReactionProduct * > G4ReactionProductVector
G4ReactionProduct GetBiasedThermalNucleus(G4double aMass, G4ThreeVector aVelocity, G4double temp=-1) const
Definition: G4Nucleus.cc:108
Hep3Vector vect() const
#define G4UniformRand()
Definition: Randomize.hh:87
G4NeutronHPEnergyDistribution * theEnergyDistribution[51]
const G4ParticleDefinition * GetDefinition() const
bool G4bool
Definition: G4Types.hh:79
HepLorentzVector & boost(double, double, double)
G4double GetKineticEnergy() const
G4int SelectExitChannel(G4double eKinetic)
G4ErrorTarget * theTarget
Definition: errprop.cc:59
static G4Neutron * Neutron()
Definition: G4Neutron.cc:104
static G4Gamma * Gamma()
Definition: G4Gamma.cc:86
const G4LorentzVector & Get4Momentum() const
G4NeutronHPEnAngCorrelation * theEnergyAngData[51]
G4LorentzVector Get4Momentum() const
static G4IonTable * GetIonTable()
Definition: G4IonTable.hh:80
G4double GetKineticEnergy() const
void SampleAndUpdate(G4ReactionProduct &aNeutron)
G4NeutronHPAngular * theAngularDistribution[51]
G4double GetTotalEnergy() const
G4double GetPDGMass() const
G4double GetLevelEnergy(G4int aLevel)
G4NeutronHPPhotonDist * theFinalStatePhotons[51]
void SetDefinition(G4ParticleDefinition *aParticleDefinition)
double mag2() const
G4ThreeVector GetMomentum() const
G4double GetTemperature() const
Definition: G4Material.hh:180
const G4Material * GetMaterial() const
G4ReactionProductVector * Sample(G4double anEnergy)
G4ReactionProductVector * GetDecayGammas(G4int aLevel)
double G4double
Definition: G4Types.hh:76
void InitDistributionInitialState(G4ReactionProduct &aNeutron, G4ReactionProduct &aTarget, G4int it)
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
void adjust_final_state(G4LorentzVector)
G4double GetPDGCharge() const
G4double GetLevelEnergy()
G4double GetMass() const
void AddSecondary(G4DynamicParticle *aP)
virtual G4double G4NeutronHPInelasticCompFS::GetXsec ( G4double  anEnergy)
inlinevirtual

Reimplemented from G4NeutronHPFinalState.

Definition at line 78 of file G4NeutronHPInelasticCompFS.hh.

References G4INCL::Math::max(), and theXsection.

79  {
80  return std::max(0., theXsection[50]->GetY(anEnergy));
81  }
T max(const T t1, const T t2)
brief Return the largest of the two arguments
virtual G4NeutronHPVector* G4NeutronHPInelasticCompFS::GetXsec ( )
inlinevirtual

Reimplemented from G4NeutronHPFinalState.

Definition at line 82 of file G4NeutronHPInelasticCompFS.hh.

References theXsection.

Referenced by SelectExitChannel().

82 { return theXsection[50]; }
void G4NeutronHPInelasticCompFS::Init ( G4double  A,
G4double  Z,
G4int  M,
G4String dirName,
G4String aSFType 
)
virtual

Implements G4NeutronHPFinalState.

Reimplemented in G4NeutronHPNInelasticFS, G4NeutronHPPInelasticFS, and G4NeutronHPTInelasticFS.

Definition at line 79 of file G4NeutronHPInelasticCompFS.cc.

References python.hepunit::eV, G4cout, G4endl, gammaPath, G4NeutronHPManager::GetDataStream(), G4NeutronHPManager::GetInstance(), G4NeutronHPNames::GetName(), G4NeutronHPDataUsed::GetName(), G4NeutronHPFinalState::hasAnyData, G4NeutronHPFinalState::hasFSData, G4NeutronHPFinalState::hasXsec, G4NeutronHPEnAngCorrelation::Init(), G4NeutronHPAngular::Init(), G4NeutronHPEnergyDistribution::Init(), G4NeutronHPVector::Init(), G4NeutronHPPhotonDist::InitAngular(), G4NeutronHPPhotonDist::InitEnergies(), G4NeutronHPPhotonDist::InitMean(), G4NeutronHPPhotonDist::InitPartials(), LR, QI, G4NeutronHPFinalState::SetAZMs(), theAngularDistribution, theEnergyAngData, theEnergyDistribution, theFinalStatePhotons, G4NeutronHPFinalState::theNames, G4NeutronHPFinalState::theNDLDataA, G4NeutronHPFinalState::theNDLDataZ, theXsection, and G4INCL::CrossSections::total().

Referenced by G4NeutronHPAInelasticFS::Init(), G4NeutronHPTInelasticFS::Init(), G4NeutronHPPInelasticFS::Init(), G4NeutronHPNInelasticFS::Init(), G4NeutronHPHe3InelasticFS::Init(), and G4NeutronHPDInelasticFS::Init().

80 {
81  gammaPath = "/Inelastic/Gammas/";
82  if(!getenv("G4NEUTRONHPDATA"))
83  throw G4HadronicException(__FILE__, __LINE__, "Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files.");
84  G4String tBase = getenv("G4NEUTRONHPDATA");
85  gammaPath = tBase+gammaPath;
86  G4String tString = dirName;
87  G4bool dbool;
88  G4NeutronHPDataUsed aFile = theNames.GetName(static_cast<G4int>(A), static_cast<G4int>(Z), M, tString, aFSType, dbool);
89  G4String filename = aFile.GetName();
90  SetAZMs( A, Z, M, aFile );
91  //theBaseA = aFile.GetA();
92  //theBaseZ = aFile.GetZ();
93  //theNDLDataA = (int)aFile.GetA();
94  //theNDLDataZ = aFile.GetZ();
95  //if(!dbool || ( Z<2.5 && ( std::abs(theBaseZ - Z)>0.0001 || std::abs(theBaseA - A)>0.0001)))
96  if ( !dbool || ( Z<2.5 && ( std::abs(theNDLDataZ - Z)>0.0001 || std::abs(theNDLDataA - A)>0.0001)) )
97  {
98  if(getenv("NeutronHPNamesLogging")) G4cout << "Skipped = "<< filename <<" "<<A<<" "<<Z<<G4endl;
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  std::istringstream theData(std::ios::in);
108  G4NeutronHPManager::GetInstance()->GetDataStream(filename,theData);
109  if(!theData) //"!" is a operator of ios
110  {
111  hasAnyData = false;
112  hasFSData = false;
113  hasXsec = false;
114  //theData.close();
115  return;
116  }
117  // here we go
118  G4int infoType, dataType, dummy;
119  G4int sfType, it;
120  hasFSData = false;
121  while (theData >> infoType)
122  {
123  hasFSData = true;
124  theData >> dataType;
125  theData >> sfType >> dummy;
126  it = 50;
127  if(sfType>=600||(sfType<100&&sfType>=50)) it = sfType%50;
128  if(dataType==3)
129  {
130  //theData >> dummy >> dummy;
131  //TK110430
132  // QI and LR introudced since G4NDL3.15
133  G4double dqi;
134  G4int ilr;
135  theData >> dqi >> ilr;
136 
137  QI[ it ] = dqi*eV;
138  LR[ it ] = ilr;
139  theXsection[it] = new G4NeutronHPVector;
140  G4int total;
141  theData >> total;
142  theXsection[it]->Init(theData, total, eV);
143  //std::cout << theXsection[it]->GetXsec(1*MeV) << std::endl;
144  }
145  else if(dataType==4)
146  {
148  theAngularDistribution[it]->Init(theData);
149  }
150  else if(dataType==5)
151  {
153  theEnergyDistribution[it]->Init(theData);
154  }
155  else if(dataType==6)
156  {
158  theEnergyAngData[it]->Init(theData);
159  }
160  else if(dataType==12)
161  {
163  theFinalStatePhotons[it]->InitMean(theData);
164  }
165  else if(dataType==13)
166  {
168  theFinalStatePhotons[it]->InitPartials(theData);
169  }
170  else if(dataType==14)
171  {
172  theFinalStatePhotons[it]->InitAngular(theData);
173  }
174  else if(dataType==15)
175  {
176  theFinalStatePhotons[it]->InitEnergies(theData);
177  }
178  else
179  {
180  throw G4HadronicException(__FILE__, __LINE__, "Data-type unknown to G4NeutronHPInelasticCompFS");
181  }
182  }
183  //theData.close();
184 }
static G4NeutronHPManager * GetInstance()
void Init(std::istream &aDataFile, G4int total, G4double ux=1., G4double uy=1.)
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 InitAngular(std::istream &aDataFile)
G4GLOB_DLL std::ostream G4cout
G4NeutronHPEnergyDistribution * theEnergyDistribution[51]
bool G4bool
Definition: G4Types.hh:79
void InitEnergies(std::istream &aDataFile)
void Init(std::istream &aDataFile)
G4NeutronHPEnAngCorrelation * theEnergyAngData[51]
G4NeutronHPAngular * theAngularDistribution[51]
G4bool InitMean(std::istream &aDataFile)
G4double total(Particle const *const p1, Particle const *const p2)
G4NeutronHPPhotonDist * theFinalStatePhotons[51]
#define G4endl
Definition: G4ios.hh:61
void SetAZMs(G4double anA, G4double aZ, G4int aM, G4NeutronHPDataUsed used)
double G4double
Definition: G4Types.hh:76
void InitPartials(std::istream &aDataFile)
void Init(std::istream &aDataFile)
void G4NeutronHPInelasticCompFS::InitDistributionInitialState ( G4ReactionProduct aNeutron,
G4ReactionProduct aTarget,
G4int  it 
)
inline

Definition at line 85 of file G4NeutronHPInelasticCompFS.hh.

References G4NeutronHPAngular::SetNeutron(), G4NeutronHPEnAngCorrelation::SetNeutron(), G4NeutronHPAngular::SetTarget(), G4NeutronHPEnAngCorrelation::SetTarget(), theAngularDistribution, and theEnergyAngData.

Referenced by CompositeApply().

88  {
89  if(theAngularDistribution[it]!=0)
90  {
91  theAngularDistribution[it]->SetTarget(aTarget);
92  theAngularDistribution[it]->SetNeutron(aNeutron);
93  }
94  if(theEnergyAngData[it]!=0)
95  {
96  theEnergyAngData[it]->SetTarget(aTarget);
97  theEnergyAngData[it]->SetNeutron(aNeutron);
98  }
99  }
void SetNeutron(const G4ReactionProduct &aNeutron)
void SetTarget(G4ReactionProduct &aTarget)
void SetTarget(const G4ReactionProduct &aTarget)
void SetNeutron(G4ReactionProduct &aNeutron)
G4NeutronHPEnAngCorrelation * theEnergyAngData[51]
G4NeutronHPAngular * theAngularDistribution[51]
void G4NeutronHPInelasticCompFS::InitGammas ( G4double  AR,
G4double  ZR 
)

Definition at line 58 of file G4NeutronHPInelasticCompFS.cc.

References gammaPath, G4NeutronHPDeExGammas::Init(), and theGammas.

Referenced by G4NeutronHPAInelasticFS::Init(), G4NeutronHPTInelasticFS::Init(), G4NeutronHPPInelasticFS::Init(), G4NeutronHPNInelasticFS::Init(), G4NeutronHPHe3InelasticFS::Init(), and G4NeutronHPDInelasticFS::Init().

59 {
60  // char the[100] = {""};
61  // std::ostrstream ost(the, 100, std::ios::out);
62  // ost <<gammaPath<<"z"<<ZR<<".a"<<AR;
63  // G4String * aName = new G4String(the);
64  // std::ifstream from(*aName, std::ios::in);
65 
66  std::ostringstream ost;
67  ost <<gammaPath<<"z"<<ZR<<".a"<<AR;
68  G4String aName = ost.str();
69  std::ifstream from(aName, std::ios::in);
70 
71  if(!from) return; // no data found for this isotope
72  // std::ifstream theGammaData(*aName, std::ios::in);
73  std::ifstream theGammaData(aName, std::ios::in);
74 
75  theGammas.Init(theGammaData);
76  // delete aName;
77 }
void Init(std::istream &aDataFile)
virtual G4NeutronHPFinalState* G4NeutronHPInelasticCompFS::New ( )
pure virtual
G4int G4NeutronHPInelasticCompFS::SelectExitChannel ( G4double  eKinetic)

Definition at line 186 of file G4NeutronHPInelasticCompFS.cc.

References G4UniformRand, GetXsec(), G4INCL::Math::max(), and theXsection.

Referenced by CompositeApply().

187 {
188 
189 // it = 0 has without Photon
190  G4double running[50];
191  running[0] = 0;
192  unsigned int i;
193  for(i=0; i<50; i++)
194  {
195  if(i!=0) running[i]=running[i-1];
196  if(theXsection[i] != 0)
197  {
198  running[i] += std::max(0., theXsection[i]->GetXsec(eKinetic));
199  }
200  }
201  G4double random = G4UniformRand();
202  G4double sum = running[49];
203  G4int it = 50;
204  if(0!=sum)
205  {
206  G4int i0;
207  for(i0=0; i0<50; i0++)
208  {
209  it = i0;
210  if(random < running[i0]/sum) break;
211  }
212  }
213 //debug: it = 1;
214  return it;
215 }
virtual G4NeutronHPVector * GetXsec()
int G4int
Definition: G4Types.hh:78
#define G4UniformRand()
Definition: Randomize.hh:87
T max(const T t1, const T t2)
brief Return the largest of the two arguments
double G4double
Definition: G4Types.hh:76

Field Documentation

G4String G4NeutronHPInelasticCompFS::gammaPath
protected

Definition at line 111 of file G4NeutronHPInelasticCompFS.hh.

Referenced by Init(), and InitGammas().

std::vector<G4int > G4NeutronHPInelasticCompFS::LR
protected

Definition at line 118 of file G4NeutronHPInelasticCompFS.hh.

Referenced by G4NeutronHPInelasticCompFS(), and Init().

std::vector< G4double > G4NeutronHPInelasticCompFS::QI
protected

Definition at line 117 of file G4NeutronHPInelasticCompFS.hh.

Referenced by CompositeApply(), G4NeutronHPInelasticCompFS(), and Init().

G4NeutronHPAngular* G4NeutronHPInelasticCompFS::theAngularDistribution[51]
protected
G4double G4NeutronHPInelasticCompFS::theCurrentA
protected

Definition at line 113 of file G4NeutronHPInelasticCompFS.hh.

G4double G4NeutronHPInelasticCompFS::theCurrentZ
protected

Definition at line 114 of file G4NeutronHPInelasticCompFS.hh.

G4NeutronHPEnAngCorrelation* G4NeutronHPInelasticCompFS::theEnergyAngData[51]
protected
G4NeutronHPEnergyDistribution* G4NeutronHPInelasticCompFS::theEnergyDistribution[51]
protected
G4NeutronHPPhotonDist* G4NeutronHPInelasticCompFS::theFinalStatePhotons[51]
protected
G4NeutronHPDeExGammas G4NeutronHPInelasticCompFS::theGammas
protected

Definition at line 110 of file G4NeutronHPInelasticCompFS.hh.

Referenced by CompositeApply(), and InitGammas().

G4NeutronHPVector* G4NeutronHPInelasticCompFS::theXsection[51]
protected

The documentation for this class was generated from the following files: