CMS 3D CMS Logo

CMSUnits.h
Go to the documentation of this file.
1 #ifndef DataFormats_Math_CMS_Units_h
2 #define DataFormats_Math_CMS_Units_h
3 
4 // This file provides units represented with user-defined literals to more easily attach units to numerical values.
5 // The CMS convention is that centimeter = 1 and GeV = 1
6 
8 
9 namespace cms_units {
10 
11  using angle_units::piRadians; // Needed by files the include this file
12 
13  namespace operators {
14 
15  // The following are needed by files that include this header
16  // Since "using namespace" is prohibited in header files, each
17  // name is individually imported with a "using" statement.
24 
25  // Length
26  constexpr double operator"" _mm(long double length) { return length * 0.1; }
27  constexpr double operator"" _cm(long double length) { return length * 1.; }
28  constexpr double operator"" _m(long double length) { return length * 100.; }
29  constexpr double operator"" _cm3(long double length) { return length * 1._cm * 1._cm * 1._cm; }
30  constexpr double operator"" _m3(long double length) { return length * 1._m * 1._m * 1._m; }
31  constexpr double operator"" _mm(unsigned long long int length) { return length * 0.1; }
32  constexpr double operator"" _cm(unsigned long long int length) { return length * 1; }
33 
34  } // namespace operators
35 } // namespace cms_units
36 
37 #endif
angle_units::operators::convertDegToRad
constexpr double convertDegToRad(NumType degrees)
Definition: angle_units.h:27
angle_units::operators::convertRadToDeg
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
angle_units::operators::almostEqual
std::enable_if<!std::numeric_limits< NumType >::is_integer, bool >::type almostEqual(NumType x, NumType y, int ulp)
Definition: angle_units.h:33
cms_units
Definition: CMSUnits.h:9
Utilities.operator
operator
Definition: Utilities.py:24
hgcalDigitizer_cfi._m
_m
Definition: hgcalDigitizer_cfi.py:211
angle_units::piRadians
constexpr double piRadians(M_PI)
angle_units.h