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 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  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 "G4FFGEnumerations.hh"
 43 #include "G4ShiftedGaussian.hh"
 44 #include "G4WattFissionSpectrumValues.hh"
 45 #include "Randomize.hh"
 46 #include "globals.hh"
 47 
 48 /** G4FPYSamplingOps performs all the uniform and Gaussian distribution sampling
 49  *  operations
 50  */
 51 class G4FPYSamplingOps
 52 {
 53   public:
 54     // Constructor definition
 55     /** Default constructor
 56      *  - Usage: No arguments required
 57      *  - Notes:
 58      */
 59     G4FPYSamplingOps();
 60     /** Overloaded constructor
 61      *  - Usage:
 62      *      - \p Verbosity: Verbosity level
 63      *  - Notes:
 64      */
 65     G4FPYSamplingOps(G4int Verbosity);
 66 
 67   protected:
 68     /** Initialize is a common function called by all constructors. */
 69     void Initialize();
 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      */
 84     G4int G4SampleIntegerGaussian(G4double Mean, G4double StdDev);
 85     /** Returns an integer value taken from a Gaussian distribution about
 86      *  \p Mean and with a standard deviation of \p StdDev.
 87      *  - Usage:
 88      *      - \p Mean: Mean about which the Gaussian distribution will be
 89      *        sampled
 90      *      - \p StdDev: Standard deviation of the Gaussian distribution. 68.3%
 91      *        of the values will lie within the first standard deviation, 95.4%
 92      *        within the second standard deviation, etc...
 93      *      - \p Range: \p POSITIVE or \p ALL
 94      *  - Notes:
 95      */
 96     G4int G4SampleIntegerGaussian(G4double Mean, G4double StdDev,
 97                                   G4FFGEnumerations::GaussianRange Range);
 98     /** Returns a double value taken from a Gaussian distribution about \p Mean
 99      *  and with a standard deviation of \p StdDev.
100      *  - Usage:
101      *      - \p Mean: Mean about which the Gaussian distribution will be
102      *        sampled
103      *      - \p StdDev: Standard deviation of the Gaussian distribution. 68.3%
104      *        of the values will lie within the first standard deviation, 95.4%
105      *        within the second standard deviation, etc...
106      *  - Notes:
107      */
108     G4double G4SampleGaussian(G4double Mean, G4double StdDev);
109     /** Returns a double value taken from a Gaussian distribution about \p Mean
110      *  and with a standard deviation of \p StdDev.
111      *  - Usage:
112      *      - \p Mean: Mean about which the Gaussian distribution will be
113      *        sampled
114      *      - \p StdDev: Standard deviation of the Gaussian distribution. 68.3%
115      *        of the values will lie within the first standard deviation, 95.4%
116      *        within the second standard deviation, etc...
117      *      - \p Range: \p POSITIVE or \p ALL
118      *  - Notes:
119      */
120     G4double G4SampleGaussian(G4double Mean, G4double StdDev,
121                               G4FFGEnumerations::GaussianRange Range);
122     /** Returns a double value evenly distributed in the range (0, 1].
123      *  - Usage: No arguments required
124      *  - Notes:
125      */
126     G4double G4SampleUniform();
127     /** Returns a double value evenly distributed in the range
128      *  (\p Lower, \p Upper].
129      *  - Usage:
130      *      - \p Lower: Lower bounds of the distribution
131      *      - \p Upper: Upper bounds of the distribution
132      *
133      *  - Notes:
134      */
135     G4double G4SampleUniform(G4double Lower, G4double Upper);
136     /** Samples the Watt fission spectrum for the selected isotope, using an
137      *  algorithm adopted from Ref. 1
138      *  - Usage:
139      *      - \p WhatIsotope: The isotope that is to be sampled
140      *      - \p WhatCause: The cause of the isotope to be sampled
141      *      - \p WhatEnergy: The energy, in MeV of the incident particle
142      *  - Notes:
143      *      - All variables needed for this function are grouped together in
144      *      WattConstants_.
145      *      -
146      */
147     G4double G4SampleWatt(G4int WhatIsotope, G4FFGEnumerations::FissionCause WhatCause,
148                           G4double WhatEnergy);
149     /** Sets the verbosity levels
150      *  - Usage:
151      *      - \p WhichVerbosity: Combination of  levels
152      *
153      *  - Notes:
154      *      - \p SILENT: All verbose output is repressed
155      *      - \p UPDATES: Only high-level internal changes are reported
156      *      - \p DAUGHTER_INFO: Displays information about daughter product sampling
157      *      - \p NEUTRON_INFO: Displays information about neutron sampling
158      *      - \p GAMMA_INFO: Displays information about gamma sampling
159      *      - \p ALPHA_INFO: Displays information about alpha sampling
160      *      - \p MOMENTUM_INFO: Displays information about momentum balancing
161      *      - \p EXTRAPOLATION_INTERPOLATION_INFO: Displays information about any data extrapolation
162      * or interpolation that occurs
163      *      - \p DEBUG: Reports program flow as it steps through functions
164      *      - \p PRINT_ALL: Displays any and all output
165      */
166     void G4SetVerbosity(G4int WhatVerbosity);
167 
168   protected:
169     // Variables
170     // Class descriptor variables
171     /** Mean for sampling a Gaussian distribution */
172     G4double Mean_;
173     /** Standard deviation for sampling a GaussianDistribution */
174     G4double StdDev_;
175     /** Structure chain that contains the all the previous values used
176      *  for sampling a Gaussian distribution
177      */
178     G4ShiftedGaussian* ShiftedGaussianValues_;
179     /** Verbosity level */
180     G4int Verbosity_;
181     /** Structure that contains the values for sampling the Watt fission
182      *  spectrum
183      */
184     WattSpectrumConstants* WattConstants_;
185 
186     // Pointers to external classes
187     /** Pointer to the CLHEP random number generator. */
188     CLHEP::HepRandomEngine* RandomEngine_;
189 
190     // Internal variables for use with sampling a Gaussian distribution.
191     /** Declares whether the second paired random number has been already
192      *  returned.
193      */
194     G4bool NextGaussianIsStoredInMemory_;
195     /** Contains the first of the two paired random numbers from the
196      *  Gaussian distribution sampling.
197      */
198     G4double GaussianOne_;
199     /** Contains the second of the two paired random numbers from the
200      *  Gaussian distribution sampling.
201      */
202     G4double GaussianTwo_;
203     /** Defines the tolerance that ShiftParameters() must match. */
204     G4double Tolerance_;
205     // Functions
206     /** Check to see if the user requested parameters have already been
207      *  calculated. If they have, it recalls the stored parameters and sets
208      *  them as the current values.
209      */
210     G4bool CheckAndSetParameters();
211     /** Evaluates the constants that are required for the Watt fission spectrum
212      *  sampling.
213      */
214     void EvaluateWattConstants();
215     /** Samples a Gaussian distribution defined by the internal class variables
216      *  NewMean_ and NewStdDev_.
217      */
218     G4double SampleGaussian();
219     /** Sets the mean and standard deviation of the Gaussian distribution
220      *  sampled by this class when \p POSITIVE values are requested.
221      *  ShiftMean() performs two different operations based on the requested
222      *  data type.
223      *  - \p INTEGER: Iteratively searches for an adjusted mean that produces
224      *    the same result as the mean requested by the implementor. In this
225      *    instance the standard deviation is not adjusted.
226      *  - \p DOUBLE: Adjusts the standard deviation of the Gaussian distribution
227      *    so that the first seven standard deviations occur are all positive.
228      *    The chance that a negative value will result using this method is
229      *    2.56E<sup>-12</sup>
230      */
231     void ShiftParameters(G4FFGEnumerations::GaussianReturnType Type);
232 
233     // Destructor function(s)
234   public:
235     /** Default deconstructor. */
236     ~G4FPYSamplingOps();
237 };
238 
239 #endif /* G4FPYSAMPLINGOPS_HH */
240