56 std::ostringstream ost;
59 std::ifstream from(aName, std::ios::in);
63 std::ifstream theGammaData(aName, std::ios::in);
77 if(!getenv(
"G4NEUTRONHPDATA"))
78 throw G4HadronicException(__FILE__, __LINE__,
"Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files where Inelastic/Gammas data is found.");
79 G4String tBase = getenv(
"G4NEUTRONHPDATA");
86 if( getenv(
"G4ParticleHPDebug") )
G4cout <<
" G4ParticleHPInelasticBaseFS::Init FILE " << filename <<
G4endl;
97 if(getenv(
"G4ParticleHPDebug_NamesLogging"))
G4cout <<
"Skipped = "<< filename <<
" "<<A<<
" "<<Z<<
G4endl;
108 std::istringstream theData(std::ios::in);
122 while (theData >> infoType)
126 if(dummy==
INT_MAX) theData >> dummy >> dummy;
152 else if(dataType==12)
158 else if(dataType==13)
164 else if(dataType==14)
169 else if(dataType==15)
176 throw G4HadronicException(__FILE__, __LINE__,
"Data-type unknown to G4ParticleHPInelasticBaseFS");
209 if ( targetMass == 0 )
224 boosted.
Lorentz(incidReactionProduct, theTarget);
234 for(ii=0; ii<nDef; ii++)
238 thePhaseSpaceDistribution.
Init(aPhaseMass, nDef);
240 thePhaseSpaceDistribution.
SetTarget(&theTarget);
241 for(ii=0; ii<nDef; ii++)
243 G4double massCode = 1000.*std::abs(theDefs[ii]->GetPDGCharge());
247 aSec->
Lorentz(*aSec, -1.*theTarget);
293 for(i0=0; i0<nDef; i0++) Done[i0] =
false;
300 for(i=0; i<tmpHadrons->size(); i++)
302 for(ii=0; ii<nDef; ii++)
303 if(!Done[ii] && tmpHadrons->operator[](i)->GetDefinition() == theDefs[ii])
307 if( getenv(
"G4ParticleHPDebug"))
G4cout <<
" G4ParticleHPInelasticBaseFS::BaseApply secondary previously added " << tmpHadrons->operator[](i)->GetDefinition()->GetParticleName() <<
" E= " << tmpHadrons->operator[](i)->GetKineticEnergy() <<
G4endl;
313 for(i0=0; i0<nDef; i0++)
335 throw G4HadronicException(__FILE__, __LINE__,
"No energy distribution to sample from in InelasticBaseFS::BaseApply");
348 G4double availableEnergy = eKinetic+massn+localMass-mass1-mass2-concreteMass;
350 G4double emin = availableEnergy+mass1+mass2 - std::sqrt((mass1+mass2)*(mass1+mass2)+orgMomentum*orgMomentum);
352 bufferedDirection = p1*aHadron->
GetMomentum().unit();
354 if(getenv(
"G4ParticleHPDebug"))
356 G4cout <<
"G4ParticleHPInelasticBaseFS "<<z1<<
" "<<
theBaseZ<<
" "<<a1<<
" "<<
theBaseA<<
" "<<availableEnergy<<
" "
363 bufferedDirection = -bufferedDirection;
367 if(getenv(
"G4ParticleHPDebug"))
369 G4cout <<
" G4ParticleHPInelasticBaseFS "<<bufferedDirection.mag2()<<
G4endl;
373 +bufferedDirection.mag2()) );
375 aHadron->
Lorentz(*aHadron, -1.*(theTarget+incidReactionProduct));
377 if(getenv(
"G4ParticleHPDebug"))
383 tmpHadrons->push_back(aHadron);
393 throw G4HadronicException(__FILE__, __LINE__,
"No data to create the neutrons in NInelasticFS");
401 boosted_tmp.
Lorentz(incidReactionProduct, theTarget);
406 for(i=0; i<thePhotons->size(); i++)
409 thePhotons->operator[](i)->Lorentz(*(thePhotons->operator[](i)), -1.*theTarget);
417 G4bool bAdjustPhotons =
true;
419 bAdjustPhotons =
true;
421 if ( getenv(
"G4PHP_DO_NOT_ADJUST_FINAL_STATE" ) ) bAdjustPhotons =
false;
424 if( bAdjustPhotons ) {
427 theGammaEnergy = anEnergy-theGammaEnergy;
437 for(i=0; i<tmpHadrons->size(); i++)
441 eBindProducts+=eBindN;
445 eBindProducts+=eBindP;
449 eBindProducts+=eBindD;
453 eBindProducts+=eBindT;
455 else if(tmpHadrons->operator[](i)->GetDefinition() ==
G4He3::He3())
457 eBindProducts+=eBindHe3;
459 else if(tmpHadrons->operator[](i)->GetDefinition() ==
G4Alpha::Alpha())
461 eBindProducts+=eBindA;
466 theGammaEnergy += eBindProducts;
469 if( getenv(
"G4ParticleHPDebug"))
G4cout <<
" G4ParticleHPInelasticBaseFS::BaseApply gamma Energy " << theGammaEnergy <<
" eBindProducts " << eBindProducts <<
G4endl;
482 theGammaEnergy -= (2*eBindA);
498 if( getenv(
"G4ParticleHPDebug"))
G4cout <<
" G4ParticleHPInelasticBaseFS::BaseApply adding gamma from level " << iLevel << theOtherPhotons->operator[](ii)->GetKineticEnergy() <<
G4endl;
506 if(random > (eHigh-eLow)/(theGammaEnergy-eLow)) iLevel++;
510 if(theOtherPhotons != 0)
512 for(
unsigned int iii=0; iii<theOtherPhotons->size(); iii++)
514 thePhotons->push_back(theOtherPhotons->operator[](iii));
516 if( getenv(
"G4ParticleHPDebug"))
517 G4cout << iii <<
" G4ParticleHPInelasticBaseFS::BaseApply adding gamma " << theOtherPhotons->operator[](iii)->GetKineticEnergy() <<
G4endl;
520 delete theOtherPhotons;
523 if(iLevel == -1)
break;
529 unsigned int nSecondaries = tmpHadrons->size();
530 unsigned int nPhotons = 0;
531 if(thePhotons!=0) { nPhotons = thePhotons->size(); }
532 nSecondaries += nPhotons;
535 if( getenv(
"G4ParticleHPDebug"))
G4cout <<
" G4ParticleHPInelasticBaseFS::BaseApply N hadrons " << nSecondaries-nPhotons <<
G4endl;
538 for(i=0; i<nSecondaries-nPhotons; i++)
541 theSec->
SetDefinition(tmpHadrons->operator[](i)->GetDefinition());
542 theSec->
SetMomentum(tmpHadrons->operator[](i)->GetMomentum());
548 delete tmpHadrons->operator[](i);
551 if( getenv(
"G4ParticleHPDebug"))
G4cout <<
" G4ParticleHPInelasticBaseFS::BaseApply N photons " << nPhotons << G4endl;
555 for(i=0; i<nPhotons; i++)
558 theSec->
SetDefinition(thePhotons->operator[](i)->GetDefinition());
559 theSec->
SetMomentum(thePhotons->operator[](i)->GetMomentum());
564 delete thePhotons->operator[](i);
static G4ParticleHPManager * GetInstance()
G4ReactionProduct * Sample(G4double anEnergy, G4double massCode, G4double mass)
G4double GetTotalMeanEnergy()
G4ReactionProductVector * GetDecayGammas(G4int aLevel)
static G4double GetNuclearMass(const G4double A, const G4double Z)
void SetMomentum(const G4ThreeVector &momentum)
void Lorentz(const G4ReactionProduct &p1, const G4ReactionProduct &p2)
G4double GetKineticEnergy() const
CLHEP::Hep3Vector G4ThreeVector
void SetKineticEnergy(const G4double en)
void SetMomentum(const G4double x, const G4double y, const G4double z)
void SetProjectileRP(G4ReactionProduct &aIncidentPart)
G4ParticleDefinition * GetIon(G4int Z, G4int A, G4int lvl=0)
void SetAZMs(G4double anA, G4double aZ, G4int aM, G4ParticleHPDataUsed used)
void GetDataStream(G4String, std::istringstream &iss)
G4ParticleHPEnAngCorrelation * theEnergyAngData
static const G4double eps
G4ParticleDefinition * GetDefinition() const
void Init(std::istream &theData)
G4double Sample(G4double anEnergy, G4int &it)
G4ReactionProductVector * Sample(G4double anEnergy)
const G4String & GetParticleName() const
void InitPartials(std::istream &aDataFile)
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
void SetProjectileRP(const G4ReactionProduct &anIncidentParticleRP)
G4ParticleDefinition * theProjectile
void Init(G4double aMass, G4int aCount)
void BaseApply(const G4HadProjectile &theTrack, G4ParticleDefinition **theDefs, G4int nDef)
void SetStatusChange(G4HadFinalStateStatus aS)
std::vector< G4ReactionProduct * > G4ReactionProductVector
void SetTarget(const G4ReactionProduct &aTarget)
G4ParticleHPDeExGammas theGammas
void adjust_final_state(G4LorentzVector)
void Init(std::istream &aDataFile, G4int total, G4double ux=1., G4double uy=1.)
const G4ParticleDefinition * GetDefinition() const
G4ReactionProduct GetBiasedThermalNucleus(G4double aMass, G4ThreeVector aVelocity, G4double temp=-1) const
G4GLOB_DLL std::ostream G4cout
void SampleAndUpdate(G4ReactionProduct &anIncidentParticle)
const G4ParticleDefinition * GetDefinition() const
G4bool InitMean(std::istream &aDataFile)
G4int GetNumberOfLevels()
G4ParticleHPNames theNames
G4double GetKineticEnergy() const
void SetTotalEnergy(const G4double en)
G4ErrorTarget * theTarget
static G4Triton * Triton()
static G4Proton * Proton()
static G4Neutron * Neutron()
void Init(std::istream &aDataFile)
const G4ParticleDefinition * GetParticleDefinition() const
static const G4double A[nN]
const G4LorentzVector & Get4Momentum() const
void SetProjectileRP(G4ReactionProduct *aIncidentParticleRP)
static G4Deuteron * Deuteron()
static G4IonTable * GetIonTable()
G4double GetKineticEnergy() const
G4double theNuclearMassDifference
G4double GetTotalEnergy() const
void SetTarget(G4ReactionProduct *aTarget)
G4double total(Particle const *const p1, Particle const *const p2)
void InitGammas(G4double AR, G4double ZR)
G4double GetPDGMass() const
static G4double GetBindingEnergy(const G4int A, const G4int Z)
G4ParticleHPEnergyDistribution * theEnergyDistribution
void SetTarget(G4ReactionProduct &aTarget)
G4ReactionProductVector * GetPhotons(G4double anEnergy)
G4HadFinalState theResult
G4ThreeVector GetMomentum() const
G4double GetTemperature() const
G4ParticleHPDataUsed GetName(G4int A, G4int Z, G4String base, G4String rest, G4bool &active)
const G4Material * GetMaterial() const
void AddSecondary(G4DynamicParticle *aP, G4int mod=-1)
void InitEnergies(std::istream &aDataFile)
void Init(G4double A, G4double Z, G4int M, G4String &dirName, G4String &bit, G4ParticleDefinition *)
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
G4ParticleHPVector * theXsection
G4ParticleHPPhotonDist * theFinalStatePhotons
void Init(std::istream &aDataFile)
void InitAngular(std::istream &aDataFile)
G4double GetPDGCharge() const
G4double GetLevelEnergy(G4int aLevel)
G4int GetNumberOfSecondaries() const
G4ParticleHPAngular * theAngularDistribution
G4ThreeVector GetMomentum() const
void Init(std::istream &aDataFile)
G4int GetBaryonNumber() const
CLHEP::HepLorentzVector G4LorentzVector