89 std::istringstream& dataStream)
90 : Isotope_(WhichIsotope),
91 MetaState_(WhichMetaState),
93 YieldType_(WhichYieldType),
100 Initialize(dataStream);
102 catch (std::exception& e) {
115 std::istringstream& dataStream)
116 : Isotope_(WhichIsotope),
117 MetaState_(WhichMetaState),
119 YieldType_(WhichYieldType),
120 Verbosity_(Verbosity)
126 Initialize(dataStream);
128 catch (std::exception& e) {
136void G4FissionProductYieldDist::Initialize(std::istringstream& dataStream)
174 catch (std::exception& e) {
189#ifdef G4MULTITHREADED
190 G4AutoLock lk(&G4FissionProductYieldDist::fissprodMutex);
201 auto Alphas =
new std::vector<G4ReactionProduct*>;
202 auto Neutrons =
new std::vector<G4ReactionProduct*>;
203 auto Gammas =
new std::vector<G4ReactionProduct*>;
245 G4cout <<
" -- First daughter product sampled" <<
G4endl;
267 G4cout <<
" -- Second daughter product sampled" <<
G4endl;
310 G4int icounter_max = 1024;
313 if (icounter > icounter_max) {
314 G4cout <<
"Loop-counter exceeded the threshold value at " << __LINE__ <<
"th line of "
315 << __FILE__ <<
"." <<
G4endl;
337 G4double NumeratorSqrt, NumeratorOther, Denominator;
342 if (!Alphas->empty()) {
366 MassRatio = 1 / MassRatio;
370 if (MassRatio > 2.75) {
373 const G4double MeanAlphaAngle = 0.3644 * MassRatio * MassRatio * MassRatio
374 - 1.9766 * MassRatio * MassRatio + 3.8207 * MassRatio - 0.9917;
379 const G4double MeanAlphaAngleStdDev = 0.0523598776;
382 for (
auto&
Alpha : *Alphas) {
384 Theta = MeanAlphaAngle + PlusMinus;
388 else if (Theta > pi) {
389 Theta = (2 * pi - Theta);
394 Magnitude = std::sqrt(2 *
Alpha->GetKineticEnergy() *
Alpha->GetDefinition()->GetPDGMass());
395 Alpha->SetMomentum(Direction * Magnitude);
396 ResultantVector +=
Alpha->GetMomentum();
401 if (!Neutrons->empty()) {
402 for (
auto&
Neutron : *Neutrons) {
408 std::sqrt(2 *
Neutron->GetKineticEnergy() *
Neutron->GetDefinition()->GetPDGMass());
409 Neutron->SetMomentum(Direction * Magnitude);
410 ResultantVector +=
Neutron->GetMomentum();
415 if (!Gammas->empty()) {
416 for (
auto& Gamma : *Gammas) {
421 Magnitude = Gamma->GetKineticEnergy() / CLHEP::c_light;
422 Gamma->SetMomentum(Direction * Magnitude);
423 ResultantVector += Gamma->GetMomentum();
432 G4double ResultantX, ResultantY, ResultantZ;
433 ResultantX = ResultantVector.
getX();
434 ResultantY = ResultantVector.
getY();
435 ResultantZ = ResultantVector.
getZ();
439 LightFragment = FirstDaughter;
440 HeavyFragment = SecondDaughter;
443 LightFragment = SecondDaughter;
444 HeavyFragment = FirstDaughter;
484 NumeratorSqrt = std::sqrt(
487 * (2 * HeavyFragmentMass * FragmentsKE - ResultantX * ResultantX - ResultantY * ResultantY)
489 * (2 * HeavyFragmentMass * FragmentsKE - ResultantX * ResultantX
490 - ResultantY * ResultantY - ResultantZ - ResultantZ)));
493 NumeratorOther = LightFragmentMass * ResultantZ;
496 Denominator = LightFragmentMass + HeavyFragmentMass;
499 const G4double LightFragmentMomentum = (NumeratorSqrt + NumeratorOther) / Denominator;
500 const G4double HeavyFragmentMomentum =
501 std::sqrt(ResultantX * ResultantX + ResultantY * ResultantY
505 LightFragment->
SetMomentum(LightFragmentDirection * LightFragmentMomentum);
506 HeavyFragmentDirection.
setX(-ResultantX);
507 HeavyFragmentDirection.
setY(-ResultantY);
508 HeavyFragmentDirection.
setZ((-LightFragmentMomentum - ResultantZ));
510 HeavyFragmentDirection.
setR(1.0);
511 HeavyFragment->
SetMomentum(HeavyFragmentDirection * HeavyFragmentMomentum);
517 G4cout <<
" -- Daugher product momenta finalized" <<
G4endl;
530 for (
auto&
Neutron : *Neutrons) {
534 for (
auto& Gamma : *Gammas) {
538 for (
auto&
Alpha : *Alphas) {
552 ResultantVector.
set(0.0, 0.0, 0.0);
553 for (
auto& FissionProduct : *FissionProducts) {
554 Direction = FissionProduct->GetMomentumDirection();
556 FissionProduct->SetMomentumDirection(Direction);
557 ResultantVector += FissionProduct->GetMomentum();
562 G4double PossibleImbalance = ResultantVector.
mag();
563 if (PossibleImbalance > 0.01) {
564 std::ostringstream Temp;
565 Temp <<
"Momenta imbalance of ";
566 Temp << PossibleImbalance / (MeV / CLHEP::c_light);
567 Temp <<
" MeV/c in the system";
569 "Results may not be valid");
573 delete FirstDaughter;
574 delete SecondDaughter;
580 return FissionProducts;
658 G4bool lowerExists =
false;
659 G4bool higherExists =
false;
687 G4Ions* FoundParticle =
nullptr;
693 if (RandomParticle <=
Trees_[tree].ProbabilityRangeEnd[energyGroup]) {
703 while ((RangeIsSmaller = (RandomParticle < Branch->ProbabilityRangeBottom[energyGroup]))
707 if (RangeIsSmaller) {
708 Branch = Branch->
Left;
711 Branch = Branch->
Right;
717 else if (lowerExists && higherExists) {
728 return FoundParticle;
732 G4bool LowerEnergyGroupExists)
736 G4Ions* FoundParticle =
nullptr;
738 G4int NextNearestEnergy;
741 if (LowerEnergyGroupExists) {
743 NextNearestEnergy = NearestEnergy - 1;
747 NextNearestEnergy = 1;
750 for (
G4int Tree = 0; Tree <
TreeCount_ && FoundParticle ==
nullptr; Tree++) {
756 return FoundParticle;
760 G4int LowerEnergyGroup)
764 G4Ions* FoundParticle =
nullptr;
765 G4int HigherEnergyGroup = LowerEnergyGroup + 1;
767 for (
G4int Tree = 0; Tree <
TreeCount_ && FoundParticle ==
nullptr; Tree++) {
773 return FoundParticle;
785 if (Branch ==
nullptr) {
797 G4Ions* FoundParticle =
nullptr;
813 if (RandomParticle < RangeAtIncidentEnergy) {
827 if (RandomParticle > RangeAtIncidentEnergy) {
837 Particle = FoundParticle;
851 G4int NumberOfAlphasToProduce;
864 for (
int i = 0; i < NumberOfAlphasToProduce; i++) {
881 G4int NeutronProduction;
887 for (
int i = 0; i < NeutronProduction; i++) {
909 G4int Z = (Product -
A) / 1000;
980 std::ostringstream DirectoryName;
981 DirectoryName <<
G4FindDataDir(
"G4NEUTRONHPDATA") << G4FFGDefaultValues::ENDFFissionDataLocation;
985 return DirectoryName.str();
994 std::ostringstream FileName;
997 if (Isotope < 100000) {
1005 return FileName.str();
1013 auto DynamicParticle =
1017 return DynamicParticle;
1026 G4int A = Isotope % 1000;
1027 G4int Z = (Isotope -
A) / 1000;
1030 std::ostringstream IsotopeName;
1032 IsotopeName << Z <<
"_" <<
A;
1047 return IsotopeName.str();
1093 for (
G4int i = 0; i < ProductCount; i++) {
1120 if (Branch !=
nullptr) {
1150 TotalAlphaEnergy = 0;
1154 for (
auto&
Alpha : *Alphas) {
1158 Alpha->SetKineticEnergy(AlphaEnergy);
1161 TotalAlphaEnergy += AlphaEnergy;
1165 MeanAlphaEnergy -= 0.1;
1188 G4int icounter_max = 1024;
1190 >= G4FFGDefaultValues::MeanGammaEnergy)
1193 if (icounter > icounter_max) {
1194 G4cout <<
"Loop-counter exceeded the threshold value at " << __LINE__ <<
"th line of "
1195 << __FILE__ <<
"." <<
G4endl;
1214 Gammas->back()->SetTotalEnergy(SampleEnergy);
1230 Gammas->back()->SetTotalEnergy(SampleEnergy);
1252 G4int icounter_max = 1024;
1255 if (icounter > icounter_max) {
1256 G4cout <<
"Loop-counter exceeded the threshold value at " << __LINE__ <<
"th line of "
1257 << __FILE__ <<
"." <<
G4endl;
1260 TotalNeutronEnergy = 0;
1265 for (
auto&
Neutron : *Neutrons) {
1268 Neutron->SetKineticEnergy(NeutronEnergy);
1271 TotalNeutronEnergy += NeutronEnergy;
1290 WhichNubar =
const_cast<G4int*
>(&SpontaneousNubar_[0][0]);
1291 NubarWidth =
const_cast<G4int*
>(&SpontaneousNubarWidth_[0][0]);
1294 WhichNubar =
const_cast<G4int*
>(&NeutronInducedNubar_[0][0]);
1295 NubarWidth =
const_cast<G4int*
>(&NeutronInducedNubarWidth_[0][0]);
1301 while (*WhichNubar != -1)
1313 while (*WhichNubar != -1)
1333 NewBranch->Left =
nullptr;
1334 NewBranch->Right =
nullptr;
1383 while (BranchPosition > 1)
1385 if ((BranchPosition & 1) != 0) {
1387 WhichBranch = &((*WhichBranch)->Right);
1391 WhichBranch = &((*WhichBranch)->Left);
1394 BranchPosition >>= 1;
1397 *WhichBranch = NewBranch;
1408 G4int WhichTree = 0;
1409 while (
static_cast<int>(
Trees_[WhichTree].IsEnd) !=
TRUE)
1434 if (Branch !=
nullptr) {
1437 delete Branch->
Left;
1439 delete Branch->
Right;
std::vector< G4DynamicParticle * > G4DynamicParticleVector
const char * G4FindDataDir(const char *)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
#define G4FFG_DATA_FUNCTIONENTER__
#define G4FFG_DATA_FUNCTIONLEAVE__
#define G4FFG_FUNCTIONLEAVE__
#define G4FFG_FUNCTIONENTER__
#define G4FFG_RECURSIVE_FUNCTIONENTER__
#define G4FFG_RECURSIVE_FUNCTIONLEAVE__
#define G4MUTEX_INITIALIZER
G4GLOB_DLL std::ostream G4cout
void setRThetaPhi(double r, double theta, double phi)
void set(double x, double y, double z)
Hep3Vector & rotateUz(const Hep3Vector &)
static G4Alpha * Definition()
G4double * G4GetEnergyGroupValues()
G4int G4GetNumberOfEnergyGroups()
void G4SetVerbosity(G4int WhatVerbosity)
G4ENDFYieldDataContainer * G4GetYield(G4int WhichYield)
G4int G4GetNumberOfFissionProducts()
G4double * GetYieldProbability()
G4FFGEnumerations::MetaState GetMetaState()
G4double G4SampleWatt(G4int WhatIsotope, G4FFGEnumerations::FissionCause WhatCause, G4double WhatEnergy)
G4double G4SampleGaussian(G4double Mean, G4double StdDev)
G4int G4SampleIntegerGaussian(G4double Mean, G4double StdDev)
G4double G4SampleUniform()
void G4SetVerbosity(G4int WhatVerbosity)
void Renormalize(ProbabilityBranch *Branch)
void BurnTree(ProbabilityBranch *Branch)
void G4SetEnergy(G4double WhatIncidentEnergy)
G4Ions * NeutronDefinition_
G4double * YieldEnergies_
G4FPYSamplingOps * RandomEngine_
virtual G4Ions * GetFissionProduct()=0
void SampleAlphaEnergies(std::vector< G4ReactionProduct * > *Alphas)
void SampleNeutronEnergies(std::vector< G4ReactionProduct * > *Neutrons)
virtual void ReadProbabilities()
G4Ions * FindParticleBranchSearch(ProbabilityBranch *Branch, G4double RandomParticle, G4int EnergyGroup1, G4int EnergyGroup2)
G4double * MaintainNormalizedData_
G4FissionProductYieldDist(G4int WhichIsotope, G4FFGEnumerations::MetaState WhichMetaState, G4FFGEnumerations::FissionCause WhichCause, G4FFGEnumerations::YieldType WhichYieldType, std::istringstream &dataStream)
G4ENDFTapeRead * ENDFData_
virtual ~G4FissionProductYieldDist()
virtual void SortProbability(G4ENDFYieldDataContainer *YieldData)
G4Ions * G4GetFissionProduct()
G4String MakeFileName(G4int Isotope, G4FFGEnumerations::MetaState MetaState)
G4String MakeIsotopeName(G4int Isotope, G4FFGEnumerations::MetaState MetaState)
const G4FFGEnumerations::FissionCause Cause_
G4Ions * FindParticle(G4double RandomParticle)
G4Ions * FindParticleInterpolation(G4double RandomParticle, G4int LowerEnergyGroup)
G4Gamma * GammaDefinition_
G4ParticleHPNames * ElementNames_
virtual void GenerateNeutrons(std::vector< G4ReactionProduct * > *Neutrons)
G4double AlphaProduction_
G4String MakeDirectoryName()
G4Ions * GetParticleDefinition(G4int Product, G4FFGEnumerations::MetaState MetaState)
void G4SetAlphaProduction(G4double WhatAlphaProduction)
G4Ions * AlphaDefinition_
G4double RemainingEnergy_
virtual void GenerateAlphas(std::vector< G4ReactionProduct * > *Alphas)
G4DynamicParticle * MakeG4DynamicParticle(G4ReactionProduct *)
void SampleGammaEnergies(std::vector< G4ReactionProduct * > *Gammas)
void G4SetVerbosity(G4int WhatVerbosity)
G4DynamicParticleVector * G4GetFission()
const G4FFGEnumerations::YieldType YieldType_
G4double TernaryProbability_
void G4SetTernaryProbability(G4double TernaryProbability)
G4Ions * FindParticleExtrapolation(G4double RandomParticle, G4bool LowerEnergyGroupExists)
static G4Gamma * Definition()
G4ParticleDefinition * GetIon(G4int Z, G4int A, G4int lvl=0)
static G4IonTable * GetIonTable()
static G4Neutron * Definition()
G4int GetAtomicNumber() const
G4double GetPDGMass() const
G4int GetAtomicMass() const
const G4String & GetParticleName() const
G4ParticleHPDataUsed GetName(G4int A, G4int Z, const G4String &base, const G4String &rest, G4bool &active)
static G4Pow * GetInstance()
G4double powN(G4double x, G4int n) const
G4double powA(G4double A, G4double y) const
void SetMomentum(const G4double x, const G4double y, const G4double z)
const G4ParticleDefinition * GetDefinition() const
G4ThreeVector GetMomentum() const
void Add(G4int Elements, T *To, T *A1, T *A2=nullptr)
void Multiply(G4int Elements, T *To, T *M1, T *M2=nullptr)
void Divide(G4int Elements, T *To, T *Numerator, T *Denominator=NULL)
void DeleteVectorOfPointers(std::vector< T > &Vector)
void Copy(G4int Elements, T *To, T *From)
void Set(G4int Elements, T *To, T Value)
G4double * ProbabilityRangeTop
G4int IncidentEnergiesCount
G4double * IncidentEnergies
ProbabilityBranch * Right
G4double * ProbabilityRangeBottom
G4double * ProbabilityRangeEnd
ProbabilityBranch * Trunk