hepunit.py
Go to the documentation of this file.
1 """
2 # ==================================================================
3 # Python module
4 #
5 # This module defines physical units and constants used in HEP,
6 # which are imported from CLHEP library.
7 #
8 # Q, 2005
9 # ==================================================================
10 """
11 #$Id: hepunit.py 66892 2013-01-17 10:57:59Z gunter $
12 
13 # ==================================================================
14 # imported from "SystemOfUnits.h"
15 # ==================================================================
16 millimeter = 1.
17 millimeter2 = millimeter*millimeter
18 millimeter3 = millimeter*millimeter*millimeter
19 
20 centimeter = 10.*millimeter
21 centimeter2 = centimeter*centimeter
22 centimeter3 = centimeter*centimeter*centimeter
23 
24 meter = 1000.*millimeter
25 meter2 = meter*meter
26 meter3 = meter*meter*meter
27 
28 kilometer = 1000.*meter
29 kilometer2 = kilometer*kilometer
30 kilometer3 = kilometer*kilometer*kilometer
31 
32 parsec = 3.0856775807e+16*meter
33 
34 micrometer = 1.e-6 *meter
35 nanometer = 1.e-9 *meter
36 angstrom = 1.e-10*meter
37 fermi = 1.e-15*meter
38 
39 barn = 1.e-28*meter2
40 millibarn = 1.e-3 *barn
41 microbarn = 1.e-6 *barn
42 nanobarn = 1.e-9 *barn
43 picobarn = 1.e-12*barn
44 
45 # symbols
46 mm = millimeter
47 mm2 = millimeter2
48 mm3 = millimeter3
49 
50 cm = centimeter
51 cm2 = centimeter2
52 cm3 = centimeter3
53 
54 m = meter
55 m2 = meter2
56 m3 = meter3
57 
58 km = kilometer
59 km2 = kilometer2
60 km3 = kilometer3
61 
62 pc = parsec
63 
64 #
65 # Angle
66 #
67 radian = 1.
68 milliradian = 1.e-3*radian
69 degree = (3.14159265358979323846/180.0)*radian
70 
71 steradian = 1.
72 
73 # symbols
74 rad = radian
75 mrad = milliradian
76 sr = steradian
77 deg = degree
78 
79 #
80 # Time [T]
81 #
82 nanosecond = 1.
83 second = 1.e+9 *nanosecond
84 millisecond = 1.e-3 *second
85 microsecond = 1.e-6 *second
86 picosecond = 1.e-12*second
87 
88 hertz = 1./second
89 kilohertz = 1.e+3*hertz
90 megahertz = 1.e+6*hertz
91 
92 # symbols
93 ns = nanosecond
94 s = second
95 ms = millisecond
96 
97 #
98 # Electric charge [Q]
99 #
100 eplus = 1. # positron charge
101 e_SI = 1.60217733e-19 # positron charge in coulomb
102 coulomb = eplus/e_SI # coulomb = 6.24150 e+18 * eplus
103 
104 #
105 # Energy [E]
106 #
107 megaelectronvolt = 1.
108 electronvolt = 1.e-6*megaelectronvolt
109 kiloelectronvolt = 1.e-3*megaelectronvolt
110 gigaelectronvolt = 1.e+3*megaelectronvolt
111 teraelectronvolt = 1.e+6*megaelectronvolt
112 petaelectronvolt = 1.e+9*megaelectronvolt
113 
114 joule = electronvolt/e_SI # joule = 6.24150 e+12 * MeV
115 
116 # symbols
117 MeV = megaelectronvolt
118 eV = electronvolt
119 keV = kiloelectronvolt
120 GeV = gigaelectronvolt
121 TeV = teraelectronvolt
122 PeV = petaelectronvolt
123 
124 #
125 # Mass [E][T^2][L^-2]
126 #
127 kilogram = joule*second*second/(meter*meter)
128 gram = 1.e-3*kilogram
129 milligram = 1.e-3*gram
130 
131 # symbols
132 kg = kilogram
133 g = gram
134 mg = milligram
135 
136 #
137 # Power [E][T^-1]
138 #
139 watt = joule/second # watt = 6.24150 e+3 * MeV/ns
140 
141 #
142 # Force [E][L^-1]
143 #
144 newton = joule/meter # newton = 6.24150 e+9 * MeV/mm
145 
146 #
147 # Pressure [E][L^-3]
148 #
149 pascal = newton/m2 # pascal = 6.24150 e+3 * MeV/mm3
150 bar = 100000*pascal # bar = 6.24150 e+8 * MeV/mm3
151 atmosphere = 101325*pascal # atm = 6.32420 e+8 * MeV/mm3
152 
153 #
154 # Electric current [Q][T^-1]
155 #
156 ampere = coulomb/second # ampere = 6.24150 e+9 * eplus/ns
157 milliampere = 1.e-3*ampere
158 microampere = 1.e-6*ampere
159 nanoampere = 1.e-9*ampere
160 
161 #
162 # Electric potential [E][Q^-1]
163 #
164 megavolt = megaelectronvolt/eplus
165 kilovolt = 1.e-3*megavolt
166 volt = 1.e-6*megavolt
167 
168 #
169 # Electric resistance [E][T][Q^-2]
170 #
171 ohm = volt/ampere # ohm = 1.60217e-16*(MeV/eplus)/(eplus/ns)
172 
173 #
174 # Electric capacitance [Q^2][E^-1]
175 #
176 farad = coulomb/volt # farad = 6.24150e+24 * eplus/Megavolt
177 millifarad = 1.e-3*farad
178 microfarad = 1.e-6*farad
179 nanofarad = 1.e-9*farad
180 picofarad = 1.e-12*farad
181 
182 #
183 # Magnetic Flux [T][E][Q^-1]
184 #
185 weber = volt*second # weber = 1000*megavolt*ns
186 
187 #
188 # Magnetic Field [T][E][Q^-1][L^-2]
189 #
190 tesla = volt*second/meter2 # tesla =0.001*megavolt*ns/mm2
191 
192 gauss = 1.e-4*tesla
193 kilogauss = 1.e-1*tesla
194 
195 #
196 # Inductance [T^2][E][Q^-2]
197 #
198 henry = weber/ampere # henry = 1.60217e-7*MeV*(ns/eplus)**2
199 
200 #
201 # Temperature
202 #
203 kelvin = 1.
204 
205 #
206 # Amount of substance
207 #
208 mole = 1.
209 
210 #
211 # Activity [T^-1]
212 #
213 becquerel = 1./second
214 curie = 3.7e+10 * becquerel
215 
216 #
217 # Absorbed dose [L^2][T^-2]
218 #
219 gray = joule/kilogram
220 
221 #
222 # Luminous intensity [I]
223 #
224 candela = 1.
225 
226 #
227 # Luminous flux [I]
228 #
229 lumen = candela*steradian
230 
231 #
232 # Illuminance [I][L^-2]
233 #
234 lux = lumen/meter2
235 
236 #
237 # Miscellaneous
238 #
239 perCent = 0.01
240 perThousand = 0.001
241 perMillion = 0.000001
242 
243 
244 # ==================================================================
245 # imported from "PhysicalConstants.h"
246 # ==================================================================
247 pi = 3.14159265358979323846
248 twopi = 2.*pi
249 halfpi = pi/2.
250 pi2 = pi*pi
251 
252 #
253 Avogadro = 6.0221367e+23/mole
254 
255 # c = 299.792458 mm/ns
256 # c^2 = 898.7404 (mm/ns)^2
257 c_light = 2.99792458e+8 * m/s
258 c_squared = c_light * c_light
259 
260 # h = 4.13566e-12 MeV*ns
261 # hbar = 6.58212e-13 MeV*ns
262 # hbarc = 197.32705e-12 MeV*mm
263 h_Planck = 6.6260755e-34 * joule*s
264 hbar_Planck = h_Planck/twopi
265 hbarc = hbar_Planck * c_light
266 hbarc_squared = hbarc * hbarc
267 
268 #
269 electron_charge = - eplus # see SystemOfUnits.h
270 e_squared = eplus * eplus
271 
272 # amu_c2 - atomic equivalent mass unit
273 # amu - atomic mass unit
274 electron_mass_c2 = 0.51099906 * MeV
275 proton_mass_c2 = 938.27231 * MeV
276 neutron_mass_c2 = 939.56563 * MeV
277 amu_c2 = 931.49432 * MeV
278 amu = amu_c2/c_squared
279 
280 # permeability of free space mu0 = 2.01334e-16 Mev*(ns*eplus)^2/mm
281 # permittivity of free space epsil0 = 5.52636e+10 eplus^2/(MeV*mm)
282 mu0 = 4*pi*1.e-7 * henry/m
283 epsilon0 = 1./(c_squared*mu0)
284 
285 # electromagnetic coupling = 1.43996e-12 MeV*mm/(eplus^2)
286 elm_coupling = e_squared/(4*pi*epsilon0)
287 fine_structure_const = elm_coupling/hbarc
288 classic_electr_radius = elm_coupling/electron_mass_c2
289 electron_Compton_length = hbarc/electron_mass_c2
290 Bohr_radius = electron_Compton_length/fine_structure_const
291 
292 alpha_rcl2 = fine_structure_const * classic_electr_radius \
293  * classic_electr_radius
294 twopi_mc2_rcl2 = twopi * electron_mass_c2 \
295  * classic_electr_radius \
296  * classic_electr_radius
297 
298 #
299 k_Boltzmann = 8.617385e-11 * MeV/kelvin
300 
301 #
302 STP_Temperature = 273.15*kelvin
303 STP_Pressure = 1.*atmosphere
304 kGasThreshold = 10.*mg/cm3
305 
306 #
307 universe_mean_density = 1.e-25*g/cm3
308