00001 #include <GenDecay/NucState.h> 00002 #include <GenDecay/NucUtil.h> 00003 #include <more/phys/ens.h> 00004 00005 #include "CLHEP/Units/SystemOfUnits.h" 00006 00007 #include <cmath> 00008 00009 using namespace GenDecay; 00010 using namespace std; 00011 using namespace more; 00012 using namespace more::phys; 00013 00014 ostream& operator<<(ostream& o, const NucState& ns) 00015 { 00016 o << ns.nuc().name(); 00017 if (ns.erel().is_known()) { 00018 o << " level=" << ns.erel().cent()/SI::keV 00019 << " keV [" << ns.eref() << "]"; 00020 } 00021 else 00022 o << " level=(unknown)"; 00023 //o << " with " << ns.decays.size() << " decays\n"; 00024 return o; 00025 } 00026 00027 int NucState::Z() 00028 { 00029 return m_nuc.n_prot(); 00030 } 00031 int NucState::A() 00032 { 00033 return m_nuc.n_prot() + m_nuc.n_neut(); 00034 } 00035 double NucState::lifetime() 00036 { 00037 const double ln2 = log(2.0); 00038 double hl = m_halflife.cent(); 00039 if (isnan(hl)) return 0; 00040 return hl / ln2; 00041 } 00042 double NucState::lifetime_clhep() 00043 { 00044 return this->lifetime()/SI::s*CLHEP::second; 00045 } 00046 double NucState::energy() 00047 { 00048 // fixme: ignores eref! 00049 return m_erel.cent(); 00050 } 00051 double NucState::energy_clhep() 00052 { 00053 return this->energy()/SI::MeV*CLHEP::MeV; 00054 } 00055 int NucState::ndecays() 00056 { 00057 return m_decays.size(); 00058 } 00059 00060 GenDecay::NucDecay* NucState::decay(int ind) 00061 { 00062 if (ind<0 || ind>= (int)m_decays.size()) return 0; 00063 return m_decays[ind]; 00064 }