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 // ------------------------------------------------------------------- 28 // 29 // GEANT4 header file 30 // 31 // File name: G4LevelManager 32 // 33 // Author: V.Ivanchenko 34 // 35 // Creation date: 4 January 2012 36 // 37 // Modifications: 38 // 13.02.2015 Design change for gamma de-excitation 39 // 40 // ------------------------------------------------------------------- 41 // 42 // Nuclear level manager for photon de-excitation process 43 // 44 45 #ifndef G4LEVELMANAGER_HH 46 #define G4LEVELMANAGER_HH 1 47 48 #include "globals.hh" 49 #include "G4NucLevel.hh" 50 #include <vector> 51 #include <iostream> 52 53 class G4LevelManager 54 { 55 56 public: 57 // levels - vector of nuclear level objects, ground state 58 // level has NULL pointer 59 // energies - list of excitation energies of nuclear levels starting 60 // from the ground state with energy zero 61 // spin - 2J, where J is the full angular momentum of the state 62 explicit G4LevelManager(G4int Z, G4int A, std::size_t nlev, 63 const std::vector<G4double>& energies, 64 const std::vector<G4int>& spin, 65 const std::vector<const G4NucLevel*>& levels); 66 67 ~G4LevelManager(); 68 69 //=================================================================== 70 // run time inlined const functions 71 //=================================================================== 72 73 // only in this method there is a check on the vector boundary 74 std::size_t NearestLevelIndex(const G4double energy, const std::size_t index=0) const; 75 76 inline std::size_t NumberOfTransitions() const; 77 78 inline const G4NucLevel* GetLevel(const std::size_t i) const; 79 80 inline G4double LevelEnergy(const std::size_t i) const; 81 82 inline G4double MaxLevelEnergy() const; 83 84 inline std::size_t NearestLowEdgeLevelIndex(const G4double energy) const; 85 86 inline const G4NucLevel* NearestLevel(const G4double energy, 87 const std::size_t index=0) const; 88 89 inline G4double NearestLevelEnergy(const G4double energy, 90 const std::size_t index=0) const; 91 92 inline G4double NearestLowEdgeLevelEnergy(const G4double energy) const; 93 94 // for stable isotopes life time is -1 95 inline G4double LifeTime(const std::size_t i) const; 96 97 inline G4int TwoSpinParity(const std::size_t i) const; 98 99 inline G4int Parity(const std::size_t i) const; 100 101 inline G4int FloatingLevel(const std::size_t i) const; 102 103 inline G4double ShellCorrection() const; 104 105 inline G4double LevelDensity(const G4double U) const; 106 107 inline const std::vector<G4double>& GetLevelEnergies() const; 108 109 inline const std::vector<const G4NucLevel*>& GetLevels() const; 110 111 const G4String& FloatingType(const std::size_t i) const; 112 113 void StreamInfo(std::ostream& os) const; 114 115 G4LevelManager(const G4LevelManager & right) = delete; 116 const G4LevelManager& operator=(const G4LevelManager &right) = delete; 117 G4bool operator==(const G4LevelManager &right) const = delete; 118 G4bool operator!=(const G4LevelManager &right) const = delete; 119 120 private: 121 122 std::vector<G4double> fLevelEnergy; 123 std::vector<G4int> fSpin; 124 std::vector<const G4NucLevel*> fLevels; 125 126 G4double fShellCorrection; 127 G4double fLevelDensity; 128 129 std::size_t nTransitions; 130 131 static const G4int nfloting = 13; 132 static G4String fFloatingLevels[nfloting]; 133 134 }; 135 136 inline std::size_t G4LevelManager::NumberOfTransitions() const 137 { 138 return nTransitions; 139 } 140 141 inline const G4NucLevel* G4LevelManager::GetLevel(const std::size_t i) const 142 { 143 return fLevels[i]; 144 } 145 146 inline G4double G4LevelManager::LevelEnergy(const std::size_t i) const 147 { 148 return fLevelEnergy[i]; 149 } 150 151 inline G4double G4LevelManager::MaxLevelEnergy() const 152 { 153 return fLevelEnergy[nTransitions]; 154 } 155 156 inline std::size_t 157 G4LevelManager::NearestLowEdgeLevelIndex(const G4double energy) const 158 { 159 std::size_t idx = nTransitions; 160 if(energy < fLevelEnergy[nTransitions]) { 161 idx = std::lower_bound(fLevelEnergy.begin(), fLevelEnergy.end(), energy) 162 - fLevelEnergy.begin() - 1; 163 } 164 return idx; 165 } 166 167 inline const G4NucLevel* 168 G4LevelManager::NearestLevel(const G4double energy, const std::size_t index) const 169 { 170 return GetLevel(NearestLevelIndex(energy, index)); 171 } 172 173 inline G4double 174 G4LevelManager::NearestLevelEnergy(const G4double energy, 175 const std::size_t index) const 176 { 177 return LevelEnergy(NearestLevelIndex(energy, index)); 178 } 179 180 inline G4double 181 G4LevelManager::NearestLowEdgeLevelEnergy(const G4double energy) const 182 { 183 return LevelEnergy(NearestLowEdgeLevelIndex(energy)); 184 } 185 186 inline G4double G4LevelManager::LifeTime(const std::size_t i) const 187 { 188 return (fLevels[i]) ? fLevels[i]->GetTimeGamma() : 0.0; 189 } 190 191 inline G4int G4LevelManager::TwoSpinParity(const std::size_t i) const 192 { 193 return fSpin[i]%100000 - 100; 194 } 195 196 inline G4int G4LevelManager::Parity(const std::size_t i) const 197 { 198 return (fSpin[i]%100000 - 100 > 0) ? 1 : -1; 199 } 200 201 inline G4int G4LevelManager::FloatingLevel(const std::size_t i) const 202 { 203 return fSpin[i]/100000; 204 } 205 206 inline G4double G4LevelManager::ShellCorrection() const 207 { 208 return fShellCorrection; 209 } 210 211 inline G4double G4LevelManager::LevelDensity(const G4double) const 212 { 213 return fLevelDensity; 214 } 215 216 inline const std::vector<G4double>& G4LevelManager::GetLevelEnergies() const 217 { 218 return fLevelEnergy; 219 } 220 221 inline const std::vector<const G4NucLevel*>& G4LevelManager::GetLevels() const 222 { 223 return fLevels; 224 } 225 226 #endif 227