Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:54:39

0001 // -*- C++ -*-
0002 // $Id: SystemOfUnits.h,v 1.4 2010/06/16 17:12:28 garren Exp $
0003 // ----------------------------------------------------------------------
0004 // HEP coherent system of Units
0005 //
0006 // This file has been provided to CLHEP by Geant4 (simulation toolkit for HEP).
0007 //
0008 // The basic units are :
0009 // millimeter              (millimeter)
0010 // nanosecond              (nanosecond)
0011 // Mega electron Volt      (MeV)
0012 // positron charge         (eplus)
0013 // degree Kelvin           (kelvin)
0014 // the amount of substance (mole)
0015 // luminous intensity      (candela)
0016 // radian                  (radian)
0017 // steradian               (steradian)
0018 //
0019 // Below is a non exhaustive list of derived and pratical units
0020 // (i.e. mostly the SI units).
0021 // You can add your own units.
0022 //
0023 // The SI numerical value of the positron charge is defined here,
0024 // as it is needed for conversion factor : positron charge = e_SI (coulomb)
0025 //
0026 // The others physical constants are defined in the header file :
0027 // PhysicalConstants.h
0028 //
0029 // Authors: M.Maire, S.Giani
0030 //
0031 // History:
0032 //
0033 // 06.02.96   Created.
0034 // 28.03.96   Added miscellaneous constants.
0035 // 05.12.97   E.Tcherniaev: Redefined pascal (to avoid warnings on WinNT)
0036 // 20.05.98   names: meter, second, gram, radian, degree
0037 //            (from Brian.Lasiuk@yale.edu (STAR)). Added luminous units.
0038 // 05.08.98   angstrom, picobarn, microsecond, picosecond, petaelectronvolt
0039 // 01.03.01   parsec    
0040 // 31.01.06   kilogray, milligray, microgray    
0041 // 29.04.08   use PDG 2006 value of e_SI
0042 // 03.11.08   use PDG 2008 value of e_SI
0043 // 19.08.15   added liter and its sub units (mma)
0044 // 12.01.16   added symbols for microsecond (us) and picosecond (ps) (mma)
0045 // 17.07.20   use PDG 2019 value of e_SI
0046 // 06.05.21   added minute, hour, day, year and millielectronvolt (mma)
0047 
0048 #ifndef HEP_SYSTEM_OF_UNITS_H
0049 #define HEP_SYSTEM_OF_UNITS_H
0050 
0051 #include "CLHEP/Units/defs.h"
0052 
0053 namespace CLHEP {
0054 
0055   //
0056   //
0057   //
0058   static constexpr double     pi  = 3.14159265358979323846;
0059   static constexpr double  twopi  = 2*pi;
0060   static constexpr double halfpi  = pi/2;
0061   static constexpr double     pi2 = pi*pi;
0062 
0063   // 
0064   // Length [L]
0065   //
0066   static constexpr double millimeter  = 1.;                        
0067   static constexpr double millimeter2 = millimeter*millimeter;
0068   static constexpr double millimeter3 = millimeter*millimeter*millimeter;
0069 
0070   static constexpr double centimeter  = 10.*millimeter;   
0071   static constexpr double centimeter2 = centimeter*centimeter;
0072   static constexpr double centimeter3 = centimeter*centimeter*centimeter;
0073 
0074   static constexpr double meter  = 1000.*millimeter;                  
0075   static constexpr double meter2 = meter*meter;
0076   static constexpr double meter3 = meter*meter*meter;
0077 
0078   static constexpr double kilometer = 1000.*meter;                   
0079   static constexpr double kilometer2 = kilometer*kilometer;
0080   static constexpr double kilometer3 = kilometer*kilometer*kilometer;
0081 
0082   static constexpr double parsec = 3.0856775807e+16*meter;
0083 
0084   static constexpr double micrometer = 1.e-6 *meter;             
0085   static constexpr double  nanometer = 1.e-9 *meter;
0086   static constexpr double  angstrom  = 1.e-10*meter;
0087   static constexpr double  fermi     = 1.e-15*meter;
0088 
0089   static constexpr double      barn = 1.e-28*meter2;
0090   static constexpr double millibarn = 1.e-3 *barn;
0091   static constexpr double microbarn = 1.e-6 *barn;
0092   static constexpr double  nanobarn = 1.e-9 *barn;
0093   static constexpr double  picobarn = 1.e-12*barn;
0094 
0095   // symbols
0096   static constexpr double nm  = nanometer;                        
0097   static constexpr double um  = micrometer;                        
0098 
0099   static constexpr double mm  = millimeter;                        
0100   static constexpr double mm2 = millimeter2;
0101   static constexpr double mm3 = millimeter3;
0102 
0103   static constexpr double cm  = centimeter;   
0104   static constexpr double cm2 = centimeter2;
0105   static constexpr double cm3 = centimeter3;
0106 
0107   static constexpr double liter = 1.e+3*cm3;
0108   static constexpr double  L = liter;
0109   static constexpr double dL = 1.e-1*liter;
0110   static constexpr double cL = 1.e-2*liter;
0111   static constexpr double mL = 1.e-3*liter;       
0112 
0113   static constexpr double m  = meter;                  
0114   static constexpr double m2 = meter2;
0115   static constexpr double m3 = meter3;
0116 
0117   static constexpr double km  = kilometer;                   
0118   static constexpr double km2 = kilometer2;
0119   static constexpr double km3 = kilometer3;
0120 
0121   static constexpr double pc = parsec;
0122 
0123   //
0124   // Angle
0125   //
0126   static constexpr double radian      = 1.;                  
0127   static constexpr double milliradian = 1.e-3*radian;
0128   static constexpr double degree = (pi/180.0)*radian;
0129 
0130   static constexpr double   steradian = 1.;
0131   
0132   // symbols
0133   static constexpr double rad  = radian;
0134   static constexpr double mrad = milliradian;
0135   static constexpr double sr   = steradian;
0136   static constexpr double deg  = degree;
0137 
0138   //
0139   // Time [T]
0140   //
0141   static constexpr double nanosecond  = 1.;
0142   static constexpr double second      = 1.e+9 *nanosecond;
0143   static constexpr double millisecond = 1.e-3 *second;
0144   static constexpr double microsecond = 1.e-6 *second;
0145   static constexpr double  picosecond = 1.e-12*second;
0146 
0147   static constexpr double minute = 60*second;
0148   static constexpr double hour   = 60*minute;
0149   static constexpr double day    = 24*hour;
0150   static constexpr double year   = 365*day;  
0151 
0152   static constexpr double hertz = 1./second;
0153   static constexpr double kilohertz = 1.e+3*hertz;
0154   static constexpr double megahertz = 1.e+6*hertz;
0155 
0156   // symbols
0157   static constexpr double ns = nanosecond;
0158   static constexpr double  s = second;
0159   static constexpr double ms = millisecond;
0160   static constexpr double us = microsecond;
0161   static constexpr double ps = picosecond;
0162 
0163   //
0164   // Electric charge [Q]
0165   //
0166   static constexpr double eplus = 1. ;// positron charge
0167   static constexpr double e_SI  = 1.602176634e-19;// positron charge in coulomb
0168   static constexpr double coulomb = eplus/e_SI;// coulomb = 6.24150 e+18 * eplus
0169 
0170   //
0171   // Energy [E]
0172   //
0173   static constexpr double megaelectronvolt = 1. ;
0174   static constexpr double     electronvolt = 1.e-6*megaelectronvolt;
0175   static constexpr double kiloelectronvolt = 1.e-3*megaelectronvolt;
0176   static constexpr double gigaelectronvolt = 1.e+3*megaelectronvolt;
0177   static constexpr double teraelectronvolt = 1.e+6*megaelectronvolt;
0178   static constexpr double petaelectronvolt = 1.e+9*megaelectronvolt;
0179   static constexpr double millielectronvolt = 1.e-9*megaelectronvolt;  
0180 
0181   static constexpr double joule = electronvolt/e_SI;// joule = 6.24150 e+12 * MeV
0182 
0183   // symbols
0184   static constexpr double MeV = megaelectronvolt;
0185   static constexpr double  eV = electronvolt;
0186   static constexpr double keV = kiloelectronvolt;
0187   static constexpr double GeV = gigaelectronvolt;
0188   static constexpr double TeV = teraelectronvolt;
0189   static constexpr double PeV = petaelectronvolt;
0190 
0191   //
0192   // Mass [E][T^2][L^-2]
0193   //
0194   static constexpr double  kilogram = joule*second*second/(meter*meter);   
0195   static constexpr double      gram = 1.e-3*kilogram;
0196   static constexpr double milligram = 1.e-3*gram;
0197 
0198   // symbols
0199   static constexpr double  kg = kilogram;
0200   static constexpr double   g = gram;
0201   static constexpr double  mg = milligram;
0202 
0203   //
0204   // Power [E][T^-1]
0205   //
0206   static constexpr double watt = joule/second;// watt = 6.24150 e+3 * MeV/ns
0207 
0208   //
0209   // Force [E][L^-1]
0210   //
0211   static constexpr double newton = joule/meter;// newton = 6.24150 e+9 * MeV/mm
0212 
0213   //
0214   // Pressure [E][L^-3]
0215   //
0216 #define pascal hep_pascal                          // a trick to avoid warnings 
0217   static constexpr double hep_pascal = newton/m2;   // pascal = 6.24150 e+3 * MeV/mm3
0218   static constexpr double bar        = 100000*pascal; // bar    = 6.24150 e+8 * MeV/mm3
0219   static constexpr double atmosphere = 101325*pascal; // atm    = 6.32420 e+8 * MeV/mm3
0220 
0221   //
0222   // Electric current [Q][T^-1]
0223   //
0224   static constexpr double      ampere = coulomb/second; // ampere = 6.24150 e+9 * eplus/ns
0225   static constexpr double milliampere = 1.e-3*ampere;
0226   static constexpr double microampere = 1.e-6*ampere;
0227   static constexpr double  nanoampere = 1.e-9*ampere;
0228 
0229   //
0230   // Electric potential [E][Q^-1]
0231   //
0232   static constexpr double megavolt = megaelectronvolt/eplus;
0233   static constexpr double kilovolt = 1.e-3*megavolt;
0234   static constexpr double     volt = 1.e-6*megavolt;
0235 
0236   //
0237   // Electric resistance [E][T][Q^-2]
0238   //
0239   static constexpr double ohm = volt/ampere;// ohm = 1.60217e-16*(MeV/eplus)/(eplus/ns)
0240 
0241   //
0242   // Electric capacitance [Q^2][E^-1]
0243   //
0244   static constexpr double farad = coulomb/volt;// farad = 6.24150e+24 * eplus/Megavolt
0245   static constexpr double millifarad = 1.e-3*farad;
0246   static constexpr double microfarad = 1.e-6*farad;
0247   static constexpr double  nanofarad = 1.e-9*farad;
0248   static constexpr double  picofarad = 1.e-12*farad;
0249 
0250   //
0251   // Magnetic Flux [T][E][Q^-1]
0252   //
0253   static constexpr double weber = volt*second;// weber = 1000*megavolt*ns
0254 
0255   //
0256   // Magnetic Field [T][E][Q^-1][L^-2]
0257   //
0258   static constexpr double tesla     = volt*second/meter2;// tesla =0.001*megavolt*ns/mm2
0259 
0260   static constexpr double gauss     = 1.e-4*tesla;
0261   static constexpr double kilogauss = 1.e-1*tesla;
0262 
0263   //
0264   // Inductance [T^2][E][Q^-2]
0265   //
0266   static constexpr double henry = weber/ampere;// henry = 1.60217e-7*MeV*(ns/eplus)**2
0267 
0268   //
0269   // Temperature
0270   //
0271   static constexpr double kelvin = 1.;
0272 
0273   //
0274   // Amount of substance
0275   //
0276   static constexpr double mole = 1.;
0277 
0278   //
0279   // Activity [T^-1]
0280   //
0281   static constexpr double becquerel = 1./second ;
0282   static constexpr double curie = 3.7e+10 * becquerel;
0283   static constexpr double kilobecquerel = 1.e+3*becquerel;
0284   static constexpr double megabecquerel = 1.e+6*becquerel;
0285   static constexpr double gigabecquerel = 1.e+9*becquerel;
0286   static constexpr double millicurie = 1.e-3*curie;
0287   static constexpr double microcurie = 1.e-6*curie;
0288   static constexpr double Bq = becquerel;
0289   static constexpr double kBq = kilobecquerel;
0290   static constexpr double MBq = megabecquerel;
0291   static constexpr double GBq = gigabecquerel;
0292   static constexpr double Ci = curie;
0293   static constexpr double mCi = millicurie;
0294   static constexpr double uCi = microcurie;
0295 
0296   //
0297   // Absorbed dose [L^2][T^-2]
0298   //
0299   static constexpr double      gray = joule/kilogram ;
0300   static constexpr double  kilogray = 1.e+3*gray;
0301   static constexpr double milligray = 1.e-3*gray;
0302   static constexpr double microgray = 1.e-6*gray;
0303 
0304   //
0305   // Luminous intensity [I]
0306   //
0307   static constexpr double candela = 1.;
0308 
0309   //
0310   // Luminous flux [I]
0311   //
0312   static constexpr double lumen = candela*steradian;
0313 
0314   //
0315   // Illuminance [I][L^-2]
0316   //
0317   static constexpr double lux = lumen/meter2;
0318 
0319   //
0320   // Miscellaneous
0321   //
0322   static constexpr double perCent     = 0.01 ;
0323   static constexpr double perThousand = 0.001;
0324   static constexpr double perMillion  = 0.000001;
0325 
0326 }  // namespace CLHEP
0327 
0328 #ifdef ENABLE_BACKWARDS_COMPATIBILITY
0329 //  backwards compatibility will be enabled ONLY in CLHEP 1.9
0330 using namespace CLHEP;
0331 #endif
0332 
0333 #endif /* HEP_SYSTEM_OF_UNITS_H */