Belle II Software development
Unit Class Reference

The Unit class. More...

#include <Unit.h>

Static Public Member Functions

static double convertValue (double value, const std::string &unitString)
 Converts a floating point value to the standard framework unit.
 
static double convertValueToUnit (double value, const std::string &unitString)
 Converts a floating point value from the standard framework unit to the given unit.
 

Static Public Attributes

static const double cm
 Standard units with the value = 1.
 
static const double ns
 Standard of [time].
 
static const double GHz
 Standard of [frequency].
 
static const double rad
 Standard of [angle].
 
static const double GeV
 Standard of [energy, momentum, mass].
 
static const double K
 Standard of [temperature].
 
static const double e
 Standard of [electric charge].
 
static const double g_cm3
 Practical units with the value set at 1.
 
static const double km
 Derived units.
 
static const double m
 [meters]
 
static const double mm
 [millimeters]
 
static const double um
 [micrometers]
 
static const double nm
 [nanometers]
 
static const double pm
 [picometers]
 
static const double fm
 [femtometers]
 
static const double m2
 [square meters]
 
static const double cm2
 [square centimeters]
 
static const double mm2
 [square millimeters]
 
static const double b
 [barn]
 
static const double mb
 [millibarn]
 
static const double ub
 [microbarn]
 
static const double nb
 [nanobarn]
 
static const double pb
 [picobarn]
 
static const double fb
 [femtobarn]
 
static const double ab
 [attobarn]
 
static const double m3
 [cubic meters]
 
static const double cm3
 [cubic centimeters]
 
static const double mm3
 [cubic millimeters]
 
static const double s
 [second]
 
static const double ms
 [millisecond]
 
static const double us
 [microsecond]
 
static const double ps
 [picosecond]
 
static const double fs
 [femtosecond]
 
static const double Hz
 [Hertz]
 
static const double kHz
 [Kilohertz]
 
static const double MHz
 [Megahertz]
 
static const double mHz
 [Millihertz]
 
static const double mrad
 [millirad]
 
static const double deg
 degree to radians
 
static const double eV
 [electronvolt]
 
static const double keV
 [kiloelectronvolt]
 
static const double MeV
 [megaelectronvolt]
 
static const double TeV
 [teraelectronvolt]
 
static const double J
 [joule]
 
static const double V
 [voltage]
 
static const double T
 [tesla]
 
static const double mT
 [millitesla]
 
static const double Gauss
 [gauss]
 
static const double kGauss
 [kilogauss]
 
static const double C
 [coulomb]
 
static const double fC
 [femtocoulomb]
 
static const double mg_cm3
 [mg/cm^3]
 
static const double kg_cm3
 [kg/cm^3]
 
static const double g_mm3
 [g/mm^3]
 
static const double mg_mm3
 [mg/mm^3]
 
static const double kg_mm3
 [kg/mm^3]
 

Static Protected Member Functions

static double registerConversion (const std::string &name, double value)
 registers the name and value of a conversion in s_conversionFactors.
 

Static Protected Attributes

static std::map< std::string, double > s_conversionFactors
 Map to be able to convert between units using string representations of the unit name.
 

Private Member Functions

 Unit ()=delete
 no Unit instances allowed.
 
 Unit (const Unit &)=delete
 
Unitoperator= (const Unit &)=delete
 

Detailed Description

The Unit class.

This class provides a set of units for the framework. Use these to specify the unit of your value. In addition the class offers methods to convert floating point numbers from a specified unit to the standard unit of the framework.

//multiply with a Unit to convert to standard units, e.g.
double length = 10.0 * Unit::mm;
// length now equals 1.0 (stand for length: cm)
//divide with a Unit to convert from standard units to the given one:
double length_mm = length / Unit::mm;
static const double mm
[millimeters]
Definition: Unit.h:70

This class cannot be instantiated, use the static members directly. The implementation can be found in UnitConst.cc

Definition at line 40 of file Unit.h.

Member Data Documentation

◆ ab

const double ab
static

[attobarn]

Definition at line 87 of file Unit.h.

◆ b

const double b
static

[barn]

Definition at line 81 of file Unit.h.

◆ C

const double C
static

[coulomb]

Definition at line 126 of file Unit.h.

◆ cm

const double cm
static

Standard units with the value = 1.

Standard of [length]

Definition at line 47 of file Unit.h.

◆ cm2

const double cm2
static

[square centimeters]

Definition at line 78 of file Unit.h.

◆ cm3

const double cm3
static

[cubic centimeters]

Definition at line 91 of file Unit.h.

◆ deg

const double deg
static

degree to radians

Definition at line 109 of file Unit.h.

◆ e

const double e
static

Standard of [electric charge].

Definition at line 53 of file Unit.h.

◆ eV

const double eV
static

[electronvolt]

Definition at line 112 of file Unit.h.

◆ fb

const double fb
static

[femtobarn]

Definition at line 86 of file Unit.h.

◆ fC

const double fC
static

[femtocoulomb]

Definition at line 127 of file Unit.h.

◆ fm

const double fm
static

[femtometers]

Definition at line 74 of file Unit.h.

◆ fs

const double fs
static

[femtosecond]

Definition at line 99 of file Unit.h.

◆ g_cm3

const double g_cm3
static

Practical units with the value set at 1.

These units are NOT consistent with the other standard units. Please use them carefully. Standard of [density]

Definition at line 60 of file Unit.h.

◆ g_mm3

const double g_mm3
static

[g/mm^3]

Definition at line 132 of file Unit.h.

◆ Gauss

const double Gauss
static

[gauss]

Definition at line 122 of file Unit.h.

◆ GeV

const double GeV
static

Standard of [energy, momentum, mass].

Definition at line 51 of file Unit.h.

◆ GHz

const double GHz
static

Standard of [frequency].

Definition at line 49 of file Unit.h.

◆ Hz

const double Hz
static

[Hertz]

Definition at line 102 of file Unit.h.

◆ J

const double J
static

[joule]

Definition at line 116 of file Unit.h.

◆ K

const double K
static

Standard of [temperature].

Definition at line 52 of file Unit.h.

◆ keV

const double keV
static

[kiloelectronvolt]

Definition at line 113 of file Unit.h.

◆ kg_cm3

const double kg_cm3
static

[kg/cm^3]

Definition at line 131 of file Unit.h.

◆ kg_mm3

const double kg_mm3
static

[kg/mm^3]

Definition at line 134 of file Unit.h.

◆ kGauss

const double kGauss
static

[kilogauss]

Definition at line 123 of file Unit.h.

◆ kHz

const double kHz
static

[Kilohertz]

Definition at line 103 of file Unit.h.

◆ km

const double km
static

Derived units.

[kilometers]

Definition at line 68 of file Unit.h.

◆ m

const double m
static

[meters]

Definition at line 69 of file Unit.h.

◆ m2

const double m2
static

[square meters]

Definition at line 77 of file Unit.h.

◆ m3

const double m3
static

[cubic meters]

Definition at line 90 of file Unit.h.

◆ mb

const double mb
static

[millibarn]

Definition at line 82 of file Unit.h.

◆ MeV

const double MeV
static

[megaelectronvolt]

Definition at line 114 of file Unit.h.

◆ mg_cm3

const double mg_cm3
static

[mg/cm^3]

Definition at line 130 of file Unit.h.

◆ mg_mm3

const double mg_mm3
static

[mg/mm^3]

Definition at line 133 of file Unit.h.

◆ MHz

const double MHz
static

[Megahertz]

Definition at line 104 of file Unit.h.

◆ mHz

const double mHz
static

[Millihertz]

Definition at line 105 of file Unit.h.

◆ mm

const double mm
static

[millimeters]

Definition at line 70 of file Unit.h.

◆ mm2

const double mm2
static

[square millimeters]

Definition at line 79 of file Unit.h.

◆ mm3

const double mm3
static

[cubic millimeters]

Definition at line 92 of file Unit.h.

◆ mrad

const double mrad
static

[millirad]

Definition at line 108 of file Unit.h.

◆ ms

const double ms
static

[millisecond]

Definition at line 96 of file Unit.h.

◆ mT

const double mT
static

[millitesla]

Definition at line 121 of file Unit.h.

◆ nb

const double nb
static

[nanobarn]

Definition at line 84 of file Unit.h.

◆ nm

const double nm
static

[nanometers]

Definition at line 72 of file Unit.h.

◆ ns

const double ns
static

Standard of [time].

Definition at line 48 of file Unit.h.

◆ pb

const double pb
static

[picobarn]

Definition at line 85 of file Unit.h.

◆ pm

const double pm
static

[picometers]

Definition at line 73 of file Unit.h.

◆ ps

const double ps
static

[picosecond]

Definition at line 98 of file Unit.h.

◆ rad

const double rad
static

Standard of [angle].

Definition at line 50 of file Unit.h.

◆ s

const double s
static

[second]

Definition at line 95 of file Unit.h.

◆ T

const double T
static

[tesla]

Definition at line 120 of file Unit.h.

◆ TeV

const double TeV
static

[teraelectronvolt]

Definition at line 115 of file Unit.h.

◆ ub

const double ub
static

[microbarn]

Definition at line 83 of file Unit.h.

◆ um

const double um
static

[micrometers]

Definition at line 71 of file Unit.h.

◆ us

const double us
static

[microsecond]

Definition at line 97 of file Unit.h.

◆ V

const double V
static

[voltage]

Definition at line 117 of file Unit.h.


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