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