File indexing completed on 2026-04-10 07:50:31
0001 #pragma once
0002
0003 #include <string>
0004 #include <vector>
0005 #include <sstream>
0006 #include <iomanip>
0007 #include <cassert>
0008
0009 #include "G4SystemOfUnits.hh"
0010 #include "G4PhysicalConstants.hh"
0011
0012 struct U4PhysicalConstants
0013 {
0014 static constexpr const char* _hc_eVnm = "hc_eVnm" ;
0015 static constexpr const double hc_eVnm = h_Planck*c_light/(eV*nm) ;
0016
0017 static constexpr const char* _twopi_hbarc = "twopi_hbarc" ;
0018 static constexpr const double twopi_hbarc = twopi*hbarc ;
0019
0020 static constexpr const char* _twopi_hbarc_eVnm = "twopi_hbarc_eVnm" ;
0021 static constexpr const double twopi_hbarc_eVnm = twopi*hbarc/(eV*nm) ;
0022
0023 static constexpr const char* _unit_eV = "unit_eV" ;
0024 static constexpr const double unit_eV = eV ;
0025
0026 static constexpr const char* _unit_nm = "unit_nm" ;
0027 static constexpr const double unit_nm = nm ;
0028
0029 static constexpr const char* _c_light_mm_per_ns = "c_light_mm_per_ns" ;
0030 static constexpr const double c_light_mm_per_ns = c_light*mm/ns ;
0031
0032 static constexpr const char* _BirksConstant1_v0 = "BirksConstant1_v0" ;
0033 static constexpr const double BirksConstant1_v0 = 12.05e3*g/cm2/MeV ;
0034
0035 static constexpr const char* _BirksConstant1_v1 = "BirksConstant1_v1" ;
0036 static constexpr const double BirksConstant1_v1 = 12.05e-3*g/cm2/MeV ;
0037
0038 static constexpr const char* _BirksConstant1_v2 = "BirksConstant1_v2" ;
0039 static constexpr const double BirksConstant1_v2 = 0.0125*g/cm2/MeV ;
0040
0041 static constexpr const char* _gval = "g" ;
0042 static constexpr const double gval = g ;
0043
0044 static constexpr const char* _gramval = "gram" ;
0045 static constexpr const double gramval = gram ;
0046
0047 static constexpr const char* _cm2val = "cm2" ;
0048 static constexpr const double cm2val = cm2 ;
0049
0050 static constexpr const char* _MeVval = "MeV" ;
0051 static constexpr const double MeVval = MeV ;
0052
0053 static constexpr const char* _universe_mean_density = "universe_mean_density" ;
0054 static constexpr const double universe_mean_density_ = universe_mean_density ;
0055
0056 static constexpr const char* _universe_mean_density_per = "universe_mean_density/(g/cm3)" ;
0057 static constexpr const double universe_mean_density_per_ = universe_mean_density/(g/cm3) ;
0058
0059 static constexpr const char* _density_unit = "(g/cm3)" ;
0060 static constexpr const double density_unit_ = (g/cm3) ;
0061
0062
0063
0064
0065 static void Get(std::vector<std::string>& labels, std::vector<double>& values);
0066 static std::string Desc();
0067 };
0068
0069 void U4PhysicalConstants::Get( std::vector<std::string>& labels, std::vector<double>& values)
0070 {
0071 labels.push_back( _c_light_mm_per_ns ) ; values.push_back(c_light_mm_per_ns) ;
0072 labels.push_back( _hc_eVnm) ; values.push_back(hc_eVnm) ;
0073 labels.push_back( _twopi_hbarc ) ; values.push_back(twopi_hbarc) ;
0074 labels.push_back( _twopi_hbarc_eVnm ) ; values.push_back(twopi_hbarc_eVnm) ;
0075 labels.push_back( _unit_eV ) ; values.push_back(unit_eV) ;
0076 labels.push_back( _unit_nm ) ; values.push_back(unit_nm) ;
0077 labels.push_back( _BirksConstant1_v0 ) ; values.push_back(BirksConstant1_v0) ;
0078 labels.push_back( _BirksConstant1_v1 ) ; values.push_back(BirksConstant1_v1) ;
0079 labels.push_back( _BirksConstant1_v2 ) ; values.push_back(BirksConstant1_v2) ;
0080 labels.push_back( _gval ) ; values.push_back(gval) ;
0081 labels.push_back( _gramval ) ; values.push_back(gramval) ;
0082 labels.push_back( _cm2val ) ; values.push_back(cm2val) ;
0083 labels.push_back( _MeVval ) ; values.push_back(MeVval) ;
0084 labels.push_back( _universe_mean_density ) ; values.push_back(universe_mean_density_) ;
0085 labels.push_back( _universe_mean_density_per ) ; values.push_back(universe_mean_density_per_ ) ;
0086 labels.push_back( _density_unit ) ; values.push_back(density_unit_ ) ;
0087 }
0088
0089 std::string U4PhysicalConstants::Desc()
0090 {
0091 std::vector<std::string> labels ;
0092 std::vector<double> values ;
0093 Get(labels, values);
0094 assert( labels.size() == values.size() );
0095 std::stringstream ss ;
0096
0097 for(unsigned i=0 ; i < values.size() ; i++)
0098 {
0099 const std::string& label = labels[i] ;
0100 double value = values[i] ;
0101 ss
0102 << std::setw(20) << label
0103 << " : "
0104 << std::fixed << std::setw(40) << std::setprecision(20) << value
0105 << " : "
0106 << std::setw(10) << std::scientific << value
0107 << std::endl
0108 ;
0109
0110 }
0111 std::string s = ss.str();
0112 return s ;
0113
0114 }
0115