37#include "tkensdf_gamma_rec.h"
55tkensdf_gamma_rec::tkensdf_gamma_rec()
62 fIs_final_level_set = _gamma_record.fIs_final_level_set;
63 fFinal_level_energy = _gamma_record.fFinal_level_energy;
75 fUncertain_record = frecord.substr(79,1);
81 set_relative_intensity(frecord);
84 set_multipolarity(frecord);
87 set_mixing_ratio(frecord);
90 set_conv_coeff(frecord);
95void tkensdf_gamma_rec::set_relative_intensity(
const tkstring &_record)
97 auto RI_str = _record.
substr(21,8);
98 auto DRI_str = _record.
substr(29,2);
100 if(RI_str.contains(
"(")) {
101 frelative_intensity.
info +=
";VAL=()";
104 frelative_intensity.
value = RI_str.atof();
105 if(frelative_intensity.
value>0) frelative_intensity.
filled =
true;
108 frelative_intensity.
unit =
"%";
109 frelative_intensity.
err = DRI_str.atof();
112void tkensdf_gamma_rec::set_multipolarity(
const tkstring &_record)
114 auto str = _record.
substr(31,10);
118void tkensdf_gamma_rec::set_mixing_ratio(
const tkstring &_record)
123 fmixing_ratio.
value = MR_str.atof();
124 if(fmixing_ratio.
value==0)
return;
126 if(!DMR_str.is_empty()) {
128 if(DMR_str.is_alpha()) {
129 fmixing_ratio.
info +=
";ERR=" + DMR_str;
136 if(DMR_str.contains(
"+") && DMR_str.contains(
"-")) {
137 bool inv = DMR_str.index(
"-") < DMR_str.index(
"+");
138 DMR_str.replace_all(
"+",
" ");
139 DMR_str.replace_all(
"-",
" ");
140 auto tokens_lt_err = DMR_str.tokenize(
" ");
141 if(tokens_lt_err.size()!=2) {
142 glog <<
error <<
" bad asymetric error decoding in record " << frecord <<
do_endl;
145 tkstring err_low_str = tokens_lt_err.back();
146 tkstring err_high_str = tokens_lt_err.front();
148 err_low_str = tokens_lt_err.front();
149 err_high_str = tokens_lt_err.back();
152 fmixing_ratio.
err_low = err_low_str.
atof()*precision;
156 fmixing_ratio.
err = DMR_str.atof()*precision;
161 fmixing_ratio.
info +=
";ERR=?";
163 fmixing_ratio.
filled =
true;
166void tkensdf_gamma_rec::set_conv_coeff(
const tkstring &_record)
168 auto CC_str = _record.
substr(55,7);
169 auto DCC_str = _record.
substr(62,2);
171 fconv_coeff.
value = CC_str.atof();
175 fconv_coeff.
unit =
"";
176 fconv_coeff.
err = DCC_str.atof();
179void tkensdf_gamma_rec::set_red_trans_prob(
const tkstring &_record)
181 auto tmp_rec = _record;
188 if(tmp_rec.begins_with(
"BM")) {
192 if(tmp_rec.begins_with(
"BE")) {
196 if(!(is_elec || is_mag))
return;
198 trans_name += tmp_rec[2];
201 bool wu = (tmp_rec.substr(3,1) ==
"W");
202 if(wu) trans_name +=
"W";
205 if(is_elec && wu) the_struct = &fBEW;
206 else if(is_elec && !wu) the_struct = &fBE;
207 else if(is_mag && wu) the_struct = &fBMW;
208 else if(is_mag && !wu) the_struct = &fBM;
209 if(!the_struct)
return;
210 if(the_struct->
filled)
return;
214 the_struct->
value *= pow(100,mult);
215 the_struct->
err *= pow(100,mult);
216 the_struct->
err_low *= pow(100,mult);
217 the_struct->
err_high *= pow(100,mult);
221 the_struct->
value *= pow(100,mult-1);
222 the_struct->
err *= pow(100,mult-1);
223 the_struct->
err_low *= pow(100,mult-1);
224 the_struct->
err_high *= pow(100,mult-1);
225 if(mult==1) the_struct->
unit =
"mu^2";
229 else the_struct->
unit =
"Weisskopf";
231 the_struct->
info +=
";TYPE=" + trans_name;
238 if(tmp_rec.substr(0,1) ==
"=") {
243 if(toks.size()>1) err = toks.at(1);
256 auto tokens_lt_err = err.
tokenize(
" ");
257 if(tokens_lt_err.size()!=2) {
258 glog <<
error <<
" bad asymetric error decoding in record " << frecord <<
do_endl;
261 tkstring err_low_str = tokens_lt_err.back();
262 tkstring err_high_str = tokens_lt_err.front();
264 err_low_str = tokens_lt_err.front();
265 err_high_str = tokens_lt_err.back();
268 the_struct->
err_low = err_low_str.
atof()*precision;
272 the_struct->
err = err.
atof()*precision;
276 the_struct->
info +=
";ERR=?";
286 the_struct->
info +=
";ERR=" + lim;
289 the_struct->
filled =
true;
294 auto tokens = fcontinuation_record.tokenize(
"$");
295 for(
auto &token: tokens) {
297 if(token.contains(
"FL=")) {
298 fIs_final_level_set =
true;
299 token.remove_all_extra_white_space().remove_all(
"FL=");
300 if(token.is_float()) fFinal_level_energy = token.atof();
301 else fFinal_level_energy = -1;
303 if(token.contains(
"BE") || token.contains(
"BM")) {
304 set_red_trans_prob(token);
308 check_red_trans_prob();
311void tkensdf_gamma_rec::check_red_trans_prob()
314 double mass = frecord.substr(0,3).atof();
318 double conv = weisskopf_conversion(
true,mass,mult);
325 fBE.
info +=
";ERR=CONV";
331 double conv = 1./weisskopf_conversion(
true,mass,mult);
336 fBEW.
unit =
"Weisskopf";
338 fBEW.
info +=
";ERR=CONV";
344 double conv = weisskopf_conversion(
false,mass,mult);
349 if(mult==1) fBM.
unit =
"mu^2";
352 fBM.
info +=
";ERR=CONV";
358 double conv = 1./weisskopf_conversion(
false,mass,mult);
363 fBMW.
unit =
"Weisskopf";
365 fBMW.
info +=
";ERR=CONV";
371double tkensdf_gamma_rec::weisskopf_conversion(
bool electric,
double mass,
double mult)
373 if(electric)
return pow(1.2,2.*mult)/(4.*M_PI)*3./(mult+3.)*3./(mult+3.)*pow(mass,2.*mult/3.);
374 return 10./M_PI*pow(1.2,2.*mult-2.)*3./(mult+3.)*3./(mult+3.)*pow(mass,(2.*mult-2.)/3.);
381 fIs_final_level_set =
false;
382 fFinal_level_energy = -1.;
383 frelative_intensity.
clear();
384 fmultipolarity.clear();
385 fmixing_ratio.
clear();
Decodding of the ENSDF gamma properties.
void print(std::ostream &) const override
void analyse_continuation_record() override
analyse a continuation record
virtual void analyse_record() override
analyse the record content
virtual bool set_record(const tkstring &_record) override
define the record from a string
Decodding of the ENSDF records.
bool decode_energy(const tkstring &_st)
decode an anergy record
tkstring get_energy_str(const tkstring &_record) const
extract the energy part
std::string with usefull tricks from TString (ROOT) and KVString (KaliVeda) and more....
tkstring strip_all_extra_white_space() const
tkstring copy() const
Returns a copy of this string.
static const char * form(const char *_format,...)
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.
int atoi() const
Converts a string to integer value.
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
tkstring & append(const tkstring &_st)
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(tklog &log)
tklog & do_endl(tklog &log)
data structure used to fill a tkmeasure object from the sqlite database