14#include "tkensdf_record.h"
35 if(_record.size() != (
RSIZE-1)) {
36 glog <<
error_v <<
"oups, record size: "<<_record.length()<<
" not equal to RSIZE: "<<
RSIZE-1<<
do_endl;
53 if(!fcontinuation_record.is_empty()) fcontinuation_record +=
"$";
62 if(!_is_continuation && !fcomment_record.empty()) fcomment_record +=
"\n";
73 f_is_continuation_record =
false;
76 if(fid.match(
"* G ")) {
78 if(!field6.
is_empty()) f_is_continuation_record =
true;
86 if(!field6.
is_empty()) f_is_continuation_record =
true;
90 if(fid.match(
"* L ")) {
92 if(!field6.
is_empty()) f_is_continuation_record =
true;
96 if(fid.match(
"* H ")) {
98 if(!field6.
is_empty()) f_is_continuation_record =
true;
102 if(fid.match(
"* E ")) {
104 if(!field6.
is_empty()) f_is_continuation_record =
true;
108 if(fid.match(
"* B ")) {
110 if(!field6.
is_empty()) f_is_continuation_record =
true;
114 if(frecord.is_empty()) {
119 if(fid.match(
"* ")) {
121 if(!field6.
is_empty()) f_is_continuation_record =
true;
125 if(fid.match(
" X*") && !field9.
is_empty()) {
130 if(fid.match(
"*PN*")) {
132 if(!field6.
is_empty()) f_is_continuation_record =
true;
136 if(fid.match(
" N*")) {
141 if(fid.match(
"* Q ")) {
143 if(!field6.
is_empty()) f_is_continuation_record =
true;
147 if(fid.match(
" P*")) {
152 if(fid.match(
"* A ")) {
154 if(!field6.
is_empty()) f_is_continuation_record =
true;
158 if( (fid.match(
"* *") || fid.match(
"* D*")) && (field9.
equal_to(
"N") || field9.
equal_to(
"P") || field9.
equal_to(
"A")) ) {
160 if(!field6.
is_empty()) f_is_continuation_record =
true;
164 if(fid.match(
" R ")) {
195 fenergy.info +=
";OFF=" + tmp_e;
201 else if(tmp_e.
substr(0,1)==
"+"){
207 index = tmp_e.
index(
"+");
208 if(index != std::string::npos && tmp_e.
substr(index-1,1).
to_lower() !=
"e") {
210 fenergy.info +=
";OFF=" + offset;
216 index = tmp_e.
index(
"(");
217 if(index != std::string::npos) {
219 fenergy.info +=
";VAL=()";
226 fenergy.unit =
"KEV";
227 fenergy.value = tmp_e.
atof();
229 fenergy.filled =
true;
233 fenergy.info +=
";ERR=" + tmp_de;
237 if(fenergy.value>0.) {
238 if(tmp_de.
is_empty()) fenergy.info +=
";ERR=?";
240 fenergy.err = tmp_de.
atof()*precision;
255 flifetime.info =
"? ";
260 flifetime.value = 3.2E23;
261 flifetime.unit =
"S";
262 flifetime.info +=
";STABLE";
265 auto tokens_lt = tmp_lt.
tokenize(
" ");
271 flifetime.value = tokens_lt.front().atof();
273 else flifetime.unit = tokens_lt.back();
280 flifetime.info +=
";ERR=" + lt_err;
288 bool inv = lt_err.
index(
"-") < lt_err.
index(
"+");
291 auto tokens_lt_err = lt_err.
tokenize(
" ");
292 if(tokens_lt_err.size()!=2) {
293 glog <<
error <<
" bad asymetric error decoding in record " << frecord <<
do_endl;
296 tkstring err_low_str = tokens_lt_err.back();
297 tkstring err_high_str = tokens_lt_err.front();
299 err_low_str = tokens_lt_err.front();
300 err_high_str = tokens_lt_err.back();
303 flifetime.err_low = err_low_str.
atof()*precision;
304 flifetime.err_high = err_high_str.
atof()*precision;
307 flifetime.err = lt_err.
atof()*precision;
312 flifetime.info +=
";ERR=?";
316 flifetime.info +=
";ISO=" + _st_ms;
319 flifetime.filled =
true;
331 f_is_continuation_record =
false;
332 fcontinuation_record =
"";
333 fcomment_record =
"";
335 fUncertain_record =
"";
337 fisknown_woth_offset =
false;
343 out <<
"Record: " << frecord << std::endl;
bool decode_lifetime(const tkstring &_st, const tkstring &_st_ms)
decode a lifetime record
bool decode_energy(const tkstring &_st)
decode an anergy record
void check_record_type()
check record type from its string
virtual void print(std::ostream &) const
virtual void add_comment_record(const tkstring &_comment_record, bool _is_continuation=false)
add a continuation record from a string
virtual bool set_record(const tkstring &_record)
define the record from a string. Option false only checks if the record is an identification record
tkstring fglobal_time_unit
virtual void add_continuation_record(const tkstring &_continuation_record)
add a continuation record from a string
void set_offset(tkstring _offset)
set_energy_offset
std::string with usefull tricks from TString (ROOT) and KVString (KaliVeda) and more....
tkstring strip_all_extra_white_space() const
tkstring & to_lower()
Change all letters to lower case.
std::vector< tkstring > tokenize(const tkstring &_delim=" ") const
Create a vector of string separated by at least one delimiter.
tkstring & remove_all(const tkstring &_s1)
tkstring substr(size_type __pos=0, size_type __n=npos) const
Inlines.
bool is_alpha() const
Checks whether tkstring is only composed of alphabetic letters.
bool equal_to(const char *_s, ECaseCompare _cmp=kExact) const
Returns true if the string and _s are identical.
size_t index(const char *_s, size_t _pos=0, ECaseCompare _cmp=kExact) const
Returns the index of the substring _s.
tkstring & remove_all_extra_white_space()
bool contains(const char *_pat, ECaseCompare _cmp=kExact) const
bool begins_with(const char *_s, ECaseCompare _cmp=kExact) const
static double get_precision(tkstring _st)
Extract the precision for a given ENSDF data.
tkstring & replace_all(const tkstring &_s1, const tkstring &_s2)
double atof() const
Converts a string to double value.
tklog & error_v(tklog &log)
tklog & error(tklog &log)
tklog & do_endl(tklog &log)