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;
150 QI[ it ] = dqi*CLHEP::eV;
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);
307 if ( use_nresp71_model( aDefinition , it , theTarget , boosted ) )
return;
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;
413 eExcitation =
QI[0] -
QI[it];
414 if(eExcitation < 20*CLHEP::keV) eExcitation = 0;
420 G4double level_tolerance = 1.0*CLHEP::keV;
441 if (iLevel == -1) iLevel = 0;
449 if (!find) iLevel = imaxEx;
452 if(std::getenv(
"G4ParticleHPDebug") && eKinetic-eExcitation < 0)
454 throw G4HadronicException(__FILE__, __LINE__,
"SEVERE: InelasticCompFS: Consistency of data not good enough, please file report");
456 if(eKinetic-eExcitation < 0) eExcitation = 0;
475 theRestEnergy->
SetMomentum(eGamm*std::sin(std::acos(costh))*std::cos(phi),
476 eGamm*std::sin(std::acos(costh))*std::sin(phi),
479 thePhotons->push_back(theRestEnergy);
490 if ( theParticles != NULL ) {
495 for (
G4int j = 0 ; j != (
G4int)theParticles->size() ; j++ ) {
496 if ( theParticles->at(j)->GetDefinition()->GetBaryonNumber() > maxA ) {
497 maxA = theParticles->at(j)->GetDefinition()->GetBaryonNumber();
500 sumA += theParticles->at(j)->GetDefinition()->GetBaryonNumber();
501 sumZ +=
G4int( theParticles->at(j)->GetDefinition()->GetPDGCharge() + eps );
505 if ( dA < 0 || dZ < 0 ) {
506 G4int newA = theParticles->at(jAtMaxA)->GetDefinition()->GetBaryonNumber() + dA ;
507 G4int newZ =
G4int( theParticles->at(jAtMaxA)->GetDefinition()->GetPDGCharge() + eps ) + dZ;
509 theParticles->at( jAtMaxA )->SetDefinition( pd );
518 nothingWasKnownOnHadron = 1;
532 boosted_tmp.
Lorentz(incidReactionProduct, theTarget);
537 if(thePhotons!=0 && thePhotons->size()!=0)
538 { aBaseEnergy-=thePhotons->operator[](0)->GetTotalEnergy(); }
541 while(aBaseEnergy>0.01*CLHEP::keV)
544 G4bool foundMatchingLevel =
false;
547 for(
G4int j=1; j<it; j++)
557 G4double deltaE = std::abs(testEnergy-aBaseEnergy);
558 if(deltaE<0.1*CLHEP::keV)
562 if ( thePhotons != NULL ) thePhotons->push_back(theNext->operator[](0));
563 aBaseEnergy = testEnergy-theNext->operator[](0)->GetTotalEnergy();
565 foundMatchingLevel =
true;
574 if(!foundMatchingLevel)
578 if ( thePhotons != NULL ) thePhotons->push_back(theNext->operator[](0));
579 aBaseEnergy = aBaseEnergy-theNext->operator[](0)->GetTotalEnergy();
588 for(i0=0; i0<thePhotons->size(); i0++)
591 thePhotons->operator[](i0)->Lorentz(*(thePhotons->operator[](i0)), -1.*theTarget);
595 if(nothingWasKnownOnHadron)
602 if(eExcitation<20*CLHEP::keV){eExcitation=0;}
603 two_body_reaction(&incidReactionProduct,&theTarget,&aHadron,eExcitation);
604 if(thePhotons==0 && eExcitation>0){
657 G4int nSecondaries = 2;
658 G4bool needsSeparateRecoil =
false;
659 G4int totalBaryonNumber = 0;
660 G4int totalCharge = 0;
662 if(theParticles != 0)
664 nSecondaries = theParticles->size();
667 for(ii0=0; ii0<theParticles->size(); ii0++)
669 aDef = theParticles->operator[](ii0)->GetDefinition();
672 totalMomentum += theParticles->operator[](ii0)->GetMomentum();
676 needsSeparateRecoil =
true;
686 if(thePhotons!=0) { nPhotons = thePhotons->size(); }
687 nSecondaries += nPhotons;
691 if( theParticles==0 )
701 aHadron.
Lorentz(aHadron, theTarget);
704 ->GetIon(
static_cast<G4int>(residualZ),
static_cast<G4int>(residualA), 0));
712 theResidual.
Lorentz(theResidual, -1.*theTarget);
716 for(i=0; i<nPhotons; i++)
718 totalPhotonMomentum += thePhotons->operator[](i)->GetMomentum();
731 for(i0=0; i0<theParticles->size(); i0++)
734 theSec->
SetDefinition(theParticles->operator[](i0)->GetDefinition());
735 theSec->
SetMomentum(theParticles->operator[](i0)->GetMomentum());
740 delete theParticles->operator[](i0);
743 if(needsSeparateRecoil && residualZ!=0)
749 resiualKineticEnergy += totalMomentum*totalMomentum;
750 resiualKineticEnergy = std::sqrt(resiualKineticEnergy) - theResidual.
GetMass();
773 for(i=0; i<nPhotons; i++)
778 theSec->
SetDefinition( thePhotons->operator[](i)->GetDefinition() );
780 theSec->
SetMomentum(thePhotons->operator[](i)->GetMomentum());
786 delete thePhotons->operator[](i);
828 theCMSproj.
Lorentz(*proj,theCMS);
829 theCMStarg.
Lorentz(*targ,theCMS);
834 G4double fmomsquared=1./4./totE/totE*(totE*totE-(prodmass-resmass)*(prodmass-resmass))*(totE*totE-(prodmass+resmass)*(prodmass+resmass));
837 fmom=std::sqrt(fmomsquared);
845 product->
SetMomentum(fmom*sinth*std::cos(phi),fmom*sinth*std::sin(phi),fmom*cosTh);
848 product->
Lorentz(*product,-1.*theCMS);
870 theCarbon.SetKineticEnergy(0.);
890 for (
G4int j=0; j<4; j++ )
892 theProds[j].
Lorentz(theProds[j], -1.*theTarget);
921 theCarbon.SetKineticEnergy(0.);
930 for (
G4int j=0; j<2; j++ )
933 theProds[j].
Lorentz(theProds[j], -1.*theTarget);
944 G4Exception(
"G4ParticleHPInelasticCompFS::CompositeApply()",
"G4ParticleInelasticCompFS.cc",
FatalException,
"Alpha production with LR!=0.");
double A(double temperature)
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)