1 #ifndef DataFormats_Math_GeantUnits_h 2 #define DataFormats_Math_GeantUnits_h 24 constexpr long double operator "" _pi(
long double x )
26 constexpr long double operator "" _pi(
unsigned long long int x )
28 constexpr long double operator"" _deg(
long double deg )
32 constexpr long double operator"" _deg(
unsigned long long int deg )
36 constexpr long double operator"" _rad(
long double rad )
42 constexpr long double operator"" _mm(
long double length )
46 constexpr long double operator"" _cm(
long double length )
54 constexpr long double operator"" _cm3(
long double length )
56 return length*1._cm*1._cm*1._cm;
58 constexpr long double operator"" _m3(
long double length )
60 return length*1._m*1._m*1._m;
64 constexpr long double operator "" _s(
long double x )
66 constexpr long double operator "" _ns(
long double x )
70 constexpr long double operator "" _MeV(
long double energy )
71 {
return energy * 1.; }
72 constexpr long double operator "" _eV(
long double energy )
73 {
return energy * 1.e-6_MeV; }
74 constexpr long double operator "" _TeV(
long double energy )
75 {
return energy * 1.e6_MeV; }
76 constexpr long double operator "" _GeV(
long double energy )
77 {
return energy * 1000._MeV; }
81 {
return mass * ( 1._eV / 1.602176487e-19 ) * 1._s * 1._s / ( 1.
_m * 1.
_m ); }
83 {
return mass * 1.e-3_kg; }
85 {
return mass * 1.e-3_g; }
90 constexpr long double operator"" _mg_per_cm3(
long double density )
91 {
return density * 1._mg / 1._cm3; }
92 constexpr long double operator"" _g_per_cm3(
long double density )
93 {
return density * 1._g / 1._cm3; }
95 {
return mass * 1._g / 1._mole; }
97 template <
class NumType>
100 return (radians * degPerRad);
103 template <
class NumType>
106 return (degrees / degPerRad);
109 template <
class NumType>
112 return (millimeters / 10.);
115 template <
class NumType>
118 return (centimeters * 10.);
121 template <
class NumType>
127 template <
class NumType>
130 return (val / desiredUnits);
double degrees(double radiants)
def degrees
constexpr NumType convertUnitsTo(long double desiredUnits, NumType val)
constexpr long double seconds(1.e+9)
constexpr NumType convertRadToDeg(NumType radians)
constexpr long double piRadians(M_PI)
constexpr long double degPerRad
constexpr long double nanoseconds(1.)
constexpr NumType convertCmToMm(NumType centimeters)
constexpr long double convertDegToRad(NumType degrees)
constexpr NumType convertMm3ToM3(NumType mm3)
constexpr NumType convertMmToCm(NumType millimeters)
constexpr long double joule(6.24150e+12)