Geant4 Cross Reference |
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: G4FissionProductYieldDist.hh 28 * Author: B. Wendt (wendbryc@isu.edu) 29 * 30 * Created on May 11, 2011, 12:04 PM 31 */ 32 33 #ifndef G4FISSIONPRODUCTYIELDDIST_HH 34 #define G4FISSIONPRODUCTYIELDDIST_HH 35 36 #include "G4DynamicParticle.hh" 37 #include "G4DynamicParticleVector.hh" 38 #include "G4ENDFTapeRead.hh" 39 #include "G4ENDFYieldDataContainer.hh" 40 #include "G4FFGEnumerations.hh" 41 #include "G4FPYNubarValues.hh" 42 #include "G4FPYSamplingOps.hh" 43 #include "G4FPYTreeStructures.hh" 44 #include "G4Gamma.hh" 45 #include "G4IonTable.hh" 46 #include "G4Ions.hh" 47 #include "G4ParticleHPNames.hh" 48 #include "G4ReactionProduct.hh" 49 #include "globals.hh" 50 51 /** G4FissionProductYieldDist is the base class for storing all the fission 52 * data and generating fission events. */ 53 class G4FissionProductYieldDist 54 { 55 public: 56 // Constructor definition 57 /** Default constructor 58 * - Usage: 59 * - \p WhichIsotope: Isotope number of the element in ZZZAAA form 60 * - \p WhichMetaState: \p GROUND_STATE, \p META_1, or \p META_2 61 * - \p WhichCause: \p SPONTANEOUS or \p N_INDUCED 62 * - \p WhichYieldType: \p INDEPENDENT or \p CUMULATIVE 63 * 64 * - Notes: 65 */ 66 G4FissionProductYieldDist(G4int WhichIsotope, G4FFGEnumerations::MetaState WhichMetaState, 67 G4FFGEnumerations::FissionCause WhichCause, 68 G4FFGEnumerations::YieldType WhichYieldType, 69 std::istringstream& dataStream); 70 /** Overloaded constructor 71 * - Usage: 72 * - \p WhichIsotope: Isotope number of the element in ZZZAAA form 73 * - \p WhichMetaState: \p GROUND_STATE, \p META_1, or \p META_2 74 * - \p WhichCause: \p SPONTANEOUS or \p N_INDUCED 75 * - \p WhichYieldType: \p INDEPENDENT or \p CUMULATIVE 76 * - \p Verbosity: Verbosity level 77 * 78 * - Notes: 79 */ 80 G4FissionProductYieldDist(G4int WhichIsotope, G4FFGEnumerations::MetaState WhichMetaState, 81 G4FFGEnumerations::FissionCause WhichCause, 82 G4FFGEnumerations::YieldType WhichYieldType, G4int Verbosity, 83 std::istringstream& dataStream); 84 85 private: 86 /** Initialize is a common function called by all constructors. */ 87 void Initialize(std::istringstream& dataStream); 88 89 #ifdef G4MULTITHREADED 90 static G4Mutex fissprodMutex; 91 #endif 92 93 public: 94 // Functions 95 /** Generates a fission event using default sampling and returns the pointer 96 * to that fission event. 97 * - Usage: No arguments required 98 * 99 * - Notes: 100 * - The fission products are loaded into FissionContainer in the 101 * following order: 102 * - First daughter product 103 * - Second daughter product 104 * - Alpha particles 105 * - Neutrons 106 * - Gamma rays 107 * - The last particle will have a NULL NextFragment pointer 108 */ 109 G4DynamicParticleVector* G4GetFission(); 110 /** Selects a fission fragment at random from the probability tree and 111 * returns the \p G4Ions pointer. 112 * - Usage: No arguments required 113 * 114 * - Notes: 115 */ 116 G4Ions* G4GetFissionProduct(); 117 /** Set the alpha production behavior for fission event generation. 118 * - Usage: 119 * - if \p AlphaProduction is negative then alpha particles are sampled 120 * randomly. 121 * 122 * - Notes: 123 * - The maximum number of alpha particles that may be created is 124 * physically limited by the nucleons present in the parent nucleus. 125 * Setting the AlphaProduction too high will have unpredictable 126 * results on the sampling of the fission products. 127 */ 128 void G4SetAlphaProduction(G4double WhatAlphaProduction); 129 /** Sets the energy of the incident particle 130 * - Usage: 131 * - \p WhatIncidentEnergy: Kinetic energy, if any, of the incident 132 * neutron in GeV 133 * 134 * - Notes: 135 */ 136 void G4SetEnergy(G4double WhatIncidentEnergy); 137 /** Sets the probability of ternary fission 138 * - Usage: 139 * - \p WhatTernaryProbability: Probability of generating a ternary 140 * fission event. 141 * 142 * - Notes: 143 */ 144 void G4SetTernaryProbability(G4double TernaryProbability); 145 /** Sets the verbosity levels 146 * - Usage: 147 * - \p WhichVerbosity: Combination of levels 148 * 149 * - Notes: 150 * - \p SILENT: All verbose output is repressed 151 * - \p UPDATES: Only high-level internal changes are reported 152 * - \p DAUGHTER_INFO: Displays information about daughter product sampling 153 * - \p NEUTRON_INFO: Displays information about neutron sampling 154 * - \p GAMMA_INFO: Displays information about gamma sampling 155 * - \p ALPHA_INFO: Displays information about alpha sampling 156 * - \p MOMENTUM_INFO: Displays information about momentum balancing 157 * - \p EXTRAPOLATION_INTERPOLATION_INFO: Displays information about any data extrapolation 158 * or interpolation that occurs 159 * - \p DEBUG: Reports program flow as it steps through functions 160 * - \p PRINT_ALL: Displays any and all output 161 */ 162 void G4SetVerbosity(G4int WhatVerbosity); 163 164 protected: 165 // Variables 166 // Class descriptor variables 167 /** Number in ZZZAAA format of the isotope that 168 * G4FissionProductYieldDist references 169 */ 170 const G4int Isotope_; 171 /** MetaState information of the isotope that G4FissionProductYieldDist 172 * references 173 * \n Possible values are \p GROUND_STATE, \p META_1, or \p META_2 174 */ 175 const G4FFGEnumerations::MetaState MetaState_; 176 /** The cause of fission: \p SPONTANEOUS or \p N_INDUCED. */ 177 const G4FFGEnumerations::FissionCause Cause_; 178 /** The type of yield to be used: \p INDEPENDET or \p CUMULATIVE */ 179 const G4FFGEnumerations::YieldType YieldType_; 180 181 // Datafile variables 182 /** Name of the fission yield product data file that 183 * G4FissionProductYieldDist references 184 */ 185 G4ENDFTapeRead* ENDFData_; 186 187 // Fission generation variables 188 /** Contains the \p G4Ions pointer to an alpha particle */ 189 G4Ions* AlphaDefinition_; 190 /** Controls whether alpha particles are emitted, and how many */ 191 G4double AlphaProduction_; 192 /** Sets the ternary fission probability. Valid ranges are [0, 1] */ 193 G4double TernaryProbability_; 194 /** Contains the \p g4ParticleDefinition pointer to a gamma particle */ 195 G4Gamma* GammaDefinition_; 196 /** Kinetic energy, if any, of the incident particle in GeV. */ 197 G4double IncidentEnergy_; 198 /** Sets the mean gamma energy, in MeV, produced by the fission of the 199 * isotope described by Isotope_ 200 */ 201 G4double MeanGammaEnergy_; 202 /** Contains the G4ParticleDefinition pointer to a neutron, cast as a 203 * G4Ion for compatibility*/ 204 G4Ions* NeutronDefinition_; 205 /** Nubar for the isotope and incident neutron energy that 206 * G4FissionProductYieldDist references. 207 */ 208 G4double Nubar_; 209 /** Width of the gaussian distribution that samples nubar for the 210 * isotope and incident neutron energy that G4FissionProductYieldDist 211 * references. 212 */ 213 G4double NubarWidth_; 214 /** Counter for the number of protons available to the fission event */ 215 G4int RemainingZ_; 216 /** Counter for the number of nucleons available to the fission event */ 217 G4int RemainingA_; 218 /** Container for the energy remaining to be assigned in the fission generation */ 219 G4double RemainingEnergy_; 220 /** Verbosity level */ 221 G4int Verbosity_; 222 223 // Pointers to the field of trees and relevant normalization data 224 /** An array, or 'field', of the probability trees */ 225 ProbabilityTree* Trees_; 226 /** Defines the smallest Z particle in the field of trees */ 227 G4Ions* SmallestZ_; 228 /** Defines the smallest A particle in the field of trees */ 229 G4Ions* SmallestA_; 230 /** Defines the largest Z particle in the field of trees. */ 231 G4Ions* LargestZ_; 232 /** Defines the largest Z particle in the field of trees */ 233 G4Ions* LargestA_; 234 /** Number of specific energy groups */ 235 G4int YieldEnergyGroups_; 236 /** Energy values of each energy */ 237 G4double* YieldEnergies_; 238 /** Variable for ensuring that the input data is normalized */ 239 G4double* MaintainNormalizedData_; 240 /** A running total of all the probabilities */ 241 G4double* DataTotal_; 242 /** The number of trees in the field */ 243 G4int TreeCount_; 244 /** A run-time counter for the total number of branches stored */ 245 G4int BranchCount_; 246 247 // Pointers to runtime classes that G4FissionProductYieldDist needs to 248 // function properly 249 /** Pointer to \p G4IonTable 250 * \n All \p G4Ions are created using 251 * \p G4IonTable 252 */ 253 G4IonTable* IonTable_; 254 /** Pointer to \p G4NeutronHPNames 255 * \n Provides access to the list of element names included in Geant4 256 */ 257 G4ParticleHPNames* ElementNames_; 258 /** Pointer to the \p CLHEP library random engine */ 259 G4FPYSamplingOps* RandomEngine_; 260 261 // Functions 262 /** Checks to make sure that alpha overpopulation will not occur, which 263 * could result in an unsolvable zero momentum in the LAB system. 264 */ 265 void CheckAlphaSanity(); 266 /** Returns the \p G4Ions definitions pointer for the particle whose 267 * probability segment contains the (0, 1] random number \p RandomParticle 268 */ 269 G4Ions* FindParticle(G4double RandomParticle); 270 /** Returns the \p G4Ions definitions pointer for the particle whose 271 * probability segment contains the (0, 1] random number \p RandomParticle 272 * by extrapolating values using the current data set. 273 * This function exists so that that different models of extrapolation 274 * may be more easily implemented in the future. 275 */ 276 G4Ions* FindParticleExtrapolation(G4double RandomParticle, G4bool LowerEnergyGroupExists); 277 /** Returns the \p G4Ions definitions pointer for the particle whose 278 * probability segment contains the (0, 1] random number \p RandomParticle 279 * by interpolating values in the current data set. 280 * This function exists so that that different models of interpolation 281 * may be more easily implemented in the future. 282 */ 283 G4Ions* FindParticleInterpolation(G4double RandomParticle, G4int LowerEnergyGroup); 284 /** Returns the \p G4Ions definitions pointer for the particle whose 285 * probability segment contains the (0, 1] random number \p RandomParticle 286 * by searching through a branch. Both the extrapolation and interpolation 287 * schemes currently use this function to identify the particle. 288 */ 289 G4Ions* FindParticleBranchSearch(ProbabilityBranch* Branch, G4double RandomParticle, 290 G4int EnergyGroup1, G4int EnergyGroup2); 291 /** Generates a \p G4DynamicParticleVector with the fission alphas 292 */ 293 virtual void GenerateAlphas(std::vector<G4ReactionProduct*>* Alphas); 294 /** Generate a linked chain of neutrons and return the pointer to the last 295 * neutron in the chain. 296 */ 297 virtual void GenerateNeutrons(std::vector<G4ReactionProduct*>* Neutrons); 298 /** Selects a fission product from the probability tree, limited by the 299 * number of nucleons available to the system 300 */ 301 virtual G4Ions* GetFissionProduct() = 0; 302 /** Returns the \p G4Ions definition pointer to the isotope defined by 303 * \p Product and \p MetaState. 304 * Searches the \p ParticleTable for the particle defined by \p Product 305 * (ZZZAAA) and \p MetaState and returns the \p G4Ions 306 * pointer to that particle. If the particle does not exist then it is 307 * created in \p G4ParticleTable and the pointer to the new particle is 308 * returned. 309 */ 310 G4Ions* GetParticleDefinition(G4int Product, G4FFGEnumerations::MetaState MetaState); 311 /** Generates the directory location for the data file referenced by 312 * G4FissionProductYieldDist 313 */ 314 G4String MakeDirectoryName(); 315 /** Generates the appropriate file name for the isotope requested */ 316 G4String MakeFileName(G4int Isotope, G4FFGEnumerations::MetaState MetaState); 317 /** Creates a \p G4DynamicParticle from an existing \p G4ReactionProduct */ 318 G4DynamicParticle* MakeG4DynamicParticle(G4ReactionProduct*); 319 /** Generates the unique name for an isotope/isomer defined by \p Isotope\ 320 * and \p MetaState in the following format: ZZZ_AAAmX_NAME 321 */ 322 G4String MakeIsotopeName(G4int Isotope, G4FFGEnumerations::MetaState MetaState); 323 /** Dynamically allocates and initializes the 'field' of 'trees' with the 324 * 'trunks' 325 */ 326 virtual void MakeTrees(); 327 /** Reads in the probability data from the data file */ 328 virtual void ReadProbabilities(); 329 /** Renormalizes the data in a ProbabilityTree. 330 * Traverses the tree structure and renormalizes all the probability data 331 * into probability segments, ensuring that no segment overlaps the 332 * other. 333 */ 334 void Renormalize(ProbabilityBranch* Branch); 335 /** Sample the energy of the alpha particles. The energy used by the alpha 336 * particles is subtracted from the available energy 337 */ 338 void SampleAlphaEnergies(std::vector<G4ReactionProduct*>* Alphas); 339 /** Samples the energy of the gamma rays */ 340 void SampleGammaEnergies(std::vector<G4ReactionProduct*>* Gammas); 341 /** Sample the energy of the neutrons using the Watt fission spectrum. The 342 * kinetic energy consumed is returned. 343 */ 344 void SampleNeutronEnergies(std::vector<G4ReactionProduct*>* Neutrons); 345 /** Sets the nubar values for the isotope referenced by 346 * G4FissionProductYieldDistdefined from the data sets defined in 347 * SpecialOps.hh 348 */ 349 void SetNubar(); 350 /** Sorts information for a potential new particle into the correct tree */ 351 virtual void SortProbability(G4ENDFYieldDataContainer* YieldData); 352 353 // Destructor function(s) 354 public: 355 /** Default deconstructor. It is a virtual function since 356 * G4FissionProductYieldDist is a parent class 357 */ 358 virtual ~G4FissionProductYieldDist(); 359 360 protected: 361 /** Recursively burns each branch in a probability tree. */ 362 void BurnTree(ProbabilityBranch* Branch); 363 }; 364 365 #endif /* G4FISSIONPRODUCTYIELDDIST_HH */ 366