37#include "tkensdf_record.h"
58 if(_record.size() != (
RSIZE-1)) {
59 glog <<
error_v <<
"oups, record size: "<<_record.length()<<
" not equal to RSIZE: "<<
RSIZE-1<<
do_endl;
76 if(!fcontinuation_record.is_empty()) fcontinuation_record +=
"$";
85 if(!_is_continuation && !fcomment_record.empty()) fcomment_record +=
"\n";
96 f_is_continuation_record =
false;
99 if(fid.match(
"* G ")) {
101 if(!field6.
is_empty()) f_is_continuation_record =
true;
109 if(!field6.
is_empty()) f_is_continuation_record =
true;
113 if(fid.match(
"* L ")) {
115 if(!field6.
is_empty()) f_is_continuation_record =
true;
119 if(fid.match(
"* H ")) {
121 if(!field6.
is_empty()) f_is_continuation_record =
true;
125 if(fid.match(
"* E ")) {
127 if(!field6.
is_empty()) f_is_continuation_record =
true;
131 if(fid.match(
"* B ")) {
133 if(!field6.
is_empty()) f_is_continuation_record =
true;
137 if(frecord.is_empty()) {
142 if(fid.match(
"* ")) {
144 if(!field6.
is_empty()) f_is_continuation_record =
true;
148 if(fid.match(
" X*") && !field9.
is_empty()) {
153 if(fid.match(
"*PN*")) {
155 if(!field6.
is_empty()) f_is_continuation_record =
true;
159 if(fid.match(
" N*")) {
164 if(fid.match(
"* Q ")) {
166 if(!field6.
is_empty()) f_is_continuation_record =
true;
170 if(fid.match(
" P*")) {
175 if(fid.match(
"* A ")) {
177 if(!field6.
is_empty()) f_is_continuation_record =
true;
181 if( (fid.match(
"* *") || fid.match(
"* D*")) && (field9.
equal_to(
"N") || field9.
equal_to(
"P") || field9.
equal_to(
"A")) ) {
183 if(!field6.
is_empty()) f_is_continuation_record =
true;
187 if(fid.match(
" R ")) {
218 fenergy.info +=
";OFF=" + tmp_e;
224 else if(tmp_e.
substr(0,1)==
"+"){
230 index = tmp_e.
index(
"+");
231 if(index != std::string::npos && tmp_e.
substr(index-1,1).
to_lower() !=
"e") {
233 fenergy.info +=
";OFF=" + offset;
239 index = tmp_e.
index(
"(");
240 if(index != std::string::npos) {
242 fenergy.info +=
";VAL=()";
249 fenergy.unit =
"KEV";
250 fenergy.value = tmp_e.
atof();
252 fenergy.filled =
true;
256 fenergy.info +=
";ERR=" + tmp_de;
260 if(fenergy.value>0.) {
261 if(tmp_de.
is_empty()) fenergy.info +=
";ERR=?";
263 fenergy.err = tmp_de.
atof()*precision;
278 flifetime.info =
"? ";
283 flifetime.value = 3.2E23;
284 flifetime.unit =
"S";
285 flifetime.info +=
";STABLE";
288 auto tokens_lt = tmp_lt.
tokenize(
" ");
294 flifetime.value = tokens_lt.front().atof();
296 else flifetime.unit = tokens_lt.back();
303 flifetime.info +=
";ERR=" + lt_err;
311 bool inv = lt_err.
index(
"-") < lt_err.
index(
"+");
314 auto tokens_lt_err = lt_err.
tokenize(
" ");
315 if(tokens_lt_err.size()!=2) {
316 glog <<
error <<
" bad asymetric error decoding in record " << frecord <<
do_endl;
319 tkstring err_low_str = tokens_lt_err.back();
320 tkstring err_high_str = tokens_lt_err.front();
322 err_low_str = tokens_lt_err.front();
323 err_high_str = tokens_lt_err.back();
326 flifetime.err_low = err_low_str.
atof()*precision;
327 flifetime.err_high = err_high_str.
atof()*precision;
330 flifetime.err = lt_err.
atof()*precision;
335 flifetime.info +=
";ERR=?";
339 flifetime.info +=
";ISO=" + _st_ms;
342 flifetime.filled =
true;
354 f_is_continuation_record =
false;
355 fcontinuation_record =
"";
356 fcomment_record =
"";
358 fUncertain_record =
"";
360 fisknown_woth_offset =
false;
366 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)