TkN 2.7
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"); }
90
92 shared_ptr<tkmeasure> get_magnetic_dipole_measure() { return get("magnetic_dipole"); }
94 double get_magnetic_dipole();
95
97 shared_ptr<tkmeasure> get_electric_quadrupole_measure() { return get("electric_quadrupole"); }
100
102 shared_ptr<tkspin_parity> get_spin_parity() { return fspin_parity; }
104 const tkstring &get_spin_parity_str() { return fspin_parity->get_jpi_str(); }
105
107 const vector<shared_ptr<tkdecay>> &get_decays_down() const { return fdecays_down; }
109 const vector<shared_ptr<tkdecay>> &get_decays_up() const { return fdecays_up; }
110
112 bool is_stable() { return fis_stable; }
114 bool is_isomer() { return fisomer_level; }
116 int get_isomer_level() { return fisomer_level; }
117
119 bool is_yrast(bool _with_tentative = false);
120
122 bool has_comment() { return fhas_comment; }
124 const tkstring &get_comment() { return fcomment; }
126 bool is_uncertain() { return !funcertain_level.is_empty(); }
127
129 void print(const tkstring &_option = "");
130
132 int get_id() { return flevel_id; }
133
135 void set_energy_offset(const tkstring &_offset) { fenergy_offset = _offset; }
136
144 void set_jpi(double _spin, int _parity, const tkstring &_jpi_str);
145
147 void add_decay_down(shared_ptr<tkdecay> _dec) { fdecays_down.push_back(_dec); }
149 void add_decay_up(shared_ptr<tkdecay> _dec) { fdecays_up.push_back(_dec); }
150
152 void set_comment(const tkstring &_comment)
153 {
154 fcomment = _comment;
155 fhas_comment = true;
156 }
157
158 void set_uncertain_level(const tkstring &_uncertain) { funcertain_level = _uncertain; }
159
160#ifdef HAS_ROOT
162 ClassDefOverride(tklevel, 0);
163#endif
164};
165} // namespace tkn
166
167#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:114
void add_decay_up(shared_ptr< tkdecay > _dec)
add a up decay to the level
Definition tklevel.h:149
bool is_stable()
returns true if the level stable
Definition tklevel.h:112
double get_lifetime(const tkunit_manager::units_keys _unit=tkunit_manager::units_keys::s)
returns the lifetime (in second by default)
Definition tklevel.cpp:160
int get_id()
get the level id
Definition tklevel.h:132
shared_ptr< tkmeasure > get_lifetime_measure()
returns the lifetime tkmeasure object
Definition tklevel.h:85
const tkstring & get_comment()
get the level comment string
Definition tklevel.h:124
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:135
void set_electric_quadrupole(tkdb_table::measure_data_struct &_struc)
define the level electric quadrupole moment
Definition tklevel.cpp:101
shared_ptr< tkmeasure > get_electric_quadrupole_measure()
return the electric quadrupole moment tkmeasure object
Definition tklevel.h:97
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:118
void set_energy_offset(const tkstring &_offset)
define the energy offset
Definition tklevel.h:135
void add_decay_down(shared_ptr< tkdecay > _dec)
add a down decay to the level
Definition tklevel.h:147
tklevel(int _id, const tkdb_table::measure_data_struct &_struc)
Definition tklevel.cpp:36
tkstring get_lifetime_str()
returns the lifetime in string (using the best adapted unit)
Definition tklevel.cpp:174
bool is_uncertain()
check if the level is uncertain
Definition tklevel.h:126
bool is_energy_offset()
to know if the energy is known with an energy offset
Definition tklevel.h:80
shared_ptr< tkspin_parity > get_spin_parity()
returns the spin parity shared pointer object
Definition tklevel.h:102
const vector< shared_ptr< tkdecay > > & get_decays_down() const
return a vector of tkdecay containing of the downward decays
Definition tklevel.h:107
virtual ~tklevel() override=default
void set_comment(const tkstring &_comment)
set the level comment string
Definition tklevel.h:152
double get_electric_quadrupole()
return the electric quadrupole moment in barns
Definition tklevel.cpp:112
const vector< shared_ptr< tkdecay > > & get_decays_up() const
return a vector of tkdecay containing the upward decays
Definition tklevel.h:109
friend class tkdataset
Definition tklevel.h:44
void print(const tkstring &_option="")
print the level properties
Definition tklevel.cpp:219
int get_isomer_level()
get the isomer level (1 for the ␌1rst (lowest energy) isomer, 2 for the second, etc....
Definition tklevel.h:116
bool is_yrast(bool _with_tentative=false)
returns true if the level is yrast
Definition tklevel.cpp:205
void set_uncertain_level(const tkstring &_uncertain)
set the level as uncertain
Definition tklevel.h:158
const tkstring & get_spin_parity_str()
returns the spin parity as a string
Definition tklevel.h:104
shared_ptr< tkmeasure > get_magnetic_dipole_measure()
return the magnetic dipole moment tkmeasure object
Definition tklevel.h:92
void set_lifetime(tkdb_table::measure_data_struct &_struc)
define the level lifetime
Definition tklevel.cpp:57
bool has_comment()
check if a comment exists
Definition tklevel.h:122
friend class tklevel_scheme
Definition tklevel.h:45
double get_magnetic_dipole()
return the magnetic dipole moment in nuclear magnetons
Definition tklevel.cpp:106
void set_magnetic_dipole(tkdb_table::measure_data_struct &_struc)
define the level magnetic dipole moment
Definition tklevel.cpp:96
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