Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 11:02:48

0001 /***************************************************************************
0002  *
0003  * $Id: SystemOfUnits.h,v 1.7 2012/06/11 15:29:27 fisyak Exp $
0004  *
0005  * Author: blasiuk adapted from CLHEP
0006  ***************************************************************************
0007  *
0008  * Description:  This file is based on the SystemOfUnits provided
0009  *               in the CLHEP library v1.2:  The units remain the same.
0010  *               It is just the naming conventions that are different:
0011  *
0012  * 1) No single letter unit:
0013  *    : m --> meter
0014  *    : s --> second
0015  *    : g --> gram
0016  *
0017  * 2) All prefixes are spelled out explicitly (except electron Volt):
0018  *    : ns --> nanosecond
0019  *    : mm --> millimeter
0020  *
0021  * 3) All units with proper names follow the international standard
0022  *    of being lower case:
0023  *    : farad --> farad
0024  *    : volt  --> volt
0025  *
0026  * The basic units are :
0027  *              centimeter              (centimeter)
0028  *              second                  (second)
0029  *              Giga electron Volt      (GeV)
0030  *              positron charge         (eplus)
0031  *              degree Kelvin           (kelvin)
0032  *              the amount of substance (mole)
0033  *              radian                  (radian)
0034  *              steradian               (steradian)
0035  ***************************************************************************
0036  *
0037  * $Log: SystemOfUnits.h,v $
0038  * Revision 1.7  2012/06/11 15:29:27  fisyak
0039  * std namespace
0040  *
0041  * Revision 1.6  2007/08/17 16:04:46  fine
0042  * Eliminate the redundant semicolon - causes the compilation error with the pedantic compilation flag
0043  *
0044  * Revision 1.5  2003/09/02 17:59:35  perev
0045  * gcc 3.2 updates + WarnOff
0046  *
0047  * Revision 1.4  1999/03/22 16:21:38  fisyak
0048  * Add anti CINT flags
0049  *
0050  * Revision 1.3  1999/03/11 14:53:07  ullrich
0051  * Added definition of inch.
0052  *
0053  * Revision 1.2  1999/03/02 20:15:08  ullrich
0054  * Added millivolt.
0055  *
0056  * Revision 1.1  1999/01/30 03:59:06  fisyak
0057  * Root Version of StarClassLibrary
0058  *
0059  * Revision 1.1  1999/01/23 00:28:08  ullrich
0060  * Initial Revision
0061  *
0062  **************************************************************************/
0063 #ifndef HEP_SYSTEM_OF_UNITS_H
0064 #define HEP_SYSTEM_OF_UNITS_H
0065 
0066 #include <math.h>
0067 
0068 namespace units {
0069     // new macro for CLHEP SystemOfUnits: at end of file
0070     //  ST_ADD_OLD_CLHEP_SYSTEM_OF_UNITS
0071     // 
0072     // Length [L]
0073     //
0074     static const double millimeter  = 0.1;
0075     static const double millimeter2 = millimeter*millimeter;
0076     static const double millimeter3 = millimeter*millimeter*millimeter;
0077 
0078     static const double centimeter  = 10*millimeter;
0079     static const double centimeter2 = centimeter*centimeter;
0080     static const double centimeter3 = centimeter*centimeter*centimeter;
0081 
0082     static const double meter       = 100.*centimeter;
0083     static const double meter2      = meter*meter;
0084     static const double meter3      = meter*meter*meter;
0085 
0086     static const double kilometer   = 1000.*meter;
0087     static const double kilometer2  = kilometer*kilometer;
0088     static const double kilometer3  = kilometer*kilometer*kilometer;
0089 
0090     static const double micrometer  = 1.e-6*meter;
0091     static const double nanometer   = 1.e-9*meter;
0092     static const double femtometer  = 1.e-15*meter;
0093     static const double fermi       = 1*femtometer;
0094     
0095     static const double      barn   = 1.e-28*meter2;
0096     static const double millibarn   = 1.e-3*barn;
0097     static const double microbarn   = 1.e-6*barn;
0098     static const double  nanobarn   = 1.e-9*barn;
0099     static const double      inch   = 2.54*centimeter;
0100     
0101     //
0102     // Angle
0103     //
0104     static const double      radian = 1.;
0105     static const double milliradian = 1.e-3*radian;
0106 #ifndef __CINT__
0107     static const double      degree = (M_PI/180.0)*radian;
0108 #endif    
0109     static const double   steradian = 1.;
0110 
0111     //
0112     // Time [T]
0113     //
0114     static const double      second = 1;
0115     static const double millisecond = 1.e-3*second;
0116     static const double microsecond = 1.e-3*millisecond;
0117     static const double  nanosecond = 1.e-3*microsecond;
0118     
0119     static const double     hertz   = 1./second;
0120     static const double kilohertz   = 1.e+3*hertz;
0121     static const double Megahertz   = 1.e+6*hertz;
0122     
0123     // but these are also unambiguous and unlikely to be used as variable!
0124     static const double  Hz         = 1*hertz;
0125     static const double kHz         = 1*kilohertz;
0126     static const double MHz         = 1*Megahertz;
0127 
0128     //
0129     // Electric charge [Q]
0130     //
0131     static const double eplus   = 1. ;              // positron charge
0132     static const double e_SI    = 1.60217733e-19;   // positron charge in coulomb
0133     static const double coulomb = eplus/e_SI;
0134     
0135     //
0136     // Energy [E]
0137     //
0138     static const double Gigaelectronvolt = 1.;
0139     static const double Megaelectronvolt = 1.e-3*Gigaelectronvolt;
0140     static const double     electronvolt = 1.e-6*Megaelectronvolt;
0141     static const double kiloelectronvolt = 1.e+3*electronvolt;
0142     static const double Teraelectronvolt = 1.e+3*Gigaelectronvolt;
0143     
0144     // but these are also unambiguous and unlikely to be used as variables
0145     static const double MeV     = Megaelectronvolt;
0146     static const double  eV     =     electronvolt;
0147     static const double keV     = kiloelectronvolt;
0148     static const double GeV     = Gigaelectronvolt;
0149     static const double TeV     = Teraelectronvolt;
0150     static const double amu     = 931.49406121 * MeV;//  unified Atomic mass unit     
0151     static const double joule   = electronvolt/e_SI;
0152     
0153     //
0154     // Mass [E][T^2][L^-2]
0155     //
0156     static const double  kilogram = joule*second*second/(meter*meter);
0157     static const double      gram = 1.e-3*kilogram;
0158     static const double milligram = 1.e-3*gram;
0159 
0160     //
0161     // Power [E][T^-1]
0162     //
0163     static const double watt    = joule/second;
0164     
0165     //
0166     // Force [E][L^-1]
0167     //
0168     static const double newton  = joule/meter;
0169 
0170     //
0171     // Pressure [E][L^-3]
0172     //
0173 #ifndef __CINT__    
0174 #define pascal hep_pascal       // a trick to avoid warnings 
0175     static const double hep_pascal = newton/meter2;
0176 #else
0177     static const double pascal     = newton/meter2;
0178 #endif
0179     static const double bar        = 100000*pascal;
0180     static const double atmosphere = 101325*pascal;
0181 
0182     //
0183     // Electric current [Q][T^-1]
0184     //
0185     static const double ampere   = coulomb/second;
0186     
0187     //
0188     // Electric potential [E][Q^-1]
0189     //
0190     static const double Megavolt = MeV/eplus;
0191     static const double kilovolt = 1.e-3*Megavolt;
0192     static const double     volt = 1.e-6*Megavolt;
0193     static const double millivolt = 1.e-3*volt;
0194     
0195     //
0196     // Electric resistance [E][T][Q^-2]
0197     //
0198     static const double ohm = volt/ampere;
0199     
0200     //
0201     // Electric capacitance [Q^2][E^-1]
0202     //
0203     static const double farad = coulomb/volt;
0204     static const double millifarad = 1.e-3*farad;
0205     static const double microfarad = 1.e-6*farad;
0206     static const double  nanofarad = 1.e-9*farad;
0207     static const double  picofarad = 1.e-12*farad;
0208     
0209     //
0210     // Magnetic Flux [T][E][Q^-1]
0211     //
0212     static const double weber = volt*second;
0213     
0214     //
0215     // Magnetic Field [T][E][Q^-1][L^-2]
0216     //
0217     static const double tesla     = volt*second/meter2;
0218     
0219     static const double gauss     = 1.e-4*tesla;
0220     static const double kilogauss = 1.e-1*tesla;
0221 
0222     //
0223     // Inductance [T^2][E][Q^-2]
0224     //
0225     static const double henry = weber/ampere;
0226 
0227     //
0228     // Temperature
0229     //
0230     static const double kelvin = 1.;
0231 
0232     //
0233     // Amount of substance
0234     //
0235     static const double mole = 1.;
0236     
0237     //
0238     // Activity [T^-1]
0239     //
0240     static const double becquerel = 1./second;
0241     static const double curie = 3.7e+10 * becquerel;
0242     
0243     //
0244     // Absorbed dose [L^2][T^-2]
0245     //
0246     static const double gray = joule/kilogram ;
0247 
0248     //
0249     // Miscellaneous
0250     //
0251     static const double perCent     = 0.01 ;
0252     static const double perThousand = 0.001;
0253     static const double perMillion  = 0.000001;
0254 
0255 #ifdef ST_ADD_OLD_CLHEP_SYSTEM_OF_UNITS
0256 
0257     static const double mm  = 0.1;         // millimeter
0258     static const double mm2 = mm*mm;
0259     static const double mm3 = mm*mm*mm;
0260     
0261     static const double cm  = 10.*mm;      // centimeter
0262     static const double cm2 = cm*cm;
0263     static const double cm3 = cm*cm*cm;
0264     
0265     static const double m  = 1000.*mm;     // meter
0266     static const double m2 = m*m;
0267     static const double m3 = m*m*m;
0268     
0269     static const double km = 1000.*m;      // kilometer
0270     static const double km2 = km*km;
0271     static const double km3 = km*km*km;
0272 
0273     static const double microm = 1.e-6*m;  // micro meter
0274     static const double  nanom = 1.e-9*m;
0275     //static const double  fermi = 1.e-15*m;
0276 
0277     //
0278     // Angle
0279     //
0280     static const double  rad = 1.;        // radian 
0281     static const double mrad = 1.e-3*rad; // milliradian
0282     static const double  deg = (M_PI/180.0)*rad;
0283 
0284     static const double   st = 1.;      // steradian
0285 
0286     //
0287     // Time [T]
0288     //
0289     static const double  s = 1;           // second
0290     static const double ns = 1.e-9*s;     // nano second
0291     static const double ms = 1.e-3*s;     // milli second
0292 
0293     // Mass [E][T^2][L^-2]
0294     //
0295     static const double kg = joule*second*second/(meter*meter); // kg = 6.24150 e+24 * MeV*ns*ns/(mm*mm)   
0296     static const double  g = 1.e-3*kg;
0297     static const double mg = 1.e-3*g;
0298 
0299 #endif
0300 
0301 }
0302 using namespace units;
0303 #endif /* HEP_SYSTEM_OF_UNITS_H */