Units.h
Go to the documentation of this file.
1 /**
2  A system of units compatible with (taken from) CLHEP.
3 */
4 
5 #ifndef WIRECELL_SYSTEM_OF_UNITS_H
6 #define WIRECELL_SYSTEM_OF_UNITS_H
7 
8 namespace WireCell {
9 namespace units {
10 
11  //
12  //
13  //
14  static const double pi = 3.14159265358979323846;
15  static const double twopi = 2*pi;
16  static const double halfpi = pi/2;
17  static const double pi2 = pi*pi;
18 
19  //
20  // Length [L]
21  //
22  static const double millimeter = 1.;
23  static const double millimeter2 = millimeter*millimeter;
24  static const double millimeter3 = millimeter*millimeter*millimeter;
25 
26  static const double centimeter = 10.*millimeter;
27  static const double centimeter2 = centimeter*centimeter;
28  static const double centimeter3 = centimeter*centimeter*centimeter;
29 
30  static const double meter = 1000.*millimeter;
31  static const double meter2 = meter*meter;
32  static const double meter3 = meter*meter*meter;
33 
34  static const double kilometer = 1000.*meter;
35  static const double kilometer2 = kilometer*kilometer;
36  static const double kilometer3 = kilometer*kilometer*kilometer;
37 
38  static const double parsec = 3.0856775807e+16*meter;
39 
40  static const double micrometer = 1.e-6 *meter;
41  static const double nanometer = 1.e-9 *meter;
42  static const double angstrom = 1.e-10*meter;
43  static const double fermi = 1.e-15*meter;
44 
45  static const double barn = 1.e-28*meter2;
46  static const double millibarn = 1.e-3 *barn;
47  static const double microbarn = 1.e-6 *barn;
48  static const double nanobarn = 1.e-9 *barn;
49  static const double picobarn = 1.e-12*barn;
50 
51  // symbols
52  static const double nm = nanometer;
53  static const double um = micrometer;
54 
55  static const double mm = millimeter;
56  static const double mm2 = millimeter2;
57  static const double mm3 = millimeter3;
58 
59  static const double cm = centimeter;
60  static const double cm2 = centimeter2;
61  static const double cm3 = centimeter3;
62 
63  static const double m = meter;
64  static const double m2 = meter2;
65  static const double m3 = meter3;
66 
67  static const double km = kilometer;
68  static const double km2 = kilometer2;
69  static const double km3 = kilometer3;
70 
71  static const double pc = parsec;
72 
73  //
74  // Angle
75  //
76  static const double radian = 1.;
77  static const double milliradian = 1.e-3*radian;
78  static const double degree = (pi/180.0)*radian;
79 
80  static const double steradian = 1.;
81 
82  // symbols
83  static const double rad = radian;
84  static const double mrad = milliradian;
85  static const double sr = steradian;
86  static const double deg = degree;
87 
88  //
89  // Time [T]
90  //
91  static const double nanosecond = 1.;
92  static const double second = 1.e+9 *nanosecond;
93  static const double millisecond = 1.e-3 *second;
94  static const double microsecond = 1.e-6 *second;
95  static const double picosecond = 1.e-12*second;
96 
97  static const double hertz = 1./second;
98  static const double kilohertz = 1.e+3*hertz;
99  static const double megahertz = 1.e+6*hertz;
100 
101  // symbols
102  static const double ns = nanosecond;
103  static const double s = second;
104  static const double ms = millisecond;
105  static const double us = microsecond;
106 
107  //
108  // Electric charge [Q]
109  //
110  static const double eplus = 1. ;// positron charge
111  static const double e_SI = 1.602176487e-19;// positron charge in coulomb
112  static const double coulomb = eplus/e_SI;// coulomb = 6.24150 e+18 * eplus
113  static const double fC = 1.0e-15*coulomb;// femtocoulomb
114 
115  //
116  // Energy [E]
117  //
118  static const double megaelectronvolt = 1. ;
119  static const double electronvolt = 1.e-6*megaelectronvolt;
120  static const double kiloelectronvolt = 1.e-3*megaelectronvolt;
121  static const double gigaelectronvolt = 1.e+3*megaelectronvolt;
122  static const double teraelectronvolt = 1.e+6*megaelectronvolt;
123  static const double petaelectronvolt = 1.e+9*megaelectronvolt;
124 
125  static const double joule = electronvolt/e_SI;// joule = 6.24150 e+12 * MeV
126 
127  // symbols
128  static const double MeV = megaelectronvolt;
129  static const double eV = electronvolt;
130  static const double keV = kiloelectronvolt;
131  static const double GeV = gigaelectronvolt;
132  static const double TeV = teraelectronvolt;
133  static const double PeV = petaelectronvolt;
134 
135  //
136  // Mass [E][T^2][L^-2]
137  //
138  static const double kilogram = joule*second*second/(meter*meter);
139  static const double gram = 1.e-3*kilogram;
140  static const double milligram = 1.e-3*gram;
141 
142  // symbols
143  static const double kg = kilogram;
144  static const double g = gram;
145  static const double mg = milligram;
146 
147  //
148  // Power [E][T^-1]
149  //
150  static const double watt = joule/second;// watt = 6.24150 e+3 * MeV/ns
151 
152  //
153  // Force [E][L^-1]
154  //
155  static const double newton = joule/meter;// newton = 6.24150 e+9 * MeV/mm
156 
157  //
158  // Pressure [E][L^-3]
159  //
160  static const double pascal = newton/m2; // pascal = 6.24150 e+3 * MeV/mm3
161  static const double bar = 100000*pascal; // bar = 6.24150 e+8 * MeV/mm3
162  static const double atmosphere = 101325*pascal; // atm = 6.32420 e+8 * MeV/mm3
163 
164  //
165  // Electric current [Q][T^-1]
166  //
167  static const double ampere = coulomb/second; // ampere = 6.24150 e+9 * eplus/ns
168  static const double milliampere = 1.e-3*ampere;
169  static const double microampere = 1.e-6*ampere;
170  static const double nanoampere = 1.e-9*ampere;
171 
172  //
173  // Electric potential [E][Q^-1]
174  //
175  static const double megavolt = megaelectronvolt/eplus;
176  static const double kilovolt = 1.e-3*megavolt;
177  static const double volt = 1.e-6*megavolt;
178  static const double millivolt = 1.e-3*volt;
179  static const double microvolt = 1.e-6*volt;
180  static const double mV = millivolt;
181  static const double uV = microvolt;
182 
183  //
184  // Electric resistance [E][T][Q^-2]
185  //
186  static const double ohm = volt/ampere;// ohm = 1.60217e-16*(MeV/eplus)/(eplus/ns)
187 
188  //
189  // Electric capacitance [Q^2][E^-1]
190  //
191  static const double farad = coulomb/volt;// farad = 6.24150e+24 * eplus/Megavolt
192  static const double millifarad = 1.e-3*farad;
193  static const double microfarad = 1.e-6*farad;
194  static const double nanofarad = 1.e-9*farad;
195  static const double picofarad = 1.e-12*farad;
196 
197  //
198  // Magnetic Flux [T][E][Q^-1]
199  //
200  static const double weber = volt*second;// weber = 1000*megavolt*ns
201 
202  //
203  // Magnetic Field [T][E][Q^-1][L^-2]
204  //
205  static const double tesla = volt*second/meter2;// tesla =0.001*megavolt*ns/mm2
206 
207  static const double gauss = 1.e-4*tesla;
208  static const double kilogauss = 1.e-1*tesla;
209 
210  //
211  // Inductance [T^2][E][Q^-2]
212  //
213  static const double henry = weber/ampere;// henry = 1.60217e-7*MeV*(ns/eplus)**2
214 
215  //
216  // Temperature
217  //
218  static const double kelvin = 1.;
219 
220  //
221  // Amount of substance
222  //
223  static const double mole = 1.;
224 
225  //
226  // Activity [T^-1]
227  //
228  static const double becquerel = 1./second ;
229  static const double curie = 3.7e+10 * becquerel;
230  static const double kilobecquerel = 1.e+3*becquerel;
231  static const double megabecquerel = 1.e+6*becquerel;
232  static const double gigabecquerel = 1.e+9*becquerel;
233  static const double millicurie = 1.e-3*curie;
234  static const double microcurie = 1.e-6*curie;
235  static const double Bq = becquerel;
236  static const double kBq = kilobecquerel;
237  static const double MBq = megabecquerel;
238  static const double GBq = gigabecquerel;
239  static const double Ci = curie;
240  static const double mCi = millicurie;
241  static const double uCi = microcurie;
242 
243  //
244  // Absorbed dose [L^2][T^-2]
245  //
246  static const double gray = joule/kilogram ;
247  static const double kilogray = 1.e+3*gray;
248  static const double milligray = 1.e-3*gray;
249  static const double microgray = 1.e-6*gray;
250 
251  //
252  // Luminous intensity [I]
253  //
254  static const double candela = 1.;
255 
256  //
257  // Luminous flux [I]
258  //
259  static const double lumen = candela*steradian;
260 
261  //
262  // Illuminance [I][L^-2]
263  //
264  static const double lux = lumen/meter2;
265 
266  //
267  // Miscellaneous
268  //
269  static const double perCent = 0.01 ;
270  static const double perThousand = 0.001;
271  static const double perMillion = 0.000001;
272 
273 
274  // some constants of nature.
275  static const double clight = 2.99792458e8*units::meter/units::second;
276 
277 } // namespace units
278 } // namespace WireCell
279 
280 #endif /* HEP_SYSTEM_OF_UNITS_H */
static const double kilovolt
Definition: Units.h:176
static const double PeV
Definition: Units.h:133
static const double meter3
Definition: Units.h:32
static const double nanometer
Definition: Units.h:41
static const double kilogram
Definition: Units.h:138
static const double atmosphere
Definition: Units.h:162
static const double uV
Definition: Units.h:181
static const double pi2
Definition: Units.h:17
static const double m
Definition: Units.h:63
static const double eplus
Definition: Units.h:110
static const double km3
Definition: Units.h:69
static const double gram
Definition: Units.h:139
static const double meter2
Definition: Units.h:31
static const double mrad
Definition: Units.h:84
static const double picosecond
Definition: Units.h:95
static const double halfpi
Definition: Units.h:16
static const double mole
Definition: Units.h:223
static const double kBq
Definition: Units.h:236
static const double kilogauss
Definition: Units.h:208
static const double mm3
Definition: Units.h:57
static const double gauss
Definition: Units.h:207
static const double micrometer
Definition: Units.h:40
static const double cm3
Definition: Units.h:61
static const double barn
Definition: Units.h:45
static const double clight
Definition: Units.h:275
static const double microsecond
Definition: Units.h:94
static const double km
Definition: Units.h:67
static const double mV
Definition: Units.h:180
static const double bar
Definition: Units.h:161
static const double microfarad
Definition: Units.h:193
static const double newton
Definition: Units.h:155
static const double mg
Definition: Units.h:145
static const double centimeter
Definition: Units.h:26
static const double MBq
Definition: Units.h:237
static const double m3
Definition: Units.h:65
static const double Bq
Definition: Units.h:235
static const double lux
Definition: Units.h:264
static const double mCi
Definition: Units.h:240
static const double GBq
Definition: Units.h:238
static const double meter
Definition: Units.h:30
static const double picobarn
Definition: Units.h:49
static const double ms
Definition: Units.h:104
static const double farad
Definition: Units.h:191
static const double milliradian
Definition: Units.h:77
static const double electronvolt
Definition: Units.h:119
static const double gray
Definition: Units.h:246
static const double coulomb
Definition: Units.h:112
static const double fermi
Definition: Units.h:43
static const double microcurie
Definition: Units.h:234
static const double millivolt
Definition: Units.h:178
static const double microvolt
Definition: Units.h:179
static const double mm2
Definition: Units.h:56
static const double gigaelectronvolt
Definition: Units.h:121
static const double nm
Definition: Units.h:52
static const double henry
Definition: Units.h:213
static const double tesla
Definition: Units.h:205
static const double twopi
Definition: Units.h:15
static const double e_SI
Definition: Units.h:111
static const double megavolt
Definition: Units.h:175
static const double gigabecquerel
Definition: Units.h:232
static const double milligray
Definition: Units.h:248
static const double nanofarad
Definition: Units.h:194
static const double angstrom
Definition: Units.h:42
static const double kiloelectronvolt
Definition: Units.h:120
static const double weber
Definition: Units.h:200
static const double ampere
Definition: Units.h:167
static const double radian
Definition: Units.h:76
static const double petaelectronvolt
Definition: Units.h:123
static const double sr
Definition: Units.h:85
static const double kilometer2
Definition: Units.h:35
static const double parsec
Definition: Units.h:38
static const double eV
Definition: Units.h:129
static const double kilometer3
Definition: Units.h:36
static const double megaelectronvolt
Definition: Units.h:118
static const double milligram
Definition: Units.h:140
static const double GeV
Definition: Units.h:131
static const double rad
Definition: Units.h:83
static const double centimeter2
Definition: Units.h:27
static const double steradian
Definition: Units.h:80
static const double g
Definition: Units.h:144
static const double MeV
Definition: Units.h:128
static const double millibarn
Definition: Units.h:46
static const double watt
Definition: Units.h:150
static const double kg
Definition: Units.h:143
static const double millicurie
Definition: Units.h:233
static const double cm
Definition: Units.h:59
static const double fC
Definition: Units.h:113
static const double ns
Definition: Units.h:102
static const double hertz
Definition: Units.h:97
static const double lumen
Definition: Units.h:259
static const double mm
Definition: Units.h:55
static const double becquerel
Definition: Units.h:228
static const double millimeter3
Definition: Units.h:24
static const double pascal
Definition: Units.h:160
static const double teraelectronvolt
Definition: Units.h:122
static const double um
Definition: Units.h:53
Definition: Main.h:22
static const double kelvin
Definition: Units.h:218
static const double perCent
Definition: Units.h:269
static const double uCi
Definition: Units.h:241
static const double km2
Definition: Units.h:68
static const double second
Definition: Units.h:92
static const double nanosecond
Definition: Units.h:91
static const double kilogray
Definition: Units.h:247
static const double Ci
Definition: Units.h:239
static const double keV
Definition: Units.h:130
static const double millimeter
Definition: Units.h:22
static const double nanobarn
Definition: Units.h:48
static const double millisecond
Definition: Units.h:93
static const double milliampere
Definition: Units.h:168
static const double microampere
Definition: Units.h:169
static const double curie
Definition: Units.h:229
static const double s
Definition: Units.h:103
static const double kilohertz
Definition: Units.h:98
static const double us
Definition: Units.h:105
static const double TeV
Definition: Units.h:132
static const double volt
Definition: Units.h:177
static const double ohm
Definition: Units.h:186
static const double millimeter2
Definition: Units.h:23
static const double millifarad
Definition: Units.h:192
static const double microgray
Definition: Units.h:249
static const double kilobecquerel
Definition: Units.h:230
static const double nanoampere
Definition: Units.h:170
static const double joule
Definition: Units.h:125
static const double megabecquerel
Definition: Units.h:231
static const double candela
Definition: Units.h:254
static const double perThousand
Definition: Units.h:270
static const double centimeter3
Definition: Units.h:28
static const double picofarad
Definition: Units.h:195
static const double perMillion
Definition: Units.h:271
static const double pi
Definition: Units.h:14
static const double deg
Definition: Units.h:86
static const double m2
Definition: Units.h:64
static const double megahertz
Definition: Units.h:99
static const double kilometer
Definition: Units.h:34
static const double microbarn
Definition: Units.h:47
static const double degree
Definition: Units.h:78
static const double cm2
Definition: Units.h:60
static const double pc
Definition: Units.h:71