54 #ifndef TGEANT4_SYSTEM_OF_UNITS_H
55 #define TGEANT4_SYSTEM_OF_UNITS_H
57 namespace TGeant4Unit {
67 static constexpr
double pi = 3.14159265358979323846;
68 static constexpr
double twopi = 2 * pi;
69 static constexpr
double halfpi = pi / 2;
70 static constexpr
double pi2 = pi * pi;
75 static constexpr
double millimeter = 1.0;
76 static constexpr
double millimeter2 = millimeter * millimeter;
77 static constexpr
double millimeter3 = millimeter * millimeter * millimeter;
79 static constexpr
double centimeter = 10. * millimeter;
80 static constexpr
double centimeter2 = centimeter * centimeter;
81 static constexpr
double centimeter3 = centimeter * centimeter * centimeter;
83 static constexpr
double meter = 1000. * millimeter;
84 static constexpr
double meter2 = meter * meter;
85 static constexpr
double meter3 = meter * meter * meter;
87 static constexpr
double kilometer = 1000. * meter;
88 static constexpr
double kilometer2 = kilometer * kilometer;
89 static constexpr
double kilometer3 = kilometer * kilometer * kilometer;
91 static constexpr
double parsec = 3.0856775807e+16 * meter;
93 static constexpr
double micrometer = 1.e-6 * meter;
94 static constexpr
double nanometer = 1.e-9 * meter;
95 static constexpr
double angstrom = 1.e-10 * meter;
96 static constexpr
double fermi = 1.e-15 * meter;
98 static constexpr
double barn = 1.e-28 * meter2;
99 static constexpr
double millibarn = 1.e-3 * barn;
100 static constexpr
double microbarn = 1.e-6 * barn;
101 static constexpr
double nanobarn = 1.e-9 * barn;
102 static constexpr
double picobarn = 1.e-12 * barn;
105 static constexpr
double nm = nanometer;
106 static constexpr
double um = micrometer;
108 static constexpr
double mm = millimeter;
109 static constexpr
double mm2 = millimeter2;
110 static constexpr
double mm3 = millimeter3;
112 static constexpr
double cm = centimeter;
113 static constexpr
double cm2 = centimeter2;
114 static constexpr
double cm3 = centimeter3;
116 static constexpr
double liter = 1.e+3 * cm3;
117 static constexpr
double L = liter;
118 static constexpr
double dL = 1.e-1 * liter;
119 static constexpr
double cL = 1.e-2 * liter;
120 static constexpr
double mL = 1.e-3 * liter;
122 static constexpr
double m = meter;
123 static constexpr
double m2 = meter2;
124 static constexpr
double m3 = meter3;
126 static constexpr
double km = kilometer;
127 static constexpr
double km2 = kilometer2;
128 static constexpr
double km3 = kilometer3;
130 static constexpr
double pc = parsec;
135 static constexpr
double degree = 1.0;
136 static constexpr
double radian = (180.0 / pi) * degree;
137 static constexpr
double milliradian = 1.e-3 * radian;
139 static constexpr
double steradian = 1.;
142 static constexpr
double rad = radian;
143 static constexpr
double mrad = milliradian;
144 static constexpr
double sr = steradian;
145 static constexpr
double deg = degree;
150 static constexpr
double nanosecond = 1.0;
151 static constexpr
double second = 1.e+9 * nanosecond;
152 static constexpr
double millisecond = 1.e-3 * second;
153 static constexpr
double microsecond = 1.e-6 * second;
154 static constexpr
double picosecond = 1.e-12 * second;
156 static constexpr
double hertz = 1. / second;
157 static constexpr
double kilohertz = 1.e+3 * hertz;
158 static constexpr
double megahertz = 1.e+6 * hertz;
161 static constexpr
double ns = nanosecond;
162 static constexpr
double s = second;
163 static constexpr
double ms = millisecond;
164 static constexpr
double us = microsecond;
165 static constexpr
double ps = picosecond;
170 static constexpr
double eplus = 1.;
171 static constexpr
double e_SI = 1.602176487e-19;
172 static constexpr
double coulomb = eplus / e_SI;
177 static constexpr
double megaelectronvolt = 1.0;
178 static constexpr
double electronvolt = 1.e-6 * megaelectronvolt;
179 static constexpr
double kiloelectronvolt = 1.e-3 * megaelectronvolt;
180 static constexpr
double gigaelectronvolt = 1.e+3 * megaelectronvolt;
181 static constexpr
double teraelectronvolt = 1.e+6 * megaelectronvolt;
182 static constexpr
double petaelectronvolt = 1.e+9 * megaelectronvolt;
184 static constexpr
double joule = electronvolt / e_SI;
187 static constexpr
double MeV = megaelectronvolt;
188 static constexpr
double eV = electronvolt;
189 static constexpr
double keV = kiloelectronvolt;
190 static constexpr
double GeV = gigaelectronvolt;
191 static constexpr
double TeV = teraelectronvolt;
192 static constexpr
double PeV = petaelectronvolt;
197 static constexpr
double kilogram = joule * second * second / (meter * meter);
198 static constexpr
double gram = 1.e-3 * kilogram;
199 static constexpr
double milligram = 1.e-3 * gram;
202 static constexpr
double kg = kilogram;
203 static constexpr
double g = gram;
204 static constexpr
double mg = milligram;
209 static constexpr
double watt = joule / second;
214 static constexpr
double newton = joule / meter;
219 #define pascal hep_pascal // a trick to avoid warnings
220 static constexpr
double hep_pascal = newton / m2;
221 static constexpr
double bar = 100000 * pascal;
222 static constexpr
double atmosphere = 101325 * pascal;
227 static constexpr
double ampere = coulomb / second;
228 static constexpr
double milliampere = 1.e-3 * ampere;
229 static constexpr
double microampere = 1.e-6 * ampere;
230 static constexpr
double nanoampere = 1.e-9 * ampere;
235 static constexpr
double megavolt = megaelectronvolt / eplus;
236 static constexpr
double kilovolt = 1.e-3 * megavolt;
237 static constexpr
double volt = 1.e-6 * megavolt;
242 static constexpr
double ohm = volt / ampere;
247 static constexpr
double farad = coulomb / volt;
248 static constexpr
double millifarad = 1.e-3 * farad;
249 static constexpr
double microfarad = 1.e-6 * farad;
250 static constexpr
double nanofarad = 1.e-9 * farad;
251 static constexpr
double picofarad = 1.e-12 * farad;
256 static constexpr
double weber = volt * second;
261 static constexpr
double tesla = volt * second / meter2;
263 static constexpr
double gauss = 1.e-4 * tesla;
264 static constexpr
double kilogauss = 1.e-1 * tesla;
269 static constexpr
double henry = weber / ampere;
274 static constexpr
double kelvin = 1.;
279 static constexpr
double mole = 1.;
284 static constexpr
double becquerel = 1. / second;
285 static constexpr
double curie = 3.7e+10 * becquerel;
286 static constexpr
double kilobecquerel = 1.e+3 * becquerel;
287 static constexpr
double megabecquerel = 1.e+6 * becquerel;
288 static constexpr
double gigabecquerel = 1.e+9 * becquerel;
289 static constexpr
double millicurie = 1.e-3 * curie;
290 static constexpr
double microcurie = 1.e-6 * curie;
291 static constexpr
double Bq = becquerel;
292 static constexpr
double kBq = kilobecquerel;
293 static constexpr
double MBq = megabecquerel;
294 static constexpr
double GBq = gigabecquerel;
295 static constexpr
double Ci = curie;
296 static constexpr
double mCi = millicurie;
297 static constexpr
double uCi = microcurie;
302 static constexpr
double gray = joule / kilogram;
303 static constexpr
double kilogray = 1.e+3 * gray;
304 static constexpr
double milligray = 1.e-3 * gray;
305 static constexpr
double microgray = 1.e-6 * gray;
310 static constexpr
double candela = 1.;
315 static constexpr
double lumen = candela * steradian;
320 static constexpr
double lux = lumen / meter2;
325 static constexpr
double perCent = 0.01;
326 static constexpr
double perThousand = 0.001;
327 static constexpr
double perMillion = 0.000001;
338 UnitType setUnitType(UnitType new_type);