CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/JetMETCorrections/InterpolationTables/interface/ComplexComparesAbs.h

Go to the documentation of this file.
00001 #ifndef NPSTAT_COMPLEXCOMPARESABS_HH_
00002 #define NPSTAT_COMPLEXCOMPARESABS_HH_
00003 
00014 #include <cmath>
00015 #include <complex>
00016 
00017 namespace npstat {
00023     template <class T>
00024     struct ComplexComparesAbs
00025     {
00026         inline static bool less(const T& l, const T& r)
00027             {return l < r;}
00028 
00029         inline static bool more(const T& l, const T& r)
00030             {return l > r;}
00031     };
00032 
00033     template <class T>
00034     struct ComplexComparesAbs<std::complex<T> >
00035     {
00036         inline static bool less(const std::complex<T>& l,
00037                                 const std::complex<T>& r)
00038             {return std::abs(l) < std::abs(r);}
00039 
00040         inline static bool more(const std::complex<T>& l,
00041                                 const std::complex<T>& r)
00042             {return std::abs(l) > std::abs(l);}
00043     };
00044 }
00045 
00046 #endif // NPSTAT_COMPLEXCOMPARESABS_HH_
00047