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