37#ifndef tkisotope_builder_H
38#define tkisotope_builder_H
42#include "tkn_config.h"
44#include "tkdatabase.h"
46#include "tkdb_builder.h"
52using json = nlohmann::json;
84 vector<pair<tkstring, double>> decay_modes;
89 if(data.
value!=-1) cout<<left<<setw(33)<<_name<<
": "<< setw(10) << data.
value <<
" (" << setw(8) << data.
err <<
")" << setw(5) << data.
unit << data.
info << endl;
92 vector<pair<tkdb_table::measure_data_struct,tkstring>> sort_map(map<tkstring, tkdb_table::measure_data_struct> &map_in,
bool inverse =
false) {
94 vector<pair<tkdb_table::measure_data_struct,tkstring>> sorted_map;
95 for (
auto &it: map_in) {
96 sorted_map.push_back({ it.second, it.first });
98 std::sort(std::begin(sorted_map), std::end(sorted_map), [inverse](pair<tkdb_table::measure_data_struct,tkstring> a, pair<tkdb_table::measure_data_struct,tkstring> b) {
99 if(inverse)
return a.first.value > b.first.value;
100 else return a.first.value <= b.first.value;
107 if(name.
is_empty() || Z==-1 || N==-1 || A==-1) {
111 cout<<left<<
"Nucleus: "<<setw(5)<<name<<endl;
112 cout<<
"Z="<<setw(3)<<Z<<
", N="<<setw(3)<<N<<
", A="<<setw(3)<<A<<endl;
113 print_data(
"Mass Excess",mass_excess);
114 print_data(
"Quadrupole deformation",quadrupoleDeformation);
115 print_data(
"Abundance",abundance);
116 if(decay_modes.size()) {
117 cout<<left<<setw(33)<<
"Decay modes"<<
": ";
118 for(
auto &mode: decay_modes) cout<< mode.first <<
" : " <<
tkstring::form(
"%g",mode.second) <<
" ; ";
121 print_data(
"Radius",radius);
122 print_data(
"Electirc quadrupole",electric_quadrupole);
123 print_data(
"Magnetic dipole",magnetic_dipole);
130 std::map<int,tkn::tkstring> columns;
138 json_nucleus read_nucleus(json &entry);
139 void fill_isotope(
const json_nucleus &_json_nuc);
142 int fill_database(
const char* _json_filename,
const char *_gs_filename,
int _only_charge=0,
int _only_mass=0);
Interface to the sqlite database.
Mother class used to fill the sqlite database.
Decoding of the NUDAT isotope properties.
int fill_database(const char *_json_filename, const char *_gs_filename, int _only_charge=0, int _only_mass=0)
virtual ~tkisotope_builder()
tkisotope_builder(tkdatabase *_database, const char *_table_name="ISOTOPE")
std::string with usefull tricks from TString (ROOT) and KVString (KaliVeda) and more....
static const char * form(const char *_format,...)
tklog & error(tklog &log)
tklog & do_endl(tklog &log)
data structure used to fill a tkmeasure object from the sqlite database