TkN 2.1
Toolkit for Nuclei
tkdecay_builder.cpp
1/********************************************************************************
2 * Copyright (c) : Université de Lyon 1, CNRS/IN2P3, UMR5822, *
3 * IP2I, F-69622 Villeurbanne Cedex, France *
4 * Normandie Université, ENSICAEN, UNICAEN, CNRS/IN2P3, *
5 * LPC Caen, F-14000 Caen, France *
6 * Contibutor(s) : *
7 * Jérémie Dudouet jeremie.dudouet@cnrs.fr [2020] *
8 * Diego Gruyer diego.gruyer@cnrs.fr [2020] *
9 * *
10 * This software is governed by the CeCILL-B license under French law and *
11 * abiding by the rules of distribution of free software. You can use, *
12 * modify and/ or redistribute the software under the terms of the *
13 * CeCILL-B license as circulated by CEA, CNRS and INRIA at the following *
14 * URL \"http://www.cecill.info\". *
15 * *
16 * As a counterpart to the access to the source code and rights to copy, *
17 * modify and redistribute granted by the license, users are provided *
18 * only with a limited warranty and the software's author, the holder of *
19 * the economic rights, and the successive licensors have only limited *
20 * liability. *
21 * *
22 * In this respect, the user's attention is drawn to the risks associated *
23 * with loading, using, modifying and/or developing or reproducing the *
24 * software by the user in light of its specific status of free software, *
25 * that may mean that it is complicated to manipulate, and that also *
26 * therefore means that it is reserved for developers and experienced *
27 * professionals having in-depth computer knowledge. Users are therefore *
28 * encouraged to load and test the software's suitability as regards *
29 * their requirements in conditions enabling the security of their *
30 * systems and/or data to be ensured and, more generally, to use and *
31 * operate it in the same conditions as regards security. *
32 * *
33 * The fact that you are presently reading this means that you have had *
34 * knowledge of the CeCILL-B license and that you accept its terms. *
35 ********************************************************************************/
36
37#include "tkdecay_builder.h"
38
39#include "tklog.h"
40#include "tkdecay.h"
41
42namespace tkn {
49}
50
51using namespace tkn;
52
53tkdecay_builder::~tkdecay_builder() = default;
54
55tkdecay_builder::tkdecay_builder(tkdatabase *_database, const char *_table_name) : tkdb_builder(_database, _table_name)
56{
57 fTable = &fDataBase->new_table(fTableName);
58
59 fTable->add_column("decay_id","INT NOT NULL PRIMARY KEY");
60 fTable->add_column("level_from_id","INT NOT NULL");
61 fTable->add_column("level_to_id","INT NOT NULL");
62 fTable->add_column("decay_type","INT");
63
64 add_measure("energy");
65 add_measure("relative_intensity");
66
67 fTable->add_column("decay_multipolarity","TEXT");
68
69 add_measure("mixing_ratio");
70 add_measure("conv_coeff");
71 add_measure("BE");
72 add_measure("BEW");
73 add_measure("BM");
74 add_measure("BMW");
75
76 fTable->add_column("decay_comment","TEXT");
77 fTable->add_column("decay_uncertain","TEXT");
78
79 fTable->add_constraint("FOREIGN KEY (level_from_id) REFERENCES LEVEL (level_id),"); // hold this link with a constraints
80 fTable->add_constraint("FOREIGN KEY (level_to_id) REFERENCES LEVEL (level_id)"); // hold this link with a constraints
81
82 fTable->write_to_database();
83
84 glog << info << "Creating '" << _table_name << "' table" << do_endl;
85}
86
87void tkdecay_builder::fill_gamma(const int &_level_idx_from,const int &_level_idx_to, const tkensdf_gamma_rec &_gamma_record)
88{
89 (*fTable)["decay_id"].set_value(fdecay_Idx); // level id
90 fdecay_Idx++;
91 (*fTable)["level_from_id"].set_value(_level_idx_from);
92 (*fTable)["level_to_id"].set_value(_level_idx_to);
93
94 (*fTable)["decay_type"].set_value(tkdecay::kgamma);
95
96 fill_measure("energy",_gamma_record.get_energy());
97 fill_measure("relative_intensity",_gamma_record.get_relative_intensity());
98 fill_measure("mixing_ratio",_gamma_record.get_mixing_ratio());
99 fill_measure("conv_coeff",_gamma_record.get_conv_coeff());
100 fill_measure("BE",_gamma_record.get_BE());
101 fill_measure("BEW",_gamma_record.get_BEW());
102 fill_measure("BM",_gamma_record.get_BM());
103 fill_measure("BMW",_gamma_record.get_BMW());
104
105 if(!_gamma_record.get_multipolarity().is_empty()) (*fTable)["decay_multipolarity"].set_value(_gamma_record.get_multipolarity());
106
107 if(!_gamma_record.get_comment_record().is_empty()) (*fTable)["decay_comment"].set_value(_gamma_record.get_comment_record());
108
109 if(_gamma_record.is_uncertain()) (*fTable)["decay_uncertain"].set_value(_gamma_record.get_uncertain_record().data());
110
111 fTable->push_row();
112}
113
114
115#ifdef HAS_ROOT
116ClassImp(tkdecay_builder);
117#endif
Interface to the sqlite database.
Definition: tkdatabase.h:57
Mother class used to fill the sqlite database.
Definition: tkdb_builder.h:50
Filling of the ENSDF decay properties.
void fill_gamma(const int &_level_idx_from, const int &_level_idx_to, const tkensdf_gamma_rec &_gamma_record)
Decodding of the ENSDF gamma properties.
const tkdb_table::measure_data_struct & get_BM() const
const tkstring & get_multipolarity() const
const tkdb_table::measure_data_struct & get_BMW() const
const tkdb_table::measure_data_struct & get_BEW() const
const tkdb_table::measure_data_struct & get_conv_coeff() const
const tkdb_table::measure_data_struct & get_mixing_ratio() const
const tkdb_table::measure_data_struct & get_BE() const
const tkdb_table::measure_data_struct & get_relative_intensity() 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
bool is_empty() const
Definition: tkstring.h:163
Definition: tklog.cpp:39
tklog & info(tklog &log)
Definition: tklog.h:336
tklog & do_endl(tklog &log)
Definition: tklog.h:235