Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:14:30

0001 //==========================================================================
0002 //  AIDA Detector description implementation 
0003 //--------------------------------------------------------------------------
0004 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0005 // All rights reserved.
0006 //
0007 // For the licensing terms see $DD4hepINSTALL/LICENSE.
0008 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0009 //
0010 // Author     : M.Frank
0011 //
0012 //==========================================================================
0013 
0014 //
0015 // System of Units for dd4hep - similar to Geant3 and TGeo/ROOT
0016 //
0017 // Taken from CLHEP with the following basic translations:
0018 //
0019 // Geant4                                   dd4hep
0020 // ----------------------------------------------------------------
0021 // millimeter         mm=1,cm=10            centimeter  mm=0.1,cm=1
0022 // nanosecond         s=1e9                 second      ns=1e-9,s=1
0023 // Mega electron Volt GeV=1e3               GeV         GeV=1
0024 // radian             rad=1                 rad = 1  //NB: different from TGeo
0025 //
0026 //
0027 #ifndef EVALUATOR_DD4HEPUNITS_H
0028 #define EVALUATOR_DD4HEPUNITS_H
0029 
0030 #include "RVersion.h"
0031 
0032 /// Main dd4hep namespace. We must import here the ROOT TGeo units
0033 namespace dd4hep {
0034 
0035   //namespace units  {
0036     //
0037     // Length [L]
0038     //
0039 #ifdef DD4HEP_USE_GEANT4_UNITS
0040     static constexpr double millimeter = 1.0;
0041 #else
0042     static constexpr double millimeter = 0.1;
0043 #endif
0044     static constexpr double millimeter2 = millimeter * millimeter;
0045     static constexpr double millimeter3 = millimeter * millimeter * millimeter;
0046 
0047     static constexpr double centimeter = 10. * millimeter;
0048     static constexpr double centimeter2 = centimeter * centimeter;
0049     static constexpr double centimeter3 = centimeter * centimeter * centimeter;
0050 
0051     static constexpr double meter = 1000. * millimeter;
0052     static constexpr double meter2 = meter * meter;
0053     static constexpr double meter3 = meter * meter * meter;
0054 
0055     static constexpr double kilometer = 1000. * meter;
0056     static constexpr double kilometer2 = kilometer * kilometer;
0057     static constexpr double kilometer3 = kilometer * kilometer * kilometer;
0058 
0059     static constexpr double parsec = 3.0856775807e+16 * meter;
0060 
0061     static constexpr double micrometer = 1.e-6 * meter;
0062     static constexpr double nanometer = 1.e-9 * meter;
0063     static constexpr double angstrom = 1.e-10 * meter;
0064     static constexpr double fermi = 1.e-15 * meter;
0065 
0066     static constexpr double barn = 1.e-28 * meter2;
0067     static constexpr double millibarn = 1.e-3 * barn;
0068     static constexpr double microbarn = 1.e-6 * barn;
0069     static constexpr double nanobarn = 1.e-9 * barn;
0070     static constexpr double picobarn = 1.e-12 * barn;
0071 
0072     // symbols
0073     static constexpr double nm = nanometer;
0074     static constexpr double um = micrometer;
0075 
0076     static constexpr double mm = millimeter;
0077     static constexpr double mm2 = millimeter2;
0078     static constexpr double mm3 = millimeter3;
0079 
0080     static constexpr double cm = centimeter;
0081     static constexpr double cm2 = centimeter2;
0082     static constexpr double cm3 = centimeter3;
0083 
0084     static constexpr double m = meter;
0085     static constexpr double m2 = meter2;
0086     static constexpr double m3 = meter3;
0087 
0088     static constexpr double km = kilometer;
0089     static constexpr double km2 = kilometer2;
0090     static constexpr double km3 = kilometer3;
0091 
0092     static constexpr double pc = parsec;
0093 
0094     //
0095     // Angle
0096     //
0097     // static constexpr double radian = 180. / 3.14159265358979323846;   // => degree=1
0098     // static constexpr double milliradian = 1.e-3 * radian;
0099     // static constexpr double degree = 1.;   //= (3.14159265358979323846/180.0)*radian;
0100 
0101     //fg: use radians as default unit as this is needed for all math functions
0102     //    and everywhere else, except in TGeo shapes -> this is taken care of in shape Handles ....
0103     static constexpr double radian = 1. ;
0104     static constexpr double milliradian = 1.e-3 * radian;
0105     static constexpr double degree = (3.14159265358979323846/180.0)*radian;
0106 
0107     static constexpr double steradian = 1.;
0108 
0109     // symbols
0110     static constexpr double rad = radian;
0111     static constexpr double mrad = milliradian;
0112     static constexpr double sr = steradian;
0113     static constexpr double deg = degree;
0114 
0115     //
0116     // Time [T]
0117     //
0118 #ifdef DD4HEP_USE_GEANT4_UNITS
0119     static constexpr double nanosecond = 1.0;
0120 #else
0121     static constexpr double nanosecond = 1.e-9;
0122 #endif
0123     static constexpr double second = 1.e+9 * nanosecond;
0124     static constexpr double millisecond = 1.e-3 * second;
0125     static constexpr double microsecond = 1.e-6 * second;
0126     static constexpr double picosecond = 1.e-12 * second;
0127 
0128     static constexpr double hertz = 1. / second;
0129     static constexpr double kilohertz = 1.e+3 * hertz;
0130     static constexpr double megahertz = 1.e+6 * hertz;
0131 
0132     // symbols
0133     static constexpr double ns = nanosecond;
0134     static constexpr double s = second;
0135     static constexpr double ms = millisecond;
0136 
0137     //
0138     // Electric charge [Q]
0139     //
0140     static constexpr double eplus = 1.;   // positron charge
0141     static constexpr double e_SI = 1.602176487e-19;   // positron charge in coulomb
0142     static constexpr double coulomb = eplus / e_SI;   // coulomb = 6.24150 e+18 * eplus
0143 
0144     //
0145     // Energy [E]
0146     //
0147 #ifdef DD4HEP_USE_GEANT4_UNITS
0148     static constexpr double megaelectronvolt = 1.0;
0149 #else
0150     static constexpr double megaelectronvolt = 1.e-3;
0151 #endif
0152     static constexpr double electronvolt = 1.e-6 * megaelectronvolt;
0153     static constexpr double kiloelectronvolt = 1.e-3 * megaelectronvolt;
0154     static constexpr double gigaelectronvolt = 1.e+3 * megaelectronvolt;
0155     static constexpr double teraelectronvolt = 1.e+6 * megaelectronvolt;
0156     static constexpr double petaelectronvolt = 1.e+9 * megaelectronvolt;
0157 
0158     static constexpr double joule = electronvolt / e_SI;   // joule = 6.24150 e+12 * MeV
0159     static constexpr double kilojoule = 1.e3*joule;
0160 
0161     // symbols
0162     static constexpr double eV  = electronvolt;
0163     static constexpr double keV = kiloelectronvolt;
0164     static constexpr double MeV = megaelectronvolt;
0165     static constexpr double GeV = gigaelectronvolt;
0166     static constexpr double TeV = teraelectronvolt;
0167     static constexpr double PeV = petaelectronvolt;
0168 
0169     //
0170     // Mass [E][T^2][L^-2]
0171     //
0172     static constexpr double kilogram = joule * second * second / (meter * meter);
0173     static constexpr double gram = 1.e-3 * kilogram;
0174     static constexpr double milligram = 1.e-3 * gram;
0175 
0176     // symbols
0177     static constexpr double kg = kilogram;
0178     static constexpr double g = gram;
0179     static constexpr double mg = milligram;
0180 
0181     //
0182     // Power [E][T^-1]
0183     //
0184     static constexpr double watt = joule / second;   // watt = 6.24150 e+3 * MeV/ns
0185     static constexpr double kilowatt = 1.e3*watt;
0186     static constexpr double megawatt = 1.e6*watt;
0187 
0188     //
0189     // Force [E][L^-1]
0190     //
0191     static constexpr double newton = joule / meter;   // newton = 6.24150 e+9 * MeV/mm
0192 
0193     //
0194     // Pressure [E][L^-3]
0195     //
0196 #define pascal hep_pascal                               // a trick to avoid warnings
0197     static constexpr double hep_pascal = newton / m2;   // pascal = 6.24150 e+3 * MeV/mm3
0198     static constexpr double bar = 100000 * pascal;      // bar    = 6.24150 e+8 * MeV/mm3
0199     static constexpr double atmosphere = 101325 * pascal;   // atm    = 6.32420 e+8 * MeV/mm3
0200 
0201     //
0202     // Electric current [Q][T^-1]
0203     //
0204     static constexpr double ampere = coulomb / second;   // ampere = 6.24150 e+9 * eplus/ns
0205     static constexpr double milliampere = 1.e-3 * ampere;
0206     static constexpr double microampere = 1.e-6 * ampere;
0207     static constexpr double nanoampere = 1.e-9 * ampere;
0208 
0209     //
0210     // Electric potential [E][Q^-1]
0211     //
0212     static constexpr double megavolt = megaelectronvolt / eplus;
0213     static constexpr double kilovolt = 1.e-3 * megavolt;
0214     static constexpr double volt = 1.e-6 * megavolt;
0215 
0216     //
0217     // Electric resistance [E][T][Q^-2]
0218     //
0219     static constexpr double ohm = volt / ampere;   // ohm = 1.60217e-16*(MeV/eplus)/(eplus/ns)
0220 
0221     //
0222     // Electric capacitance [Q^2][E^-1]
0223     //
0224     static constexpr double farad = coulomb / volt;   // farad = 6.24150e+24 * eplus/Megavolt
0225     static constexpr double millifarad = 1.e-3 * farad;
0226     static constexpr double microfarad = 1.e-6 * farad;
0227     static constexpr double nanofarad = 1.e-9 * farad;
0228     static constexpr double picofarad = 1.e-12 * farad;
0229 
0230     //
0231     // Magnetic Flux [T][E][Q^-1]
0232     //
0233     static constexpr double weber = volt * second;   // weber = 1000*megavolt*ns
0234 
0235     //
0236     // Magnetic Field [T][E][Q^-1][L^-2]
0237     //
0238     static constexpr double tesla = volt * second / meter2;   // tesla =0.001*megavolt*ns/mm2
0239 
0240     static constexpr double gauss = 1.e-4 * tesla;
0241     static constexpr double kilogauss = 1.e-1 * tesla;
0242 
0243     //
0244     // Inductance [T^2][E][Q^-2]
0245     //
0246     static constexpr double henry = weber / ampere;   // henry = 1.60217e-7*MeV*(ns/eplus)**2
0247 
0248     //
0249     // Temperature
0250     //
0251     static constexpr double kelvin = 1.;
0252 
0253     //
0254     // Amount of substance
0255     //
0256     static constexpr double mole = 1.;
0257 
0258     //
0259     // Activity [T^-1]
0260     //
0261     static constexpr double becquerel = 1. / second;
0262     static constexpr double curie = 3.7e+10 * becquerel;
0263 
0264     //
0265     // Absorbed dose [L^2][T^-2]
0266     //
0267     static constexpr double gray = joule / kilogram;
0268     static constexpr double kilogray = 1.e+3 * gray;
0269     static constexpr double milligray = 1.e-3 * gray;
0270     static constexpr double microgray = 1.e-6 * gray;
0271 
0272     //
0273     // Luminous intensity [I]
0274     //
0275     static constexpr double candela = 1.;
0276 
0277     //
0278     // Luminous flux [I]
0279     //
0280     static constexpr double lumen = candela * steradian;
0281 
0282     //
0283     // Illuminance [I][L^-2]
0284     //
0285     static constexpr double lux = lumen / meter2;
0286 
0287     //
0288     // Miscellaneous
0289     //
0290     static constexpr double perCent = 0.01;
0291     static constexpr double perThousand = 0.001;
0292     static constexpr double perMillion = 0.000001;
0293 
0294     // -*- C++ -*-
0295     // ----------------------------------------------------------------------
0296     // HEP coherent Physical Constants
0297     //
0298     // This file has been provided by Geant4 (simulation toolkit for HEP).
0299     //
0300     // The basic units are :
0301     //            millimeter
0302     //            nanosecond
0303     //            Mega electron Volt
0304     //            positon charge
0305     //            degree Kelvin
0306     //              amount of substance (mole)
0307     //              luminous intensity (candela)
0308     //            radian
0309     //              steradian
0310     //
0311     // Below is a non exhaustive list of Physical CONSTANTS,
0312     // computed in the Internal HEP System Of Units.
0313     //
0314     // Most of them are extracted from the Particle Data Book :
0315     //        Phys. Rev. D  volume 50 3-1 (1994) page 1233
0316     //
0317     //        ...with a meaningful (?) name ...
0318     //
0319     // You can add your own constants.
0320     //
0321     // Author: M.Maire
0322     //
0323     // History:
0324     //
0325     // 23.02.96 Created
0326     // 26.03.96 Added constants for standard conditions of temperature
0327     //          and pressure; also added Gas threshold.
0328     // 29.04.08   use PDG 2006 values
0329     // 03.11.08   use PDG 2008 values
0330 
0331     static constexpr double pi = 3.14159265358979323846;
0332     static constexpr double twopi = 2 * pi;
0333     static constexpr double halfpi = pi / 2;
0334     static constexpr double pi2 = pi * pi;
0335 
0336     //
0337     //
0338     //
0339     static constexpr double Avogadro = 6.02214179e+23 / mole;
0340 
0341     //
0342     // c   = 299.792458 mm/ns
0343     // c^2 = 898.7404 (mm/ns)^2
0344     //
0345     static constexpr double c_light = 2.99792458e+8 * m / s;
0346     static constexpr double c_squared = c_light * c_light;
0347 
0348     //
0349     // h     = 4.13566e-12 MeV*ns
0350     // hbar  = 6.58212e-13 MeV*ns
0351     // hbarc = 197.32705e-12 MeV*mm
0352     //
0353     static constexpr double h_Planck = 6.62606896e-34 * joule * s;
0354     static constexpr double hbar_Planck = h_Planck / twopi;
0355     static constexpr double hbarc = hbar_Planck * c_light;
0356     static constexpr double hbarc_squared = hbarc * hbarc;
0357 
0358     //
0359     //
0360     //
0361     static constexpr double electron_charge = -eplus;   // see SystemOfUnits.h
0362     static constexpr double e_squared = eplus * eplus;
0363 
0364     //
0365     // amu_c2 - atomic equivalent mass unit
0366     //        - AKA, unified atomic mass unit (u)
0367     // amu    - atomic mass unit
0368     //
0369     static constexpr double electron_mass_c2 = 0.510998910 * MeV;
0370     static constexpr double proton_mass_c2 = 938.272013 * MeV;
0371     static constexpr double neutron_mass_c2 = 939.56536 * MeV;
0372     static constexpr double amu_c2 = 931.494028 * MeV;
0373     static constexpr double amu = amu_c2 / c_squared;
0374 
0375     //
0376     // permeability of free space mu0    = 2.01334e-16 Mev*(ns*eplus)^2/mm
0377     // permittivity of free space epsil0 = 5.52636e+10 eplus^2/(MeV*mm)
0378     //
0379     static constexpr double mu0 = 4 * pi * 1.e-7 * henry / m;
0380     static constexpr double epsilon0 = 1. / (c_squared * mu0);
0381 
0382     //
0383     // electromagnetic coupling = 1.43996e-12 MeV*mm/(eplus^2)
0384     //
0385     static constexpr double elm_coupling = e_squared / (4 * pi * epsilon0);
0386     static constexpr double fine_structure_const = elm_coupling / hbarc;
0387     static constexpr double classic_electr_radius = elm_coupling / electron_mass_c2;
0388     static constexpr double electron_Compton_length = hbarc / electron_mass_c2;
0389     static constexpr double Bohr_radius = electron_Compton_length / fine_structure_const;
0390 
0391     static constexpr double alpha_rcl2 = fine_structure_const * classic_electr_radius * classic_electr_radius;
0392 
0393     static constexpr double twopi_mc2_rcl2 = twopi * electron_mass_c2 * classic_electr_radius * classic_electr_radius;
0394     //
0395     //
0396     //
0397     static constexpr double k_Boltzmann = 8.617343e-11 * MeV / kelvin;
0398 
0399     //
0400     // IUPAC standard temperature and pressure (STP)
0401     // STP uses 273.15 K (0 °C, 32 °F) and (since 1982) 1 bar (100 kPa) and not 1 atm!
0402     static constexpr double Temperature_STP = 273.15 * kelvin;
0403     static constexpr double Pressure_STP    = 1. * bar;
0404     //
0405     // NTP uses the NIST convention: 20 °C (293.15 K, 68 °F), 1 atm (14.696 psi, 101.325 kPa)
0406     static constexpr double Temperature_NTP = 293.15 * kelvin;
0407     static constexpr double Pressure_NTP    = 1. * atmosphere;
0408     //
0409     static constexpr double kGasThreshold   = 10. * mg / cm3;
0410     //
0411     //
0412     //
0413     static constexpr double universe_mean_density = 1.e-25 * g / cm3;
0414   //}
0415 }
0416 #endif // EVALUATOR_DD4HEPUNITS_H