Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:17

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:   G4FissionProductYieldDist.hh
0028  * Author: B. Wendt (wendbryc@isu.edu)
0029  *
0030  * Created on May 11, 2011, 12:04 PM
0031  */
0032 
0033 #ifndef G4FISSIONPRODUCTYIELDDIST_HH
0034 #define G4FISSIONPRODUCTYIELDDIST_HH
0035 
0036 #include "G4DynamicParticle.hh"
0037 #include "G4DynamicParticleVector.hh"
0038 #include "G4ENDFTapeRead.hh"
0039 #include "G4ENDFYieldDataContainer.hh"
0040 #include "G4FFGEnumerations.hh"
0041 #include "G4FPYNubarValues.hh"
0042 #include "G4FPYSamplingOps.hh"
0043 #include "G4FPYTreeStructures.hh"
0044 #include "G4Gamma.hh"
0045 #include "G4IonTable.hh"
0046 #include "G4Ions.hh"
0047 #include "G4ParticleHPNames.hh"
0048 #include "G4ReactionProduct.hh"
0049 #include "globals.hh"
0050 
0051 /** G4FissionProductYieldDist is the base class for storing all the fission
0052  *  data and generating fission events. */
0053 class G4FissionProductYieldDist
0054 {
0055   public:
0056     // Constructor definition
0057     /** Default constructor
0058      *  - Usage:
0059      *      - \p WhichIsotope: Isotope number of the element in ZZZAAA form
0060      *      - \p WhichMetaState: \p GROUND_STATE, \p META_1, or \p META_2
0061      *      - \p WhichCause: \p SPONTANEOUS or \p N_INDUCED
0062      *      - \p WhichYieldType: \p INDEPENDENT or \p CUMULATIVE
0063      *
0064      *  - Notes:
0065      */
0066     G4FissionProductYieldDist(G4int WhichIsotope, G4FFGEnumerations::MetaState WhichMetaState,
0067                               G4FFGEnumerations::FissionCause WhichCause,
0068                               G4FFGEnumerations::YieldType WhichYieldType,
0069                               std::istringstream& dataStream);
0070     /** Overloaded constructor
0071      *  - Usage:
0072      *      - \p WhichIsotope: Isotope number of the element in ZZZAAA form
0073      *      - \p WhichMetaState: \p GROUND_STATE, \p META_1, or \p META_2
0074      *      - \p WhichCause: \p SPONTANEOUS or \p N_INDUCED
0075      *      - \p WhichYieldType: \p INDEPENDENT or \p CUMULATIVE
0076      *      - \p Verbosity: Verbosity level
0077      *
0078      *  - Notes:
0079      */
0080     G4FissionProductYieldDist(G4int WhichIsotope, G4FFGEnumerations::MetaState WhichMetaState,
0081                               G4FFGEnumerations::FissionCause WhichCause,
0082                               G4FFGEnumerations::YieldType WhichYieldType, G4int Verbosity,
0083                               std::istringstream& dataStream);
0084 
0085   private:
0086     /** Initialize is a common function called by all constructors. */
0087     void Initialize(std::istringstream& dataStream);
0088 
0089 #ifdef G4MULTITHREADED
0090     static G4Mutex fissprodMutex;
0091 #endif
0092 
0093   public:
0094     // Functions
0095     /** Generates a fission event using default sampling and returns the pointer
0096      *  to that fission event.
0097      *  - Usage: No arguments required
0098      *
0099      *  - Notes:
0100      *      - The fission products are loaded into FissionContainer in the
0101      *        following order:
0102      *          - First daughter product
0103      *          - Second daughter product
0104      *          - Alpha particles
0105      *          - Neutrons
0106      *          - Gamma rays
0107      *      - The last particle will have a NULL NextFragment pointer
0108      */
0109     G4DynamicParticleVector* G4GetFission();
0110     /** Selects a fission fragment at random from the probability tree and
0111      *  returns the \p G4Ions pointer.
0112      *  - Usage: No arguments required
0113      *
0114      *  - Notes:
0115      */
0116     G4Ions* G4GetFissionProduct();
0117     /** Set the alpha production behavior for fission event generation.
0118      *  - Usage:
0119      *      - if \p AlphaProduction is negative then alpha particles are sampled
0120      *        randomly.
0121      *
0122      *  - Notes:
0123      *      - The maximum number of alpha particles that may be created is
0124      *        physically limited by the nucleons present in the parent nucleus.
0125      *        Setting the AlphaProduction too high will have unpredictable
0126      *        results on the sampling of the fission products.
0127      */
0128     void G4SetAlphaProduction(G4double WhatAlphaProduction);
0129     /** Sets the energy of the incident particle
0130      *  - Usage:
0131      *      - \p WhatIncidentEnergy: Kinetic energy, if any, of the incident
0132      *      neutron in GeV
0133      *
0134      *  - Notes:
0135      */
0136     void G4SetEnergy(G4double WhatIncidentEnergy);
0137     /** Sets the probability of ternary fission
0138      *  - Usage:
0139      *      - \p WhatTernaryProbability: Probability of generating a ternary
0140      *        fission event.
0141      *
0142      *  - Notes:
0143      */
0144     void G4SetTernaryProbability(G4double TernaryProbability);
0145     /** Sets the verbosity levels
0146      *  - Usage:
0147      *      - \p WhichVerbosity: Combination of  levels
0148      *
0149      *  - Notes:
0150      *      - \p SILENT: All verbose output is repressed
0151      *      - \p UPDATES: Only high-level internal changes are reported
0152      *      - \p DAUGHTER_INFO: Displays information about daughter product sampling
0153      *      - \p NEUTRON_INFO: Displays information about neutron sampling
0154      *      - \p GAMMA_INFO: Displays information about gamma sampling
0155      *      - \p ALPHA_INFO: Displays information about alpha sampling
0156      *      - \p MOMENTUM_INFO: Displays information about momentum balancing
0157      *      - \p EXTRAPOLATION_INTERPOLATION_INFO: Displays information about any data extrapolation
0158      * or interpolation that occurs
0159      *      - \p DEBUG: Reports program flow as it steps through functions
0160      *      - \p PRINT_ALL: Displays any and all output
0161      */
0162     void G4SetVerbosity(G4int WhatVerbosity);
0163 
0164   protected:
0165     // Variables
0166     // Class descriptor variables
0167     /** Number in ZZZAAA format of the isotope that
0168      *  G4FissionProductYieldDist references
0169      */
0170     const G4int Isotope_;
0171     /** MetaState information of the isotope that G4FissionProductYieldDist
0172      *  references
0173      *  \n Possible values are \p GROUND_STATE, \p META_1, or \p META_2
0174      */
0175     const G4FFGEnumerations::MetaState MetaState_;
0176     /** The cause of fission: \p SPONTANEOUS or \p N_INDUCED. */
0177     const G4FFGEnumerations::FissionCause Cause_;
0178     /** The type of yield to be used: \p INDEPENDET or \p CUMULATIVE */
0179     const G4FFGEnumerations::YieldType YieldType_;
0180 
0181     // Datafile variables
0182     /** Name of the fission yield product data file that
0183      *  G4FissionProductYieldDist references
0184      */
0185     G4ENDFTapeRead* ENDFData_;
0186 
0187     // Fission generation variables
0188     /** Contains the \p G4Ions pointer to an alpha particle */
0189     G4Ions* AlphaDefinition_;
0190     /** Controls whether alpha particles are emitted, and how many */
0191     G4double AlphaProduction_;
0192     /** Sets the ternary fission probability. Valid ranges are [0, 1] */
0193     G4double TernaryProbability_;
0194     /** Contains the \p g4ParticleDefinition pointer to a gamma particle */
0195     G4Gamma* GammaDefinition_;
0196     /** Kinetic energy, if any, of the incident particle in GeV. */
0197     G4double IncidentEnergy_;
0198     /** Sets the mean gamma energy, in MeV, produced by the fission of the
0199      *  isotope described by Isotope_
0200      */
0201     G4double MeanGammaEnergy_;
0202     /** Contains the G4ParticleDefinition pointer to a neutron, cast as a
0203      *  G4Ion for compatibility*/
0204     G4Ions* NeutronDefinition_;
0205     /** Nubar for the isotope and incident neutron energy that
0206      *  G4FissionProductYieldDist references.
0207      */
0208     G4double Nubar_;
0209     /** Width of the gaussian distribution that samples nubar for the
0210      *  isotope and incident neutron energy that G4FissionProductYieldDist
0211      *  references.
0212      */
0213     G4double NubarWidth_;
0214     /** Counter for the number of protons available to the fission event */
0215     G4int RemainingZ_;
0216     /** Counter for the number of nucleons available to the fission event */
0217     G4int RemainingA_;
0218     /** Container for the energy remaining to be assigned in the fission generation */
0219     G4double RemainingEnergy_;
0220     /** Verbosity level */
0221     G4int Verbosity_;
0222 
0223     // Pointers to the field of trees and relevant normalization data
0224     /** An array, or 'field', of the probability trees */
0225     ProbabilityTree* Trees_;
0226     /** Defines the smallest Z particle in the field of trees */
0227     G4Ions* SmallestZ_;
0228     /** Defines the smallest A particle in the field of trees */
0229     G4Ions* SmallestA_;
0230     /** Defines the largest Z particle in the field of trees. */
0231     G4Ions* LargestZ_;
0232     /** Defines the largest Z particle in the field of trees */
0233     G4Ions* LargestA_;
0234     /** Number of specific energy groups */
0235     G4int YieldEnergyGroups_;
0236     /** Energy values of each energy */
0237     G4double* YieldEnergies_;
0238     /** Variable for ensuring that the input data is normalized */
0239     G4double* MaintainNormalizedData_;
0240     /** A running total of all the probabilities */
0241     G4double* DataTotal_;
0242     /** The number of trees in the field */
0243     G4int TreeCount_;
0244     /** A run-time counter for the total number of branches stored */
0245     G4int BranchCount_;
0246 
0247     // Pointers to runtime classes that G4FissionProductYieldDist needs to
0248     // function properly
0249     /** Pointer to \p G4IonTable
0250      *  \n All \p G4Ions are created using
0251      *  \p G4IonTable
0252      */
0253     G4IonTable* IonTable_;
0254     /** Pointer to \p G4NeutronHPNames
0255      * \n Provides access to the list of element names included in Geant4
0256      */
0257     G4ParticleHPNames* ElementNames_;
0258     /** Pointer to the \p CLHEP library random engine */
0259     G4FPYSamplingOps* RandomEngine_;
0260 
0261     // Functions
0262     /** Checks to make sure that alpha overpopulation will not occur, which
0263      *  could result in an unsolvable zero momentum in the LAB system.
0264      */
0265     void CheckAlphaSanity();
0266     /** Returns the \p G4Ions definitions pointer for the particle whose
0267      *  probability segment contains the (0, 1] random number \p RandomParticle
0268      */
0269     G4Ions* FindParticle(G4double RandomParticle);
0270     /** Returns the \p G4Ions definitions pointer for the particle whose
0271      *  probability segment contains the (0, 1] random number \p RandomParticle
0272      *  by extrapolating values using the current data set.
0273      *  This function exists so that that different models of extrapolation
0274      *  may be more easily implemented in the future.
0275      */
0276     G4Ions* FindParticleExtrapolation(G4double RandomParticle, G4bool LowerEnergyGroupExists);
0277     /** Returns the \p G4Ions definitions pointer for the particle whose
0278      *  probability segment contains the (0, 1] random number \p RandomParticle
0279      *  by interpolating values in the current data set.
0280      *  This function exists so that that different models of interpolation
0281      *  may be more easily implemented in the future.
0282      */
0283     G4Ions* FindParticleInterpolation(G4double RandomParticle, G4int LowerEnergyGroup);
0284     /** Returns the \p G4Ions definitions pointer for the particle whose
0285      *  probability segment contains the (0, 1] random number \p RandomParticle
0286      *  by searching through a branch. Both the extrapolation and interpolation
0287      *  schemes currently use this function to identify the particle.
0288      */
0289     G4Ions* FindParticleBranchSearch(ProbabilityBranch* Branch, G4double RandomParticle,
0290                                      G4int EnergyGroup1, G4int EnergyGroup2);
0291     /** Generates a \p G4DynamicParticleVector with the fission alphas
0292      */
0293     virtual void GenerateAlphas(std::vector<G4ReactionProduct*>* Alphas);
0294     /** Generate a linked chain of neutrons and return the pointer to the last
0295      * neutron in the chain.
0296      */
0297     virtual void GenerateNeutrons(std::vector<G4ReactionProduct*>* Neutrons);
0298     /** Selects a fission product from the probability tree, limited by the
0299      *  number of nucleons available to the system
0300      */
0301     virtual G4Ions* GetFissionProduct() = 0;
0302     /** Returns the \p G4Ions definition pointer to the isotope defined by
0303      *  \p Product and \p MetaState.
0304      *  Searches the \p ParticleTable for the particle defined by \p Product
0305      *  (ZZZAAA) and \p MetaState and returns the \p G4Ions
0306      *  pointer to that particle. If the particle does not exist then it is
0307      *  created in \p G4ParticleTable and the pointer to the new particle is
0308      *  returned.
0309      */
0310     G4Ions* GetParticleDefinition(G4int Product, G4FFGEnumerations::MetaState MetaState);
0311     /** Generates the directory location for the data file referenced by
0312      *  G4FissionProductYieldDist
0313      */
0314     G4String MakeDirectoryName();
0315     /** Generates the appropriate file name for the isotope requested */
0316     G4String MakeFileName(G4int Isotope, G4FFGEnumerations::MetaState MetaState);
0317     /** Creates a \p G4DynamicParticle from an existing \p G4ReactionProduct */
0318     G4DynamicParticle* MakeG4DynamicParticle(G4ReactionProduct*);
0319     /** Generates the unique name for an isotope/isomer defined by \p Isotope\
0320      *  and \p MetaState in the following format: ZZZ_AAAmX_NAME
0321      */
0322     G4String MakeIsotopeName(G4int Isotope, G4FFGEnumerations::MetaState MetaState);
0323     /** Dynamically allocates and initializes the 'field' of 'trees' with the
0324      *  'trunks'
0325      */
0326     virtual void MakeTrees();
0327     /** Reads in the probability data from the data file */
0328     virtual void ReadProbabilities();
0329     /** Renormalizes the data in a ProbabilityTree.
0330      *  Traverses the tree structure and renormalizes all the probability data
0331      *  into probability segments, ensuring that no segment overlaps the
0332      *  other.
0333      */
0334     void Renormalize(ProbabilityBranch* Branch);
0335     /** Sample the energy of the alpha particles. The energy used by the alpha
0336      *  particles is subtracted from the available energy
0337      */
0338     void SampleAlphaEnergies(std::vector<G4ReactionProduct*>* Alphas);
0339     /** Samples the energy of the gamma rays */
0340     void SampleGammaEnergies(std::vector<G4ReactionProduct*>* Gammas);
0341     /** Sample the energy of the neutrons using the Watt fission spectrum. The
0342      *  kinetic energy consumed is returned.
0343      */
0344     void SampleNeutronEnergies(std::vector<G4ReactionProduct*>* Neutrons);
0345     /** Sets the nubar values for the isotope referenced by
0346      *  G4FissionProductYieldDistdefined from the data sets defined in
0347      *  SpecialOps.hh
0348      */
0349     void SetNubar();
0350     /** Sorts information for a potential new particle into the correct tree */
0351     virtual void SortProbability(G4ENDFYieldDataContainer* YieldData);
0352 
0353     // Destructor function(s)
0354   public:
0355     /** Default deconstructor. It is a virtual function since
0356      *  G4FissionProductYieldDist is a parent class
0357      */
0358     virtual ~G4FissionProductYieldDist();
0359 
0360   protected:
0361     /** Recursively burns each branch in a probability tree. */
0362     void BurnTree(ProbabilityBranch* Branch);
0363 };
0364 
0365 #endif /* G4FISSIONPRODUCTYIELDDIST_HH */