35 #include <CLHEP/Random/Stat.h>
99 if(ParametersChanged ==
TRUE)
133 if(ParametersChanged ==
TRUE)
137 std::ostringstream Temp;
138 Temp <<
"Mean value of " << Mean <<
" out of range";
139 G4Exception(
"G4FPYGaussianOps::G4SampleIntegerGaussian()",
142 "A value of '0' will be used instead.");
175 if(ParametersChanged ==
TRUE)
208 std::ostringstream Temp;
220 if(Mean / StdDev < 2)
233 if(ParametersChanged ==
TRUE)
249 }
while (RandInt < 0);
274 G4double Difference = Upper - Lower;
311 G4int icounter_max=1024;
316 if ( icounter > icounter_max ) {
317 G4cout <<
"Loop-counter exceeded the threshold value at " << __LINE__ <<
"th line of " << __FILE__ <<
"." <<
G4endl;
366 G4int IsotopeIndex = 0;
406 "Incident neutron energy above 14 MeV requested.",
408 "Using Watt fission constants for 14 Mev.");
414 G4int EnergyIndex = 0;
416 G4double RangeDifference, ConstantDifference;
424 if(EnergyDifference != 0)
426 std::ostringstream Temp;
427 Temp <<
"Incident neutron energy of ";
429 Temp <<
"explicitly listed in the data tables";
445 [EnergyIndex - 1][0];
446 A = (EnergyDifference / RangeDifference) * ConstantDifference +
447 NeutronInducedWattConstants[IsotopeIndex]
448 [EnergyIndex - 1][0];
452 NeutronInducedWattConstants[IsotopeIndex][EnergyIndex][1] -
453 NeutronInducedWattConstants[IsotopeIndex]
454 [EnergyIndex - 1][1];
456 (EnergyDifference / RangeDifference) * ConstantDifference +
457 NeutronInducedWattConstants[IsotopeIndex]
458 [EnergyIndex - 1][1];
464 G4String Temp =
"Watt fission spectra data not available for ";
467 Temp +=
"proton induced fission.";
470 Temp +=
"gamma induced fission.";
473 Temp +=
"!Warning! unknown cause.";
478 "Fission events will not be sampled in this run.");
512 }
while (Radius > 1.0);
515 MappingFactor = std::sqrt(-2.0*
G4Log(Radius)/Radius) *
StdDev_;
556 G4double ErfContainer, AdjustedErfContainer, Container;
565 G4bool ToleranceCheck =
false;
577 G4int icounter_max=1024;
581 if ( icounter > icounter_max ) {
582 G4cout <<
"Loop-counter exceeded the threshold value at " << __LINE__ <<
"th line of " << __FILE__ <<
"." <<
G4endl;
587 AdjustedErfContainer = 0;
590 for(
G4int i = 0; i <= UpperLimit; i++)
593 LowErf = ((AdjMean - i) / Normalization);
594 HighErf = ((AdjMean - (i + 1.0)) / Normalization);
604 Container = (CLHEP::HepStat::erf(HighErf) - CLHEP::HepStat::erf(LowErf))/2.0;
606 Container = (erf(HighErf) - erf(LowErf))/2.0;
608 }
else if (HighErf < 0)
614 Container = (CLHEP::HepStat::erf(HighErf) + CLHEP::HepStat::erf(LowErf))/2.0;
616 Container = (erf(HighErf) + erf(LowErf))/2.0;
622 Container = (CLHEP::HepStat::erf(LowErf) - CLHEP::HepStat::erf(HighErf))/2.0;
624 Container = (erf(LowErf) - erf(HighErf))/2.0;
630 if ( Container != Container) Container = 0;
634 ErfContainer += Container;
635 AdjustedErfContainer += Container * i;
639 Container = AdjustedErfContainer / ErfContainer;
643 if(ToleranceCheck ==
TRUE)
649 if(HalfDelta ==
TRUE)
655 if(Container >
Mean_)
static G4Pow * GetInstance()
G4double powA(G4double A, G4double y) const
G4double G4SampleGaussian(G4double Mean, G4double StdDev)
Returns a double value taken from a Gaussian distribution about Mean and with a standard deviation of...
static const G4double NeutronInducedWattConstants[][3][2]
Watt fission spectrum constants for neutron induced fission.
G4double SampleGaussian(void)
Samples a Gaussian distribution defined by the internal class variables NewMean_ and NewStdDev_...
~G4FPYSamplingOps(void)
Default deconstructor.
void EvaluateWattConstants(void)
Evaluates the constants that are required for the Watt fission spectrum sampling. ...
G4double G4SampleWatt(G4int WhatIsotope, G4FFGEnumerations::FissionCause WhatCause, G4double WhatEnergy)
Samples the Watt fission spectrum for the selected isotope, using an algorithm adopted from Ref...
WattSpectrumConstants contains constants and other variables for use in sampling the Watt fission spe...
#define G4FFG_SAMPLING_FUNCTIONENTER__
G4double G4SampleUniform(void)
Returns a double value evenly distributed in the range (0, 1].
G4double Energy
Energy, if any, of the incident particle that cause the fission.
static const G4double SpontaneousWattConstants[][2]
Watt fission spectrum constants for spontaneous fission.
G4double G4FindShiftedMean(G4double RequestedMean, G4double RequestedStdDev)
Returns the shifted mean that correlates to a RequestedMean and RequestedStdDev pair.
G4FFGEnumerations::FissionCause Cause
Fission cause for which the Watt fission spectrum is being sampled.
G4double StdDev_
Standard deviation for sampling a GaussianDistribution.
G4ShiftedGaussian * ShiftedGaussianValues_
Structure chain that contains the all the previous values used for sampling a Gaussian distribution...
FissionCause
Causes of fission.
Verbosity
These are the verbosity levels.
G4double M
Sampling constant.
WattSpectrumConstants * WattConstants_
Structure that contains the values for sampling the Watt fission spectrum.
GaussianReturnType
Sample a discretized Gaussian distribution (INT) or continuous (DOUBLE)
void G4SetVerbosity(G4int WhatVerbosity)
Sets the verbosity levels.
G4int Product
Isotope code in ZZZAAA format for which the Watt fission spectrum is being sampled.
G4GLOB_DLL std::ostream G4cout
double A(double temperature)
static const G4int SpontaneousWattIsotopesIndex[]
This table provides the indexing for SpontaneousWattConstants_.
G4double GaussianOne_
Contains the first of the two paired random numbers from the Gaussian distribution sampling...
void G4InsertShiftedMean(G4double ShiftedMean, G4double RequestedMean, G4double RequestedStdDev)
Inserts a ShiftedMean indexed by the RequestedMean and RequestedStdDev.
void ShiftParameters(G4FFGEnumerations::GaussianReturnType Type)
Sets the mean and standard deviation of the Gaussian distribution sampled by this class when POSITIVE...
G4double B
Sampling constant taken from the data tables.
G4int Verbosity_
Verbosity level.
G4double GaussianTwo_
Contains the second of the two paired random numbers from the Gaussian distribution sampling...
void Initialize(void)
Initialize is a common function called by all constructors.
GaussianRange
Truncate the Gaussian distribution at 0 (POSITIVE) or sample all values (ALL)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
static const G4int NeutronInducedWattIsotopesIndex[]
This table provides the indexing for NeutronInducedWattConstants_.
G4double G4Log(G4double x)
CLHEP::HepRandomEngine * RandomEngine_
Pointer to the CLHEP random number generator.
G4double Tolerance_
Defines the tolerance that ShiftParameters() must match.
#define G4FFG_FUNCTIONLEAVE__
G4double Mean_
Mean for sampling a Gaussian distribution.
G4double L
Sampling constant.
G4ShiftedGaussian is a class for storing the shifted values used for sampling a Gaussian distribution...
#define G4FFG_SAMPLING_FUNCTIONLEAVE__
void G4SetVerbosity(G4int WhatVerbosity)
Sets the verbosity levels.
G4FPYSamplingOps(void)
Default constructor.
static const G4double IncidentEnergyBins[]
These are the energy values in MeV for the neutron induced Watt fission spectrum constants.
static const G4double ThermalNeutronEnergy
The energy of thermal neutrons.
G4bool CheckAndSetParameters(void)
Check to see if the user requested parameters have already been calculated.
#define G4FFG_FUNCTIONENTER__
static const G4FFGEnumerations::Verbosity Verbosity
Verbosity for the entire package.
G4bool NextGaussianIsStoredInMemory_
Declares whether the second paired random number has been already returned.
G4int G4SampleIntegerGaussian(G4double Mean, G4double StdDev)
Returns an integer value taken from a Gaussian distribution.