37 shared_ptr<tkmeasure> energy = make_shared<tkmeasure>(_struc.
value,_struc.
unit);
39 if(_struc.
err>0.) energy->set_error(_struc.
err);
42 energy->set_type(
"Level energy");
43 add_property(
"energy",energy);
45 if(energy->get_info_tag().contains(
";OFF=")) {
46 int idx = energy->get_info_tag().index(
";OFF=");
48 set_energy_offset(offset);
54 shared_ptr<tkmeasure> lifetime = make_shared<tkmeasure>(_struc.
value,_struc.
unit);
56 if(_struc.
err>0.) lifetime->set_error(_struc.
err);
59 if(lifetime->get_info_tag().contains(
"STABLE")) fis_stable =
true;
60 lifetime->set_type(
"lifetime");
61 add_property(
"lifetime",lifetime,
tkstring::form(
"%g",lifetime->get_value()));
63 if(lifetime->get_info_tag().contains(
";ISO=")) {
65 int idx = lifetime->get_info_tag().index(
";ISO=");
66 fisomer_level = lifetime->get_info_tag().substr(idx+6,1).atoi();
67 if(fisomer_level==0) fisomer_level = 1;
73 if(_spin>=0) fspin_parity->set_spin(_spin);
74 if(_parity>=0) fspin_parity->set_parity(_parity);
75 fspin_parity->set_from_str(_jpi_str);
76 add_property_str(
"spin_parity",_jpi_str,
"");
91 glog <<
error << gunits->get_name(_unit) <<
" is not of 'energy' type (returns nan(1))" <<
do_endl;
94 if(
get(
"energy")->get_unit()==
"") {
95 cout << fenergy_offset << endl;
96 cout << fbelongs_to_nucleus << endl;
100 glog <<
warning <<
"Level is only known relatively to an offset, use the _with_offset option to get the relative energy" <<
do_endl;
101 return std::nan(
"1");
103 return get(
"energy")->get_value(_unit);
117 glog <<
error << gunits->get_name(_unit) <<
" is not of 'time' or 'energy' type (returns nan(1))" <<
do_endl;
118 return std::nan(
"1");
120 return get(
"lifetime")->get_value(_unit);
133 lifetime_str =
"STABLE";
140 for(
auto &unit: units) {
160 if(_with_tentative)
return fisYrast_uncertain;
161 else return fisYrast_exact;
175 std::cout << std::setw(15) << left << flevel_id;
181 std::cout << std::setw(15)<< left <<
" ";
183 std::cout << std::setw(15)<< left << fspin_parity->get_jpi_str();
189 std::cout << std::setw(15)<< left <<
" ";
193 std::cout << std::setw(15)<< left <<
" "
194 << std::setw(15)<< left <<
" "
195 << std::setw(15)<< left <<
" ";
197 std::cout << std::endl;
202 glog <<
" ; Jpi: " << setw(4) << fspin_parity->get_jpi_str();
212 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
tklevel(int _id, const tkdb_table::measure_data_struct &_struc)
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_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