Units.h
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*!
3 
4 \namespace genie::units
5 
6 \brief Physical System of Units
7 
8 \author Costas Andreopoulos <constantinos.andreopoulos \at cern.ch>
9  University of Liverpool & STFC Rutherford Appleton Laboratory
10 
11 \created May 03, 2004
12 
13 \cpright Copyright (c) 2003-2020, The GENIE Collaboration
14  For the full text of the license visit http://copyright.genie-mc.org
15 */
16 //____________________________________________________________________________
17 
18 #ifndef _UNITS_H_
19 #define _UNITS_H_
20 
21 namespace genie {
22 
23 namespace units {
24 
25 //-- Basic unit
26 
27 static constexpr double gigaelectronvolt = 1.;
28 static constexpr double GeV = gigaelectronvolt;
29 
30 //-- Conversion of conventionl [L], [M], [T] units in physical units
31 
32 static constexpr double kSpeedOfLight = 2.99792458e+08; // [m/s] exact by definition
33 static constexpr double qe_coulomb = 1.602176634e-19; // electron charge magnitude, exact by definition since 20 May 2019
34 static constexpr double hbarc = 1.973269804e-16; // [GeV*m] exact by definition although approxicamted here
35 static constexpr double meter = 1. / (hbarc * GeV);
36 static constexpr double kilogram = kSpeedOfLight * kSpeedOfLight * 10e-9 * GeV / qe_coulomb ;
37 static constexpr double second = meter * kSpeedOfLight / GeV;
38 
39 
40 static constexpr double kilometer = 1000.*meter;
41 static constexpr double millimeter = 0.001*meter;
42 static constexpr double millimeter2 = millimeter*millimeter;
43 static constexpr double millimeter3 = millimeter*millimeter2;
44 static constexpr double centimeter = 0.01*meter;
45 static constexpr double centimeter2 = centimeter*centimeter;
46 static constexpr double centimeter3 = centimeter*centimeter2;
47 static constexpr double decimeter = 0.1*meter;
48 static constexpr double decimeter2 = decimeter*decimeter;
49 static constexpr double decimeter3 = decimeter*decimeter2;
50 static constexpr double meter2 = meter*meter;
51 static constexpr double meter3 = meter*meter2;
52 static constexpr double micrometer = 1.e-6 *meter;
53 static constexpr double nanometer = 1.e-9 *meter;
54 static constexpr double angstrom = 1.e-10*meter;
55 static constexpr double fermi = 1.e-15*meter;
56 static constexpr double fermi2 = fermi*fermi;
57 static constexpr double fermi3 = fermi*fermi2;
58 static constexpr double barn = 1.e-28*meter2;
59 static constexpr double millibarn = 1.e-3 *barn;
60 static constexpr double microbarn = 1.e-6 *barn;
61 static constexpr double nanobarn = 1.e-9 *barn;
62 static constexpr double picobarn = 1.e-12*barn;
63 
64 static constexpr double km = kilometer;
65 static constexpr double mm = millimeter;
66 static constexpr double mm2 = millimeter2;
67 static constexpr double mm3 = millimeter3;
68 static constexpr double cm = centimeter;
69 static constexpr double cm2 = centimeter2;
70 static constexpr double cm3 = centimeter3;
71 static constexpr double m = meter;
72 static constexpr double m2 = meter2;
73 static constexpr double m3 = meter3;
74 static constexpr double A = angstrom;
75 static constexpr double fm = fermi;
76 static constexpr double fm2 = fermi2;
77 static constexpr double fm3 = fermi3;
78 static constexpr double b = barn;
79 static constexpr double mb = millibarn;
80 static constexpr double ub = microbarn;
81 static constexpr double nb = nanobarn;
82 static constexpr double pb = picobarn;
83 
84 //-- [T: time]
85 
86 static constexpr double millisecond = 1.e-03 *second;
87 static constexpr double microsecond = 1.e-06 *second;
88 static constexpr double nanosecond = 1.e-09 *second;
89 static constexpr double picosecond = 1.e-12 *second;
90 static constexpr double femptosecond = 1.e-15 *second;
91 static constexpr double attosecond = 1.e-18 *second;
92 static constexpr double zeptosecond = 1.e-21 *second;
93 static constexpr double yoctosecond = 1.e-24 *second;
94 
95 static constexpr double s = second;
96 static constexpr double ms = millisecond;
97 static constexpr double us = microsecond;
98 static constexpr double ns = nanosecond;
99 static constexpr double ps = picosecond;
100 static constexpr double fs = femptosecond;
101 static constexpr double as = attosecond;
102 static constexpr double zs = zeptosecond;
103 static constexpr double ys = yoctosecond;
104 
105 static constexpr double hertz = 1./second;
106 static constexpr double kilohertz = 1.e+3*hertz;
107 static constexpr double megahertz = 1.e+6*hertz;
108 static constexpr double gigahertz = 1.e+9*hertz;
109 
110 static constexpr double Hz = hertz;
111 static constexpr double kHz = kilohertz;
112 static constexpr double MHz = megahertz;
113 static constexpr double GHz = gigahertz;
114 
115 //-- [Q: Charge]
116 
117 static constexpr double qe = 1.;
118 
119 //-- [E: Energy]
120 
121 static constexpr double electronvolt = 1.e-09 *GeV;
122 static constexpr double kiloelectronvolt = 1.e+03 *electronvolt;
123 static constexpr double megaelectronvolt = 1.e+06 *electronvolt ;
124 static constexpr double teraelectronvolt = 1.e+12 *electronvolt;
125 static constexpr double petaelectronvolt = 1.e+15 *electronvolt;
126 
127 static constexpr double eV = electronvolt;
128 static constexpr double keV = kiloelectronvolt;
129 static constexpr double MeV = megaelectronvolt;
130 static constexpr double TeV = teraelectronvolt;
131 static constexpr double PeV = petaelectronvolt;
132 
133 static constexpr double GeV2 = GeV * GeV;
134 static constexpr double GeV3 = GeV * GeV2;
135 static constexpr double GeV4 = GeV * GeV3;
136 static constexpr double GeV5 = GeV * GeV4;
137 
138 //-- [M: Mass]
139 
140 static constexpr double gram = 1.e-3 *kilogram;
141 static constexpr double milligram = 1.e-3 *gram;
142 
143 static constexpr double kg = kilogram;
144 static constexpr double g = gram;
145 static constexpr double mg = milligram;
146 
147 //-- [Density]
148 
149 static constexpr double kilogram_meter3 = kilogram / meter3;
150 static constexpr double gram_centimeter3 = gram / centimeter3;
151 
152 static constexpr double kg_m3 = kilogram_meter3;
153 static constexpr double g_cm3 = gram_centimeter3;
154 
155 //-- [Dimensionless quantities]
156 
157 // Angle
158 
159 static constexpr double radian = 1.;
160 static constexpr double milliradian = 1.e-3*radian;
161 static constexpr double degree = (3.14159265358979323846/180.0)*radian;
162 static constexpr double steradian = 1.;
163 
164 static constexpr double rad = radian;
165 static constexpr double mrad = milliradian;
166 static constexpr double sr = steradian;
167 static constexpr double deg = degree;
168 
169 //-- [Etc]
170 
171 static constexpr double clhep_def_density_unit = g_cm3/(0.62415185185E+19);
172 
173 } // namespace units
174 } // namespace genie
175 
176 #endif // _UNITS_H_
static constexpr double cm
Definition: Units.h:68
static constexpr double millibarn
Definition: Units.h:59
static constexpr double MHz
Definition: Units.h:112
static constexpr double hertz
Definition: Units.h:105
static constexpr double femptosecond
Definition: Units.h:90
static constexpr double centimeter2
Definition: Units.h:45
static constexpr double GHz
Definition: Units.h:113
static constexpr double nanosecond
Definition: Units.h:88
static constexpr double keV
Definition: Units.h:128
static constexpr double rad
Definition: Units.h:164
static constexpr double kilohertz
Definition: Units.h:106
static constexpr double nb
Definition: Units.h:81
static constexpr double millimeter3
Definition: Units.h:43
static constexpr double fermi3
Definition: Units.h:57
static constexpr double hbarc
Definition: Units.h:34
static constexpr double us
Definition: Units.h:97
THE MAIN GENIE PROJECT NAMESPACE
Definition: AlgCmp.h:25
static constexpr double g
Definition: Units.h:144
static constexpr double petaelectronvolt
Definition: Units.h:125
static constexpr double mrad
Definition: Units.h:165
static constexpr double electronvolt
Definition: Units.h:121
static constexpr double nanobarn
Definition: Units.h:61
static constexpr double PeV
Definition: Units.h:131
static constexpr double gram
Definition: Units.h:140
static constexpr double cm3
Definition: Units.h:70
static constexpr double gigaelectronvolt
Definition: Units.h:27
static constexpr double clhep_def_density_unit
Definition: Units.h:171
static constexpr double s
Definition: Units.h:95
static constexpr double fs
Definition: Units.h:100
static constexpr double kg
Definition: Units.h:143
static constexpr double mm2
Definition: Units.h:66
static constexpr double kilogram_meter3
Definition: Units.h:149
static constexpr double kiloelectronvolt
Definition: Units.h:122
static constexpr double ns
Definition: Units.h:98
static constexpr double MeV
Definition: Units.h:129
static constexpr double ub
Definition: Units.h:80
static constexpr double km
Definition: Units.h:64
static constexpr double mg
Definition: Units.h:145
static constexpr double decimeter
Definition: Units.h:47
static constexpr double ms
Definition: Units.h:96
static constexpr double b
Definition: Units.h:78
static constexpr double megahertz
Definition: Units.h:107
static constexpr double microbarn
Definition: Units.h:60
static constexpr double fm3
Definition: Units.h:77
static constexpr double millimeter
Definition: Units.h:41
static constexpr double microsecond
Definition: Units.h:87
static constexpr double as
Definition: Units.h:101
static constexpr double second
Definition: Units.h:37
static constexpr double barn
Definition: Units.h:58
const double e
static constexpr double picobarn
Definition: Units.h:62
static constexpr double kilogram
Definition: Units.h:36
static constexpr double milliradian
Definition: Units.h:160
static constexpr double yoctosecond
Definition: Units.h:93
static constexpr double eV
Definition: Units.h:127
static constexpr double qe_coulomb
Definition: Units.h:33
static constexpr double qe
Definition: Units.h:117
static constexpr double m2
Definition: Units.h:72
static constexpr double cm2
Definition: Units.h:69
static constexpr double GeV
Definition: Units.h:28
static constexpr double TeV
Definition: Units.h:130
static constexpr double mb
Definition: Units.h:79
static constexpr double teraelectronvolt
Definition: Units.h:124
static constexpr double meter3
Definition: Units.h:51
static constexpr double fm2
Definition: Units.h:76
static constexpr double GeV4
Definition: Units.h:135
static constexpr double picosecond
Definition: Units.h:89
static constexpr double milligram
Definition: Units.h:141
static constexpr double millimeter2
Definition: Units.h:42
static constexpr double deg
Definition: Units.h:167
static constexpr double decimeter2
Definition: Units.h:48
static constexpr double g_cm3
Definition: Units.h:153
static constexpr double Hz
Definition: Units.h:110
static constexpr double ps
Definition: Units.h:99
static constexpr double decimeter3
Definition: Units.h:49
static constexpr double kg_m3
Definition: Units.h:152
static constexpr double m3
Definition: Units.h:73
static constexpr double GeV3
Definition: Units.h:134
static constexpr double millisecond
Definition: Units.h:86
static constexpr double meter2
Definition: Units.h:50
static constexpr double fermi2
Definition: Units.h:56
static constexpr double GeV2
Definition: Units.h:133
static constexpr double kilometer
Definition: Units.h:40
static constexpr double gram_centimeter3
Definition: Units.h:150
static constexpr double radian
Definition: Units.h:159
static constexpr double meter
Definition: Units.h:35
static constexpr double nanometer
Definition: Units.h:53
static constexpr double centimeter3
Definition: Units.h:46
static constexpr double mm
Definition: Units.h:65
static constexpr double zs
Definition: Units.h:102
static constexpr double fermi
Definition: Units.h:55
static constexpr double centimeter
Definition: Units.h:44
static constexpr double pb
Definition: Units.h:82
static constexpr double zeptosecond
Definition: Units.h:92
static constexpr double fm
Definition: Units.h:75
static constexpr double GeV5
Definition: Units.h:136
static constexpr double degree
Definition: Units.h:161
static constexpr double gigahertz
Definition: Units.h:108
static constexpr double mm3
Definition: Units.h:67
static constexpr double micrometer
Definition: Units.h:52
static constexpr double steradian
Definition: Units.h:162
static constexpr double ys
Definition: Units.h:103
static constexpr double sr
Definition: Units.h:166
static constexpr double kSpeedOfLight
Definition: Units.h:32
static constexpr double attosecond
Definition: Units.h:91
static constexpr double m
Definition: Units.h:71
static constexpr double angstrom
Definition: Units.h:54
static constexpr double kHz
Definition: Units.h:111
static constexpr double megaelectronvolt
Definition: Units.h:123