TkN 2.1
Toolkit for Nuclei
tkensdf_level_rec.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 "tkensdf_level_rec.h"
38#include "tklog.h"
39#include "tkproperty.h"
40
41namespace tkn {
48}
49
50using namespace tkn;
51using namespace std;
52
53tkensdf_level_rec::tkensdf_level_rec()
54{
55 ftype = klevel;
56}
57
59{
60 frecord = _record;
61 return true;
62}
63
65{
66 // check if the level is uncertain
67 fUncertain_record = frecord.substr(79,1);
68
69 if(! decode_energy(get_energy_str(frecord))) fenergy.value = -1;
70
71 decode_jpi(get_jpi_str(frecord));
72
74
76}
77
79{
80 int i=0;
81 auto tokens = fcontinuation_record.tokenize("$");
82 for(auto &token: tokens) {
83 i++;
84 if(token.begins_with("FLAG")) continue;
85 if(token.begins_with("XREF")) continue;
86 if(token.begins_with("BE") || token.begins_with("BM")) {
87// cout<<"BE " << token<<endl;
88 }
89 else if (token.begins_with("B")) {
90// cout<< token<<endl;
91 }
92 else if(token.begins_with("CONF")) {
93// cout<< token<<endl;
94 }
95 }
96}
97
99{
101 fSpin.clear();
102 fParity.clear();
103
105 fJPi_str = "";
106 fJPi_tentative = false;
107 fJ = 0;
108 fPi = true;
109}
110
111void tkensdf_level_rec::print(std::ostream &/*out*/) const
112{
113 glog << info_o << "level: E=" << fenergy.value << "(" << fenergy.err << ")" << " : JPi=" << fJPi_str << do_endl;
114}
115
117{
118 fJPi_str = _st;
120 fJPi_str.replace_all("OR",",");
121 fJPi_str.replace_all("TO",":");
122 fJPi_str.replace_all("AND","&");
123
124 // no idea what this means
125 if(fJPi_str.contains("NATURAL") || fJPi_str.contains("UNATURAL")) {
126 // cout << "NATURAL/UNATURAL spin type: "<<fJpi_str << endl;
127 return false;
128 }
129 // in case of levels are build on an unkonwn energy level, the unkown level is defined as E=X(Y,Z...) and J=J(J1,J2,J3...)
130 // The levels built on this level, are then defined with an energy of E+X and J+2(4,6...)
131 if(fJPi_str.substr(0,1).is_alpha() &&
132 (!fJPi_str.substr(1,1).is_alpha() || fJPi_str.substr(1,2) == "AP")) {
133 // cout << "alpha spin type: "<<fJpi_str << endl;
134 return false;
135 }
136 // if the spin is either approximative (AP), or in a range (LE or GE)
137 if(fJPi_str.contains("AP") || fJPi_str.contains("LE") || fJPi_str.contains("GE") ) {
138 // cout << "operator spin type: "<<fJpi_str << endl;
139 fJPi_tentative = true;
140 }
141 // Means a list of several possibilities
142 else if(fJPi_str.contains(",")) {
143 // cout << "OR spin type: "<<fJpi_str << endl;
144 fJPi_tentative = true;
145 }
146 // Means a range of possible spins
147 else if(fJPi_str.contains(":")) {
148 // cout << "To spin type: "<<fJpi_str << endl;
149 fJPi_tentative = true;
150 }
151 // case of two spin states are attributed... why, how ?
152 else if(fJPi_str.contains("&")) {
153 // cout << "and spin type: "<<fJpi_str << endl;
154 return false;
155 }
156 else if(fJPi_str.is_empty()) {
157 // cout << "empty spin type: "<<fJpi_str << endl;
158 return false;
159 }
160 // normal case
161 else {
162 // cout << "normal spin type: "<<fJpi_str << endl;
169 else fJPi_tentative = true;
170 }
171
172 fJ = fSpin.get_value();
173 if(fParity.is_parity(tkparity::eparity::kParityPlus)) fPi = false;
174 else fPi = true;
175
176 return true;
177}
void print(std::ostream &) const override
void analyse_continuation_record() override
analyse a continuation record
tkstring get_jpi_str(const tkstring &_record) const
extract the JPi part
virtual void analyse_record() override
analyse the record content
virtual bool set_record(const tkstring &_record) override
define the record from a string
bool decode_jpi(const tkstring &_st)
decode the spin parity part
tkspin fSpin
spin parameters
bool decode_lifetime(const tkstring &_st, const tkstring &_st_ms)
decode a lifetime record
bool decode_energy(const tkstring &_st)
decode an anergy record
tkstring get_lifetime_metastable_str(const tkstring &_record) const
extract the lifetime part
tkstring get_energy_str(const tkstring &_record) const
extract the energy part
tkstring get_lifetime_str(const tkstring &_record) const
extract the lifetime part
virtual void clear()
virtual void clear()
to clear the content
virtual bool is_parity(tkparity::eparity _parity)
test the parity value
Definition: tkspin_parity.h:98
virtual void set(const tkstring &_st)
define the parity from a string
data_info get_info()
to get information about this data
Definition: tkproperty.h:81
double get_value()
To get the spin as a double.
Definition: tkspin_parity.h:66
void set(int n, int d=1)
define the spin value
virtual void clear()
to clear the content
Definition: tkspin_parity.h:74
std::string with usefull tricks from TString (ROOT) and KVString (KaliVeda) and more....
Definition: tkstring.h:54
bool is_empty() const
Definition: tkstring.h:163
tkstring substr(size_type __pos=0, size_type __n=npos) const
Inlines.
Definition: tkstring.h:179
bool is_alpha() const
Checks whether tkstring is only composed of alphabetic letters.
Definition: tkstring.cpp:420
tkstring & remove_all_extra_white_space()
Definition: tkstring.cpp:526
bool contains(const char *_pat, ECaseCompare _cmp=kExact) const
Definition: tkstring.h:197
tkstring & replace_all(const tkstring &_s1, const tkstring &_s2)
Definition: tkstring.h:203
Definition: tklog.cpp:39
tklog & info_o(tklog &log)
Definition: tklog.h:331
tklog & do_endl(tklog &log)
Definition: tklog.h:235