Classes | |
class | DecayRates |
Visit the chain, calculate mean and total rates given abundances and collect correlated decays. More... | |
struct | NucDecay |
class | NucState |
class | NucVisitor |
class | Radiation |
class | AlphaRadiation |
class | BetaRadiation |
class | GammaRadiation |
class | ElectronCapture |
Namespaces | |
namespace | __init__ |
namespace | beta |
namespace | chain |
namespace | data |
namespace | decay |
namespace | elements |
namespace | g4data |
namespace | Helpers |
namespace | Histogram |
namespace | pdfrand |
namespace | test_foo |
namespace | test_rand |
namespace | u238 |
Typedefs | |
typedef std::map< std::pair< NucState *, NucState * >, std::vector< NucDecay * > > | NucDecayMap_t |
Map mother,daughter to the decays that joins them. | |
Enumerations | |
enum | RadiationType { Unknown = 0, Alpha, BetaMinus, BetaPlus, Gamma, EleCapture } |
Functions | |
double | more_to_clhep_time (double more_time) |
double | more_to_clhep_energy (double more_energy) |
bool | get_nucleus (const more::phys::nucleus &pn, more::phys::ens::nucleus &en) |
Fill out a ens::nucleus given the phys::nucleus, return true if no error. | |
NucState * | get_state (const phys::nucleus &n, ens::confiv_t hl, ens::confiv_t rel, int ref) |
const NucDecayMap_t & | get_decays () |
Get all decays that have been chained so far. | |
void | dump_dataset (const ens::dataset &ds) |
void | chain (NucState *mother, int depth=-1, more::phys::nucleus stop_nuc=more::phys::nucleus()) |
Form decay chain starting from given mother state. | |
NucState * | get_ground (std::string name) |
Get a ground state by name (eg "U-238"). | |
NucState * | get_ground (phys::nucleus nucl) |
const Radiation * | decay_radiation (const NucDecay &dk) |
Make a radiation object for given decay. | |
NucState * | get_state (const more::phys::nucleus &n, more::phys::ens::confiv_t hl=more::phys::ens::confiv_t(0.0, 0.0), more::phys::ens::confiv_t rel=more::phys::ens::confiv_t(0.0, 0.0), int ref=0.0) |
Return the state coresponding to given phys::nucleus, half life, relative energy and reference energy. | |
NucState * | get_ground (more::phys::nucleus nucl) |
Return the NucState for the given nucleus that is at the ground state. | |
void | dump_dataset (const more::phys::ens::dataset &ds) |
Dump dataset on our terms. |
typedef std::map<std::pair<NucState*,NucState*>,std::vector<NucDecay*> > GenDecay::NucDecayMap_t |
double GenDecay::more_to_clhep_time | ( | double | more_time | ) |
Definition at line 16 of file NucUtil.cc.
00017 { 00018 return more_time * CLHEP::second / SI::s; 00019 }
double GenDecay::more_to_clhep_energy | ( | double | more_energy | ) |
Definition at line 20 of file NucUtil.cc.
00021 { 00022 return more_energy * CLHEP::MeV / SI::MeV; 00023 }
bool GenDecay::get_nucleus | ( | const more::phys::nucleus & | pn, | |
more::phys::ens::nucleus & | en | |||
) |
Fill out a ens::nucleus given the phys::nucleus, return true if no error.
Definition at line 40 of file NucUtil.cc.
00041 { 00042 static NucNucMap_t nucnuc; 00043 00044 ens::nucleus out = nucnuc[pn]; 00045 if (out.has_dataset()) { 00046 en = out; 00047 return true; 00048 } 00049 00050 try { 00051 out = pn; 00052 } 00053 catch (std::runtime_error) { 00054 cerr << "Caught run time error when assigning nucleus: \"" << pn << "\"" << endl; 00055 cerr << "Is the fetcher used a few lines above the correct one?\n" 00056 << "Maybe you need to set MORE_PHYS_FETCHER to point to the fetcher script?\n"; 00057 return false; 00058 } 00059 en = out; 00060 nucnuc[pn] = out; 00061 return true; 00062 }
NucState* GenDecay::get_state | ( | const phys::nucleus & | n, | |
ens::confiv_t | hl, | |||
ens::confiv_t | rel, | |||
int | ref | |||
) |
Definition at line 69 of file NucUtil.cc.
00071 { 00072 Nuc2state_t::iterator it = gsNuc2state.find(n); 00073 00074 // No such nucleus seen yet 00075 if (it == gsNuc2state.end()) { 00076 vector<NucState*> vns; 00077 NucState* ns = new NucState(n,hl,rel,ref); 00078 vns.push_back(ns); 00079 gsNuc2state[n] = vns; 00080 00081 //cerr << "get_state: Made first ever " << *ns << "(@" 00082 // << (void*)ns << ")" << endl; 00083 return ns; 00084 } 00085 00086 // nucleus seen, check for specific NucState 00087 vector<NucState*>& vns = it->second; 00088 for (size_t ind=0; ind < vns.size(); ++ind) { 00089 if (vns[ind]->eref() != ref) { 00090 //cerr << "get_state: No match: " << vns[ind]->eref << " != " << ref 00091 // << endl; 00092 continue; 00093 } 00094 if (vns[ind]->erel() != rel) { 00095 //cerr << "get_state: No match: " << vns[ind]->erel / SI::keV 00096 // << " != " << rel / SI::keV << endl; 00097 continue; 00098 } 00099 // found it 00100 //cerr << "get_state: in slot " << ind << " found " 00101 // << *vns[ind] << "(@" << (void*)vns[ind] << ")" << endl; 00102 return vns[ind]; 00103 } 00104 00105 // Specific state not yet seen, add it. 00106 NucState* ns = new NucState(n,hl,rel,ref); 00107 vns.push_back(ns); 00108 //cerr << "get_state: added new " << *ns << "(@" << (void*)ns << ")" << endl; 00109 return ns; 00110 }
const NucDecayMap_t & GenDecay::get_decays | ( | ) |
Get all decays that have been chained so far.
Definition at line 160 of file NucUtil.cc.
00160 { return gsNucDecays; }
void GenDecay::dump_dataset | ( | const ens::dataset & | ds | ) |
Definition at line 338 of file NucUtil.cc.
00339 { 00340 cerr << ds.ident()->nucl() << " with\n" 00341 << "\t"<< count(ds.decay_info_begin(), ds.decay_info_end()) << " decay info\n" 00342 << "\t"<< count(ds.level_begin(), ds.level_end()) << " levels\n" 00343 << endl; 00344 00345 for (ens::dataset::decay_info_iterator it_dk = ds.decay_info_begin(); 00346 it_dk != ds.decay_info_end(); ++it_dk) { 00347 00348 if (it_dk->parent()) { 00349 cerr << "Decay parent:\n"; 00350 it_dk->parent()->dump(cerr); 00351 } 00352 else { cerr << "No decay parent\n"; } 00353 00354 if (it_dk->norm()) { 00355 cerr << "Decay norm:\n"; 00356 it_dk->norm()->dump(cerr); 00357 } 00358 else { cerr << "No decay norm\n"; } 00359 00360 if (it_dk->pnorm()) { 00361 cerr << "Decay pnorm:\n"; 00362 it_dk->pnorm()->dump(cerr); 00363 } 00364 else { cerr << "No decay pnorm\n"; } 00365 } 00366 00367 cerr << "Levels:\n"; 00368 for (ens::dataset::level_iterator it_lev = ds.level_begin(); 00369 it_lev != ds.level_end(); ++it_lev) { 00370 00371 dump_level(*it_lev); 00372 } 00373 00374 }
void GenDecay::chain | ( | NucState * | mother, | |
int | depth = -1 , |
|||
more::phys::nucleus | stop_nuc = more::phys::nucleus() | |||
) |
Form decay chain starting from given mother state.
If depth is non-negative, do not chain further down than that many daughters. If stop_nuc is given, do not chain beyond its ground state.
Definition at line 896 of file NucUtil.cc.
00898 { 00899 // record if a NucState has been chained yet 00900 typedef map<NucState*,int> NucChained_t; 00901 static NucChained_t chained; 00902 00903 00904 if (!mother) { 00905 cerr << "ERROR: chain given null mother\n"; 00906 return; 00907 } 00908 00909 if (!depth) { 00910 //cerr << "Reached target depth with " << *mother << endl; 00911 return; 00912 } 00913 --depth; 00914 00915 //cerr << "Mother nuc: " << mother->nuc() 00916 // << " stop_nuc: " << stop_nuc << endl; 00917 if (mother->energy() == 0.0 && mother->eref() == 0 && 00918 mother->nuc() == stop_nuc) 00919 { 00920 cerr << "Reached ground state stop_nuc = " << stop_nuc << endl; 00921 return; 00922 } 00923 00924 // Don't chain a state that has already been seen 00925 if (chained[mother]) return; 00926 chained[mother] = 1; 00927 00928 //cerr << "Chaining " << *mother << "(@" << (void*)mother << ") at depth "<<depth<<"\n"; 00929 00930 // load mother 00931 ens::nucleus pnucl; 00932 if (!get_nucleus(mother->nuc(),pnucl)) { 00933 cerr << "Got run time error with " << mother->nuc() << endl; 00934 } 00935 00936 vector<NucState*> daughters; 00937 00938 // look for daughters 00939 for (int ind=0; get_xxx_daughters[ind]; ++ind) { 00940 vector<NucState*> ds = get_xxx_daughters[ind](mother); 00941 00942 //cerr << *mother << " has " << ds.size() 00943 // << " daughters made by " << decay_names[ind] << endl; 00944 00945 daughters.insert(daughters.end(),ds.begin(),ds.end()); 00946 } 00947 00948 normalize_branching_fractions(*mother); 00949 00950 //cerr << *mother << " has these daughters:\n"; 00951 //for (size_t ind=0; ind < daughters.size(); ++ind) { 00952 // cerr << "\t" << *daughters[ind] << endl; 00953 //} 00954 for (size_t ind=0; ind < daughters.size(); ++ind) { 00955 for (size_t inuc=0; inuc < daughters.size(); ++inuc) { 00956 chain(daughters[inuc],depth,stop_nuc); 00957 } 00958 } 00959 00960 }
NucState * GenDecay::get_ground | ( | std::string | name | ) |
Get a ground state by name (eg "U-238").
Definition at line 962 of file NucUtil.cc.
00963 { 00964 istringstream iss(name); 00965 phys::nucleus nucl; 00966 iss >> nucl; 00967 return get_ground(nucl); 00968 }
NucState* GenDecay::get_ground | ( | phys::nucleus | nucl | ) |
Definition at line 970 of file NucUtil.cc.
00971 { 00972 ens::nucleus candidate; 00973 if (!get_nucleus(nucl,candidate)) { 00974 cerr << "get_ground: failed to get_nucleus for " << nucl << endl; 00975 return 0; 00976 } 00977 const ens::dataset& al = get_adopted_levels(candidate); 00978 if (!al_dataset_ok(al)) { 00979 cerr << "get_ground: adopted levels data set is not okay:\n"; 00980 al.dump(cerr); 00981 return 0; 00982 } 00983 00984 ens::confiv_t erel(0.0,0.0); 00985 const ens::rec_level* lev = get_level(al,erel,0); 00986 if (!lev) { 00987 cerr << "get_ground: failed to get ground energy level record for " << nucl << endl; 00988 return 0; 00989 } 00990 00991 ens::confiv_t hl = lev->T_half(); 00992 NucState* head = get_state(nucl,hl); 00993 return head; 00994 }
Make a radiation object for given decay.
Definition at line 996 of file NucUtil.cc.
00997 { 00998 static map<const NucDecay*, Radiation*> radCache; 00999 01000 Radiation* rad = radCache[&dk]; 01001 if (rad) return rad; 01002 01003 int parentZ = dk.mother->nuc().n_prot(); 01004 int parentA = dk.mother->nuc().n_part(); 01005 if (dk.type == "A DECAY") { 01006 rad = new AlphaRadiation(dk.clhep_energy(), parentA); 01007 } 01008 if (dk.type == "Gamma") { 01009 rad = new GammaRadiation(dk.clhep_energy()); 01010 } 01011 if (dk.type == "IT DECAY") { 01012 rad = new GammaRadiation(dk.clhep_energy()); 01013 } 01014 if (dk.type == "B- DECAY") { 01015 rad = new BetaRadiation(dk.clhep_energy(), parentZ); 01016 } 01017 if (dk.type == "B+ DECAY") { 01018 rad = new BetaRadiation(dk.clhep_energy(), -1*parentZ); 01019 } 01020 if (dk.type == "EC DECAY") { 01021 rad = new ElectronCapture(dk.clhep_energy()); 01022 } 01023 01024 if (!rad) { 01025 cerr << "decay_radiation: failed to make radiation from \"" << dk << "\"\n"; 01026 return 0; 01027 } 01028 01029 radCache[&dk] = rad; 01030 return rad; 01031 }
NucState* GenDecay::get_state | ( | const more::phys::nucleus & | n, | |
more::phys::ens::confiv_t | hl = more::phys::ens::confiv_t(0.0, 0.0) , |
|||
more::phys::ens::confiv_t | rel = more::phys::ens::confiv_t(0.0, 0.0) , |
|||
int | ref = 0.0 | |||
) |
Return the state coresponding to given phys::nucleus, half life, relative energy and reference energy.
NucState* GenDecay::get_ground | ( | more::phys::nucleus | nucl | ) |
Return the NucState for the given nucleus that is at the ground state.
void GenDecay::dump_dataset | ( | const more::phys::ens::dataset & | ds | ) |
Dump dataset on our terms.
Can also use ds.dump(cout) to use built-in dumper.