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