Back to home page

EIC code displayed by LXR

 
 

    


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

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 // -------------------------------------------------------------------
0028 //
0029 //      GEANT4 header file 
0030 //
0031 //      File name:     G4LevelManager
0032 //
0033 //      Author:        V.Ivanchenko
0034 // 
0035 //      Creation date: 4 January 2012
0036 //
0037 //      Modifications:
0038 //  13.02.2015 Design change for gamma de-excitation 
0039 //      
0040 // -------------------------------------------------------------------
0041 //
0042 // Nuclear level manager for photon de-excitation process 
0043 // 
0044 
0045 #ifndef G4LEVELMANAGER_HH
0046 #define G4LEVELMANAGER_HH 1
0047 
0048 #include "globals.hh"
0049 #include "G4NucLevel.hh"
0050 #include <vector>
0051 #include <iostream>
0052 
0053 class G4LevelManager 
0054 {
0055 
0056 public:
0057   // levels - vector of nuclear level objects, ground state 
0058   //          level has NULL pointer
0059   // energies - list of excitation energies of nuclear levels starting
0060   //            from the ground state with energy zero 
0061   // spin - 2J, where J is the full angular momentum of the state 
0062   explicit G4LevelManager(G4int Z, G4int A, std::size_t nlev,
0063               const std::vector<G4double>& energies,
0064               const std::vector<G4int>& spin,
0065               const std::vector<const G4NucLevel*>& levels); 
0066 
0067   ~G4LevelManager();
0068 
0069   //===================================================================
0070   // run time inlined const functions
0071   //===================================================================
0072 
0073   // only in this method there is a check on the vector boundary
0074   std::size_t NearestLevelIndex(const G4double energy, const std::size_t index=0) const;
0075 
0076   inline std::size_t NumberOfTransitions() const;
0077 
0078   inline const G4NucLevel* GetLevel(const std::size_t i) const;
0079 
0080   inline G4double LevelEnergy(const std::size_t i) const;
0081 
0082   inline G4double MaxLevelEnergy() const;
0083 
0084   inline std::size_t NearestLowEdgeLevelIndex(const G4double energy) const;
0085 
0086   inline const G4NucLevel* NearestLevel(const G4double energy, 
0087                                         const std::size_t index=0) const;
0088 
0089   inline G4double NearestLevelEnergy(const G4double energy, 
0090                                      const std::size_t index=0) const;
0091 
0092   inline G4double NearestLowEdgeLevelEnergy(const G4double energy) const;
0093 
0094   // for stable isotopes life time is -1
0095   inline G4double LifeTime(const std::size_t i) const;
0096 
0097   inline G4int TwoSpinParity(const std::size_t i) const;
0098 
0099   inline G4int Parity(const std::size_t i) const;
0100 
0101   inline G4int FloatingLevel(const std::size_t i) const;
0102 
0103   inline G4double ShellCorrection() const;
0104 
0105   inline G4double LevelDensity(const G4double U) const;
0106 
0107   inline const std::vector<G4double>& GetLevelEnergies() const;
0108 
0109   inline const std::vector<const G4NucLevel*>& GetLevels() const;
0110 
0111   const G4String& FloatingType(const std::size_t i) const;
0112 
0113   void StreamInfo(std::ostream& os) const;
0114 
0115   G4LevelManager(const G4LevelManager & right) = delete;  
0116   const G4LevelManager& operator=(const G4LevelManager &right) = delete;
0117   G4bool operator==(const G4LevelManager &right) const = delete;
0118   G4bool operator!=(const G4LevelManager &right) const = delete;
0119 
0120 private:
0121 
0122   std::vector<G4double> fLevelEnergy;
0123   std::vector<G4int> fSpin;
0124   std::vector<const G4NucLevel*> fLevels;
0125   
0126   G4double fShellCorrection;
0127   G4double fLevelDensity;
0128 
0129   std::size_t nTransitions;
0130 
0131   static const G4int nfloting = 13;
0132   static G4String fFloatingLevels[nfloting];
0133 
0134 };
0135 
0136 inline std::size_t G4LevelManager::NumberOfTransitions() const
0137 {
0138   return nTransitions;
0139 }
0140 
0141 inline const G4NucLevel* G4LevelManager::GetLevel(const std::size_t i) const
0142 {
0143   return fLevels[i]; 
0144 }
0145 
0146 inline G4double G4LevelManager::LevelEnergy(const std::size_t i) const
0147 {
0148   return fLevelEnergy[i]; 
0149 }
0150 
0151 inline G4double G4LevelManager::MaxLevelEnergy() const
0152 {
0153   return fLevelEnergy[nTransitions]; 
0154 }
0155 
0156 inline std::size_t 
0157 G4LevelManager::NearestLowEdgeLevelIndex(const G4double energy) const
0158 {
0159   std::size_t idx = nTransitions;
0160   if(energy < fLevelEnergy[nTransitions]) {
0161     idx = std::lower_bound(fLevelEnergy.begin(), fLevelEnergy.end(), energy)
0162       - fLevelEnergy.begin() - 1;
0163   }
0164   return idx;
0165 }
0166 
0167 inline const G4NucLevel* 
0168 G4LevelManager::NearestLevel(const G4double energy, const std::size_t index) const
0169 {   
0170   return GetLevel(NearestLevelIndex(energy, index));
0171 }
0172 
0173 inline G4double
0174 G4LevelManager::NearestLevelEnergy(const G4double energy, 
0175                                    const std::size_t index) const
0176 {   
0177   return LevelEnergy(NearestLevelIndex(energy, index));
0178 }
0179 
0180 inline G4double 
0181 G4LevelManager::NearestLowEdgeLevelEnergy(const G4double energy) const
0182 {   
0183   return LevelEnergy(NearestLowEdgeLevelIndex(energy));
0184 }
0185 
0186 inline G4double G4LevelManager::LifeTime(const std::size_t i) const
0187 {
0188   return (fLevels[i]) ? fLevels[i]->GetTimeGamma() : 0.0;
0189 }
0190    
0191 inline G4int G4LevelManager::TwoSpinParity(const std::size_t i) const
0192 {
0193   return fSpin[i]%100000 - 100; 
0194 }
0195 
0196 inline G4int G4LevelManager::Parity(const std::size_t i) const
0197 {
0198   return (fSpin[i]%100000 - 100 > 0) ? 1 : -1; 
0199 }
0200 
0201 inline G4int G4LevelManager::FloatingLevel(const std::size_t i) const
0202 {
0203   return fSpin[i]/100000; 
0204 }
0205 
0206 inline G4double G4LevelManager::ShellCorrection() const
0207 {
0208   return fShellCorrection;
0209 }
0210 
0211 inline G4double G4LevelManager::LevelDensity(const G4double) const
0212 {
0213   return fLevelDensity;
0214 }
0215 
0216 inline const std::vector<G4double>& G4LevelManager::GetLevelEnergies() const
0217 {
0218   return fLevelEnergy;
0219 }
0220 
0221 inline const std::vector<const G4NucLevel*>& G4LevelManager::GetLevels() const
0222 {
0223   return fLevels;
0224 }
0225 
0226 #endif