72 std::ostringstream ost;
75 std::ifstream from(aName, std::ios::in);
79 std::ifstream theGammaData(aName, std::ios::in);
89 if(!std::getenv(
"G4NEUTRONHPDATA"))
90 throw G4HadronicException(__FILE__, __LINE__,
"Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files where Inelastic/Gammas data is found.");
91 G4String tBase = std::getenv(
"G4NEUTRONHPDATA");
98 if( std::getenv(
"G4ParticleHPDebug") )
G4cout <<
" G4ParticleHPInelasticCompFS::Init FILE " << filename <<
G4endl;
110 if(std::getenv(
"G4ParticleHPDebug_NamesLogging"))
G4cout <<
"Skipped = "<< filename <<
" "<<
A<<
" "<<
Z<<
G4endl;
120 std::istringstream theData(std::ios::in);
131 G4int infoType, dataType, dummy;
134 while (theData >> infoType)
138 theData >> sfType >> dummy;
140 if(sfType>=600||(sfType<100&&sfType>=50)) it = sfType%50;
148 theData >> dqi >> ilr;
174 else if(dataType==12)
179 else if(dataType==13)
184 else if(dataType==14)
188 else if(dataType==15)
194 throw G4HadronicException(__FILE__, __LINE__,
"Data-type unknown to G4ParticleHPInelasticCompFS");
209 if(i!=0) running[i]=running[i-1];
221 for(i0=0; i0<50; i0++)
225 if(random < running[i0]/sum)
break;
284 boosted.
Lorentz(incidReactionProduct, theTarget);
318 (targetMass - residualMass);
320 if ( availableEnergy < 0 )
325 G4int nothingWasKnownOnHadron = 0;
337 (aHadron.
GetMass()+residualMass));
346 if ( p2 > 0.0 ) p = std::sqrt( p );
369 if (
QI[it] < 0 || 849 <
QI[it] ) dqi =
QI[it];
374 G4int icounter_max=1024;
377 if ( icounter > icounter_max ) {
378 G4cout <<
"Loop-counter exceeded the threshold value at " << __LINE__ <<
"th line of " << __FILE__ <<
"." <<
G4endl;
382 }
while(eSecN>MaxEne);
385 eGamm = eKinetic-eSecN;
391 iLevel+=
G4int(random);
398 while (eKinetic-eExcitation < 0 && iLevel>0)
407 if (dqi < 0 || 849 < dqi) useQI =
true;
443 if (iLevel == -1) iLevel = 0;
451 if (!find) iLevel = imaxEx;
454 if(std::getenv(
"G4ParticleHPDebug") && eKinetic-eExcitation < 0)
456 throw G4HadronicException(__FILE__, __LINE__,
"SEVERE: InelasticCompFS: Consistency of data not good enough, please file report");
458 if(eKinetic-eExcitation < 0) eExcitation = 0;
477 theRestEnergy->
SetMomentum(eGamm*std::sin(std::acos(costh))*std::cos(phi),
478 eGamm*std::sin(std::acos(costh))*std::sin(phi),
481 thePhotons->push_back(theRestEnergy);
492 if ( theParticles != NULL ) {
497 for (
G4int j = 0 ; j != (
G4int)theParticles->size() ; j++ ) {
498 if ( theParticles->at(j)->GetDefinition()->GetBaryonNumber() >
maxA ) {
499 maxA = theParticles->at(j)->GetDefinition()->GetBaryonNumber();
502 sumA += theParticles->at(j)->GetDefinition()->GetBaryonNumber();
503 sumZ +=
G4int( theParticles->at(j)->GetDefinition()->GetPDGCharge() +
eps );
507 if ( dA < 0 || dZ < 0 ) {
508 G4int newA = theParticles->at(jAtMaxA)->GetDefinition()->GetBaryonNumber() + dA ;
509 G4int newZ =
G4int( theParticles->at(jAtMaxA)->GetDefinition()->GetPDGCharge() +
eps ) + dZ;
511 theParticles->at( jAtMaxA )->SetDefinition( pd );
520 nothingWasKnownOnHadron = 1;
534 boosted_tmp.
Lorentz(incidReactionProduct, theTarget);
539 if(thePhotons!=0 && thePhotons->size()!=0)
540 { aBaseEnergy-=thePhotons->operator[](0)->GetTotalEnergy(); }
546 G4bool foundMatchingLevel =
false;
549 for(
G4int j=1; j<it; j++)
559 G4double deltaE = std::abs(testEnergy-aBaseEnergy);
564 if ( thePhotons != NULL ) thePhotons->push_back(theNext->operator[](0));
565 aBaseEnergy = testEnergy-theNext->operator[](0)->GetTotalEnergy();
567 foundMatchingLevel =
true;
576 if(!foundMatchingLevel)
580 if ( thePhotons != NULL ) thePhotons->push_back(theNext->operator[](0));
581 aBaseEnergy = aBaseEnergy-theNext->operator[](0)->GetTotalEnergy();
590 for(i0=0; i0<thePhotons->size(); i0++)
593 thePhotons->operator[](i0)->Lorentz(*(thePhotons->operator[](i0)), -1.*theTarget);
597 if (nothingWasKnownOnHadron)
609 if(thePhotons==0 && eExcitation>0){
662 G4int nSecondaries = 2;
663 G4bool needsSeparateRecoil =
false;
664 G4int totalBaryonNumber = 0;
665 G4int totalCharge = 0;
667 if(theParticles != 0)
669 nSecondaries = theParticles->size();
672 for(ii0=0; ii0<theParticles->size(); ii0++)
674 aDef = theParticles->operator[](ii0)->GetDefinition();
677 totalMomentum += theParticles->operator[](ii0)->GetMomentum();
681 needsSeparateRecoil =
true;
691 if(thePhotons!=0) { nPhotons = thePhotons->size(); }
692 nSecondaries += nPhotons;
696 if( theParticles==0 )
706 aHadron.
Lorentz(aHadron, theTarget);
709 ->GetIon(
static_cast<G4int>(residualZ),
static_cast<G4int>(residualA), 0));
717 theResidual.
Lorentz(theResidual, -1.*theTarget);
721 for(i=0; i<nPhotons; i++)
723 totalPhotonMomentum += thePhotons->operator[](i)->GetMomentum();
736 for(i0=0; i0<theParticles->size(); i0++)
739 theSec->
SetDefinition(theParticles->operator[](i0)->GetDefinition());
740 theSec->
SetMomentum(theParticles->operator[](i0)->GetMomentum());
745 delete theParticles->operator[](i0);
748 if(needsSeparateRecoil && residualZ!=0)
754 resiualKineticEnergy += totalMomentum*totalMomentum;
755 resiualKineticEnergy = std::sqrt(resiualKineticEnergy) - theResidual.
GetMass();
778 for(i=0; i<nPhotons; i++)
783 theSec->
SetDefinition( thePhotons->operator[](i)->GetDefinition() );
785 theSec->
SetMomentum(thePhotons->operator[](i)->GetMomentum());
791 delete thePhotons->operator[](i);
833 theCMSproj.
Lorentz(*proj,theCMS);
834 theCMStarg.
Lorentz(*targ,theCMS);
839 G4double fmomsquared=1./4./totE/totE*(totE*totE-(prodmass-resmass)*(prodmass-resmass))*(totE*totE-(prodmass+resmass)*(prodmass+resmass));
842 fmom=std::sqrt(fmomsquared);
850 product->
SetMomentum(fmom*sinth*std::cos(phi),fmom*sinth*std::sin(phi),fmom*cosTh);
853 product->
Lorentz(*product,-1.*theCMS);
895 for (
G4int j=0; j<4; j++ )
897 theProds[j].
Lorentz(theProds[j], -1.*theTarget);
935 for (
G4int j=0; j<2; j++ )
938 theProds[j].
Lorentz(theProds[j], -1.*theTarget);
949 G4Exception(
"G4ParticleHPInelasticCompFS::CompositeApply()",
"G4ParticleInelasticCompFS.cc",
FatalException,
"Alpha production with LR!=0.");
static const G4double eps
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::vector< G4ReactionProduct * > G4ReactionProductVector
static constexpr double keV
static constexpr double MeV
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 * Neutron()
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 Init(std::istream &aDataFile)
void SampleAndUpdate(G4ReactionProduct &anIncidentParticle)
G4ParticleHPLevel * GetLevel(G4int i)
G4ReactionProductVector * GetDecayGammas(G4int aLevel)
G4int GetNumberOfLevels()
G4double GetLevelEnergy(G4int aLevel)
void Init(std::istream &aDataFile)
void Init(std::istream &aDataFile)
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 InitDistributionInitialState(G4ReactionProduct &anIncidentPart, G4ReactionProduct &aTarget, G4int it)
G4int SelectExitChannel(G4double eKinetic)
void CompositeApply(const G4HadProjectile &theTrack, G4ParticleDefinition *aHadron)
G4ParticleHPAngular * theAngularDistribution[51]
void InitGammas(G4double AR, G4double ZR)
G4NRESP71M03 nresp71_model
void Init(G4double A, G4double Z, G4int M, G4String &dirName, G4String &aSFType, G4ParticleDefinition *)
G4ParticleHPEnergyDistribution * theEnergyDistribution[51]
G4ParticleHPEnAngCorrelation * theEnergyAngData[51]
virtual G4ParticleHPVector * GetXsec()
G4ParticleHPPhotonDist * theFinalStatePhotons[51]
void two_body_reaction(G4ReactionProduct *proj, G4ReactionProduct *targ, G4ReactionProduct *product, G4double resExcitationEnergy)
G4ParticleHPDeExGammas theGammas
std::vector< G4double > QI
G4ParticleHPVector * theXsection[51]
G4bool use_nresp71_model(const G4ParticleDefinition *aDefinition, const G4int it, const G4ReactionProduct &theTarget, G4ReactionProduct &boosted)
G4double GetLevelEnergy()
static G4ParticleHPManager * GetInstance()
void GetDataStream(G4String, std::istringstream &iss)
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)
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)
static constexpr double keV
static constexpr double twopi
static constexpr double eV
G4double total(Particle const *const p1, Particle const *const p2)
T max(const T t1, const T t2)
brief Return the largest of the two arguments