00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // $Id$ 00027 // 00028 // ------------------------------------------------------------------- 00029 // 00030 // GEANT4 header file 00031 // 00032 // File name: G4NucLevel 00033 // 00034 // Author: V.Ivanchenko 00035 // 00036 // Creation date: 4 January 2012 00037 // 00038 // Modifications: 00039 // 00040 // ------------------------------------------------------------------- 00041 // 00042 // Nuclear level manager for photon de-excitation process 00043 // Providing management of levels for high energy generators 00044 // The internal conversion is excluded because there are no atomic shell 00045 // 00046 00047 #ifndef G4LEVELMANAGER_HH 00048 #define G4LEVELMANAGER_HH 1 00049 00050 #include "globals.hh" 00051 #include "G4NucLevel.hh" 00052 #include <vector> 00053 00054 class G4LevelReader; 00055 00056 class G4LevelManager 00057 { 00058 00059 public: 00060 00061 G4LevelManager(G4int Z, G4int A, G4LevelReader& reader, 00062 const G4String& filename); 00063 00064 ~G4LevelManager(); 00065 00066 inline G4int NumberOfLevels() const; 00067 00068 inline const G4NucLevel* GetLevel(G4int i) const; 00069 00070 inline const G4NucLevel* NearestLevel(G4double energy) const; 00071 00072 private: 00073 00074 G4LevelManager(const G4LevelManager & right); 00075 const G4LevelManager& operator=(const G4LevelManager &right); 00076 G4bool operator==(const G4LevelManager &right) const; 00077 G4bool operator!=(const G4LevelManager &right) const; 00078 00079 std::vector<G4NucLevel*> fLevel; 00080 G4int nLevels; 00081 G4int theZ; 00082 G4int theA; 00083 G4double fEdiffMax; 00084 }; 00085 00086 inline G4int G4LevelManager::NumberOfLevels() const 00087 { 00088 return nLevels; 00089 } 00090 00091 inline const G4NucLevel* G4LevelManager::GetLevel(G4int i) const 00092 { 00093 return fLevel[i]; 00094 } 00095 00096 inline const G4NucLevel* 00097 G4LevelManager::NearestLevel(G4double energy) const 00098 { 00099 const G4NucLevel* p = 0; 00100 if(energy < fLevel[nLevels-1]->LevelEnergy() + fEdiffMax) { 00101 for(G4int i=nLevels-1; i>=0; --i) { 00102 p = fLevel[i]; 00103 G4double lEnergy = p->LevelEnergy(); 00104 if(0 == i || energy > lEnergy) { break; } 00105 if(lEnergy - energy <= 0.5*(lEnergy - fLevel[i-1]->LevelEnergy())) 00106 { break; } 00107 } 00108 } 00109 return p; 00110 } 00111 00112 #endif