60 shared_ptr<tkmeasure> energy = make_shared<tkmeasure>(_struc.
value,_struc.
unit);
62 if(_struc.
err>0.) energy->set_error(_struc.
err);
65 energy->set_type(
"Level energy");
66 add_property(
"energy",energy);
68 if(energy->get_info_tag().contains(
";OFF=")) {
69 int idx = energy->get_info_tag().index(
";OFF=");
77 shared_ptr<tkmeasure> lifetime = make_shared<tkmeasure>(_struc.
value,_struc.
unit);
79 if(_struc.
err>0.) lifetime->set_error(_struc.
err);
82 if(lifetime->get_info_tag().contains(
"STABLE")) fis_stable =
true;
83 lifetime->set_type(
"lifetime");
84 add_property(
"lifetime",lifetime,
tkstring::form(
"%g",lifetime->get_value()));
86 if(lifetime->get_info_tag().contains(
";ISO=")) {
88 int idx = lifetime->get_info_tag().index(
";ISO=");
89 fisomer_level = lifetime->get_info_tag().substr(idx+6,1).atoi();
90 if(fisomer_level==0) fisomer_level = 1;
96 if(_spin>=0) fspin_parity->set_spin(_spin);
97 if(_parity>=0) fspin_parity->set_parity(_parity);
98 fspin_parity->set_from_str(_jpi_str);
99 add_property_str(
"spin_parity",_jpi_str,
"");
113 if(gunits->get_type(_unit)!=tkunit_manager::units_type::kEnergy){
114 glog <<
error << gunits->get_name(_unit) <<
" is not of 'energy' type (returns nan(1))" <<
do_endl;
115 return std::nan(
"1");
117 if(
get(
"energy")->get_unit()==
"") {
118 cout << fenergy_offset << endl;
119 cout << fbelongs_to_nucleus << endl;
123 glog <<
warning <<
"Level is only known relatively to an offset, use the _with_offset option to get the relative energy" <<
do_endl;
124 return std::nan(
"1");
126 return get(
"energy")->get_value(_unit);
139 if(gunits->get_type(_unit)!=tkunit_manager::units_type::kTime&&gunits->get_type(_unit)!=tkunit_manager::units_type::kEnergy){
140 glog <<
error << gunits->get_name(_unit) <<
" is not of 'time' or 'energy' type (returns nan(1))" <<
do_endl;
141 return std::nan(
"1");
143 return get(
"lifetime")->get_value(_unit);
156 lifetime_str =
"STABLE";
163 for(
auto &unit: units) {
183 if(_with_tentative)
return fisYrast_uncertain;
184 else return fisYrast_exact;
198 std::cout << std::setw(15) << left << flevel_id;
204 std::cout << std::setw(15)<< left <<
" ";
206 std::cout << std::setw(15)<< left << fspin_parity->get_jpi_str();
212 std::cout << std::setw(15)<< left <<
" ";
216 std::cout << std::setw(15)<< left <<
" "
217 << std::setw(15)<< left <<
" "
218 << std::setw(15)<< left <<
" ";
220 std::cout << std::endl;
225 glog <<
" ; Jpi: " << setw(4) << fspin_parity->get_jpi_str();
235 glog <<
" uncertain level tag: " << funcertain_level;
Stores information on a nuclear level.
bool is_isomer()
returns true is the level an isomer
bool is_stable()
returns true if the level stable
double get_lifetime(const tkunit_manager::units_keys _unit=tkunit_manager::units_keys::s)
returns the lifetime (in second by default)
shared_ptr< tkmeasure > get_lifetime_measure()
returns the lifetime tkmeasure object
const tkstring & get_comment()
get the level comment string
double get_energy(const tkunit_manager::units_keys _unit=tkunit_manager::units_keys::keV, bool _with_offset=false)
returns the energy in keV by default
tkstring get_offset_bandhead()
returns the bandhead string offset value (ex: X)
shared_ptr< tkmeasure > get_energy_measure()
returns the energy tkmeasure object
void set_jpi(double _spin, int _parity, const tkstring &_jpi_str)
define the spin parity
tkstring get_lifetime_str()
returns the lifetime in string (using the best adapted unit)
bool is_uncertain()
check if the level is uncertain
bool is_energy_offset()
to know if the energy is known with an energy offset
void print(const tkstring &_option="")
print the level properties
int get_isomer_level()
get the isomer level (1 for the 1rst (lowest energy) isomer, 2 for the second, etc....
bool is_yrast(bool _with_tentative=false)
returns true is the leve is Yrast
void set_energy_offset(tkstring &_offset)
define the energy offset
void set_lifetime(tkdb_table::measure_data_struct &_struc)
define the level lifetime
bool has_comment()
check if a comment exists
Contains list of properties.
bool has_property(const tkstring &_property) const
to check if the property is available
shared_ptr< tkmeasure > get(const tkstring &_property) const
get the property as tkmeasure
Nuclear excited state spin-parity.
std::string with usefull tricks from TString (ROOT) and KVString (KaliVeda) and more....
static const char * form(const char *_format,...)
static tkstring Form(const char *_format,...)
tkstring substr(size_type __pos=0, size_type __n=npos) const
Inlines.
bool contains(const char *_pat, ECaseCompare _cmp=kExact) const
tkstring & replace_all(const tkstring &_s1, const tkstring &_s2)
units_keys
units identifiers
static std::vector< std::tuple< tkstring, units_type, double > > funits_properties
tklog & error(tklog &log)
tklog & do_endl(tklog &log)
tklog & warning(tklog &log)
tklog & comment(tklog &log)
data structure used to fill a tkmeasure object from the sqlite database