Belle II Software  release-08-01-10
Unit Class Reference

The Unit class. More...

#include <Unit.h>

Collaboration diagram for Unit:

Static Public Member Functions

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

Static Public Attributes

static const double cm
 Standard units with the value = 1. More...
 
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. More...
 
static const double km
 Derived units. More...
 
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

◆ cm

const double cm
static

Standard units with the value = 1.

Standard of [length]

Definition at line 47 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.

◆ km

const double km
static

Derived units.

[kilometers]

Definition at line 68 of file Unit.h.


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