File indexing completed on 2025-01-18 09:58:46
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045 #ifndef G4NUCLEVEL_HH
0046 #define G4NUCLEVEL_HH 1
0047
0048 #include "globals.hh"
0049 #include <vector>
0050 #include <iostream>
0051
0052 class G4NucLevel
0053 {
0054 public:
0055
0056 explicit G4NucLevel(std::size_t ntrans, G4double tgamma,
0057 const std::vector<G4int>& vTrans,
0058 const std::vector<G4float>& wLevelGamma,
0059 const std::vector<G4float>& wGamma,
0060 const std::vector<G4float>& vRatio,
0061 const std::vector<const std::vector<G4float>*>& wShell);
0062
0063 ~G4NucLevel();
0064
0065 inline std::size_t NumberOfTransitions() const;
0066
0067 inline std::size_t FinalExcitationIndex(std::size_t idx) const;
0068
0069 inline G4int TransitionType(std::size_t idx) const;
0070
0071 inline G4double GetTimeGamma() const;
0072
0073 inline G4float GammaProbability(std::size_t idx) const;
0074
0075 inline G4float GammaCumProbability(std::size_t idx) const;
0076
0077 inline G4float MultipolarityRatio(std::size_t idx) const;
0078
0079 inline std::size_t SampleGammaTransition(G4double rndm) const;
0080
0081 inline G4int SampleShell(std::size_t idx, G4double rndm) const;
0082
0083 inline const std::vector<G4float>* ShellProbabilty(std::size_t idx) const;
0084
0085 void StreamInfo(std::ostream& os) const;
0086
0087 G4NucLevel(const G4NucLevel &right) = delete;
0088 G4bool operator==(const G4NucLevel &right) const = delete;
0089 G4bool operator!=(const G4NucLevel &right) const = delete;
0090 G4bool operator<(const G4NucLevel &right) const = delete;
0091 const G4NucLevel& operator=(const G4NucLevel &right) = delete;
0092
0093 private:
0094
0095 std::size_t length;
0096 G4double fTimeGamma;
0097
0098 std::vector<G4int> fTrans;
0099 std::vector<G4float> fGammaCumProbability;
0100 std::vector<G4float> fGammaProbability;
0101 std::vector<G4float> fMpRatio;
0102 std::vector<const std::vector<G4float>*> fShellProbability;
0103 };
0104
0105 inline std::size_t G4NucLevel::NumberOfTransitions() const
0106 {
0107 return length;
0108 }
0109
0110 inline std::size_t G4NucLevel::FinalExcitationIndex(const std::size_t idx) const
0111 {
0112 return (std::size_t)(fTrans[idx]/10000);
0113 }
0114
0115 inline G4int G4NucLevel::TransitionType(const std::size_t idx) const
0116 {
0117 return fTrans[idx]%10000;
0118 }
0119
0120 inline G4double G4NucLevel::GetTimeGamma() const
0121 {
0122 return fTimeGamma;
0123 }
0124
0125 inline G4float G4NucLevel::GammaProbability(const std::size_t idx) const
0126 {
0127 return fGammaProbability[idx];
0128 }
0129
0130 inline G4float G4NucLevel::GammaCumProbability(const std::size_t idx) const
0131 {
0132 return fGammaCumProbability[idx];
0133 }
0134
0135 inline G4float G4NucLevel::MultipolarityRatio(const std::size_t idx) const
0136 {
0137 return fMpRatio[idx];
0138 }
0139
0140 inline std::size_t G4NucLevel::SampleGammaTransition(const G4double rndm) const
0141 {
0142 G4float x = rndm;
0143 std::size_t idx = 0;
0144 for(; idx<length; ++idx) {
0145 if(x <= fGammaCumProbability[idx]) { break; }
0146 }
0147 return idx;
0148 }
0149
0150 inline G4int
0151 G4NucLevel::SampleShell(const std::size_t idx, const G4double rndm) const
0152 {
0153 const std::vector<G4float>* prob = fShellProbability[idx];
0154 G4int i(-1);
0155 if(nullptr != prob) {
0156 G4int nn = (G4int)prob->size();
0157 G4float x = rndm;
0158 for(i=0; i<nn; ++i) { if(x <= (*prob)[i]) { break; } }
0159 }
0160 return i;
0161 }
0162
0163 inline const std::vector<G4float>*
0164 G4NucLevel::ShellProbabilty(std::size_t idx) const
0165 {
0166 return fShellProbability[idx];
0167 }
0168
0169 #endif