|
|
|||
Warning, file /include/Geant4/G4FPYSamplingOps.hh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 // 0026 /* 0027 * File: G4FPYSamplingOps.hh 0028 * Author: B. Wendt (wendbryc@isu.edu) 0029 * 0030 * Created on June 30, 2011, 11:10 AM 0031 */ 0032 0033 /* * * * * * * * * * * * * * * * References * * * * * * * * * * * * * * * * 0034 * * 0035 * 1. "Sampling ENDL Watt Fission Spectra, D. E. Cullen, LLNL, April, 2004 * 0036 * * 0037 * * * * * * * * * * * * * * * * References * * * * * * * * * * * * * * * */ 0038 0039 #ifndef G4FPYSAMPLINGOPS_HH 0040 #define G4FPYSAMPLINGOPS_HH 0041 0042 #include "G4FFGEnumerations.hh" 0043 #include "G4ShiftedGaussian.hh" 0044 #include "G4WattFissionSpectrumValues.hh" 0045 #include "Randomize.hh" 0046 #include "globals.hh" 0047 0048 /** G4FPYSamplingOps performs all the uniform and Gaussian distribution sampling 0049 * operations 0050 */ 0051 class G4FPYSamplingOps 0052 { 0053 public: 0054 // Constructor definition 0055 /** Default constructor 0056 * - Usage: No arguments required 0057 * - Notes: 0058 */ 0059 G4FPYSamplingOps(); 0060 /** Overloaded constructor 0061 * - Usage: 0062 * - \p Verbosity: Verbosity level 0063 * - Notes: 0064 */ 0065 G4FPYSamplingOps(G4int Verbosity); 0066 0067 protected: 0068 /** Initialize is a common function called by all constructors. */ 0069 void Initialize(); 0070 0071 public: 0072 // Functions 0073 /** Returns an integer value taken from a Gaussian distribution. 0074 * This overloaded version assumes that the range is not restricted to 0075 * positive values only. 0076 * - Usage: 0077 * - \p Mean: Mean about which the Gaussian distribution will be 0078 * sampled 0079 * - \p StdDev: Standard deviation of the Gaussian distribution. 68.3% 0080 * of the values will lie within the first standard deviation, 95.4% 0081 * within the second standard deviation, etc... 0082 * - Notes: 0083 */ 0084 G4int G4SampleIntegerGaussian(G4double Mean, G4double StdDev); 0085 /** Returns an integer value taken from a Gaussian distribution about 0086 * \p Mean and with a standard deviation of \p StdDev. 0087 * - Usage: 0088 * - \p Mean: Mean about which the Gaussian distribution will be 0089 * sampled 0090 * - \p StdDev: Standard deviation of the Gaussian distribution. 68.3% 0091 * of the values will lie within the first standard deviation, 95.4% 0092 * within the second standard deviation, etc... 0093 * - \p Range: \p POSITIVE or \p ALL 0094 * - Notes: 0095 */ 0096 G4int G4SampleIntegerGaussian(G4double Mean, G4double StdDev, 0097 G4FFGEnumerations::GaussianRange Range); 0098 /** Returns a double value taken from a Gaussian distribution about \p Mean 0099 * and with a standard deviation of \p StdDev. 0100 * - Usage: 0101 * - \p Mean: Mean about which the Gaussian distribution will be 0102 * sampled 0103 * - \p StdDev: Standard deviation of the Gaussian distribution. 68.3% 0104 * of the values will lie within the first standard deviation, 95.4% 0105 * within the second standard deviation, etc... 0106 * - Notes: 0107 */ 0108 G4double G4SampleGaussian(G4double Mean, G4double StdDev); 0109 /** Returns a double value taken from a Gaussian distribution about \p Mean 0110 * and with a standard deviation of \p StdDev. 0111 * - Usage: 0112 * - \p Mean: Mean about which the Gaussian distribution will be 0113 * sampled 0114 * - \p StdDev: Standard deviation of the Gaussian distribution. 68.3% 0115 * of the values will lie within the first standard deviation, 95.4% 0116 * within the second standard deviation, etc... 0117 * - \p Range: \p POSITIVE or \p ALL 0118 * - Notes: 0119 */ 0120 G4double G4SampleGaussian(G4double Mean, G4double StdDev, 0121 G4FFGEnumerations::GaussianRange Range); 0122 /** Returns a double value evenly distributed in the range (0, 1]. 0123 * - Usage: No arguments required 0124 * - Notes: 0125 */ 0126 G4double G4SampleUniform(); 0127 /** Returns a double value evenly distributed in the range 0128 * (\p Lower, \p Upper]. 0129 * - Usage: 0130 * - \p Lower: Lower bounds of the distribution 0131 * - \p Upper: Upper bounds of the distribution 0132 * 0133 * - Notes: 0134 */ 0135 G4double G4SampleUniform(G4double Lower, G4double Upper); 0136 /** Samples the Watt fission spectrum for the selected isotope, using an 0137 * algorithm adopted from Ref. 1 0138 * - Usage: 0139 * - \p WhatIsotope: The isotope that is to be sampled 0140 * - \p WhatCause: The cause of the isotope to be sampled 0141 * - \p WhatEnergy: The energy, in MeV of the incident particle 0142 * - Notes: 0143 * - All variables needed for this function are grouped together in 0144 * WattConstants_. 0145 * - 0146 */ 0147 G4double G4SampleWatt(G4int WhatIsotope, G4FFGEnumerations::FissionCause WhatCause, 0148 G4double WhatEnergy); 0149 /** Sets the verbosity levels 0150 * - Usage: 0151 * - \p WhichVerbosity: Combination of levels 0152 * 0153 * - Notes: 0154 * - \p SILENT: All verbose output is repressed 0155 * - \p UPDATES: Only high-level internal changes are reported 0156 * - \p DAUGHTER_INFO: Displays information about daughter product sampling 0157 * - \p NEUTRON_INFO: Displays information about neutron sampling 0158 * - \p GAMMA_INFO: Displays information about gamma sampling 0159 * - \p ALPHA_INFO: Displays information about alpha sampling 0160 * - \p MOMENTUM_INFO: Displays information about momentum balancing 0161 * - \p EXTRAPOLATION_INTERPOLATION_INFO: Displays information about any data extrapolation 0162 * or interpolation that occurs 0163 * - \p DEBUG: Reports program flow as it steps through functions 0164 * - \p PRINT_ALL: Displays any and all output 0165 */ 0166 void G4SetVerbosity(G4int WhatVerbosity); 0167 0168 protected: 0169 // Variables 0170 // Class descriptor variables 0171 /** Mean for sampling a Gaussian distribution */ 0172 G4double Mean_; 0173 /** Standard deviation for sampling a GaussianDistribution */ 0174 G4double StdDev_; 0175 /** Structure chain that contains the all the previous values used 0176 * for sampling a Gaussian distribution 0177 */ 0178 G4ShiftedGaussian* ShiftedGaussianValues_; 0179 /** Verbosity level */ 0180 G4int Verbosity_; 0181 /** Structure that contains the values for sampling the Watt fission 0182 * spectrum 0183 */ 0184 WattSpectrumConstants* WattConstants_; 0185 0186 // Pointers to external classes 0187 /** Pointer to the CLHEP random number generator. */ 0188 CLHEP::HepRandomEngine* RandomEngine_; 0189 0190 // Internal variables for use with sampling a Gaussian distribution. 0191 /** Declares whether the second paired random number has been already 0192 * returned. 0193 */ 0194 G4bool NextGaussianIsStoredInMemory_; 0195 /** Contains the first of the two paired random numbers from the 0196 * Gaussian distribution sampling. 0197 */ 0198 G4double GaussianOne_; 0199 /** Contains the second of the two paired random numbers from the 0200 * Gaussian distribution sampling. 0201 */ 0202 G4double GaussianTwo_; 0203 /** Defines the tolerance that ShiftParameters() must match. */ 0204 G4double Tolerance_; 0205 // Functions 0206 /** Check to see if the user requested parameters have already been 0207 * calculated. If they have, it recalls the stored parameters and sets 0208 * them as the current values. 0209 */ 0210 G4bool CheckAndSetParameters(); 0211 /** Evaluates the constants that are required for the Watt fission spectrum 0212 * sampling. 0213 */ 0214 void EvaluateWattConstants(); 0215 /** Samples a Gaussian distribution defined by the internal class variables 0216 * NewMean_ and NewStdDev_. 0217 */ 0218 G4double SampleGaussian(); 0219 /** Sets the mean and standard deviation of the Gaussian distribution 0220 * sampled by this class when \p POSITIVE values are requested. 0221 * ShiftMean() performs two different operations based on the requested 0222 * data type. 0223 * - \p INTEGER: Iteratively searches for an adjusted mean that produces 0224 * the same result as the mean requested by the implementor. In this 0225 * instance the standard deviation is not adjusted. 0226 * - \p DOUBLE: Adjusts the standard deviation of the Gaussian distribution 0227 * so that the first seven standard deviations occur are all positive. 0228 * The chance that a negative value will result using this method is 0229 * 2.56E<sup>-12</sup> 0230 */ 0231 void ShiftParameters(G4FFGEnumerations::GaussianReturnType Type); 0232 0233 // Destructor function(s) 0234 public: 0235 /** Default deconstructor. */ 0236 ~G4FPYSamplingOps(); 0237 }; 0238 0239 #endif /* G4FPYSAMPLINGOPS_HH */
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|