66 std::ostringstream ost;
69 std::ifstream from(aName, std::ios::in);
72 std::ifstream theGammaData(aName, std::ios::in);
81 throw G4HadronicException(__FILE__, __LINE__,
"Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files where Inelastic/Gammas data is found.");
89 if( std::getenv(
"G4ParticleHPDebug") )
G4cout <<
" G4ParticleHPInelasticCompFS::Init FILE " << filename <<
G4endl;
97 if(std::getenv(
"G4ParticleHPDebug_NamesLogging"))
G4cout <<
"Skipped = "<< filename <<
" "<<
A<<
" "<<
Z<<
G4endl;
104 std::istringstream theData(std::ios::in);
115 G4int infoType, dataType, dummy;
118 while (theData >> infoType)
122 theData >> sfType >> dummy;
124 if(sfType>=600||(sfType<100&&sfType>=50)) it = sfType%50;
132 theData >> dqi >> ilr;
134 QI[ it ] = dqi*CLHEP::eV;
158 else if(dataType==12)
163 else if(dataType==13)
168 else if(dataType==14)
172 else if(dataType==15)
178 throw G4HadronicException(__FILE__, __LINE__,
"Data-type unknown to G4ParticleHPInelasticCompFS");
191 if(i!=0) running[i]=running[i-1];
203 for(i0=0; i0<50; ++i0)
206 if(random < running[i0]/sum)
break;
235 if( std::getenv(
"G4ParticleHPDebug"))
236 G4cout <<
this <<
" G4ParticleHPInelasticCompFS::CompositeApply A "
259 boosted.
Lorentz(incidReactionProduct, theTarget);
281 if ( use_nresp71_model( aDefinition , it , theTarget , boosted ) )
return;
292 (targetMass - residualMass);
294 if ( availableEnergy < 0 )
298 G4int nothingWasKnownOnHadron = 0;
309 (aHadron.
GetMass()+residualMass));
339 if (
QI[it] < 0 || 849 <
QI[it] ) dqi =
QI[it];
344 G4int icounter_max=1024;
347 if ( icounter > icounter_max ) {
348 G4cout <<
"Loop-counter exceeded the threshold value at " << __LINE__ <<
"th line of " << __FILE__ <<
"." <<
G4endl;
352 }
while(eSecN>MaxEne);
355 eGamm = eKinetic-eSecN;
361 iLevel+=
G4int(random);
368 while (eKinetic-eExcitation < 0 && iLevel>0)
377 if (dqi < 0 || 849 < dqi) useQI =
true;
386 eExcitation = std::max(0.,
QI[0] -
QI[it]);
392 G4double level_tolerance = 1.0*CLHEP::keV;
413 if (iLevel == -1) iLevel = 0;
421 if (!find) iLevel = imaxEx;
424 if(std::getenv(
"G4ParticleHPDebug") && eKinetic-eExcitation < 0)
426 throw G4HadronicException(__FILE__, __LINE__,
"SEVERE: InelasticCompFS: Consistency of data not good enough, please file report");
428 if(eKinetic-eExcitation < 0) eExcitation = 0;
445 theRestEnergy->
SetMomentum(eGamm*std::sin(std::acos(costh))*std::cos(phi),
446 eGamm*std::sin(std::acos(costh))*std::sin(phi),
449 thePhotons->push_back(theRestEnergy);
459 if ( theParticles != NULL ) {
464 for (
G4int j = 0 ; j != (
G4int)theParticles->size() ; ++j ) {
465 if ( theParticles->at(j)->GetDefinition()->GetBaryonNumber() > maxA ) {
466 maxA = theParticles->at(j)->GetDefinition()->GetBaryonNumber();
469 sumA += theParticles->at(j)->GetDefinition()->GetBaryonNumber();
470 sumZ +=
G4int( theParticles->at(j)->GetDefinition()->GetPDGCharge() + eps );
474 if ( dA < 0 || dZ < 0 ) {
475 G4int newA = theParticles->at(jAtMaxA)->GetDefinition()->GetBaryonNumber() + dA ;
476 G4int newZ =
G4int( theParticles->at(jAtMaxA)->GetDefinition()->GetPDGCharge() + eps ) + dZ;
478 theParticles->at( jAtMaxA )->SetDefinition( pd );
485 nothingWasKnownOnHadron = 1;
493 boosted_tmp.
Lorentz(incidReactionProduct, theTarget);
498 if(thePhotons!=0 && thePhotons->size()!=0)
499 { aBaseEnergy-=thePhotons->operator[](0)->GetTotalEnergy(); }
502 while(aBaseEnergy>0.01*CLHEP::keV)
505 G4bool foundMatchingLevel =
false;
508 for(
G4int j=1; j<it; ++j)
518 G4double deltaE = std::abs(testEnergy-aBaseEnergy);
519 if(deltaE<0.1*CLHEP::keV)
523 if ( thePhotons !=
nullptr )
524 thePhotons->push_back(theNext->operator[](0));
525 aBaseEnergy = testEnergy-theNext->operator[](0)->GetTotalEnergy();
527 foundMatchingLevel =
true;
536 if(!foundMatchingLevel)
540 if ( thePhotons !=
nullptr )
541 thePhotons->push_back(theNext->operator[](0));
542 aBaseEnergy = aBaseEnergy-theNext->operator[](0)->GetTotalEnergy();
551 for(i0=0; i0<thePhotons->size(); ++i0)
554 thePhotons->operator[](i0)->Lorentz(*(thePhotons->operator[](i0)), -1.*theTarget);
557 if (nothingWasKnownOnHadron)
568 two_body_reaction(&incidReactionProduct,&theTarget,&aHadron,eExcitation);
569 if(thePhotons==0 && eExcitation>0){
586 G4bool needsSeparateRecoil =
false;
587 G4int totalBaryonNumber = 0;
588 G4int totalCharge = 0;
590 if(theParticles != 0)
594 for(ii0=0; ii0<theParticles->size(); ++ii0)
596 aDef = theParticles->operator[](ii0)->GetDefinition();
599 totalMomentum += theParticles->operator[](ii0)->GetMomentum();
603 needsSeparateRecoil =
true;
611 std::size_t nPhotons = 0;
612 if(thePhotons!=0) { nPhotons = thePhotons->size(); }
616 if( theParticles==0 )
623 if( std::getenv(
"G4ParticleHPDebug"))
624 G4cout <<
this <<
" G4ParticleHPInelasticCompFS::BaseApply add secondary1 "
630 aHadron.
Lorentz(aHadron, theTarget);
633 ->GetIon(
static_cast<G4int>(residualZ),
static_cast<G4int>(residualA), 0));
641 theResidual.
Lorentz(theResidual, -1.*theTarget);
645 for(i=0; i<(
G4int)nPhotons; ++i)
647 totalPhotonMomentum += thePhotons->operator[](i)->GetMomentum();
655 if( std::getenv(
"G4ParticleHPDebug"))
657 <<
" G4ParticleHPInelasticCompFS::BaseApply add secondary2 "
665 for(i0=0; i0<theParticles->size(); ++i0)
668 theSec->
SetDefinition(theParticles->operator[](i0)->GetDefinition());
669 theSec->
SetMomentum(theParticles->operator[](i0)->GetMomentum());
672 if( std::getenv(
"G4ParticleHPDebug"))
674 <<
" G4ParticleHPInelasticCompFS::BaseApply add secondary3 "
679 delete theParticles->operator[](i0);
682 if(needsSeparateRecoil && residualZ!=0)
688 resiualKineticEnergy += totalMomentum*totalMomentum;
689 resiualKineticEnergy = std::sqrt(resiualKineticEnergy) - theResidual.
GetMass();
704 if( std::getenv(
"G4ParticleHPDebug"))
706 <<
" G4ParticleHPInelasticCompFS::BaseApply add secondary4 "
715 for(i=0; i<(
G4int)nPhotons; ++i)
720 theSec->
SetDefinition( thePhotons->operator[](i)->GetDefinition() );
722 theSec->
SetMomentum(thePhotons->operator[](i)->GetMomentum());
725 if( std::getenv(
"G4ParticleHPDebug"))
727 <<
" G4ParticleHPInelasticCompFS::BaseApply add secondary5 "
733 delete thePhotons->operator[](i);
772 theCMSproj.
Lorentz(*proj,theCMS);
773 theCMStarg.
Lorentz(*targ,theCMS);
778 G4double fmomsquared=1./4./totE/totE*(totE*totE-(prodmass-resmass)*(prodmass-resmass))*(totE*totE-(prodmass+resmass)*(prodmass+resmass));
781 fmom=std::sqrt(fmomsquared);
789 product->
SetMomentum(fmom*sinth*std::cos(phi),fmom*sinth*std::sin(phi),fmom*cosTh);
792 product->
Lorentz(*product,-1.*theCMS);
810 theCarbon.SetKineticEnergy(0.);
832 for (
G4int j=0; j<4; ++j )
834 theProds[j].
Lorentz(theProds[j], -1.*theTarget);
853 theCarbon.SetKineticEnergy(0.);
862 for (
G4int j=0; j<2; ++j )
865 theProds[j].
Lorentz(theProds[j], -1.*theTarget);
876 G4Exception(
"G4ParticleHPInelasticCompFS::CompositeApply()",
878 "Alpha production with LR!=0.");
const char * G4FindDataDir(const char *)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
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 * 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)
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]
G4ParticleHPDeExGammas theGammas
std::vector< G4double > QI
G4ParticleHPVector * theXsection[51]
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)