14#include "tklevel_builder.h"
19#include "tkensdf_level_rec.h"
37 fTable = &fDataBase->new_table(fTableName);
39 fTable->add_column(
"level_id",
"INT NOT NULL PRIMARY KEY");
40 fTable->add_column(
"isotope_id",
"INT NOT NULL");
41 fTable->add_column(
"dataset_id",
"INT NOT NULL");
43 add_measure(
"energy");
45 fTable->add_column(
"level_spin",
"REAL");
46 fTable->add_column(
"level_parity",
"INT");
47 fTable->add_column(
"level_spin_parity",
"TEXT");
49 add_measure(
"lifetime");
51 fTable->add_column(
"level_comment",
"TEXT");
53 fTable->add_column(
"level_uncertain",
"TEXT");
55 fTable->add_constraint(
"FOREIGN KEY (isotope_id) REFERENCES ISOTOPE (isotope_id),");
56 fTable->add_constraint(
"FOREIGN KEY (dataset_id) REFERENCES DATASET (dataset_id)");
58 fTable->write_to_database();
60 glog <<
info <<
"Creating '" << _table_name <<
"' table" <<
do_endl;
66 (*fTable)[
"level_id"].set_value(fLevelIdx);
67 (*fTable)[
"isotope_id"].set_value(_isotope_idx);
68 (*fTable)[
"dataset_id"].set_value(_dset_idx);
70 fill_measure(
"energy", _lev_record.
get_energy());
73 if (_lev_record.
get_J()->
is_known()) (*fTable)[
"level_spin"].set_value(_lev_record.
get_j());
75 (*fTable)[
"level_spin_parity"].set_value(_lev_record.
get_Jpi_str());
89 isotope[
"spin"].set_value(_lev_record.
get_j());
90 isotope[
"parity"].set_value(_lev_record.
get_pi());
91 isotope[
"spin_parity"].set_value(_lev_record.
get_Jpi_str());
97 if (_lev_record.
get_lifetime().
value == 0.) isotope[
"lifetime_unc"].set_value(0.);
Interface to the sqlite database.
tkdb_builder(tkdatabase *_database, const char *_table_name)
Representaiton of a sqlite data table.
void update_row(const tkstring &_where)
Decodding of the ENSDF level properties.
const bool & get_pi() const
const tkstring & get_Jpi_str() const
const tkparity * get_Pi() const
const double & get_j() const
const tkspin * get_J() const
bool is_uncertain() const
check if the record is uncertain
const tkstring & get_uncertain_record() const
get the record uncertain type
virtual const tkstring & get_comment_record() const
get the continuation record
const tkdb_table::measure_data_struct & get_energy() const
const tkdb_table::measure_data_struct & get_lifetime() const
Filling of the ENSDF level properties.
void fill_level(int _dset_idx, int _isotope_idx, const tkensdf_level_rec &_lev_record, bool _adopted)
tklevel_builder(tkdatabase *_database, const char *_table_name="LEVEL")
virtual ~tklevel_builder() override
bool is_known() const
to get some information about this data
static const char * form(const char *_format,...)
bool contains(const char *_pat, ECaseCompare _cmp=kExact) const
tklog & do_endl(tklog &log)