5 #include "CLHEP/Evaluator/Evaluator.h"
9 void Evaluator::setSystemOfUnits(
double meter,
17 const double kilo_ = 1.e+03;
18 const double mega_ = 1.e+06;
19 const double giga_ = 1.e+09;
20 const double tera_ = 1.e+12;
21 const double peta_ = 1.e+15;
23 const double deci_ = 1.e-01;
24 const double centi_ = 1.e-02;
25 const double milli_ = 1.e-03;
26 const double micro_ = 1.e-06;
27 const double nano_ = 1.e-09;
28 const double pico_ = 1.e-12;
40 setVariable(
"meter", m);
41 setVariable(
"metre", m);
46 setVariable(
"kilogram", kg);
47 setVariable(
"kg", kg);
52 setVariable(
"second", s);
58 setVariable(
"ampere", A);
59 setVariable(
"amp", A);
65 setVariable(
"kelvin", K);
69 const double mol =
mole;
70 setVariable(
"mole", mol);
71 setVariable(
"mol", mol);
75 setVariable(
"candela", cd);
76 setVariable(
"cd", cd);
85 const double rad = 1.;
86 setVariable(
"radian", rad);
87 setVariable(
"rad", rad);
88 setVariable(
"milliradian", milli_ * rad);
89 setVariable(
"mrad", milli_ * rad);
91 const double pi = 3.14159265358979323846;
92 const double deg = rad*pi/180.;
93 setVariable(
"degree", deg);
94 setVariable(
"deg", deg);
98 setVariable(
"steradian", sr);
99 setVariable(
"sr", sr);
109 const double Hz = 1./
s;
110 setVariable(
"hertz", Hz);
111 setVariable(
"Hz", Hz);
115 const double N = m * kg / (s*
s);
116 setVariable(
"newton", N);
121 const double Pa = N / (m*
m);
122 setVariable(
"pascal", Pa);
123 setVariable(
"Pa", Pa);
125 const double atm = 101325. * Pa;
126 setVariable(
"atmosphere", atm);
127 setVariable(
"atm", atm);
129 const double bar = 100000*Pa;
130 setVariable(
"bar", bar);
134 const double J = N *
m;
135 setVariable(
"joule", J);
140 const double W = J /
s;
141 setVariable(
"watt", W);
146 const double C = A *
s;
147 setVariable(
"coulomb", C);
152 const double V = J /
C;
153 setVariable(
"volt", V);
158 const double ohm = V /
A;
159 setVariable(
"ohm", ohm);
165 const double S = 1./
ohm;
166 setVariable(
"siemens", S);
171 const double F = C / V;
172 setVariable(
"farad", F);
177 const double T = V * s / (m*
m);
178 setVariable(
"tesla", T);
182 const double Gs = 1.e-4*T;
183 setVariable(
"gauss", Gs);
184 setVariable(
"Gs", Gs);
188 const double Wb = V *
s;
189 setVariable(
"weber", Wb);
190 setVariable(
"Wb", Wb);
194 const double H = Wb /
A;
195 setVariable(
"henry", H);
199 const double lm = cd *
sr;
200 setVariable(
"lumen", lm);
201 setVariable(
"lm", lm);
204 const double lx = lm / (m*
m);
205 setVariable(
"lux", lx);
206 setVariable(
"lx", lx);
210 const double Bq = 1./
s;
211 setVariable(
"becquerel", Bq);
212 setVariable(
"Bq", Bq);
213 setVariable(
"kilobecquerel", kilo_ * Bq);
214 setVariable(
"kBq", kilo_ * Bq);
215 setVariable(
"megabecquerel", mega_ * Bq);
216 setVariable(
"MBq", mega_ * Bq);
217 setVariable(
"gigabecquerel", giga_ * Bq);
218 setVariable(
"GBq", giga_ * Bq);
222 setVariable(
"curie", 3.7e+10 * Bq);
223 setVariable(
"Ci", 3.7e+10 * Bq);
224 setVariable(
"millicurie", milli_ * 3.7e+10 * Bq);
225 setVariable(
"mCi", milli_ * 3.7e+10 * Bq);
226 setVariable(
"microcurie", micro_ * 3.7e+10 * Bq);
227 setVariable(
"uCi", micro_ * 3.7e+10 * Bq);
231 const double Gy = J /
kg;
232 setVariable(
"gray", Gy);
233 setVariable(
"Gy", Gy);
234 setVariable(
"kilogray", kilo_ * Gy);
235 setVariable(
"milligray", milli_ * Gy);
236 setVariable(
"microgray", micro_ * Gy);
239 const double Sv = J /
kg;
240 setVariable(
"sievert", Sv);
241 setVariable(
"Sv", Sv);
251 const double mm = milli_ *
m;
252 setVariable(
"millimeter", mm);
253 setVariable(
"mm", mm);
255 const double cm = centi_ *
m;
256 setVariable(
"centimeter", cm);
257 setVariable(
"cm", cm);
259 setVariable(
"decimeter", deci_ * m);
261 const double km = kilo_ *
m;
262 setVariable(
"kilometer", km);
263 setVariable(
"km", km);
265 setVariable(
"micrometer", micro_ * m);
266 setVariable(
"micron", micro_ * m);
267 setVariable(
"nanometer", nano_ * m);
270 setVariable(
"angstrom", 1.e-10 * m);
273 setVariable(
"fermi", 1.e-15 * m);
277 setVariable(
"m2", m*m);
278 setVariable(
"mm2", mm*mm);
279 setVariable(
"cm2", cm*cm);
280 setVariable(
"km2", km*km);
282 const double barn = 1.e-28 * m*
m;
283 setVariable(
"barn", barn);
284 setVariable(
"millibarn", milli_ * barn);
285 setVariable(
"mbarn", milli_ * barn);
286 setVariable(
"microbarn", micro_ * barn);
287 setVariable(
"nanobarn", nano_ * barn);
288 setVariable(
"picobarn", pico_ * barn);
292 setVariable(
"m3", m*m*m);
293 setVariable(
"mm3", mm*mm*mm);
294 setVariable(
"cm3", cm*cm*cm);
295 setVariable(
"cc", cm*cm*cm);
296 setVariable(
"km3", km*km*km);
298 const double L = 1.e-3*m*m*
m;
299 setVariable(
"liter", L);
300 setVariable(
"litre", L);
302 setVariable(
"centiliter", centi_ * L);
303 setVariable(
"cL", centi_ * L);
304 setVariable(
"milliliter", milli_ * L);
305 setVariable(
"mL", milli_ * L);
309 const double dpt = 1./
m;
310 setVariable(
"diopter", dpt);
311 setVariable(
"dioptre", dpt);
312 setVariable(
"dpt", dpt);
316 const double g = 0.001*
kg;
317 setVariable(
"gram", g);
319 setVariable(
"milligram", milli_ * g);
320 setVariable(
"mg", milli_ * g);
324 setVariable(
"millisecond", milli_ * s);
325 setVariable(
"ms", milli_ * s);
326 setVariable(
"microsecond", micro_ * s);
327 setVariable(
"nanosecond", nano_ * s);
328 setVariable(
"ns", nano_ * s);
329 setVariable(
"picosecond", pico_ * s);
333 setVariable(
"milliampere", milli_ * A);
334 setVariable(
"mA", milli_ * A);
335 setVariable(
"microampere", micro_ * A);
336 setVariable(
"nanoampere", nano_ * A);
340 setVariable(
"kilohertz", kilo_ * Hz);
341 setVariable(
"kHz", kilo_ * Hz);
342 setVariable(
"megahertz", mega_ * Hz);
343 setVariable(
"MHz", mega_ * Hz);
346 setVariable(
"kilonewton", kilo_ * N);
347 setVariable(
"kN", kilo_ * N);
350 setVariable(
"kilobar", kilo_ * bar);
351 setVariable(
"kbar", kilo_ * bar);
352 setVariable(
"millibar", milli_ * bar);
353 setVariable(
"mbar", milli_ * bar);
356 setVariable(
"kilojoule", kilo_ * J);
357 setVariable(
"kJ", kilo_ * J);
358 setVariable(
"megajoule", mega_ * J);
359 setVariable(
"MJ", mega_ * J);
360 setVariable(
"gigajoule", giga_ * J);
361 setVariable(
"GJ", giga_ * J);
363 const double e_SI = 1.60217733e-19;
364 const double ePlus = e_SI *
C;
365 const double eV = ePlus * V;
366 setVariable(
"electronvolt", eV);
367 setVariable(
"eV", eV);
368 setVariable(
"kiloelectronvolt", kilo_ * eV);
369 setVariable(
"keV", kilo_ * eV);
370 setVariable(
"megaelectronvolt", mega_ * eV);
371 setVariable(
"MeV", mega_ * eV);
372 setVariable(
"gigaelectronvolt", giga_ * eV);
373 setVariable(
"GeV", giga_ * eV);
374 setVariable(
"teraelectronvolt", tera_ * eV);
375 setVariable(
"TeV", tera_ * eV);
376 setVariable(
"petaelectronvolt", peta_ * eV);
377 setVariable(
"PeV", peta_ * eV);
380 setVariable(
"kilowatt", kilo_ * W);
381 setVariable(
"kW", kilo_ * W);
382 setVariable(
"megawatt", mega_ * W);
383 setVariable(
"MW", mega_ * W);
384 setVariable(
"gigawatt", giga_ * W);
385 setVariable(
"GW", giga_ * W);
388 setVariable(
"kilovolt", kilo_ * V);
389 setVariable(
"kV", kilo_ * V);
390 setVariable(
"megavolt", mega_ * V);
391 setVariable(
"MV", mega_ * V);
394 setVariable(
"millifarad", milli_ * F);
395 setVariable(
"mF", milli_ * F);
396 setVariable(
"microfarad", micro_ * F);
397 setVariable(
"uF", micro_ * F);
398 setVariable(
"nanofarad", nano_ * F);
399 setVariable(
"nF", nano_ * F);
400 setVariable(
"picofarad", pico_ * F);
401 setVariable(
"pF", pico_ * F);
404 setVariable(
"kilogauss", kilo_ * Gs);
405 setVariable(
"kGs", kilo_ * Gs);
static const double candela
double A(double temperature)
static const double meter
static const double second
static const double kelvin
static const double kilogram
static const double ampere