Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4FPYSamplingOps.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 /*
27  * File: G4FPYSamplingOps.hh
28  * Author: B. Wendt (wendbryc@isu.edu)
29  *
30  * Created on June 30, 2011, 11:10 AM
31  */
32 
33 /* * * * * * * * * * * * * * * * References * * * * * * * * * * * * * * * *
34  * *
35  * 1. "Sampling ENDL Watt Fission Spectra, D. E. Cullen, LLNL, April, 2004 *
36  * *
37  * * * * * * * * * * * * * * * * References * * * * * * * * * * * * * * * */
38 
39 #ifndef G4FPYSAMPLINGOPS_HH
40 #define G4FPYSAMPLINGOPS_HH
41 
42 #include "Randomize.hh"
43 #include "globals.hh"
44 
45 #include "G4FFGEnumerations.hh"
46 #include "G4ShiftedGaussian.hh"
48 
49 /** G4FPYSamplingOps performs all the uniform and Gaussian distribution sampling
50  * operations
51  */
53 {
54 public:
55 // Constructor definition
56  /** Default constructor
57  * - Usage: No arguments required
58  * - Notes:
59  */
60  G4FPYSamplingOps( void );
61  /** Overloaded constructor
62  * - Usage:
63  * - \p Verbosity: Verbosity level
64  * - Notes:
65  */
67 protected:
68  /** Initialize is a common function called by all constructors. */
69  void Initialize( void );
70 
71 public:
72 // Functions
73  /** Returns an integer value taken from a Gaussian distribution.
74  * This overloaded version assumes that the range is not restricted to
75  * positive values only.
76  * - Usage:
77  * - \p Mean: Mean about which the Gaussian distribution will be
78  * sampled
79  * - \p StdDev: Standard deviation of the Gaussian distribution. 68.3%
80  * of the values will lie within the first standard deviation, 95.4%
81  * within the second standard deviation, etc...
82  * - Notes:
83  */
85  G4double StdDev );
86  /** Returns an integer value taken from a Gaussian distribution about
87  * \p Mean and with a standard deviation of \p StdDev.
88  * - Usage:
89  * - \p Mean: Mean about which the Gaussian distribution will be
90  * sampled
91  * - \p StdDev: Standard deviation of the Gaussian distribution. 68.3%
92  * of the values will lie within the first standard deviation, 95.4%
93  * within the second standard deviation, etc...
94  * - \p Range: \p POSITIVE or \p ALL
95  * - Notes:
96  */
98  G4double StdDev,
100  /** Returns a double value taken from a Gaussian distribution about \p Mean
101  * and with a standard deviation of \p StdDev.
102  * - Usage:
103  * - \p Mean: Mean about which the Gaussian distribution will be
104  * sampled
105  * - \p StdDev: Standard deviation of the Gaussian distribution. 68.3%
106  * of the values will lie within the first standard deviation, 95.4%
107  * within the second standard deviation, etc...
108  * - Notes:
109  */
111  G4double StdDev );
112  /** Returns a double value taken from a Gaussian distribution about \p Mean
113  * and with a standard deviation of \p StdDev.
114  * - Usage:
115  * - \p Mean: Mean about which the Gaussian distribution will be
116  * sampled
117  * - \p StdDev: Standard deviation of the Gaussian distribution. 68.3%
118  * of the values will lie within the first standard deviation, 95.4%
119  * within the second standard deviation, etc...
120  * - \p Range: \p POSITIVE or \p ALL
121  * - Notes:
122  */
124  G4double StdDev,
126  /** Returns a double value evenly distributed in the range (0, 1].
127  * - Usage: No arguments required
128  * - Notes:
129  */
130  G4double G4SampleUniform( void );
131  /** Returns a double value evenly distributed in the range
132  * (\p Lower, \p Upper].
133  * - Usage:
134  * - \p Lower: Lower bounds of the distribution
135  * - \p Upper: Upper bounds of the distribution
136  *
137  * - Notes:
138  */
140  G4double Upper );
141  /** Samples the Watt fission spectrum for the selected isotope, using an
142  * algorithm adopted from Ref. 1
143  * - Usage:
144  * - \p WhatIsotope: The isotope that is to be sampled
145  * - \p WhatCause: The cause of the isotope to be sampled
146  * - \p WhatEnergy: The energy, in MeV of the incident particle
147  * - Notes:
148  * - All variables needed for this function are grouped together in
149  * WattConstants_.
150  * -
151  */
152  G4double G4SampleWatt( G4int WhatIsotope,
154  G4double WhatEnergy );
155  /** Sets the verbosity levels
156  * - Usage:
157  * - \p WhichVerbosity: Combination of levels
158  *
159  * - Notes:
160  * - \p SILENT: All verbose output is repressed
161  * - \p UPDATES: Only high-level internal changes are reported
162  * - \p DAUGHTER_INFO: Displays information about daughter product sampling
163  * - \p NEUTRON_INFO: Displays information about neutron sampling
164  * - \p GAMMA_INFO: Displays information about gamma sampling
165  * - \p ALPHA_INFO: Displays information about alpha sampling
166  * - \p MOMENTUM_INFO: Displays information about momentum balancing
167  * - \p EXTRAPOLATION_INTERPOLATION_INFO: Displays information about any data extrapolation or interpolation that occurs
168  * - \p DEBUG: Reports program flow as it steps through functions
169  * - \p PRINT_ALL: Displays any and all output
170  */
171  void G4SetVerbosity( G4int WhatVerbosity );
172 
173 protected:
174 // Variables
175  // Class descriptor variables
176  /** Mean for sampling a Gaussian distribution */
178  /** Standard deviation for sampling a GaussianDistribution */
180  /** Structure chain that contains the all the previous values used
181  * for sampling a Gaussian distribution
182  */
184  /** Verbosity level */
186  /** Structure that contains the values for sampling the Watt fission
187  * spectrum
188  */
190 
191  // Pointers to external classes
192  /** Pointer to the CLHEP random number generator. */
194 
195  // Internal variables for use with sampling a Gaussian distribution.
196  /** Declares whether the second paired random number has been already
197  * returned.
198  */
200  /** Contains the first of the two paired random numbers from the
201  * Gaussian distribution sampling.
202  */
204  /** Contains the second of the two paired random numbers from the
205  * Gaussian distribution sampling.
206  */
208  /** Defines the tolerance that ShiftParameters() must match. */
210 // Functions
211  /** Check to see if the user requested parameters have already been
212  * calculated. If they have, it recalls the stored parameters and sets
213  * them as the current values.
214  */
216  /** Evaluates the constants that are required for the Watt fission spectrum
217  * sampling.
218  */
219  void EvaluateWattConstants( void );
220  /** Samples a Gaussian distribution defined by the internal class variables
221  * NewMean_ and NewStdDev_.
222  */
223  G4double SampleGaussian( void );
224  /** Sets the mean and standard deviation of the Gaussian distribution
225  * sampled by this class when \p POSITIVE values are requested.
226  * ShiftMean() performs two different operations based on the requested
227  * data type.
228  * - \p INTEGER: Iteratively searches for an adjusted mean that produces
229  * the same result as the mean requested by the implementor. In this
230  * instance the standard deviation is not adjusted.
231  * - \p DOUBLE: Adjusts the standard deviation of the Gaussian distribution
232  * so that the first seven standard deviations occur are all positive.
233  * The chance that a negative value will result using this method is
234  * 2.56E<sup>-12</sup>
235  */
237 
238 // Destructor function(s)
239 public:
240  /** Default deconstructor. */
241  ~G4FPYSamplingOps( void );
242 };
243 
244 #endif /* G4FPYSAMPLINGOPS_HH */
245 
G4double G4SampleGaussian(G4double Mean, G4double StdDev)
G4double SampleGaussian(void)
void EvaluateWattConstants(void)
G4double G4SampleWatt(G4int WhatIsotope, G4FFGEnumerations::FissionCause WhatCause, G4double WhatEnergy)
G4double G4SampleUniform(void)
G4ShiftedGaussian * ShiftedGaussianValues_
int G4int
Definition: G4Types.hh:78
WattSpectrumConstants * WattConstants_
bool G4bool
Definition: G4Types.hh:79
void ShiftParameters(G4FFGEnumerations::GaussianReturnType Type)
CLHEP::HepRandomEngine * RandomEngine_
double G4double
Definition: G4Types.hh:76
void G4SetVerbosity(G4int WhatVerbosity)
G4bool CheckAndSetParameters(void)
G4bool NextGaussianIsStoredInMemory_
G4int G4SampleIntegerGaussian(G4double Mean, G4double StdDev)