TkN 2.4
Toolkit for Nuclei
Loading...
Searching...
No Matches
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 * Licensed under the MIT License <http://opensource.org/licenses/MIT>. *
11 * SPDX-License-Identifier: MIT *
12 ********************************************************************************/
13
14#include "tkensdf_level_rec.h"
15#include "tklog.h"
16#include "tkproperty.h"
17
18namespace tkn {
25}
26
27using namespace tkn;
28using namespace std;
29
34
36{
37 frecord = _record;
38 return true;
39}
40
42{
43 // check if the level is uncertain
44 fUncertain_record = frecord.substr(79,1);
45
46 if(! decode_energy(get_energy_str(frecord))) fenergy.value = -1;
47
48 decode_jpi(get_jpi_str(frecord));
49
51
53}
54
56{
57 int i=0;
58 auto tokens = fcontinuation_record.tokenize("$");
59 for(auto &token: tokens) {
60 i++;
61 if(token.begins_with("FLAG")) continue;
62 if(token.begins_with("XREF")) continue;
63 if(token.begins_with("BE") || token.begins_with("BM")) {
64// cout<<"BE " << token<<endl;
65 }
66 else if (token.begins_with("B")) {
67// cout<< token<<endl;
68 }
69 else if(token.begins_with("CONF")) {
70// cout<< token<<endl;
71 }
72 }
73}
74
76{
78 fSpin.clear();
79 fParity.clear();
80
82 fJPi_str = "";
83 fJPi_tentative = false;
84 fJ = 0;
85 fPi = true;
86}
87
88void tkensdf_level_rec::print(std::ostream &/*out*/) const
89{
90 glog << info_o << "level: E=" << fenergy.value << "(" << fenergy.err << ")" << " : JPi=" << fJPi_str << do_endl;
91}
92
94{
95 fJPi_str = _st;
96 fJPi_str.remove_all_extra_white_space();
97 fJPi_str.replace_all("OR",",");
98 fJPi_str.replace_all("TO",":");
99 fJPi_str.replace_all("AND","&");
100
101 // no idea what this means
102 if(fJPi_str.contains("NATURAL") || fJPi_str.contains("UNATURAL")) {
103 // cout << "NATURAL/UNATURAL spin type: "<<fJpi_str << endl;
104 return false;
105 }
106 // 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...)
107 // The levels built on this level, are then defined with an energy of E+X and J+2(4,6...)
108 if(fJPi_str.substr(0,1).is_alpha() &&
109 (!fJPi_str.substr(1,1).is_alpha() || fJPi_str.substr(1,2) == "AP")) {
110 // cout << "alpha spin type: "<<fJpi_str << endl;
111 return false;
112 }
113 // if the spin is either approximative (AP), or in a range (LE or GE)
114 if(fJPi_str.contains("AP") || fJPi_str.contains("LE") || fJPi_str.contains("GE") ) {
115 // cout << "operator spin type: "<<fJpi_str << endl;
116 fJPi_tentative = true;
117 }
118 // Means a list of several possibilities
119 else if(fJPi_str.contains(",")) {
120 // cout << "OR spin type: "<<fJpi_str << endl;
121 fJPi_tentative = true;
122 }
123 // Means a range of possible spins
124 else if(fJPi_str.contains(":")) {
125 // cout << "To spin type: "<<fJpi_str << endl;
126 fJPi_tentative = true;
127 }
128 // case of two spin states are attributed... why, how ?
129 else if(fJPi_str.contains("&")) {
130 // cout << "and spin type: "<<fJpi_str << endl;
131 return false;
132 }
133 else if(fJPi_str.is_empty()) {
134 // cout << "empty spin type: "<<fJpi_str << endl;
135 return false;
136 }
137 // normal case
138 else {
139 // cout << "normal spin type: "<<fJpi_str << endl;
140 fSpin.set(fJPi_str);
141 fParity.set(fJPi_str);
142 if(fSpin.get_info() == tkproperty::kTentative || fParity.get_info() == tkproperty::kTentative) fJPi_tentative = true;
143 else if(fSpin.get_info() == tkproperty::kKnown && fParity.get_info() == tkproperty::kKnown) fJPi_tentative = false;
144 else if(fSpin.get_info() == tkproperty::kAbout || fParity.get_info() == tkproperty::kAbout) fJPi_tentative = true;
145 else if(fSpin.get_info() == tkproperty::kTheo || fParity.get_info() == tkproperty::kTheo) fJPi_tentative = true;
146 else fJPi_tentative = true;
147 }
148
149 fJ = fSpin.get_value();
150 if(fParity.is_parity(tkparity::eparity::kParityPlus)) fPi = false;
151 else fPi = true;
152
153 return true;
154}
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
std::string with usefull tricks from TString (ROOT) and KVString (KaliVeda) and more....
Definition tkstring.h:31
tkstring substr(size_type __pos=0, size_type __n=npos) const
Inlines.
Definition tkstring.h:156
Definition tklog.cpp:16
tklog & info_o(tklog &log)
Definition tklog.h:308
tklog & do_endl(tklog &log)
Definition tklog.h:212