TkN 2.7.1
Toolkit for Nuclei
Loading...
Searching...
No Matches
tklevel.h
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 * Licensed under the MIT License <http://opensource.org/licenses/MIT>. *
11 * SPDX-License-Identifier: MIT *
12 ********************************************************************************/
13
14#ifndef tklevel_H
15#define tklevel_H
16
17#include "tkn_config.h"
18
19#ifdef HAS_ROOT
20#include "TClass.h"
21#endif
22
23#include "tkdb_table.h"
24#include "tkproperty_list.h"
25#include "tkmeasure.h"
26#include "tkspin_parity.h"
27#include "tkdecay.h"
28
29namespace tkn {
30
43class tklevel : public tkproperty_list {
44 friend class tkdataset;
45 friend class tklevel_scheme;
46
47protected:
48 int flevel_id = -1;
49 tkstring fbelongs_to_nucleus = "";
50
51 shared_ptr<tkspin_parity> fspin_parity;
52
53 bool fis_stable = false;
54 bool fis_isomer = false;
55 int fisomer_level = 0;
56
57 bool fisYrast_exact = false;
58 bool fisYrast_uncertain = false;
59
60 vector<shared_ptr<tkdecay>> fdecays_down;
61 vector<shared_ptr<tkdecay>> fdecays_up;
62
63 tkstring fcomment{};
64 bool fhas_comment = false;
65
66 tkstring funcertain_level{};
67
68 tkstring fenergy_offset = "";
69
70public:
71 tklevel(int _id, const tkdb_table::measure_data_struct &_struc);
72 virtual ~tklevel() override = default;
73
75 shared_ptr<tkmeasure> get_energy_measure() { return get("energy"); }
77 double get_energy(const tkunit_manager::units_keys _unit = tkunit_manager::units_keys::keV, bool _with_offset = false);
78
80 bool is_energy_offset() { return (!fenergy_offset.is_empty()); }
82 tkstring get_offset_bandhead() { return fenergy_offset; }
83
85 shared_ptr<tkmeasure> get_lifetime_measure() { return get("lifetime"); }
97
99 shared_ptr<tkmeasure> get_magnetic_dipole_measure() { return get("magnetic_dipole"); }
101 double get_magnetic_dipole();
102
104 shared_ptr<tkmeasure> get_electric_quadrupole_measure() { return get("electric_quadrupole"); }
107
109 shared_ptr<tkspin_parity> get_spin_parity() { return fspin_parity; }
111 const tkstring &get_spin_parity_str() { return fspin_parity->get_jpi_str(); }
112
114 const vector<shared_ptr<tkdecay>> &get_decays_down() const { return fdecays_down; }
116 const vector<shared_ptr<tkdecay>> &get_decays_up() const { return fdecays_up; }
117
119 bool is_stable() { return fis_stable; }
121 bool is_isomer() { return fisomer_level; }
123 int get_isomer_level() { return fisomer_level; }
124
126 bool is_yrast(bool _with_tentative = false);
127
129 bool has_comment() { return fhas_comment; }
131 const tkstring &get_comment() { return fcomment; }
133 bool is_uncertain() { return !funcertain_level.is_empty(); }
134
136 void print(const tkstring &_option = "");
137
139 int get_id() { return flevel_id; }
140
142 void set_energy_offset(const tkstring &_offset) { fenergy_offset = _offset; }
143
151 void set_jpi(double _spin, int _parity, const tkstring &_jpi_str);
152
154 void add_decay_down(shared_ptr<tkdecay> _dec) { fdecays_down.push_back(_dec); }
156 void add_decay_up(shared_ptr<tkdecay> _dec) { fdecays_up.push_back(_dec); }
157
159 void set_comment(const tkstring &_comment)
160 {
161 fcomment = _comment;
162 fhas_comment = true;
163 }
164
165 void set_uncertain_level(const tkstring &_uncertain) { funcertain_level = _uncertain; }
166
167#ifdef HAS_ROOT
169 ClassDefOverride(tklevel, 0);
170#endif
171};
172} // namespace tkn
173
174#endif
Represents a nuclear excited level (or ground state).
Definition tklevel.h:43
bool is_isomer()
returns true is the level an isomer
Definition tklevel.h:121
void add_decay_up(shared_ptr< tkdecay > _dec)
add a up decay to the level
Definition tklevel.h:156
bool is_stable()
returns true if the level stable
Definition tklevel.h:119
double get_lifetime(const tkunit_manager::units_keys _unit=tkunit_manager::units_keys::s)
Definition tklevel.cpp:168
int get_id()
get the level id
Definition tklevel.h:139
double get_mean_lifetime(tkunit_manager::units_keys _unit=tkunit_manager::s)
Mean lifetime tau = T1/2 / ln(2); time units only; same missing/stable rules.
Definition tklevel.cpp:158
shared_ptr< tkmeasure > get_lifetime_measure()
Legacy stored measure: half-life in time units, width in energy units.
Definition tklevel.h:85
const tkstring & get_comment()
get the level comment string
Definition tklevel.h:131
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
Definition tklevel.cpp:136
void set_electric_quadrupole(tkdb_table::measure_data_struct &_struc)
define the level electric quadrupole moment
Definition tklevel.cpp:102
shared_ptr< tkmeasure > get_electric_quadrupole_measure()
return the electric quadrupole moment tkmeasure object
Definition tklevel.h:104
tkstring get_offset_bandhead()
returns the bandhead string offset value (ex: X)
Definition tklevel.h:82
shared_ptr< tkmeasure > get_energy_measure()
returns the energy tkmeasure object
Definition tklevel.h:75
void set_jpi(double _spin, int _parity, const tkstring &_jpi_str)
define the spin parity
Definition tklevel.cpp:119
void set_energy_offset(const tkstring &_offset)
define the energy offset
Definition tklevel.h:142
void add_decay_down(shared_ptr< tkdecay > _dec)
add a down decay to the level
Definition tklevel.h:154
tklevel(int _id, const tkdb_table::measure_data_struct &_struc)
Definition tklevel.cpp:37
tkstring get_lifetime_str()
Legacy formatting of T1/2 or Gamma (not mean lifetime).
Definition tklevel.cpp:182
bool is_uncertain()
check if the level is uncertain
Definition tklevel.h:133
bool is_energy_offset()
to know if the energy is known with an energy offset
Definition tklevel.h:80
double get_decay_width(tkunit_manager::units_keys _unit=tkunit_manager::keV)
Decay width Gamma = hbar/tau; energy units only. Stable: 0; absent: NaN.
Definition tklevel.cpp:163
shared_ptr< tkspin_parity > get_spin_parity()
returns the spin parity shared pointer object
Definition tklevel.h:109
const vector< shared_ptr< tkdecay > > & get_decays_down() const
return a vector of tkdecay containing of the downward decays
Definition tklevel.h:114
virtual ~tklevel() override=default
void set_comment(const tkstring &_comment)
set the level comment string
Definition tklevel.h:159
double get_electric_quadrupole()
return the electric quadrupole moment in barns
Definition tklevel.cpp:113
const vector< shared_ptr< tkdecay > > & get_decays_up() const
return a vector of tkdecay containing the upward decays
Definition tklevel.h:116
friend class tkdataset
Definition tklevel.h:44
void print(const tkstring &_option="")
print the level properties
Definition tklevel.cpp:227
int get_isomer_level()
get the isomer level (1 for the ␌1rst (lowest energy) isomer, 2 for the second, etc....
Definition tklevel.h:123
bool is_yrast(bool _with_tentative=false)
returns true if the level is yrast
Definition tklevel.cpp:213
void set_uncertain_level(const tkstring &_uncertain)
set the level as uncertain
Definition tklevel.h:165
const tkstring & get_spin_parity_str()
returns the spin parity as a string
Definition tklevel.h:111
shared_ptr< tkmeasure > get_magnetic_dipole_measure()
return the magnetic dipole moment tkmeasure object
Definition tklevel.h:99
void set_lifetime(tkdb_table::measure_data_struct &_struc)
Define the stored ENSDF half-life (time) or width (energy).
Definition tklevel.cpp:58
double get_half_life(tkunit_manager::units_keys _unit=tkunit_manager::s)
Half-life T1/2; time units only. Stable: +inf; absent/invalid unit: NaN.
Definition tklevel.cpp:153
bool has_comment()
check if a comment exists
Definition tklevel.h:129
friend class tklevel_scheme
Definition tklevel.h:45
double get_magnetic_dipole()
return the magnetic dipole moment in nuclear magnetons
Definition tklevel.cpp:107
void set_magnetic_dipole(tkdb_table::measure_data_struct &_struc)
define the level magnetic dipole moment
Definition tklevel.cpp:97
shared_ptr< tkmeasure > get(const tkstring &_property) const
get the property as tkmeasure
tkproperty_list(tkstring _name)
std::string with usefull tricks from TString (ROOT) and KVString (KaliVeda) and more....
Definition tkstring.h:33
units_keys
units identifiers
Definition tkunit.h:48
Definition tklog.cpp:16
data structure used to fill a tkmeasure object from the sqlite database
Definition tkdb_table.h:51