rivet is hosted by Hepforge, IPPP Durham
MathHeader.hh
Go to the documentation of this file.
00001 #ifndef RIVET_Math_MathHeader
00002 #define RIVET_Math_MathHeader
00003 
00004 #include "Rivet/Exceptions.hh"
00005 #include <stdexcept>
00006 #include <string>
00007 #include <ostream>
00008 #include <sstream>
00009 #include <iostream>
00010 #include <limits>
00011 #include <cmath>
00012 #include <map>
00013 #include <vector>
00014 #include <algorithm>
00015 
00016 
00017 // Macro to help with overzealous compiler warnings
00018 /// @note It's easier and better to just not give an arg name to args which won't be used, when possible.
00019 #ifdef UNUSED
00020 #elif defined(__GNUC__)
00021 # define UNUSED(x) UNUSED_ ## x __attribute__((unused))
00022 #elif defined(__LCLINT__)
00023 # define UNUSED(x) /*@unused@*/ x
00024 #else
00025 # define UNUSED(x) x
00026 #endif
00027 
00028 
00029 /// Macro to help mark code as deprecated to produce compiler warnings
00030 #ifndef DEPRECATED
00031 #if __GNUC__ && __cplusplus && RIVET_NO_DEPRECATION_WARNINGS == 0
00032 #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
00033 #if GCC_VERSION >= 40500
00034   #if __cplusplus > 201103L
00035   #define DEPRECATED(x) [[deprecated(x)]]
00036   #else
00037   #define DEPRECATED(x) __attribute__((deprecated(x)))
00038   #endif
00039 #else
00040   #define DEPRECATED(x) __attribute__((deprecated))
00041 #endif
00042 #else
00043   #define DEPRECATED(x)
00044 #endif
00045 #endif
00046 
00047 
00048 namespace Rivet {
00049 
00050   using std::string;
00051   using std::ostream;
00052   using std::ostringstream;
00053   using std::cout;
00054   using std::endl;
00055   using std::pair;
00056   using std::vector;
00057   using std::transform;
00058   using std::min;
00059   using std::max;
00060   using std::abs;
00061   using std::isnan;
00062   using std::isinf;
00063 
00064   const double MAXDOUBLE = std::numeric_limits<double>::max();
00065   const double MAXINT = std::numeric_limits<int>::max();
00066 
00067   /// A pre-defined value of \f$ \pi \f$.
00068   const double PI = M_PI;
00069 
00070   /// A pre-defined value of \f$ 2\pi \f$.
00071   const double TWOPI = 2*M_PI;
00072 
00073   /// A pre-defined value of \f$ \pi/2 \f$.
00074   const double HALFPI = M_PI_2;
00075 
00076   /// Enum for signs of numbers.
00077   enum Sign { MINUS = -1, ZERO = 0, PLUS = 1 };
00078 
00079   /// Enum for rapidity variable to be used in calculating \f$ R \f$, applying rapidity cuts, etc.
00080   enum RapScheme { PSEUDORAPIDITY = 0, ETARAP = 0, RAPIDITY = 1, YRAP = 1 };
00081 
00082   /// Enum for range of \f$ \phi \f$ to be mapped into
00083   enum PhiMapping { MINUSPI_PLUSPI, ZERO_2PI, ZERO_PI };
00084 
00085 }
00086 
00087 #endif