92 std::istringstream& dataStream )
93: Isotope_(WhichIsotope),
94 MetaState_(WhichMetaState),
96 YieldType_(WhichYieldType),
104 Initialize(dataStream);
105 }
catch (std::exception& e)
120 std::istringstream& dataStream)
121 : Isotope_(WhichIsotope), MetaState_(WhichMetaState), Cause_(WhichCause),
122 YieldType_(WhichYieldType), Verbosity_(Verbosity)
129 Initialize(dataStream);
130 }
catch (std::exception& e)
140void G4FissionProductYieldDist::Initialize(std::istringstream& dataStream)
181 }
catch (std::exception& e)
197#ifdef G4MULTITHREADED
198 G4AutoLock lk(&G4FissionProductYieldDist::fissprodMutex);
209 std::vector< G4ReactionProduct* >* Alphas =
new std::vector< G4ReactionProduct* >;
210 std::vector< G4ReactionProduct* >* Neutrons =
new std::vector< G4ReactionProduct* >;
211 std::vector< G4ReactionProduct* >* Gammas =
new std::vector< G4ReactionProduct* >;
254 G4cout <<
" -- First daughter product sampled" <<
G4endl;
275 G4cout <<
" -- Second daughter product sampled" <<
G4endl;
318 G4int icounter_max=1024;
322 if ( icounter > icounter_max ) {
323 G4cout <<
"Loop-counter exceeded the threshold value at " << __LINE__ <<
"th line of " << __FILE__ <<
"." <<
G4endl;
346 G4double NumeratorSqrt, NumeratorOther, Denominator;
351 if(Alphas->size() > 0)
376 MassRatio = 1 / MassRatio;
384 const G4double MeanAlphaAngle = 0.3644 * MassRatio * MassRatio * MassRatio
385 - 1.9766 * MassRatio * MassRatio
392 const G4double MeanAlphaAngleStdDev = 0.0523598776;
395 for(
unsigned int i = 0; i < Alphas->size(); ++i)
398 Theta = MeanAlphaAngle + PlusMinus;
402 }
else if(Theta > pi)
404 Theta = (2 * pi - Theta);
409 Magnitude = std::sqrt(2 * Alphas->at(i)->GetKineticEnergy() * Alphas->at(i)->GetDefinition()->GetPDGMass());
410 Alphas->at(i)->SetMomentum(Direction * Magnitude);
411 ResultantVector += Alphas->at(i)->GetMomentum();
416 if(Neutrons->size() != 0)
418 for(
unsigned int i = 0; i < Neutrons->size(); ++i)
424 Magnitude = std::sqrt(2 * Neutrons->at(i)->GetKineticEnergy() * Neutrons->at(i)->GetDefinition()->GetPDGMass());
425 Neutrons->at(i)->SetMomentum(Direction * Magnitude);
426 ResultantVector += Neutrons->at(i)->GetMomentum();
431 if(Gammas->size() != 0)
433 for(
unsigned int i = 0; i < Gammas->size(); ++i)
439 Magnitude = Gammas->at(i)->GetKineticEnergy() / CLHEP::c_light;
440 Gammas->at(i)->SetMomentum(Direction * Magnitude);
441 ResultantVector += Gammas->at(i)->GetMomentum();
450 G4double ResultantX, ResultantY, ResultantZ;
451 ResultantX = ResultantVector.
getX();
452 ResultantY = ResultantVector.
getY();
453 ResultantZ = ResultantVector.
getZ();
457 LightFragment = FirstDaughter;
458 HeavyFragment = SecondDaughter;
461 LightFragment = SecondDaughter;
462 HeavyFragment = FirstDaughter;
502 NumeratorSqrt = std::sqrt(LightFragmentMass *
503 (LightFragmentMass * (2 * HeavyFragmentMass * FragmentsKE
504 - ResultantX * ResultantX
505 - ResultantY * ResultantY)
506 + HeavyFragmentMass * (2 * HeavyFragmentMass * FragmentsKE
507 - ResultantX * ResultantX
508 - ResultantY * ResultantY
509 - ResultantZ - ResultantZ)));
512 NumeratorOther = LightFragmentMass * ResultantZ;
515 Denominator = LightFragmentMass + HeavyFragmentMass;
518 const G4double LightFragmentMomentum = (NumeratorSqrt + NumeratorOther) / Denominator;
519 const G4double HeavyFragmentMomentum = std::sqrt(ResultantX * ResultantX
520 + ResultantY * ResultantY
524 LightFragment->
SetMomentum(LightFragmentDirection * LightFragmentMomentum);
525 HeavyFragmentDirection.
setX(-ResultantX);
526 HeavyFragmentDirection.
setY(-ResultantY);
527 HeavyFragmentDirection.
setZ((-LightFragmentMomentum - ResultantZ));
529 HeavyFragmentDirection.
setR(1.0);
530 HeavyFragment->
SetMomentum(HeavyFragmentDirection * HeavyFragmentMomentum);
537 G4cout <<
" -- Daugher product momenta finalized" <<
G4endl;
549 for(
unsigned int i = 0; i < Neutrons->size(); i++)
554 for(
unsigned int i = 0; i < Gammas->size(); i++)
559 for(
unsigned int i = 0; i < Alphas->size(); i++)
574 ResultantVector.
set(0.0, 0.0, 0.0);
575 for(
unsigned int i = 0; i < FissionProducts->size(); i++)
577 Direction = FissionProducts->at(i)->GetMomentumDirection();
579 FissionProducts->at(i)->SetMomentumDirection(Direction);
580 ResultantVector += FissionProducts->at(i)->GetMomentum();
585 G4double PossibleImbalance = ResultantVector.
mag();
586 if(PossibleImbalance > 0.01)
588 std::ostringstream Temp;
589 Temp <<
"Momenta imbalance of ";
590 Temp << PossibleImbalance / (MeV / CLHEP::c_light);
591 Temp <<
" MeV/c in the system";
592 G4Exception(
"G4FissionProductYieldDist::G4GetFission()",
595 "Results may not be valid");
599 delete FirstDaughter;
600 delete SecondDaughter;
606 return FissionProducts;
693 G4bool lowerExists =
false;
694 G4bool higherExists =
false;
728 G4Ions* FoundParticle = NULL;
736 if(RandomParticle <=
Trees_[tree].ProbabilityRangeEnd[energyGroup])
747 while((RangeIsSmaller = (RandomParticle < Branch->ProbabilityRangeBottom[energyGroup]))
753 Branch = Branch->
Left;
755 Branch = Branch->
Right;
760 }
else if(lowerExists && higherExists)
772 return FoundParticle;
777 G4bool LowerEnergyGroupExists )
781 G4Ions* FoundParticle = NULL;
783 G4int NextNearestEnergy;
786 if(LowerEnergyGroupExists ==
true)
789 NextNearestEnergy = NearestEnergy - 1;
793 NextNearestEnergy = 1;
796 for(
G4int Tree = 0; Tree <
TreeCount_ && FoundParticle == NULL; Tree++)
805 return FoundParticle;
810 G4int LowerEnergyGroup )
814 G4Ions* FoundParticle = NULL;
815 G4int HigherEnergyGroup = LowerEnergyGroup + 1;
817 for(
G4int Tree = 0; Tree <
TreeCount_ && FoundParticle == NULL; Tree++)
826 return FoundParticle;
845 || EnergyGroup1 == EnergyGroup2
853 G4Ions* FoundParticle = NULL;
865 if(RandomParticle < RangeAtIncidentEnergy)
879 if(RandomParticle > RangeAtIncidentEnergy)
892 Particle = FoundParticle;
908 G4int NumberOfAlphasToProduce;
923 for(
int i = 0; i < NumberOfAlphasToProduce; i++)
942 G4int NeutronProduction;
947 for(
int i = 0; i < NeutronProduction; i++)
971 G4int Z = (Product -
A) / 1000;
1043 std::ostringstream DirectoryName;
1044 DirectoryName <<
G4FindDataDir(
"G4NEUTRONHPDATA") << G4FFGDefaultValues::ENDFFissionDataLocation;
1048 return DirectoryName.str();
1059 std::ostringstream FileName;
1062 if(Isotope < 100000)
1071 return FileName.str();
1082 return DynamicParticle;
1092 G4int A = Isotope % 1000;
1093 G4int Z = (Isotope -
A) / 1000;
1096 std::ostringstream IsotopeName;
1098 IsotopeName <<
Z <<
"_" <<
A;
1115 return IsotopeName.str();
1164 for(
G4int i = 0; i < ProductCount; i++)
1227 TotalAlphaEnergy = 0;
1231 for(
unsigned int i = 0; i < Alphas->size(); i++)
1237 Alphas->at(i)->SetKineticEnergy(AlphaEnergy);
1240 TotalAlphaEnergy += AlphaEnergy;
1244 MeanAlphaEnergy -= 0.1;
1269 G4int icounter_max=1024;
1273 if ( icounter > icounter_max ) {
1274 G4cout <<
"Loop-counter exceeded the threshold value at " << __LINE__ <<
"th line of " << __FILE__ <<
"." <<
G4endl;
1295 Gammas->back()->SetTotalEnergy(SampleEnergy);
1312 Gammas->back()->SetTotalEnergy(SampleEnergy);
1335 G4int icounter_max=1024;
1339 if ( icounter > icounter_max ) {
1340 G4cout <<
"Loop-counter exceeded the threshold value at " << __LINE__ <<
"th line of " << __FILE__ <<
"." <<
G4endl;
1343 TotalNeutronEnergy = 0;
1348 for(
unsigned int i = 0; i < Neutrons->size(); i++)
1352 Neutrons->at(i)->SetKineticEnergy(NeutronEnergy);
1355 TotalNeutronEnergy +=NeutronEnergy;
1376 WhichNubar =
const_cast<G4int*
>(&SpontaneousNubar_[0][0]);
1377 NubarWidth =
const_cast<G4int*
>(&SpontaneousNubarWidth_[0][0]);
1380 WhichNubar =
const_cast<G4int*
>(&NeutronInducedNubar_[0][0]);
1381 NubarWidth =
const_cast<G4int*
>(&NeutronInducedNubarWidth_[0][0]);
1387 + *(WhichNubar + 2) * BFactor;
1388 while(*WhichNubar != -1)
1393 + *(WhichNubar + 2) * BFactor;
1402 while(*WhichNubar != -1)
1424 NewBranch->Left = NULL;
1425 NewBranch->Right = NULL;
1478 while(BranchPosition > 1)
1480 if(BranchPosition & 1)
1483 WhichBranch = &((*WhichBranch)->Right);
1487 WhichBranch = &((*WhichBranch)->Left);
1490 BranchPosition >>= 1;
1493 *WhichBranch = NewBranch;
1505 G4int WhichTree = 0;
1536 delete Branch->
Left;
1538 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()
G4int G4GetNumberOfFissionProducts(void)
void G4SetVerbosity(G4int WhatVerbosity)
G4double * G4GetEnergyGroupValues(void)
G4ENDFYieldDataContainer * G4GetYield(G4int WhichYield)
G4int G4GetNumberOfEnergyGroups(void)
G4FFGEnumerations::MetaState GetMetaState(void)
G4double * GetYieldProbability(void)
G4double G4SampleWatt(G4int WhatIsotope, G4FFGEnumerations::FissionCause WhatCause, G4double WhatEnergy)
G4double G4SampleGaussian(G4double Mean, G4double StdDev)
G4int G4SampleIntegerGaussian(G4double Mean, G4double StdDev)
void G4SetVerbosity(G4int WhatVerbosity)
G4double G4SampleUniform(void)
G4String MakeDirectoryName(void)
void Renormalize(ProbabilityBranch *Branch)
void BurnTree(ProbabilityBranch *Branch)
void G4SetEnergy(G4double WhatIncidentEnergy)
G4Ions * NeutronDefinition_
G4double * YieldEnergies_
G4FPYSamplingOps * RandomEngine_
void SampleAlphaEnergies(std::vector< G4ReactionProduct * > *Alphas)
void SampleNeutronEnergies(std::vector< G4ReactionProduct * > *Neutrons)
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_
G4DynamicParticleVector * G4GetFission(void)
virtual void SortProbability(G4ENDFYieldDataContainer *YieldData)
G4String MakeFileName(G4int Isotope, G4FFGEnumerations::MetaState MetaState)
G4String MakeIsotopeName(G4int Isotope, G4FFGEnumerations::MetaState MetaState)
const G4FFGEnumerations::FissionCause Cause_
virtual void ReadProbabilities(void)
G4Ions * FindParticle(G4double RandomParticle)
G4Ions * FindParticleInterpolation(G4double RandomParticle, G4int LowerEnergyGroup)
virtual ~G4FissionProductYieldDist(void)
G4Gamma * GammaDefinition_
G4ParticleHPNames * ElementNames_
virtual void GenerateNeutrons(std::vector< G4ReactionProduct * > *Neutrons)
G4double AlphaProduction_
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 *)
virtual G4Ions * GetFissionProduct(void)=0
virtual void MakeTrees(void)
void SampleGammaEnergies(std::vector< G4ReactionProduct * > *Gammas)
void G4SetVerbosity(G4int WhatVerbosity)
void CheckAlphaSanity(void)
const G4FFGEnumerations::YieldType YieldType_
G4double TernaryProbability_
void G4SetTernaryProbability(G4double TernaryProbability)
G4Ions * FindParticleExtrapolation(G4double RandomParticle, G4bool LowerEnergyGroupExists)
G4Ions * G4GetFissionProduct(void)
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
G4int GetPDGEncoding() const
const G4String & GetParticleName() const
static const G4String theString[100]
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=NULL)
void Multiply(G4int Elements, T *To, T *M1, T *M2=NULL)
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