TkN 2.2
Toolkit for Nuclei
tkmeasure Class Reference

Stores information on an experimental measure. More...

Detailed Description

Stores information on an experimental measure.

To handle the fact that a measure is always associated to a specific unit and an uncertainty, that can be in some cases assymetric, a dedicated class called tkn::tkmeasure has been created.In addition, a tkmeasure gives some properties on the measure, like if the measure is uncertain, is coming from a systematic strudy or from calculations. It can also handle the fact that some measures are given as a limit value.The standard way to access a tkmeasure is using the tkproperty_list::get() method:

tknucleus nuc("14C");
auto measure = nuc.get("lifetime");
cout << measure->get_value() << " " << measure->get_unit() << " +- " << measure->get_error() << endl;
A nucleus made of Z protons and N neutrons.
Definition: tknucleus.h:54
5700 y +- 30
To list the accessible tkmeasure properties, use:
tknucleus nuc("14C");
nuc.list_data_properties()
[ INFO ] nucleus data properties:
[ INFO ] Qalpha Qalpha = -12012.500 (0.081) keV
[ INFO ] QbetaMinus QbetaMinus = 156.4760 (0.0037) keV
[ INFO ] QbetaMinusOneNeutronEmission QbetaMinusOneNeutronEmission = -10396.9000 (0.2696) keV
[ INFO ] QbetaMinusTwoNeutronEmission QbetaMinusTwoNeutronEmission = -30460.80000000 (0.00537582) keV
[ INFO ] QdeltaAlpha QdeltaAlpha = 2892.4400000 (0.0405445) keV
[ INFO ] QdoubleBetaMinus QdoubleBetaMinus = -4987.8900 (0.0254) keV
[ INFO ] QdoubleElectronCapture QdoubleElectronCapture = -36934.600 (132.245) keV
[ INFO ] QelectronCapture QelectronCapture = -20643.8000 (21.2133) keV
[ INFO ] QelectronCaptureOneProtonEmission QelectronCaptureOneProtonEmission = -37928.2000 (10.1805) keV
[ INFO ] QpositronEmission QpositronEmission = -21665.8000 (21.2133) keV
[ INFO ] XRay_Kalpha1 XRay_Kalpha1 = 0.277 keV
[ INFO ] atomic_mass atomic_mass = 12.011 u
[ INFO ] atomic_radius_van_der_Waals atomic_radius_van_der_Waals = 170 pm
[ INFO ] binding_energy_ldm_fit_overA binding_energy_ldm_fit_overA = -37.0681 (0.0004) keV
[ INFO ] binding_energy_overA binding_energy_overA = 7520.3200 (0.0004) keV
[ INFO ] boiling_point boiling_point = 4098 K
[ INFO ] density density = 2.267
[ INFO ] ionization_energy ionization_energy = 11.26 eV
[ INFO ] lifetime lifetime = 5700 (30 ) y
[ INFO ] mass_excess mass_excess = 3019.89000 (0.00375) keV
[ INFO ] melting_point melting_point = 3823 K
[ INFO ] neutronSeparationEnergy neutronSeparationEnergy = 8176.4300 (0.0038) keV
[ INFO ] pairingGap pairingGap = 3479.180000 (0.399772) keV
[ INFO ] protonSeparationEnergy protonSeparationEnergy = 20831.0000 (1.0001) keV
[ INFO ] quadrupoleDeformation quadrupoleDeformation = 0.3593840 (0.0279568)
[ INFO ] twoNeutronSeparationEnergy twoNeutronSeparationEnergy = 13122.7000 (0.0039) keV
[ INFO ] twoProtonSeparationEnergy twoProtonSeparationEnergy = 36635.8000 (1.9086) keV
The same applies for a tklevel or a tkdecay:

tknucleus nuc("132Sn");
auto level = nuc.get_level_scheme()->get_level("2+1");
level->list_data_properties();
[ INFO ] data properties:
[ INFO ] energy Level energy = 4041.20 (0.15 ) keV
[ INFO ] lifetime lifetime = 2.4 (-0.5 ; +0.9 ) fs
In this case, the lifetime uncertainty is asymetric, we can access it as follows:
tknucleus nuc("132Sn");
auto level = nuc.get_level_scheme()->get_level("2+1");
auto lifetime = level->get("lifetime");
cout << lifetime->get_value() << " " << lifetime->get_unit() << " - " << lifetime->get_error_low() << " + " << lifetime->get_error_high() << endl;
2.4 fs - 0.5 + 0.9

Definition at line 59 of file tkmeasure.h.

Inheritance diagram for tkmeasure:
tkproperty

#include <tkmeasure.h>

Public Member Functions

 tkmeasure ()
 
 tkmeasure (double _value, const tkstring &_unit_name, double _err=0)
 
 tkmeasure (double _value, const tkstring &_unit_name, double _errlow, double _errhigh)
 
 tkmeasure (double _value, const tkunit_manager::units_keys &_unit, double _err=0)
 
 tkmeasure (double _value, const tkunit_manager::units_keys &_unit, double _errlow, double _errhigh)
 
virtual ~tkmeasure ()=default
 
double get_error () const
 returns the error on the measured value More...
 
double get_error (const tkstring &_unit_name)
 returns the error on the measured value in the required string unit More...
 
double get_error (const tkunit_manager::units_keys &_unit)
 returns the error on the measured value in the required unit key More...
 
double get_error_high () const
 returns the high assymetric error on the measured value More...
 
double get_error_high (const tkstring &_unit_name)
 returns the high assymetric error on the measured value in the required string unit More...
 
double get_error_high (const tkunit_manager::units_keys &_unit)
 returns the high assymetric error on the measured value in the required unit key More...
 
double get_error_low () const
 returns the low assymetric error on the measured value More...
 
double get_error_low (const tkstring &_unit_name)
 returns the low assymetric error on the measured value in the required string unit More...
 
double get_error_low (const tkunit_manager::units_keys &_unit)
 returns the low assymetric error on the measured value in the required unit key More...
 
int get_exp_error_precision (const double &_err) const
 calculate the needed precision for printouts More...
 
const tkstringget_info_tag ()
 returns the info tag (calculation, systematic, approx value...) More...
 
const tkstringget_info_tag_const () const
 
const tkstringget_type () const
 returns the measured data type (energy, lifetime...) More...
 
tkstring get_unit () const
 returns the unit name More...
 
tkunit_manager::units_keys get_unit_key () const
 returns the unit key More...
 
double get_value () const
 returns the measure value More...
 
double get_value (const tkstring &_unit_name)
 returns the measure value in the required string unit More...
 
double get_value (const tkunit_manager::units_keys &_unit)
 returns the measure value in the required unit key More...
 
bool is_asym_errors () const
 test is the measure uncertainty is asymmetric More...
 
tkmeasure operator* (double _multiplier) const
 
tkmeasure operator+ (const tkmeasure &_measure) const
 
tkmeasure operator- () const
 
tkmeasure operator- (const tkmeasure &_measure) const
 
void print (bool with_return=true)
 print the measured properties More...
 
void set (const double &_val, const tkstring &_unit="")
 set the measured value and unit. No given units keeps the current one More...
 
void set (const double &_val, const tkunit_manager::units_keys &_unit)
 set the measured value and unit key More...
 
virtual void set_error (const double &_err)
 set the error of this measured data More...
 
virtual void set_error (const double &_err_low, const double &_err_high)
 set the asymetruic error of this value More...
 
void set_info_tag (const tkstring &_tag)
 define the info tag (calculation, systematic, approx value...) More...
 
void set_type (const tkstring &_type)
 set the measured data type (energy, lifetime...) More...
 
bool set_unit (const tkstring &_unit_name)
 set the measured data unit (value and errors) More...
 
bool set_unit (const tkunit_manager::units_keys &_unit)
 set the measured data unit (value and errors) More...
 
- Public Member Functions inherited from tkproperty
 tkproperty ()
 
 tkproperty (tkproperty::data_info _info)
 
virtual ~tkproperty ()
 
void clear ()
 clear the property More...
 
data_info get_info ()
 to get information about this data More...
 
data_info get_info_const () const
 
tkstring get_info_str (bool _showknown=true) const
 to print in string the data_info More...
 
tkstring get_reference ()
 to get the reference of this data More...
 
bool is_converted () const
 to know if the value has been converted More...
 
bool is_info (data_info _info) const
 to get some information about this data More...
 
bool is_known () const
 to get some information about this data More...
 
void set_converted (bool _val=true)
 to define the value as a converted one More...
 
void set_info (tkproperty::data_info _info)
 to set some information about this data More...
 
void set_reference (const char *_st)
 to set the reference of this data More...
 

Friends

tkmeasure operator* (double _multiplier, const tkmeasure &obj)
 
std::ostream & operator<< (std::ostream &os, const tkmeasure *_measure)
 redefinition of the << operator to take precision into account More...
 

Additional Inherited Members

- Public Types inherited from tkproperty
enum  data_info {
  kKnown , kUnknown , kTentative , kTheo ,
  kAbout , kSystematic , kLimit , kUncertain
}
 flags that qualify a given data More...
 
- Static Public Member Functions inherited from tkproperty
static data_info what_is (const tkstring &_st)
 It deduces from a string the kind of data. More...
 

Constructor & Destructor Documentation

◆ tkmeasure() [1/5]

tkmeasure ( )
inline

Definition at line 75 of file tkmeasure.h.

◆ tkmeasure() [2/5]

tkmeasure ( double  _value,
const tkstring _unit_name,
double  _err = 0 
)
inline

Definition at line 76 of file tkmeasure.h.

◆ tkmeasure() [3/5]

tkmeasure ( double  _value,
const tkstring _unit_name,
double  _errlow,
double  _errhigh 
)
inline

Definition at line 77 of file tkmeasure.h.

◆ tkmeasure() [4/5]

tkmeasure ( double  _value,
const tkunit_manager::units_keys _unit,
double  _err = 0 
)

Definition at line 51 of file tkmeasure.cpp.

◆ tkmeasure() [5/5]

tkmeasure ( double  _value,
const tkunit_manager::units_keys _unit,
double  _errlow,
double  _errhigh 
)

Definition at line 59 of file tkmeasure.cpp.

◆ ~tkmeasure()

virtual ~tkmeasure ( )
virtualdefault

Member Function Documentation

◆ get_error() [1/3]

double get_error ( ) const

returns the error on the measured value

Definition at line 174 of file tkmeasure.cpp.

◆ get_error() [2/3]

double get_error ( const tkstring _unit_name)
inline

returns the error on the measured value in the required string unit

Definition at line 118 of file tkmeasure.h.

◆ get_error() [3/3]

double get_error ( const tkunit_manager::units_keys _unit)

returns the error on the measured value in the required unit key

Definition at line 183 of file tkmeasure.cpp.

◆ get_error_high() [1/3]

double get_error_high ( ) const

returns the high assymetric error on the measured value

Definition at line 209 of file tkmeasure.cpp.

◆ get_error_high() [2/3]

double get_error_high ( const tkstring _unit_name)
inline

returns the high assymetric error on the measured value in the required string unit

Definition at line 132 of file tkmeasure.h.

◆ get_error_high() [3/3]

double get_error_high ( const tkunit_manager::units_keys _unit)

returns the high assymetric error on the measured value in the required unit key

Definition at line 217 of file tkmeasure.cpp.

◆ get_error_low() [1/3]

double get_error_low ( ) const

returns the low assymetric error on the measured value

Definition at line 192 of file tkmeasure.cpp.

◆ get_error_low() [2/3]

double get_error_low ( const tkstring _unit_name)
inline

returns the low assymetric error on the measured value in the required string unit

Definition at line 125 of file tkmeasure.h.

◆ get_error_low() [3/3]

double get_error_low ( const tkunit_manager::units_keys _unit)

returns the low assymetric error on the measured value in the required unit key

Definition at line 200 of file tkmeasure.cpp.

◆ get_exp_error_precision()

int get_exp_error_precision ( const double &  _err) const
inline

calculate the needed precision for printouts

Definition at line 296 of file tkmeasure.h.

◆ get_info_tag()

const tkstring & get_info_tag ( )
inline

returns the info tag (calculation, systematic, approx value...)

Definition at line 88 of file tkmeasure.h.

◆ get_info_tag_const()

const tkstring & get_info_tag_const ( ) const
inline

Definition at line 89 of file tkmeasure.h.

◆ get_type()

const tkstring & get_type ( ) const
inline

returns the measured data type (energy, lifetime...)

Definition at line 94 of file tkmeasure.h.

◆ get_unit()

tkstring get_unit ( ) const
inline

returns the unit name

Definition at line 135 of file tkmeasure.h.

◆ get_unit_key()

tkunit_manager::units_keys get_unit_key ( ) const
inline

returns the unit key

Definition at line 137 of file tkmeasure.h.

◆ get_value() [1/3]

double get_value ( ) const
inline

returns the measure value

Definition at line 97 of file tkmeasure.h.

◆ get_value() [2/3]

double get_value ( const tkstring _unit_name)
inline

returns the measure value in the required string unit

Definition at line 101 of file tkmeasure.h.

◆ get_value() [3/3]

double get_value ( const tkunit_manager::units_keys _unit)

returns the measure value in the required unit key

Definition at line 164 of file tkmeasure.cpp.

◆ is_asym_errors()

bool is_asym_errors ( ) const
inline

test is the measure uncertainty is asymmetric

Definition at line 83 of file tkmeasure.h.

◆ operator*()

tkmeasure operator* ( double  _multiplier) const
inline

Definition at line 256 of file tkmeasure.h.

◆ operator+()

tkmeasure operator+ ( const tkmeasure _measure) const
inline

Definition at line 215 of file tkmeasure.h.

◆ operator-() [1/2]

tkmeasure operator- ( ) const
inline

Definition at line 285 of file tkmeasure.h.

◆ operator-() [2/2]

tkmeasure operator- ( const tkmeasure _measure) const
inline

Definition at line 289 of file tkmeasure.h.

◆ print()

void print ( bool  with_return = true)
inline

print the measured properties

Definition at line 212 of file tkmeasure.h.

◆ set() [1/2]

void set ( const double &  _val,
const tkstring _unit = "" 
)

set the measured value and unit. No given units keeps the current one

Definition at line 103 of file tkmeasure.cpp.

◆ set() [2/2]

void set ( const double &  _val,
const tkunit_manager::units_keys _unit 
)

set the measured value and unit key

Definition at line 109 of file tkmeasure.cpp.

◆ set_error() [1/2]

virtual void set_error ( const double &  _err)
inlinevirtual

set the error of this measured data

Definition at line 109 of file tkmeasure.h.

◆ set_error() [2/2]

virtual void set_error ( const double &  _err_low,
const double &  _err_high 
)
inlinevirtual

set the asymetruic error of this value

Definition at line 111 of file tkmeasure.h.

◆ set_info_tag()

void set_info_tag ( const tkstring _tag)

define the info tag (calculation, systematic, approx value...)

Definition at line 69 of file tkmeasure.cpp.

◆ set_type()

void set_type ( const tkstring _type)
inline

set the measured data type (energy, lifetime...)

Definition at line 92 of file tkmeasure.h.

◆ set_unit() [1/2]

bool set_unit ( const tkstring _unit_name)
inline

set the measured data unit (value and errors)

Definition at line 140 of file tkmeasure.h.

◆ set_unit() [2/2]

bool set_unit ( const tkunit_manager::units_keys _unit)

set the measured data unit (value and errors)

Definition at line 115 of file tkmeasure.cpp.

Friends And Related Function Documentation

◆ operator*

tkmeasure operator* ( double  _multiplier,
const tkmeasure obj 
)
friend

Definition at line 284 of file tkmeasure.h.

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const tkmeasure _measure 
)
friend

redefinition of the << operator to take precision into account

Definition at line 145 of file tkmeasure.h.


The documentation for this class was generated from the following files: