ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SystemOfUnits.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file SystemOfUnits.h
1 // -*- C++ -*-
2 // ----------------------------------------------------------------------
3 // HEP coherent system of Units
4 //
5 // This file has been provided to CLHEP by Geant4 (simulation toolkit for HEP).
6 //
7 // The basic units are :
8 // millimeter (millimeter)
9 // nanosecond (nanosecond)
10 // Mega electron Volt (MeV)
11 // positron charge (eplus)
12 // degree Kelvin (kelvin)
13 // the amount of substance (mole)
14 // luminous intensity (candela)
15 // radian (radian)
16 // steradian (steradian)
17 //
18 // Below is a non exhaustive list of derived and pratical units
19 // (i.e. mostly the SI units).
20 // You can add your own units.
21 //
22 // The SI numerical value of the positron charge is defined here,
23 // as it is needed for conversion factor : positron charge = e_SI (coulomb)
24 //
25 // The others physical constants are defined in the header file :
26 // PhysicalConstants.h
27 //
28 // Authors: M.Maire, S.Giani
29 //
30 // History:
31 //
32 // 06.02.96 Created.
33 // 28.03.96 Added miscellaneous constants.
34 // 05.12.97 E.Tcherniaev: Redefined pascal (to avoid warnings on WinNT)
35 // 20.05.98 names: meter, second, gram, radian, degree
36 // (from Brian.Lasiuk@yale.edu (STAR)). Added luminous units.
37 // 05.08.98 angstrom, picobarn, microsecond, picosecond, petaelectronvolt
38 // 01.03.01 parsec
39 // 31.01.06 kilogray, milligray, microgray
40 // 29.04.08 use PDG 2006 value of e_SI
41 // 03.11.08 use PDG 2008 value of e_SI
42 // 19.08.15 added liter and its sub units (mma)
43 // 12.01.16 added symbols for microsecond (us) and picosecond (ps) (mma)
44 
45 #ifndef HEP_SYSTEM_OF_UNITS_H
46 #define HEP_SYSTEM_OF_UNITS_H
47 
48 namespace CLHEP {
49 
50  //
51  //
52  //
53  static constexpr double pi = 3.14159265358979323846;
54  static constexpr double twopi = 2*pi;
55  static constexpr double halfpi = pi/2;
56  static constexpr double pi2 = pi*pi;
57 
58  //
59  // Length [L]
60  //
61  static constexpr double millimeter = 1.;
62  static constexpr double millimeter2 = millimeter*millimeter;
63  static constexpr double millimeter3 = millimeter*millimeter*millimeter;
64 
65  static constexpr double centimeter = 10.*millimeter;
66  static constexpr double centimeter2 = centimeter*centimeter;
67  static constexpr double centimeter3 = centimeter*centimeter*centimeter;
68 
69  static constexpr double meter = 1000.*millimeter;
70  static constexpr double meter2 = meter*meter;
71  static constexpr double meter3 = meter*meter*meter;
72 
73  static constexpr double kilometer = 1000.*meter;
74  static constexpr double kilometer2 = kilometer*kilometer;
75  static constexpr double kilometer3 = kilometer*kilometer*kilometer;
76 
77  static constexpr double parsec = 3.0856775807e+16*meter;
78 
79  static constexpr double micrometer = 1.e-6 *meter;
80  static constexpr double nanometer = 1.e-9 *meter;
81  static constexpr double angstrom = 1.e-10*meter;
82  static constexpr double fermi = 1.e-15*meter;
83 
84  static constexpr double barn = 1.e-28*meter2;
85  static constexpr double millibarn = 1.e-3 *barn;
86  static constexpr double microbarn = 1.e-6 *barn;
87  static constexpr double nanobarn = 1.e-9 *barn;
88  static constexpr double picobarn = 1.e-12*barn;
89 
90  // symbols
91  static constexpr double nm = nanometer;
92  static constexpr double um = micrometer;
93 
94  static constexpr double mm = millimeter;
95  static constexpr double mm2 = millimeter2;
96  static constexpr double mm3 = millimeter3;
97 
98  static constexpr double cm = centimeter;
99  static constexpr double cm2 = centimeter2;
100  static constexpr double cm3 = centimeter3;
101 
102  static constexpr double liter = 1.e+3*cm3;
103  static constexpr double L = liter;
104  static constexpr double dL = 1.e-1*liter;
105  static constexpr double cL = 1.e-2*liter;
106  static constexpr double mL = 1.e-3*liter;
107 
108  static constexpr double m = meter;
109  static constexpr double m2 = meter2;
110  static constexpr double m3 = meter3;
111 
112  static constexpr double km = kilometer;
113  static constexpr double km2 = kilometer2;
114  static constexpr double km3 = kilometer3;
115 
116  static constexpr double pc = parsec;
117 
118  //
119  // Angle
120  //
121  static constexpr double radian = 1.;
122  static constexpr double milliradian = 1.e-3*radian;
123  static constexpr double degree = (pi/180.0)*radian;
124 
125  static constexpr double steradian = 1.;
126 
127  // symbols
128  static constexpr double rad = radian;
129  static constexpr double mrad = milliradian;
130  static constexpr double sr = steradian;
131  static constexpr double deg = degree;
132 
133  //
134  // Time [T]
135  //
136  static constexpr double nanosecond = 1.;
137  static constexpr double second = 1.e+9 *nanosecond;
138  static constexpr double millisecond = 1.e-3 *second;
139  static constexpr double microsecond = 1.e-6 *second;
140  static constexpr double picosecond = 1.e-12*second;
141 
142  static constexpr double hertz = 1./second;
143  static constexpr double kilohertz = 1.e+3*hertz;
144  static constexpr double megahertz = 1.e+6*hertz;
145 
146  // symbols
147  static constexpr double ns = nanosecond;
148  static constexpr double s = second;
149  static constexpr double ms = millisecond;
150  static constexpr double us = microsecond;
151  static constexpr double ps = picosecond;
152 
153  //
154  // Electric charge [Q]
155  //
156  static constexpr double eplus = 1. ;// positron charge
157  static constexpr double e_SI = 1.602176487e-19;// positron charge in coulomb
158  static constexpr double coulomb = eplus/e_SI;// coulomb = 6.24150 e+18 * eplus
159 
160  //
161  // Energy [E]
162  //
163  static constexpr double megaelectronvolt = 1. ;
164  static constexpr double electronvolt = 1.e-6*megaelectronvolt;
165  static constexpr double kiloelectronvolt = 1.e-3*megaelectronvolt;
166  static constexpr double gigaelectronvolt = 1.e+3*megaelectronvolt;
167  static constexpr double teraelectronvolt = 1.e+6*megaelectronvolt;
168  static constexpr double petaelectronvolt = 1.e+9*megaelectronvolt;
169 
170  static constexpr double joule = electronvolt/e_SI;// joule = 6.24150 e+12 * MeV
171 
172  // symbols
173  static constexpr double MeV = megaelectronvolt;
174  static constexpr double eV = electronvolt;
175  static constexpr double keV = kiloelectronvolt;
176  static constexpr double GeV = gigaelectronvolt;
177  static constexpr double TeV = teraelectronvolt;
178  static constexpr double PeV = petaelectronvolt;
179 
180  //
181  // Mass [E][T^2][L^-2]
182  //
183  static constexpr double kilogram = joule*second*second/(meter*meter);
184  static constexpr double gram = 1.e-3*kilogram;
185  static constexpr double milligram = 1.e-3*gram;
186 
187  // symbols
188  static constexpr double kg = kilogram;
189  static constexpr double g = gram;
190  static constexpr double mg = milligram;
191 
192  //
193  // Power [E][T^-1]
194  //
195  static constexpr double watt = joule/second;// watt = 6.24150 e+3 * MeV/ns
196 
197  //
198  // Force [E][L^-1]
199  //
200  static constexpr double newton = joule/meter;// newton = 6.24150 e+9 * MeV/mm
201 
202  //
203  // Pressure [E][L^-3]
204  //
205 #define pascal hep_pascal // a trick to avoid warnings
206  static constexpr double hep_pascal = newton/m2; // pascal = 6.24150 e+3 * MeV/mm3
207  static constexpr double bar = 100000*pascal; // bar = 6.24150 e+8 * MeV/mm3
208  static constexpr double atmosphere = 101325*pascal; // atm = 6.32420 e+8 * MeV/mm3
209 
210  //
211  // Electric current [Q][T^-1]
212  //
213  static constexpr double ampere = coulomb/second; // ampere = 6.24150 e+9 * eplus/ns
214  static constexpr double milliampere = 1.e-3*ampere;
215  static constexpr double microampere = 1.e-6*ampere;
216  static constexpr double nanoampere = 1.e-9*ampere;
217 
218  //
219  // Electric potential [E][Q^-1]
220  //
221  static constexpr double megavolt = megaelectronvolt/eplus;
222  static constexpr double kilovolt = 1.e-3*megavolt;
223  static constexpr double volt = 1.e-6*megavolt;
224 
225  //
226  // Electric resistance [E][T][Q^-2]
227  //
228  static constexpr double ohm = volt/ampere;// ohm = 1.60217e-16*(MeV/eplus)/(eplus/ns)
229 
230  //
231  // Electric capacitance [Q^2][E^-1]
232  //
233  static constexpr double farad = coulomb/volt;// farad = 6.24150e+24 * eplus/Megavolt
234  static constexpr double millifarad = 1.e-3*farad;
235  static constexpr double microfarad = 1.e-6*farad;
236  static constexpr double nanofarad = 1.e-9*farad;
237  static constexpr double picofarad = 1.e-12*farad;
238 
239  //
240  // Magnetic Flux [T][E][Q^-1]
241  //
242  static constexpr double weber = volt*second;// weber = 1000*megavolt*ns
243 
244  //
245  // Magnetic Field [T][E][Q^-1][L^-2]
246  //
247  static constexpr double tesla = volt*second/meter2;// tesla =0.001*megavolt*ns/mm2
248 
249  static constexpr double gauss = 1.e-4*tesla;
250  static constexpr double kilogauss = 1.e-1*tesla;
251 
252  //
253  // Inductance [T^2][E][Q^-2]
254  //
255  static constexpr double henry = weber/ampere;// henry = 1.60217e-7*MeV*(ns/eplus)**2
256 
257  //
258  // Temperature
259  //
260  static constexpr double kelvin = 1.;
261 
262  //
263  // Amount of substance
264  //
265  static constexpr double mole = 1.;
266 
267  //
268  // Activity [T^-1]
269  //
270  static constexpr double becquerel = 1./second ;
271  static constexpr double curie = 3.7e+10 * becquerel;
272  static constexpr double kilobecquerel = 1.e+3*becquerel;
273  static constexpr double megabecquerel = 1.e+6*becquerel;
274  static constexpr double gigabecquerel = 1.e+9*becquerel;
275  static constexpr double millicurie = 1.e-3*curie;
276  static constexpr double microcurie = 1.e-6*curie;
277  static constexpr double Bq = becquerel;
278  static constexpr double kBq = kilobecquerel;
279  static constexpr double MBq = megabecquerel;
280  static constexpr double GBq = gigabecquerel;
281  static constexpr double Ci = curie;
282  static constexpr double mCi = millicurie;
283  static constexpr double uCi = microcurie;
284 
285  //
286  // Absorbed dose [L^2][T^-2]
287  //
288  static constexpr double gray = joule/kilogram ;
289  static constexpr double kilogray = 1.e+3*gray;
290  static constexpr double milligray = 1.e-3*gray;
291  static constexpr double microgray = 1.e-6*gray;
292 
293  //
294  // Luminous intensity [I]
295  //
296  static constexpr double candela = 1.;
297 
298  //
299  // Luminous flux [I]
300  //
301  static constexpr double lumen = candela*steradian;
302 
303  //
304  // Illuminance [I][L^-2]
305  //
306  static constexpr double lux = lumen/meter2;
307 
308  //
309  // Miscellaneous
310  //
311  static constexpr double perCent = 0.01 ;
312  static constexpr double perThousand = 0.001;
313  static constexpr double perMillion = 0.000001;
314 
315 } // namespace CLHEP
316 
317 #endif /* HEP_SYSTEM_OF_UNITS_H */