52 std::ostringstream ost;
55 std::ifstream from(aName, std::ios::in);
58 std::ifstream theGammaData(aName, std::ios::in);
71 throw G4HadronicException(__FILE__, __LINE__,
"Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files where Inelastic/Gammas data is found.");
79 if( std::getenv(
"G4ParticleHPDebug") )
G4cout <<
" G4ParticleHPInelasticBaseFS::Init FILE " << filename <<
G4endl;
86 if(std::getenv(
"G4ParticleHPDebug_NamesLogging"))
G4cout <<
"Skipped = "<< filename <<
" "<<
A<<
" "<<
Z<<
G4endl;
94 std::istringstream theData(std::ios::in);
108 while (theData >> infoType)
141 else if(dataType==12)
147 else if(dataType==13)
153 else if(dataType==14)
158 else if(dataType==15)
165 throw G4HadronicException(__FILE__, __LINE__,
"Data-type unknown to G4ParticleHPInelasticBaseFS");
197 if ( targetMass == 0 )
214 boosted.
Lorentz(incidReactionProduct, theTarget);
224 for(ii=0; ii<nDef; ++ii)
230 if(Qvalue<1.*CLHEP::keV && Qvalue>-1.*CLHEP::keV) {
236 for (ii = 0; ii < nDef; ++ii) {
241 if (ResidualA > 0 && ResidualZ > 0) {
246 if (
Qvalue > 400*CLHEP::MeV ||
Qvalue < -400*CLHEP::MeV) {
253 thePhaseSpaceDistribution.
Init(aPhaseMass, nDef);
255 thePhaseSpaceDistribution.
SetTarget(&theTarget);
258 for(ii=0; ii<nDef; ++ii)
260 G4double massCode = 1000.*std::abs(theDefs[ii]->GetPDGCharge());
264 aSec->
Lorentz(*aSec, -1.*theTarget);
271 if( std::getenv(
"G4ParticleHPDebug"))
273 <<
" G4ParticleHPInelasticBaseFS::BaseApply NoFSData add secondary "
316 if ( tmpHadrons !=
nullptr ) {
321 for (
G4int j = 0 ; j != (
G4int)tmpHadrons->size() ; ++j ) {
323 if ( tmpHadrons->at(j)->GetDefinition()->GetBaryonNumber() > maxA ) {
324 maxA = tmpHadrons->at(j)->GetDefinition()->GetBaryonNumber();
327 sumA += tmpHadrons->at(j)->GetDefinition()->GetBaryonNumber();
328 sumZ +=
G4int( tmpHadrons->at(j)->GetDefinition()->GetPDGCharge() + eps );
332 if ( dA < 0 || dZ < 0 ) {
333 G4int newA = tmpHadrons->at(jAtMaxA)->GetDefinition()->GetBaryonNumber() + dA ;
334 G4int newZ =
G4int( tmpHadrons->at(jAtMaxA)->GetDefinition()->GetPDGCharge() + eps ) + dZ;
335 if(newA>newZ && newZ>0){
337 tmpHadrons->at( jAtMaxA )->SetDefinition( pd );
347 for(i0=0; i0<nDef; ++i0) Done[i0] =
false;
353 for(i0=0; i0<nDef; ++i0)
375 throw G4HadronicException(__FILE__, __LINE__,
"No energy distribution to sample from in InelasticBaseFS::BaseApply");
388 G4double availableEnergy = eKinetic+massn+localMass-mass1-mass2-concreteMass;
390 G4double emin = availableEnergy+mass1+mass2 - std::sqrt((mass1+mass2)*(mass1+mass2)+orgMomentum*orgMomentum);
391 G4double p1=std::sqrt(2.*mass2*emin);
394 if(std::getenv(
"G4ParticleHPDebug"))
396 G4cout <<
"G4ParticleHPInelasticBaseFS "<<z1<<
" "<<
theBaseZ<<
" "<<a1<<
" "<<
theBaseA<<
" "<<availableEnergy<<
" "
403 bufferedDirection = -bufferedDirection;
407 if(std::getenv(
"G4ParticleHPDebug"))
409 G4cout <<
" G4ParticleHPInelasticBaseFS "<<bufferedDirection.
mag2()<<
G4endl;
413 +bufferedDirection.
mag2()) );
415 aHadron->
Lorentz(*aHadron, -1.*(theTarget+incidReactionProduct));
417 if(std::getenv(
"G4ParticleHPDebug"))
423 tmpHadrons->push_back(aHadron);
433 throw G4HadronicException(__FILE__, __LINE__,
"No data to create the neutrons in NInelasticFS");
441 boosted_tmp.
Lorentz(incidReactionProduct, theTarget);
446 for(i=0; i<thePhotons->size(); ++i)
449 thePhotons->operator[](i)->Lorentz(*(thePhotons->operator[](i)), -1.*theTarget);
457 G4bool bAdjustPhotons =
true;
459 bAdjustPhotons =
true;
462 bAdjustPhotons =
false;
465 if( bAdjustPhotons ) {
468 theGammaEnergy = anEnergy-theGammaEnergy;
478 for(i=0; i<tmpHadrons->size(); i++)
482 eBindProducts+=eBindN;
486 eBindProducts+=eBindP;
490 eBindProducts+=eBindD;
494 eBindProducts+=eBindT;
496 else if(tmpHadrons->operator[](i)->GetDefinition() ==
G4He3::He3())
498 eBindProducts+=eBindHe3;
500 else if(tmpHadrons->operator[](i)->GetDefinition() ==
G4Alpha::Alpha())
502 eBindProducts+=eBindA;
507 theGammaEnergy += eBindProducts;
510 if( std::getenv(
"G4ParticleHPDebug"))
G4cout <<
" G4ParticleHPInelasticBaseFS::BaseApply gamma Energy " << theGammaEnergy <<
" eBindProducts " << eBindProducts <<
G4endl;
522 theGammaEnergy -= (2*eBindA);
538 if( std::getenv(
"G4ParticleHPDebug"))
539 G4cout <<
" G4ParticleHPInelasticBaseFS::BaseApply adding gamma from level "
541 << theOtherPhotons->operator[](ii)->GetKineticEnergy(
550 if(random > (eHigh-eLow)/(theGammaEnergy-eLow)) iLevel++;
554 if(theOtherPhotons != 0)
556 for(std::size_t iii=0; iii<theOtherPhotons->size(); ++iii)
558 thePhotons->push_back(theOtherPhotons->operator[](iii));
560 if( std::getenv(
"G4ParticleHPDebug"))
561 G4cout << iii <<
" G4ParticleHPInelasticBaseFS::BaseApply adding gamma " << theOtherPhotons->operator[](iii)->GetKineticEnergy() <<
G4endl;
564 delete theOtherPhotons;
567 if(iLevel == -1)
break;
573 std::size_t nSecondaries = tmpHadrons->size();
574 std::size_t nPhotons = 0;
575 if(thePhotons!=0) { nPhotons = thePhotons->size(); }
576 nSecondaries += nPhotons;
579 if( std::getenv(
"G4ParticleHPDebug"))
580 G4cout <<
" G4ParticleHPInelasticBaseFS::BaseApply N hadrons "
581 << nSecondaries-nPhotons <<
G4endl;
584 for(i=0; i<nSecondaries-nPhotons; ++i)
587 theSec->
SetDefinition(tmpHadrons->operator[](i)->GetDefinition());
588 theSec->
SetMomentum(tmpHadrons->operator[](i)->GetMomentum());
593 delete tmpHadrons->operator[](i);
596 if( std::getenv(
"G4ParticleHPDebug"))
G4cout <<
" G4ParticleHPInelasticBaseFS::BaseApply N photons " << nPhotons <<
G4endl;
600 for(i=0; i<nPhotons; ++i)
603 theSec->
SetDefinition(thePhotons->operator[](i)->GetDefinition());
604 theSec->
SetMomentum(thePhotons->operator[](i)->GetMomentum());
609 delete thePhotons->operator[](i);
const char * G4FindDataDir(const char *)
std::vector< G4ReactionProduct * > G4ReactionProductVector
G4GLOB_DLL std::ostream G4cout
void Put(const value_type &val) const
static G4Deuteron * Deuteron()
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
const G4ParticleDefinition * GetParticleDefinition() const
G4double GetKineticEnergy() const
void SetMomentum(const G4ThreeVector &momentum)
void SetStatusChange(G4HadFinalStateStatus aS)
void AddSecondary(G4DynamicParticle *aP, G4int mod=-1)
std::size_t GetNumberOfSecondaries() const
const G4Material * GetMaterial() const
const G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
const G4LorentzVector & Get4Momentum() const
G4ParticleDefinition * GetIon(G4int Z, G4int A, G4int lvl=0)
static G4IonTable * GetIonTable()
G4double GetTemperature() const
static G4Neutron * Neutron()
static G4double GetBindingEnergy(const G4int A, const G4int Z)
static G4double GetNuclearMass(const G4double A, const G4double Z)
G4ReactionProduct GetBiasedThermalNucleus(G4double aMass, G4ThreeVector aVelocity, G4double temp=-1) const
G4int GetAtomicNumber() const
G4double GetPDGMass() const
G4double GetPDGCharge() const
G4int GetBaryonNumber() const
const G4String & GetParticleName() const
void SetTarget(const G4ReactionProduct &aTarget)
void SetProjectileRP(const G4ReactionProduct &anIncidentParticleRP)
void Init(std::istream &aDataFile)
void SampleAndUpdate(G4ReactionProduct &anIncidentParticle)
G4ReactionProductVector * GetDecayGammas(G4int aLevel)
G4int GetNumberOfLevels()
G4double GetLevelEnergy(G4int aLevel)
void Init(std::istream &aDataFile)
void Init(std::istream &aDataFile)
void SetProjectileRP(G4ReactionProduct &aIncidentPart)
G4double GetTotalMeanEnergy()
void SetTarget(G4ReactionProduct &aTarget)
G4ReactionProductVector * Sample(G4double anEnergy)
void Init(std::istream &theData)
G4double Sample(G4double anEnergy, G4int &it)
void SetAZMs(G4double anA, G4double aZ, G4int aM, G4ParticleHPDataUsed used)
G4ParticleDefinition * theProjectile
G4Cache< G4HadFinalState * > theResult
void adjust_final_state(G4LorentzVector)
G4ParticleHPNames theNames
void BaseApply(const G4HadProjectile &theTrack, G4ParticleDefinition **theDefs, G4int nDef)
void InitGammas(G4double AR, G4double ZR)
void Init(G4double A, G4double Z, G4int M, G4String &dirName, G4String &bit, G4ParticleDefinition *)
G4ParticleHPEnergyDistribution * theEnergyDistribution
G4ParticleHPPhotonDist * theFinalStatePhotons
G4double theNuclearMassDifference
G4ParticleHPAngular * theAngularDistribution
G4ParticleHPVector * theXsection
G4ParticleHPDeExGammas theGammas
G4ParticleHPEnAngCorrelation * theEnergyAngData
static G4ParticleHPManager * GetInstance()
G4bool GetDoNotAdjustFinalState()
void GetDataStream(G4String, std::istringstream &iss)
G4ReactionProduct * Sample(G4double anEnergy, G4double massCode, G4double mass)
void Init(G4double aMass, G4int aCount)
G4ParticleHPDataUsed GetName(G4int A, G4int Z, G4String base, G4String rest, G4bool &active)
void InitEnergies(std::istream &aDataFile)
G4ReactionProductVector * GetPhotons(G4double anEnergy)
void InitAngular(std::istream &aDataFile)
void InitPartials(std::istream &aDataFile, G4ParticleHPVector *theXsec=0)
G4bool InitMean(std::istream &aDataFile)
void Init(std::istream &aDataFile, G4int total, G4double ux=1., G4double uy=1.)
static G4Proton * Proton()
void SetMomentum(const G4double x, const G4double y, const G4double z)
void SetTotalEnergy(const G4double en)
G4double GetKineticEnergy() const
const G4ParticleDefinition * GetDefinition() const
G4double GetTotalEnergy() const
G4ThreeVector GetMomentum() const
void Lorentz(const G4ReactionProduct &p1, const G4ReactionProduct &p2)
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
void SetKineticEnergy(const G4double en)
static G4Triton * Triton()
void SetProjectileRP(G4ReactionProduct *aIncidentParticleRP)
void SetTarget(G4ReactionProduct *aTarget)
void SetQValue(G4double aValue)