77 for (
G4int i = 0; i < 51; ++i) {
91 for (
G4int i = 0; i < 51; ++i) {
118 std::ostringstream ost;
121 std::ifstream from(aName, std::ios::in);
124 std::ifstream theGammaData(aName, std::ios::in);
142 G4cout <<
" G4ParticleHPInelasticCompFS::Init FILE " << filename <<
G4endl;
151 G4cout <<
"Skipped = " << filename <<
" " <<
A <<
" " << Z <<
G4endl;
158 std::istringstream theData(std::ios::in);
168 G4int infoType, dataType, dummy;
171 while (theData >> infoType)
175 theData >> sfType >> dummy;
177 if (sfType >= 600 || (sfType < 100 && sfType >= 50))
183 theData >> dqi >> ilr;
185 QI[it] = dqi * CLHEP::eV;
192 else if (dataType == 4) {
196 else if (dataType == 5) {
200 else if (dataType == 6) {
205 else if (dataType == 12) {
209 else if (dataType == 13) {
213 else if (dataType == 14) {
216 else if (dataType == 15) {
224 ed,
"Data-type unknown");
234 for (i = 0; i < 50; ++i) {
235 if (i != 0) running[i] = running[i - 1];
245 for (i0 = 0; i0 < 50; ++i0) {
247 if (random < running[i0] / sum)
break;
267 for (
G4int i = 0; i < 50; ++i) {
276 G4cout <<
"G4ParticleHPInelasticCompFS::CompositeApply A=" <<
theBaseA <<
" Z="
302 boosted.
Lorentz(incidReactionProduct, theTarget);
328 if (use_nresp71_model(aDefinition, it, theTarget, boosted))
return;
340 + (targetMass - residualMass);
342 if (availableEnergy < 0) {
345 G4int nothingWasKnownOnHadron = 0;
359 G4double p = (p2 > 0.0) ? std::sqrt(p2) : 0.0;
379 if (
QI[it] < 0 || 849 <
QI[it])
385 G4int icounter_max = 1024;
389 if (icounter > icounter_max) {
390 G4cout <<
"Loop-counter exceeded the threshold value at " << __LINE__ <<
"th line of "
391 << __FILE__ <<
"." <<
G4endl;
395 }
while (eSecN > MaxEne);
398 eGamm = eKinetic - eSecN;
399 for (iLevel = imaxEx; iLevel >= 0; --iLevel) {
402 if (iLevel < imaxEx && iLevel >= 0) {
410 for (iLevel = imaxEx; iLevel >= 0; --iLevel) {
417 if (dqi < 0 || 849 < dqi) useQI =
true;
420 eExcitation = std::max(0.,
QI[0] -
QI[it]);
425 const G4double level_tolerance = 1.0 * CLHEP::keV;
429 for (iLevel = 1; iLevel <= imaxEx; ++iLevel) {
431 if (std::abs(eExcitation - elevel) < level_tolerance) {
435 if (eExcitation < elevel) {
437 iLevel = std::max(iLevel - 1, 0);
443 if (!find) iLevel = imaxEx;
450 "SEVERE: InelasticCompFS: Consistency of data not good enough, please file report");
452 if (eKinetic - eExcitation < 0) eExcitation = 0;
467 if (theParticles !=
nullptr) {
472 for (
G4int j = 0; j != (
G4int)theParticles->size(); ++j) {
473 auto ptr = theParticles->at(j);
474 G4int barnum = ptr->GetDefinition()->GetBaryonNumber();
480 sumZ +=
G4lrint(ptr->GetDefinition()->GetPDGCharge()/CLHEP::eplus);
485 if (dA < 0 || dZ < 0) {
486 G4int newA = theParticles->at(jAtMaxA)->GetDefinition()->GetBaryonNumber() + dA;
488 G4lrint(theParticles->at(jAtMaxA)->GetDefinition()->GetPDGCharge()/CLHEP::eplus) + dZ;
490 theParticles->at(jAtMaxA)->SetDefinition(pd);
496 nothingWasKnownOnHadron = 1;
503 boosted_tmp.
Lorentz(incidReactionProduct, theTarget);
508 if (thePhotons !=
nullptr && !thePhotons->empty()) {
509 aBaseEnergy -= (*thePhotons)[0]->GetTotalEnergy();
512 while (aBaseEnergy > 0.01 * CLHEP::keV)
515 G4bool foundMatchingLevel =
false;
518 for (
G4int j = 1; j < it; ++j) {
525 G4double deltaE = std::abs(testEnergy - aBaseEnergy);
526 if (deltaE < 0.1 * CLHEP::keV) {
528 if (thePhotons !=
nullptr) thePhotons->push_back(theNext->operator[](0));
529 aBaseEnergy = testEnergy - theNext->operator[](0)->GetTotalEnergy();
531 foundMatchingLevel =
true;
539 if (!foundMatchingLevel) {
541 if (thePhotons !=
nullptr) thePhotons->push_back(theNext->operator[](0));
542 aBaseEnergy = aBaseEnergy - theNext->operator[](0)->GetTotalEnergy();
549 if (thePhotons !=
nullptr) {
550 for (
auto const & p : *thePhotons) {
552 p->Lorentz(*p, -1. * theTarget);
555 if (nothingWasKnownOnHadron != 0) {
565 two_body_reaction(&incidReactionProduct, &theTarget, &aHadron, eExcitation);
566 if (thePhotons ==
nullptr && eExcitation > 0) {
567 for (iLevel = imaxEx; iLevel >= 0; --iLevel) {
582 G4bool needsSeparateRecoil =
false;
583 G4int totalBaryonNumber = 0;
584 G4int totalCharge = 0;
586 if (theParticles !=
nullptr) {
588 for (std::size_t ii0 = 0; ii0 < theParticles->size(); ++ii0) {
589 aDef = (*theParticles)[ii0]->GetDefinition();
592 totalMomentum += (*theParticles)[ii0]->GetMomentum();
594 if (totalBaryonNumber
597 needsSeparateRecoil =
true;
605 std::size_t nPhotons = 0;
606 if (thePhotons !=
nullptr) {
607 nPhotons = thePhotons->size();
612 if (theParticles ==
nullptr) {
619 G4cout <<
" G4ParticleHPInelasticCompFS::BaseApply add secondary1 "
625 aHadron.
Lorentz(aHadron, theTarget);
636 theResidual.
Lorentz(theResidual, -1. * theTarget);
638 if (thePhotons !=
nullptr) {
639 for (std::size_t i = 0; i < nPhotons; ++i) {
640 totalPhotonMomentum += (*thePhotons)[i]->GetMomentum();
649 G4cout <<
this <<
" G4ParticleHPInelasticCompFS::BaseApply add secondary2 "
656 for (std::size_t i0 = 0; i0 < theParticles->size(); ++i0) {
659 theSec->
SetMomentum((*theParticles)[i0]->GetMomentum());
663 G4cout <<
" G4ParticleHPInelasticCompFS::BaseApply add secondary3 "
668 delete (*theParticles)[i0];
671 if (needsSeparateRecoil && residualZ != 0) {
675 resiualKineticEnergy += totalMomentum * totalMomentum;
676 resiualKineticEnergy = std::sqrt(resiualKineticEnergy) - theResidual.
GetMass();
693 G4cout <<
" G4ParticleHPInelasticCompFS::BaseApply add secondary4 "
700 if (thePhotons !=
nullptr) {
701 for (std::size_t i = 0; i < nPhotons; ++i) {
707 theSec->
SetMomentum((*thePhotons)[i]->GetMomentum());
711 G4cout <<
" G4ParticleHPInelasticCompFS::BaseApply add secondary5 "
717 delete thePhotons->operator[](i);
760 theCMSproj.
Lorentz(*proj, theCMS);
761 theCMStarg.
Lorentz(*targ, theCMS);
769 G4double fmomsquared = (totE * totE - (prodmass - resmass) * (prodmass - resmass)) *
770 (totE * totE - (prodmass + resmass) * (prodmass + resmass)) / (4.*totE*totE);
771 G4double fmom = (fmomsquared > 0) ? std::sqrt(fmomsquared) : 0.0;
775 product->
SetTotalEnergy(std::sqrt(prodmass * prodmass + fmom * fmom));
777 product->
Lorentz(*product, -1. * theCMS);
799 theCarbon.SetKineticEnergy(0.);
819 for (
auto& theProd : theProds) {
820 theProd.Lorentz(theProd, -1. * theTarget);
841 theCarbon.SetKineticEnergy(0.);
850 for (
auto& theProd : theProds) {
852 theProd.Lorentz(theProd, -1. * theTarget);
861 G4Exception(
"G4ParticleHPInelasticCompFS::CompositeApply()",
"G4ParticleInelasticCompFS.cc",
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4ThreeVector G4RandomDirection()
std::vector< G4ReactionProduct * > G4ReactionProductVector
CLHEP::Hep3Vector G4ThreeVector
G4GLOB_DLL std::ostream G4cout
static G4Alpha * Definition()
void Put(const value_type &val) const
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
G4int ApplyMechanismABE(G4ReactionProduct &neut, G4ReactionProduct &carb, G4ReactionProduct *theProds)
G4int ApplyMechanismI_NBeA2A(G4ReactionProduct &neut, G4ReactionProduct &carb, G4ReactionProduct *theProds, const G4double QI)
G4int ApplyMechanismII_ACN2A(G4ReactionProduct &neut, G4ReactionProduct &carb, G4ReactionProduct *theProds, const G4double QI)
static G4Neutron * Definition()
static G4double GetNuclearMass(const G4double A, const G4double Z)
G4ReactionProduct GetBiasedThermalNucleus(G4double aMass, G4ThreeVector aVelocity, G4double temp=-1) 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 idx) const
G4double GetLevelEnergy(G4int idx) const
G4int GetNumberOfLevels() const
void Init(std::istream &aDataFile)
void Init(std::istream &aDataFile)
void SetProjectileRP(G4ReactionProduct &aIncidentPart)
void SetTarget(G4ReactionProduct &aTarget)
G4ReactionProductVector * Sample(G4double anEnergy)
void Init(std::istream &theData)
G4double Sample(G4double anEnergy, G4int &it)
void SetA_Z(G4double anA, G4double aZ, G4int aM=0)
G4ParticleHPManager * fManager
G4ParticleDefinition * theProjectile
G4Cache< G4HadFinalState * > theResult
void SetAZMs(G4ParticleHPDataUsed used)
void adjust_final_state(G4LorentzVector)
G4ParticleHPNames theNames
void InitDistributionInitialState(G4ReactionProduct &anIncidentPart, G4ReactionProduct &aTarget, G4int it)
G4int SelectExitChannel(G4double eKinetic)
void CompositeApply(const G4HadProjectile &theTrack, G4ParticleDefinition *aHadron)
G4ParticleHPAngular * theAngularDistribution[51]
void Init(G4double A, G4double Z, G4int M, G4String &dirName, G4String &aSFType, G4ParticleDefinition *) override
void InitGammas(G4double AR, G4double ZR)
G4ParticleHPEnergyDistribution * theEnergyDistribution[51]
G4ParticleHPVector * GetXsec() override
G4ParticleHPEnAngCorrelation * theEnergyAngData[51]
~G4ParticleHPInelasticCompFS() override
G4ParticleHPPhotonDist * theFinalStatePhotons[51]
G4ParticleHPDeExGammas theGammas
G4ParticleHPInelasticCompFS()
std::vector< G4double > QI
G4ParticleHPVector * theXsection[51]
const G4String & GetNeutronHPPath() const
void GetDataStream(const G4String &, std::istringstream &iss)
G4bool GetUseNRESP71Model() const
G4ParticleHPDataUsed GetName(G4int A, G4int Z, const G4String &base, const 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=nullptr)
G4bool InitMean(std::istream &aDataFile)
G4double GetLevelEnergy()
void Init(std::istream &aDataFile, G4int total, G4double ux=1., G4double uy=1.)
void SetMomentum(const G4double x, const G4double y, const G4double z)
void SetTotalEnergy(const G4double en)
G4double GetTotalMomentum() const
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)