TkN 2.5
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<tkspin_parity> get_spin_parity() { return fspin_parity; }
94 const tkstring &get_spin_parity_str() { return fspin_parity->get_jpi_str(); }
95
97 vector<shared_ptr<tkdecay>> get_decays_down() { return fdecays_down; }
99 vector<shared_ptr<tkdecay>> get_decays_up() { return fdecays_up; }
100
102 bool is_stable() { return fis_stable; }
104 bool is_isomer() { return fisomer_level; }
106 int get_isomer_level() { return fisomer_level; }
107
109 bool is_yrast(bool _with_tentative = false);
110
112 bool has_comment() { return fhas_comment; }
114 const tkstring &get_comment() { return fcomment; }
116 bool is_uncertain() { return !funcertain_level.is_empty(); }
117
119 void print(const tkstring &_option = "");
120
122 int get_id() { return flevel_id; }
123
125 void set_energy_offset(const tkstring &_offset) { fenergy_offset = _offset; }
126
130 void set_jpi(double _spin, int _parity, const tkstring &_jpi_str);
131
133 void add_decay_down(shared_ptr<tkdecay> _dec) { fdecays_down.push_back(_dec); }
135 void add_decay_up(shared_ptr<tkdecay> _dec) { fdecays_up.push_back(_dec); }
136
138 void set_comment(const tkstring &_comment)
139 {
140 fcomment = _comment;
141 fhas_comment = true;
142 }
143
144 void set_uncertain_level(const tkstring &_uncertain) { funcertain_level = _uncertain; }
145
146#ifdef HAS_ROOT
148 ClassDefOverride(tklevel, 0);
149#endif
150};
151} // namespace tkn
152
153#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:104
void add_decay_up(shared_ptr< tkdecay > _dec)
add a up decay to the level
Definition tklevel.h:135
bool is_stable()
returns true if the level stable
Definition tklevel.h:102
double get_lifetime(const tkunit_manager::units_keys _unit=tkunit_manager::units_keys::s)
returns the lifetime (in second by default)
Definition tklevel.cpp:203
int get_id()
get the level id
Definition tklevel.h:122
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:114
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:178
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:161
void set_energy_offset(const tkstring &_offset)
define the energy offset
Definition tklevel.h:125
void add_decay_down(shared_ptr< tkdecay > _dec)
add a down decay to the level
Definition tklevel.h:133
tklevel(int _id, const tkdb_table::measure_data_struct &_struc)
Definition tklevel.cpp:119
tkstring get_lifetime_str()
returns the lifetime in string (using the best adapted unit)
Definition tklevel.cpp:217
bool is_uncertain()
check if the level is uncertain
Definition tklevel.h:116
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:92
vector< shared_ptr< tkdecay > > get_decays_up()
return a vector of tkdecay containing the upward decays
Definition tklevel.h:99
virtual ~tklevel() override=default
void set_comment(const tkstring &_comment)
set the level comment string
Definition tklevel.h:138
friend class tkdataset
Definition tklevel.h:44
void print(const tkstring &_option="")
print the level properties
Definition tklevel.cpp:262
int get_isomer_level()
get the isomer level (1 for the ␌1rst (lowest energy) isomer, 2 for the second, etc....
Definition tklevel.h:106
bool is_yrast(bool _with_tentative=false)
returns true if the level is yrast
Definition tklevel.cpp:248
void set_uncertain_level(const tkstring &_uncertain)
set the level as uncertain
Definition tklevel.h:144
vector< shared_ptr< tkdecay > > get_decays_down()
return a vector of tkdecay containing of the downward decays
Definition tklevel.h:97
const tkstring & get_spin_parity_str()
returns the spin parity as a string
Definition tklevel.h:94
void set_lifetime(tkdb_table::measure_data_struct &_struc)
define the level lifetime
Definition tklevel.cpp:140
bool has_comment()
check if a comment exists
Definition tklevel.h:112
friend class tklevel_scheme
Definition tklevel.h:45
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:32
units_keys
units identifiers
Definition tkunit.h:46
Definition tklog.cpp:16
data structure used to fill a tkmeasure object from the sqlite database
Definition tkdb_table.h:49