]> git.uio.no Git - u/mrichter/AliRoot.git/blob - SystemOfUnits.h
c5cf7a52a938974ef83b7ed3d6a8f0e60745ce7c
[u/mrichter/AliRoot.git] / SystemOfUnits.h
1 /***************************************************************************
2  *
3  * $Id$
4  *
5  * Author: blasiuk adapted from CLHEP
6  ***************************************************************************
7  *
8  * Description:  This file is based on the SystemOfUnits provided
9  *               in the CLHEP library v1.2:  The units remain the same.
10  *               It is just the naming conventions that are different:
11  *
12  * 1) No single letter unit:
13  *    : m --> meter
14  *    : s --> second
15  *    : g --> gram
16  *
17  * 2) All prefixes are spelled out explicitly (except electron Volt):
18  *    : ns --> nanosecond
19  *    : mm --> millimeter
20  *
21  * 3) All units with proper names follow the international standard
22  *    of being lower case:
23  *    : farad --> farad
24  *    : volt  --> volt
25  *
26  * The basic units are :
27  *              centimeter              (centimeter)
28  *              second                  (second)
29  *              Giga electron Volt      (GeV)
30  *              positron charge         (eplus)
31  *              degree Kelvin           (kelvin)
32  *              the amount of substance (mole)
33  *              radian                  (radian)
34  *              steradian               (steradian)
35  ***************************************************************************
36  *
37  * $Log$
38  * Revision 1.1.1.1  2007/04/25 15:38:41  panos
39  * Importing the HBT code dir
40  *
41  * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
42  * First version on CVS
43  *
44  * Revision 1.5  2003/09/02 17:59:35  perev
45  * gcc 3.2 updates + WarnOff
46  *
47  * Revision 1.4  1999/03/22 16:21:38  fisyak
48  * Add anti CINT flags
49  *
50  * Revision 1.3  1999/03/11 14:53:07  ullrich
51  * Added definition of inch.
52  *
53  * Revision 1.2  1999/03/02 20:15:08  ullrich
54  * Added millivolt.
55  *
56  * Revision 1.1  1999/01/30 03:59:06  fisyak
57  * Root Version of StarClassLibrary
58  *
59  * Revision 1.1  1999/01/23 00:28:08  ullrich
60  * Initial Revision
61  *
62  **************************************************************************/
63 #ifndef HEP_SYSTEM_OF_UNITS_H
64 #define HEP_SYSTEM_OF_UNITS_H
65
66
67 #ifndef M_PI
68 #define M_PI 3.14159265358979312
69 #endif
70
71
72 namespace units {
73     // new macro for CLHEP SystemOfUnits: at end of file
74     //  ST_ADD_OLD_CLHEP_SYSTEM_OF_UNITS
75     // 
76     // Length [L]
77     //
78     static const double millimeter  = 0.1;
79     static const double millimeter2 = millimeter*millimeter;
80     static const double millimeter3 = millimeter*millimeter*millimeter;
81
82     static const double centimeter  = 10*millimeter;
83     static const double centimeter2 = centimeter*centimeter;
84     static const double centimeter3 = centimeter*centimeter*centimeter;
85
86     static const double meter       = 100.*centimeter;
87     static const double meter2      = meter*meter;
88     static const double meter3      = meter*meter*meter;
89
90     static const double kilometer   = 1000.*meter;
91     static const double kilometer2  = kilometer*kilometer;
92     static const double kilometer3  = kilometer*kilometer*kilometer;
93
94     static const double micrometer  = 1.e-6*meter;
95     static const double nanometer   = 1.e-9*meter;
96     static const double femtometer  = 1.e-15*meter;
97     static const double fermi       = 1*femtometer;
98     
99     static const double      barn   = 1.e-28*meter2;
100     static const double millibarn   = 1.e-3*barn;
101     static const double microbarn   = 1.e-6*barn;
102     static const double  nanobarn   = 1.e-9*barn;
103     static const double      inch   = 2.54*centimeter;
104     
105     //
106     // Angle
107     //
108     static const double      radian = 1.;
109     static const double milliradian = 1.e-3*radian;
110 #ifndef __CINT__
111     static const double      degree = (M_PI/180.0)*radian;
112 #endif    
113     static const double   steradian = 1.;
114
115     //
116     // Time [T]
117     //
118     static const double      second = 1;
119     static const double millisecond = 1.e-3*second;
120     static const double microsecond = 1.e-3*millisecond;
121     static const double  nanosecond = 1.e-3*microsecond;
122     
123     static const double     hertz   = 1./second;
124     static const double kilohertz   = 1.e+3*hertz;
125     static const double Megahertz   = 1.e+6*hertz;
126     
127     // but these are also unambiguous and unlikely to be used as variable!
128     static const double  Hz         = 1*hertz;
129     static const double kHz         = 1*kilohertz;
130     static const double MHz         = 1*Megahertz;
131
132     //
133     // Electric charge [Q]
134     //
135     static const double eplus   = 1. ;                  // positron charge
136     static const double e_SI    = 1.60217733e-19;       // positron charge in coulomb
137     static const double coulomb = eplus/e_SI;
138     
139     //
140     // Energy [E]
141     //
142     static const double Gigaelectronvolt = 1.;
143     static const double Megaelectronvolt = 1.e-3*Gigaelectronvolt;
144     static const double     electronvolt = 1.e-6*Megaelectronvolt;
145     static const double kiloelectronvolt = 1.e+3*electronvolt;
146     static const double Teraelectronvolt = 1.e+3*Gigaelectronvolt;
147     
148     // but these are also unambiguous and unlikely to be used as variables
149     static const double MeV     = Megaelectronvolt;
150     static const double  eV     =     electronvolt;
151     static const double keV     = kiloelectronvolt;
152     static const double GeV     = Gigaelectronvolt;
153     static const double TeV     = Teraelectronvolt;
154     
155     static const double joule   = electronvolt/e_SI;
156     
157     //
158     // Mass [E][T^2][L^-2]
159     //
160     static const double  kilogram = joule*second*second/(meter*meter);
161     static const double      gram = 1.e-3*kilogram;
162     static const double milligram = 1.e-3*gram;
163
164     //
165     // Power [E][T^-1]
166     //
167     static const double watt    = joule/second;
168     
169     //
170     // Force [E][L^-1]
171     //
172     static const double newton  = joule/meter;
173
174     //
175     // Pressure [E][L^-3]
176     //
177 #ifndef __CINT__    
178 #define pascal hep_pascal       // a trick to avoid warnings 
179     static const double hep_pascal = newton/meter2;
180 #else
181     static const double pascal     = newton/meter2;
182 #endif
183     static const double bar        = 100000*pascal;
184     static const double atmosphere = 101325*pascal;
185
186     //
187     // Electric current [Q][T^-1]
188     //
189     static const double ampere   = coulomb/second;
190     
191     //
192     // Electric potential [E][Q^-1]
193     //
194     static const double Megavolt = MeV/eplus;
195     static const double kilovolt = 1.e-3*Megavolt;
196     static const double     volt = 1.e-6*Megavolt;
197     static const double millivolt = 1.e-3*volt;
198     
199     //
200     // Electric resistance [E][T][Q^-2]
201     //
202     static const double ohm = volt/ampere;
203     
204     //
205     // Electric capacitance [Q^2][E^-1]
206     //
207     static const double farad = coulomb/volt;
208     static const double millifarad = 1.e-3*farad;
209     static const double microfarad = 1.e-6*farad;
210     static const double  nanofarad = 1.e-9*farad;
211     static const double  picofarad = 1.e-12*farad;
212     
213     //
214     // Magnetic Flux [T][E][Q^-1]
215     //
216     static const double weber = volt*second;
217     
218     //
219     // Magnetic Field [T][E][Q^-1][L^-2]
220     //
221     static const double tesla     = volt*second/meter2;
222     
223     static const double gauss     = 1.e-4*tesla;
224     static const double kilogauss = 1.e-1*tesla;
225
226     //
227     // Inductance [T^2][E][Q^-2]
228     //
229     static const double henry = weber/ampere;
230
231     //
232     // Temperature
233     //
234     static const double kelvin = 1.;
235
236     //
237     // Amount of substance
238     //
239     static const double mole = 1.;
240     
241     //
242     // Activity [T^-1]
243     //
244     static const double becquerel = 1./second;
245     static const double curie = 3.7e+10 * becquerel;
246     
247     //
248     // Absorbed dose [L^2][T^-2]
249     //
250     static const double gray = joule/kilogram ;
251
252     //
253     // Miscellaneous
254     //
255     static const double perCent     = 0.01 ;
256     static const double perThousand = 0.001;
257     static const double perMillion  = 0.000001;
258
259 #ifdef ST_ADD_OLD_CLHEP_SYSTEM_OF_UNITS
260
261     static const double mm  = 0.1;         // millimeter
262     static const double mm2 = mm*mm;
263     static const double mm3 = mm*mm*mm;
264     
265     static const double cm  = 10.*mm;      // centimeter
266     static const double cm2 = cm*cm;
267     static const double cm3 = cm*cm*cm;
268     
269     static const double m  = 1000.*mm;     // meter
270     static const double m2 = m*m;
271     static const double m3 = m*m*m;
272     
273     static const double km = 1000.*m;      // kilometer
274     static const double km2 = km*km;
275     static const double km3 = km*km*km;
276
277     static const double microm = 1.e-6*m;  // micro meter
278     static const double  nanom = 1.e-9*m;
279     //static const double  fermi = 1.e-15*m;
280
281     //
282     // Angle
283     //
284     static const double  rad = 1.;        // radian 
285     static const double mrad = 1.e-3*rad; // milliradian
286     static const double  deg = (M_PI/180.0)*rad;
287
288     static const double   st = 1.;          // steradian
289
290     //
291     // Time [T]
292     //
293     static const double  s = 1;           // second
294     static const double ns = 1.e-9*s;     // nano second
295     static const double ms = 1.e-3*s;     // milli second
296
297     // Mass [E][T^2][L^-2]
298     //
299     static const double kg = joule*second*second/(meter*meter); // kg = 6.24150 e+24 * MeV*ns*ns/(mm*mm)   
300     static const double  g = 1.e-3*kg;
301     static const double mg = 1.e-3*g;
302
303 #endif
304
305 };
306 using namespace units;
307 #endif /* HEP_SYSTEM_OF_UNITS_H */