54 #ifndef TGEO_SYSTEM_OF_UNITS_H
55 #define TGEO_SYSTEM_OF_UNITS_H
57 #ifndef HAVE_GEANT4_UNITS
71 static constexpr
double pi = 3.14159265358979323846;
72 static constexpr
double twopi = 2 * pi;
73 static constexpr
double halfpi = pi / 2;
74 static constexpr
double pi2 = pi * pi;
79 static constexpr
double millimeter = 0.1;
80 static constexpr
double millimeter2 = millimeter * millimeter;
81 static constexpr
double millimeter3 = millimeter * millimeter * millimeter;
83 static constexpr
double centimeter = 10. * millimeter;
84 static constexpr
double centimeter2 = centimeter * centimeter;
85 static constexpr
double centimeter3 = centimeter * centimeter * centimeter;
87 static constexpr
double meter = 1000. * millimeter;
88 static constexpr
double meter2 = meter * meter;
89 static constexpr
double meter3 = meter * meter * meter;
91 static constexpr
double kilometer = 1000. * meter;
92 static constexpr
double kilometer2 = kilometer * kilometer;
93 static constexpr
double kilometer3 = kilometer * kilometer * kilometer;
95 static constexpr
double parsec = 3.0856775807e+16 * meter;
97 static constexpr
double micrometer = 1.e-6 * meter;
98 static constexpr
double nanometer = 1.e-9 * meter;
99 static constexpr
double angstrom = 1.e-10 * meter;
100 static constexpr
double fermi = 1.e-15 * meter;
102 static constexpr
double barn = 1.e-28 * meter2;
103 static constexpr
double millibarn = 1.e-3 * barn;
104 static constexpr
double microbarn = 1.e-6 * barn;
105 static constexpr
double nanobarn = 1.e-9 * barn;
106 static constexpr
double picobarn = 1.e-12 * barn;
109 static constexpr
double nm = nanometer;
110 static constexpr
double um = micrometer;
112 static constexpr
double mm = millimeter;
113 static constexpr
double mm2 = millimeter2;
114 static constexpr
double mm3 = millimeter3;
116 static constexpr
double cm = centimeter;
117 static constexpr
double cm2 = centimeter2;
118 static constexpr
double cm3 = centimeter3;
120 static constexpr
double liter = 1.e+3 * cm3;
121 static constexpr
double L = liter;
122 static constexpr
double dL = 1.e-1 * liter;
123 static constexpr
double cL = 1.e-2 * liter;
124 static constexpr
double mL = 1.e-3 * liter;
126 static constexpr
double m = meter;
127 static constexpr
double m2 = meter2;
128 static constexpr
double m3 = meter3;
130 static constexpr
double km = kilometer;
131 static constexpr
double km2 = kilometer2;
132 static constexpr
double km3 = kilometer3;
134 static constexpr
double pc = parsec;
139 static constexpr
double degree = 1.0;
140 static constexpr
double radian = (180.0 / pi) * degree;
141 static constexpr
double milliradian = 1.e-3 * radian;
143 static constexpr
double steradian = 1.;
146 static constexpr
double rad = radian;
147 static constexpr
double mrad = milliradian;
148 static constexpr
double sr = steradian;
149 static constexpr
double deg = degree;
154 static constexpr
double nanosecond = 1.e-9;
155 static constexpr
double second = 1.e+9 * nanosecond;
156 static constexpr
double millisecond = 1.e-3 * second;
157 static constexpr
double microsecond = 1.e-6 * second;
158 static constexpr
double picosecond = 1.e-12 * second;
160 static constexpr
double hertz = 1. / second;
161 static constexpr
double kilohertz = 1.e+3 * hertz;
162 static constexpr
double megahertz = 1.e+6 * hertz;
165 static constexpr
double ns = nanosecond;
166 static constexpr
double s = second;
167 static constexpr
double ms = millisecond;
168 static constexpr
double us = microsecond;
169 static constexpr
double ps = picosecond;
174 static constexpr
double eplus = 1.;
175 static constexpr
double e_SI = 1.602176487e-19;
176 static constexpr
double coulomb = eplus / e_SI;
181 static constexpr
double megaelectronvolt = 1.e-3;
182 static constexpr
double electronvolt = 1.e-6 * megaelectronvolt;
183 static constexpr
double kiloelectronvolt = 1.e-3 * megaelectronvolt;
184 static constexpr
double gigaelectronvolt = 1.e+3 * megaelectronvolt;
185 static constexpr
double teraelectronvolt = 1.e+6 * megaelectronvolt;
186 static constexpr
double petaelectronvolt = 1.e+9 * megaelectronvolt;
188 static constexpr
double joule = electronvolt / e_SI;
191 static constexpr
double MeV = megaelectronvolt;
192 static constexpr
double eV = electronvolt;
193 static constexpr
double keV = kiloelectronvolt;
194 static constexpr
double GeV = gigaelectronvolt;
195 static constexpr
double TeV = teraelectronvolt;
196 static constexpr
double PeV = petaelectronvolt;
201 static constexpr
double kilogram = joule * second * second / (meter * meter);
202 static constexpr
double gram = 1.e-3 * kilogram;
203 static constexpr
double milligram = 1.e-3 * gram;
206 static constexpr
double kg = kilogram;
207 static constexpr
double g = gram;
208 static constexpr
double mg = milligram;
213 static constexpr
double watt = joule / second;
218 static constexpr
double newton = joule / meter;
223 #define pascal hep_pascal // a trick to avoid warnings
224 static constexpr
double hep_pascal = newton / m2;
225 static constexpr
double bar = 100000 * pascal;
226 static constexpr
double atmosphere = 101325 * pascal;
231 static constexpr
double ampere = coulomb / second;
232 static constexpr
double milliampere = 1.e-3 * ampere;
233 static constexpr
double microampere = 1.e-6 * ampere;
234 static constexpr
double nanoampere = 1.e-9 * ampere;
239 static constexpr
double megavolt = megaelectronvolt / eplus;
240 static constexpr
double kilovolt = 1.e-3 * megavolt;
241 static constexpr
double volt = 1.e-6 * megavolt;
246 static constexpr
double ohm = volt / ampere;
251 static constexpr
double farad = coulomb / volt;
252 static constexpr
double millifarad = 1.e-3 * farad;
253 static constexpr
double microfarad = 1.e-6 * farad;
254 static constexpr
double nanofarad = 1.e-9 * farad;
255 static constexpr
double picofarad = 1.e-12 * farad;
260 static constexpr
double weber = volt * second;
265 static constexpr
double tesla = volt * second / meter2;
267 static constexpr
double gauss = 1.e-4 * tesla;
268 static constexpr
double kilogauss = 1.e-1 * tesla;
273 static constexpr
double henry = weber / ampere;
278 static constexpr
double kelvin = 1.;
283 static constexpr
double mole = 1.;
288 static constexpr
double becquerel = 1. / second;
289 static constexpr
double curie = 3.7e+10 * becquerel;
290 static constexpr
double kilobecquerel = 1.e+3 * becquerel;
291 static constexpr
double megabecquerel = 1.e+6 * becquerel;
292 static constexpr
double gigabecquerel = 1.e+9 * becquerel;
293 static constexpr
double millicurie = 1.e-3 * curie;
294 static constexpr
double microcurie = 1.e-6 * curie;
295 static constexpr
double Bq = becquerel;
296 static constexpr
double kBq = kilobecquerel;
297 static constexpr
double MBq = megabecquerel;
298 static constexpr
double GBq = gigabecquerel;
299 static constexpr
double Ci = curie;
300 static constexpr
double mCi = millicurie;
301 static constexpr
double uCi = microcurie;
306 static constexpr
double gray = joule / kilogram;
307 static constexpr
double kilogray = 1.e+3 * gray;
308 static constexpr
double milligray = 1.e-3 * gray;
309 static constexpr
double microgray = 1.e-6 * gray;
314 static constexpr
double candela = 1.;
319 static constexpr
double lumen = candela * steradian;
324 static constexpr
double lux = lumen / meter2;
329 static constexpr
double perCent = 0.01;
330 static constexpr
double perThousand = 0.001;
331 static constexpr
double perMillion = 0.000001;
341 UnitType setUnitType(UnitType new_type);