ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4SIunits.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4SIunits.hh
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 //
28 // ----------------------------------------------------------------------
29 //
30 // Class description:
31 //
32 // This file is a modified version of SystemOfUnits.h
33 // It is provided for checking the overall 'units coherence' of the
34 // Geant4 kernel.
35 // -------
36 // Warning: if you use it, do not forget to recompile the whole Geant4 kernel
37 // -------
38 // The basic units are those of the International System:
39 //
40 // meter
41 // second
42 // kilogram
43 // ampere
44 // degree kelvin
45 // the amount of substance (mole)
46 // luminous intensity (candela)
47 // radian
48 // steradian
49 //
50 //
51 // The SI numerical value of the positron charge is defined here,
52 // as it is needed for conversion factor : positron charge = e_SI (coulomb)
53 //
54 // The others physical constants are defined in the header file :
55 // PhysicalConstants.h
56 //
57 
58 // Authors: M.Maire, S.Giani
59 //
60 // History:
61 //
62 // 10.03.99 created
63 // 01.03.01 parsec
64 // 11.06.15 upgrate. Equivalent to SystemOfUnits.h
65 // 08.08.15 add decimeter, liter (mma)
66 // 12.01.16 added symbols for microsecond (us) and picosecond (ps) (mma)
67 
68 #ifndef SI_SYSTEM_OF_UNITS_HH
69 #define SI_SYSTEM_OF_UNITS_HH
70 
71 //
72 //
73 //
74 static constexpr double pi = 3.14159265358979323846;
75 static constexpr double twopi = 2*pi;
76 static constexpr double halfpi = pi/2;
77 static constexpr double pi2 = pi*pi;
78 //
79 // Length [L]
80 //
81 static constexpr double meter = 1.;
82 static constexpr double meter2 = meter*meter;
83 static constexpr double meter3 = meter*meter*meter;
84 
85 static constexpr double millimeter = 0.001*meter;
86 static constexpr double millimeter2 = millimeter*millimeter;
87 static constexpr double millimeter3 = millimeter*millimeter*millimeter;
88 
89 static constexpr double centimeter = 10.*millimeter;
90 static constexpr double centimeter2 = centimeter*centimeter;
91 static constexpr double centimeter3 = centimeter*centimeter*centimeter;
92 
93 static constexpr double kilometer = 1000.*meter;
94 static constexpr double kilometer2 = kilometer*kilometer;
95 static constexpr double kilometer3 = kilometer*kilometer*kilometer;
96 
97 static constexpr double parsec = 3.0856775807e+16*meter;
98 
99 static constexpr double micrometer = 1.e-6 *meter;
100 static constexpr double nanometer = 1.e-9 *meter;
101 static constexpr double angstrom = 1.e-10*meter;
102 static constexpr double fermi = 1.e-15*meter;
103 
104 static constexpr double barn = 1.e-28*meter2;
105 static constexpr double millibarn = 1.e-3 *barn;
106 static constexpr double microbarn = 1.e-6 *barn;
107 static constexpr double nanobarn = 1.e-9 *barn;
108 static constexpr double picobarn = 1.e-12*barn;
109 
110 // symbols
111 static constexpr double nm = nanometer;
112 static constexpr double um = micrometer;
113 
114 static constexpr double mm = millimeter;
115 static constexpr double mm2 = millimeter2;
116 static constexpr double mm3 = millimeter3;
117 
118 static constexpr double cm = centimeter;
119 static constexpr double cm2 = centimeter2;
120 static constexpr double cm3 = centimeter3;
121 
122 static constexpr double liter = 1.e+3*cm3;
123 static constexpr double L = liter;
124 static constexpr double dL = 1.e-1*liter;
125 static constexpr double cL = 1.e-2*liter;
126 static constexpr double mL = 1.e-3*liter;
127 
128 static constexpr double m = meter;
129 static constexpr double m2 = meter2;
130 static constexpr double m3 = meter3;
131 
132 static constexpr double km = kilometer;
133 static constexpr double km2 = kilometer2;
134 static constexpr double km3 = kilometer3;
135 
136 static constexpr double pc = parsec;
137 
138 //
139 // Angle
140 //
141 static constexpr double radian = 1.;
142 static constexpr double milliradian = 1.e-3*radian;
143 static constexpr double degree = (pi/180.0)*radian;
144 
145 static constexpr double steradian = 1.;
146 
147 // symbols
148 static constexpr double rad = radian;
149 static constexpr double mrad = milliradian;
150 static constexpr double sr = steradian;
151 static constexpr double deg = degree;
152 
153 //
154 // Time [T]
155 //
156 static constexpr double second = 1.;
157 static constexpr double nanosecond = 1.e-9 *second;
158 static constexpr double millisecond = 1.e-3 *second;
159 static constexpr double microsecond = 1.e-6 *second;
160 static constexpr double picosecond = 1.e-12*second;
161 
162 static constexpr double hertz = 1./second;
163 static constexpr double kilohertz = 1.e+3*hertz;
164 static constexpr double megahertz = 1.e+6*hertz;
165 
166 // symbols
167 static constexpr double ns = nanosecond;
168 static constexpr double s = second;
169 static constexpr double ms = millisecond;
170 static constexpr double us = microsecond;
171 static constexpr double ps = picosecond;
172 
173 //
174 // Mass [E][T^2][L^-2]
175 //
176 static constexpr double kilogram = 1.;
177 static constexpr double gram = 1.e-3*kilogram;
178 static constexpr double milligram = 1.e-3*gram;
179 
180 // symbols
181 static constexpr double kg = kilogram;
182 static constexpr double g = gram;
183 static constexpr double mg = milligram;
184 
185 //
186 // Electric current [Q][T^-1]
187 //
188 static constexpr double ampere = 1.;
189 static constexpr double milliampere = 1.e-3*ampere;
190 static constexpr double microampere = 1.e-6*ampere;
191 static constexpr double nanoampere = 1.e-9*ampere;
192 
193 //
194 // Electric charge [Q]
195 //
196 static constexpr double coulomb = ampere*second;
197 static constexpr double e_SI = 1.602176487e-19; // positron charge in coulomb
198 static constexpr double eplus = e_SI*coulomb ; // positron charge
199 
200 //
201 // Energy [E]
202 //
203 static constexpr double joule = kg*m*m/(s*s);
204 
205 static constexpr double electronvolt = e_SI*joule;
206 static constexpr double kiloelectronvolt = 1.e+3*electronvolt;
207 static constexpr double megaelectronvolt = 1.e+6*electronvolt;
208 static constexpr double gigaelectronvolt = 1.e+9*electronvolt;
209 static constexpr double teraelectronvolt = 1.e+12*electronvolt;
210 static constexpr double petaelectronvolt = 1.e+15*electronvolt;
211 
212 // symbols
213 static constexpr double MeV = megaelectronvolt;
214 static constexpr double eV = electronvolt;
215 static constexpr double keV = kiloelectronvolt;
216 static constexpr double GeV = gigaelectronvolt;
217 static constexpr double TeV = teraelectronvolt;
218 static constexpr double PeV = petaelectronvolt;
219 
220 //
221 // Power [E][T^-1]
222 //
223 static constexpr double watt = joule/second; // watt = 6.24150 e+3 * MeV/ns
224 
225 //
226 // Force [E][L^-1]
227 //
228 static constexpr double newton = joule/meter; // newton = 6.24150 e+9 * MeV/mm
229 
230 //
231 // Pressure [E][L^-3]
232 //
233 #define pascal hep_pascal // a trick to avoid warnings
234 static constexpr double hep_pascal = newton/m2; // pascal = 6.24150 e+3 * MeV/mm3
235 static constexpr double bar = 100000*pascal; // bar = 6.24150 e+8 * MeV/mm3
236 static constexpr double atmosphere = 101325*pascal; // atm = 6.32420 e+8 * MeV/mm3
237 
238 //
239 // Electric potential [E][Q^-1]
240 //
241 static constexpr double megavolt = megaelectronvolt/eplus;
242 static constexpr double kilovolt = 1.e-3*megavolt;
243 static constexpr double volt = 1.e-6*megavolt;
244 
245 //
246 // Electric resistance [E][T][Q^-2]
247 //
248 static constexpr double ohm = volt/ampere; // ohm = 1.60217e-16*(MeV/eplus)/(eplus/ns)
249 
250 //
251 // Electric capacitance [Q^2][E^-1]
252 //
253 static constexpr double farad = coulomb/volt; // farad = 6.24150e+24 * eplus/Megavolt
254 static constexpr double millifarad = 1.e-3*farad;
255 static constexpr double microfarad = 1.e-6*farad;
256 static constexpr double nanofarad = 1.e-9*farad;
257 static constexpr double picofarad = 1.e-12*farad;
258 
259 //
260 // Magnetic Flux [T][E][Q^-1]
261 //
262 static constexpr double weber = volt*second; // weber = 1000*megavolt*ns
263 
264 //
265 // Magnetic Field [T][E][Q^-1][L^-2]
266 //
267 static constexpr double tesla = volt*second/meter2; // tesla =0.001*megavolt*ns/mm2
268 
269 static constexpr double gauss = 1.e-4*tesla;
270 static constexpr double kilogauss = 1.e-1*tesla;
271 
272 //
273 // Inductance [T^2][E][Q^-2]
274 //
275 static constexpr double henry = weber/ampere; // henry = 1.60217e-7*MeV*(ns/eplus)**2
276 
277 //
278 // Temperature
279 //
280 static constexpr double kelvin = 1.;
281 
282 //
283 // Amount of substance
284 //
285 static constexpr double mole = 1.;
286 
287 //
288 // Activity [T^-1]
289 //
290 static constexpr double becquerel = 1./second ;
291 static constexpr double curie = 3.7e+10 * becquerel;
292 static constexpr double kilobecquerel = 1.e+3*becquerel;
293 static constexpr double megabecquerel = 1.e+6*becquerel;
294 static constexpr double gigabecquerel = 1.e+9*becquerel;
295 static constexpr double millicurie = 1.e-3*curie;
296 static constexpr double microcurie = 1.e-6*curie;
297 static constexpr double Bq = becquerel;
298 static constexpr double kBq = kilobecquerel;
299 static constexpr double MBq = megabecquerel;
300 static constexpr double GBq = gigabecquerel;
301 static constexpr double Ci = curie;
302 static constexpr double mCi = millicurie;
303 static constexpr double uCi = microcurie;
304 
305 //
306 // Absorbed dose [L^2][T^-2]
307 //
308 static constexpr double gray = joule/kilogram;
309 static constexpr double kilogray = 1.e+3*gray;
310 static constexpr double milligray = 1.e-3*gray;
311 static constexpr double microgray = 1.e-6*gray;
312 
313 //
314 // Luminous intensity [I]
315 //
316 static constexpr double candela = 1.;
317 
318 //
319 // Luminous flux [I]
320 //
321 static constexpr double lumen = candela*steradian;
322 
323 //
324 // Illuminance [I][L^-2]
325 //
326 static constexpr double lux = lumen/meter2;
327 
328 //
329 // Miscellaneous
330 //
331 static constexpr double perCent = 0.01 ;
332 static constexpr double perThousand = 0.001;
333 static constexpr double perMillion = 0.000001;
334 
335 
336 #endif /* SI_SYSTEM_OF_UNITS_HH */