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.
23 
24  // Length
25  constexpr double operator"" _mm(long double length) { return length * 0.1; }
26  constexpr double operator"" _cm(long double length) { return length * 1.; }
27  constexpr double operator"" _m(long double length) { return length * 100.; }
28  constexpr double operator"" _cm3(long double length) { return length * 1._cm * 1._cm * 1._cm; }
29  constexpr double operator"" _m3(long double length) { return length * 1._m * 1._m * 1._m; }
30  constexpr double operator"" _mm(unsigned long long int length) { return length * 0.1; }
31  constexpr double operator"" _cm(unsigned long long int length) { return length * 1; }
32 
33  } // namespace operators
34 } // namespace cms_units
35 
36 #endif
angle_units::operators::convertRadToDeg
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
angle_units::operators::convertDegToRad
constexpr long double convertDegToRad(NumType degrees)
Definition: angle_units.h:27
cms_units
Definition: CMSUnits.h:9
Utilities.operator
operator
Definition: Utilities.py:24
hgcalDigitizer_cfi._m
_m
Definition: hgcalDigitizer_cfi.py:204
angle_units::piRadians
constexpr long double piRadians(M_PIl)
angle_units.h