StarClassLibrary/SystemOfUnits.h

00001 /*************************************************************************** 00002 * 00003 * $Id: SystemOfUnits.h,v 1.6 2007/08/17 16:04:46 fine Exp $ 00004 * 00005 * Author: blasiuk adapted from CLHEP 00006 *************************************************************************** 00007 * 00008 * Description: This file is based on the SystemOfUnits provided 00009 * in the CLHEP library v1.2: The units remain the same. 00010 * It is just the naming conventions that are different: 00011 * 00012 * 1) No single letter unit: 00013 * : m --> meter 00014 * : s --> second 00015 * : g --> gram 00016 * 00017 * 2) All prefixes are spelled out explicitly (except electron Volt): 00018 * : ns --> nanosecond 00019 * : mm --> millimeter 00020 * 00021 * 3) All units with proper names follow the international standard 00022 * of being lower case: 00023 * : farad --> farad 00024 * : volt --> volt 00025 * 00026 * The basic units are : 00027 * centimeter (centimeter) 00028 * second (second) 00029 * Giga electron Volt (GeV) 00030 * positron charge (eplus) 00031 * degree Kelvin (kelvin) 00032 * the amount of substance (mole) 00033 * radian (radian) 00034 * steradian (steradian) 00035 *************************************************************************** 00036 * 00037 * $Log: SystemOfUnits.h,v $ 00038 * Revision 1.6 2007/08/17 16:04:46 fine 00039 * Eliminate the redundant semicolon - causes the compilation error with the pedantic compilation flag 00040 * 00041 * Revision 1.5 2003/09/02 17:59:35 perev 00042 * gcc 3.2 updates + WarnOff 00043 * 00044 * Revision 1.4 1999/03/22 16:21:38 fisyak 00045 * Add anti CINT flags 00046 * 00047 * Revision 1.3 1999/03/11 14:53:07 ullrich 00048 * Added definition of inch. 00049 * 00050 * Revision 1.2 1999/03/02 20:15:08 ullrich 00051 * Added millivolt. 00052 * 00053 * Revision 1.1 1999/01/30 03:59:06 fisyak 00054 * Root Version of StarClassLibrary 00055 * 00056 * Revision 1.1 1999/01/23 00:28:08 ullrich 00057 * Initial Revision 00058 * 00059 **************************************************************************/ 00060 #ifndef HEP_SYSTEM_OF_UNITS_H 00061 #define HEP_SYSTEM_OF_UNITS_H 00062 00063 #include <math.h> 00064 00065 namespace units { 00066 // new macro for CLHEP SystemOfUnits: at end of file 00067 // ST_ADD_OLD_CLHEP_SYSTEM_OF_UNITS 00068 // 00069 // Length [L] 00070 // 00071 static const double millimeter = 0.1; 00072 static const double millimeter2 = millimeter*millimeter; 00073 static const double millimeter3 = millimeter*millimeter*millimeter; 00074 00075 static const double centimeter = 10*millimeter; 00076 static const double centimeter2 = centimeter*centimeter; 00077 static const double centimeter3 = centimeter*centimeter*centimeter; 00078 00079 static const double meter = 100.*centimeter; 00080 static const double meter2 = meter*meter; 00081 static const double meter3 = meter*meter*meter; 00082 00083 static const double kilometer = 1000.*meter; 00084 static const double kilometer2 = kilometer*kilometer; 00085 static const double kilometer3 = kilometer*kilometer*kilometer; 00086 00087 static const double micrometer = 1.e-6*meter; 00088 static const double nanometer = 1.e-9*meter; 00089 static const double femtometer = 1.e-15*meter; 00090 static const double fermi = 1*femtometer; 00091 00092 static const double barn = 1.e-28*meter2; 00093 static const double millibarn = 1.e-3*barn; 00094 static const double microbarn = 1.e-6*barn; 00095 static const double nanobarn = 1.e-9*barn; 00096 static const double inch = 2.54*centimeter; 00097 00098 // 00099 // Angle 00100 // 00101 static const double radian = 1.; 00102 static const double milliradian = 1.e-3*radian; 00103 #ifndef __CINT__ 00104 static const double degree = (M_PI/180.0)*radian; 00105 #endif 00106 static const double steradian = 1.; 00107 00108 // 00109 // Time [T] 00110 // 00111 static const double second = 1; 00112 static const double millisecond = 1.e-3*second; 00113 static const double microsecond = 1.e-3*millisecond; 00114 static const double nanosecond = 1.e-3*microsecond; 00115 00116 static const double hertz = 1./second; 00117 static const double kilohertz = 1.e+3*hertz; 00118 static const double Megahertz = 1.e+6*hertz; 00119 00120 // but these are also unambiguous and unlikely to be used as variable! 00121 static const double Hz = 1*hertz; 00122 static const double kHz = 1*kilohertz; 00123 static const double MHz = 1*Megahertz; 00124 00125 // 00126 // Electric charge [Q] 00127 // 00128 static const double eplus = 1. ; // positron charge 00129 static const double e_SI = 1.60217733e-19; // positron charge in coulomb 00130 static const double coulomb = eplus/e_SI; 00131 00132 // 00133 // Energy [E] 00134 // 00135 static const double Gigaelectronvolt = 1.; 00136 static const double Megaelectronvolt = 1.e-3*Gigaelectronvolt; 00137 static const double electronvolt = 1.e-6*Megaelectronvolt; 00138 static const double kiloelectronvolt = 1.e+3*electronvolt; 00139 static const double Teraelectronvolt = 1.e+3*Gigaelectronvolt; 00140 00141 // but these are also unambiguous and unlikely to be used as variables 00142 static const double MeV = Megaelectronvolt; 00143 static const double eV = electronvolt; 00144 static const double keV = kiloelectronvolt; 00145 static const double GeV = Gigaelectronvolt; 00146 static const double TeV = Teraelectronvolt; 00147 00148 static const double joule = electronvolt/e_SI; 00149 00150 // 00151 // Mass [E][T^2][L^-2] 00152 // 00153 static const double kilogram = joule*second*second/(meter*meter); 00154 static const double gram = 1.e-3*kilogram; 00155 static const double milligram = 1.e-3*gram; 00156 00157 // 00158 // Power [E][T^-1] 00159 // 00160 static const double watt = joule/second; 00161 00162 // 00163 // Force [E][L^-1] 00164 // 00165 static const double newton = joule/meter; 00166 00167 // 00168 // Pressure [E][L^-3] 00169 // 00170 #ifndef __CINT__ 00171 #define pascal hep_pascal // a trick to avoid warnings 00172 static const double hep_pascal = newton/meter2; 00173 #else 00174 static const double pascal = newton/meter2; 00175 #endif 00176 static const double bar = 100000*pascal; 00177 static const double atmosphere = 101325*pascal; 00178 00179 // 00180 // Electric current [Q][T^-1] 00181 // 00182 static const double ampere = coulomb/second; 00183 00184 // 00185 // Electric potential [E][Q^-1] 00186 // 00187 static const double Megavolt = MeV/eplus; 00188 static const double kilovolt = 1.e-3*Megavolt; 00189 static const double volt = 1.e-6*Megavolt; 00190 static const double millivolt = 1.e-3*volt; 00191 00192 // 00193 // Electric resistance [E][T][Q^-2] 00194 // 00195 static const double ohm = volt/ampere; 00196 00197 // 00198 // Electric capacitance [Q^2][E^-1] 00199 // 00200 static const double farad = coulomb/volt; 00201 static const double millifarad = 1.e-3*farad; 00202 static const double microfarad = 1.e-6*farad; 00203 static const double nanofarad = 1.e-9*farad; 00204 static const double picofarad = 1.e-12*farad; 00205 00206 // 00207 // Magnetic Flux [T][E][Q^-1] 00208 // 00209 static const double weber = volt*second; 00210 00211 // 00212 // Magnetic Field [T][E][Q^-1][L^-2] 00213 // 00214 static const double tesla = volt*second/meter2; 00215 00216 static const double gauss = 1.e-4*tesla; 00217 static const double kilogauss = 1.e-1*tesla; 00218 00219 // 00220 // Inductance [T^2][E][Q^-2] 00221 // 00222 static const double henry = weber/ampere; 00223 00224 // 00225 // Temperature 00226 // 00227 static const double kelvin = 1.; 00228 00229 // 00230 // Amount of substance 00231 // 00232 static const double mole = 1.; 00233 00234 // 00235 // Activity [T^-1] 00236 // 00237 static const double becquerel = 1./second; 00238 static const double curie = 3.7e+10 * becquerel; 00239 00240 // 00241 // Absorbed dose [L^2][T^-2] 00242 // 00243 static const double gray = joule/kilogram ; 00244 00245 // 00246 // Miscellaneous 00247 // 00248 static const double perCent = 0.01 ; 00249 static const double perThousand = 0.001; 00250 static const double perMillion = 0.000001; 00251 00252 #ifdef ST_ADD_OLD_CLHEP_SYSTEM_OF_UNITS 00253 00254 static const double mm = 0.1; // millimeter 00255 static const double mm2 = mm*mm; 00256 static const double mm3 = mm*mm*mm; 00257 00258 static const double cm = 10.*mm; // centimeter 00259 static const double cm2 = cm*cm; 00260 static const double cm3 = cm*cm*cm; 00261 00262 static const double m = 1000.*mm; // meter 00263 static const double m2 = m*m; 00264 static const double m3 = m*m*m; 00265 00266 static const double km = 1000.*m; // kilometer 00267 static const double km2 = km*km; 00268 static const double km3 = km*km*km; 00269 00270 static const double microm = 1.e-6*m; // micro meter 00271 static const double nanom = 1.e-9*m; 00272 //static const double fermi = 1.e-15*m; 00273 00274 // 00275 // Angle 00276 // 00277 static const double rad = 1.; // radian 00278 static const double mrad = 1.e-3*rad; // milliradian 00279 static const double deg = (M_PI/180.0)*rad; 00280 00281 static const double st = 1.; // steradian 00282 00283 // 00284 // Time [T] 00285 // 00286 static const double s = 1; // second 00287 static const double ns = 1.e-9*s; // nano second 00288 static const double ms = 1.e-3*s; // milli second 00289 00290 // Mass [E][T^2][L^-2] 00291 // 00292 static const double kg = joule*second*second/(meter*meter); // kg = 6.24150 e+24 * MeV*ns*ns/(mm*mm) 00293 static const double g = 1.e-3*kg; 00294 static const double mg = 1.e-3*g; 00295 00296 #endif 00297 00298 } 00299 using namespace units; 00300 #endif /* HEP_SYSTEM_OF_UNITS_H */

Generated on Sun Mar 15 04:51:10 2009 for StRoot by doxygen 1.3.7