1 #ifndef DataFormats_Math_GeantUnits_h 2 #define DataFormats_Math_GeantUnits_h 30 constexpr long double operator"" _mm(
long double length) {
return length * 1.; }
31 constexpr long double operator"" _cm(
long double length) {
return length * 10.; }
32 constexpr long double operator"" _m(
long double length) {
return length * 1000.; }
33 constexpr long double operator"" _cm3(
long double length) {
return length * 1._cm * 1._cm * 1._cm; }
34 constexpr long double operator"" _m3(
long double length) {
return length * 1._m * 1._m * 1._m; }
35 constexpr long double operator"" _mm(
unsigned long long int length) {
return length * 1; }
36 constexpr long double operator"" _cm(
unsigned long long int length) {
return length * 10; }
44 constexpr long double operator"" _eV(
long double energy) {
return energy * 1.e-6_MeV; }
45 constexpr long double operator"" _TeV(
long double energy) {
return energy * 1.e6_MeV; }
46 constexpr long double operator"" _GeV(
long double energy) {
return energy * 1000._MeV; }
50 return mass * (1._eV / 1.602176487e-19) * 1._s * 1._s / (1.
_m * 1.
_m);
52 constexpr long double operator"" _g(
long double mass) {
return mass * 1.e-3_kg; }
53 constexpr long double operator"" _mg(
long double mass) {
return mass * 1.e-3_g; }
54 constexpr long double operator"" _mole(
long double mass) {
return mass * 1.; }
57 constexpr long double operator"" _mg_per_cm3(
long double density) {
return density * 1._mg / 1._cm3; }
58 constexpr long double operator"" _g_per_cm3(
long double density) {
return density * 1._g / 1._cm3; }
59 constexpr long double operator"" _g_per_mole(
long double mass) {
return mass * 1._g / 1._mole; }
61 template <
class NumType>
64 return (millimeters / 10.);
67 template <
class NumType>
70 return (centimeters * 10.);
73 template <
class NumType>
76 return (centimeters * 100.);
79 template <
class NumType>
86 template <
class NumType>
88 return (val / desiredUnits);
constexpr NumType convertCm2ToMm2(NumType centimeters)
constexpr NumType convertUnitsTo(long double desiredUnits, NumType val)
constexpr long double convertDegToRad(NumType degrees)
constexpr long double seconds(1.e+9)
constexpr NumType convertRadToDeg(NumType radians)
constexpr long double piRadians(M_PIl)
constexpr long double nanoseconds(1.)
constexpr NumType convertCmToMm(NumType centimeters)
constexpr NumType convertMm3ToM3(NumType mm3)
constexpr NumType convertMmToCm(NumType millimeters)
constexpr long double joule(6.24150e+12)