CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
MathUtil.h
Go to the documentation of this file.
1 //
2 //##############################################################################
3 //
4 // Nikolai Amelin (C) JINR/Dubna 1999
5 //
6 //##############################################################################
7 //
8 
9 #ifndef NAMathUtil_h
10 #define NAMathUtil_h 1
11 
12 #include <iostream>
13 #include <cmath>
14 #include <Rtypes.h>
15 
16 const double GeV = 1.;
17 const double fermi = 1.;
18 const double hbarc = 0.197 * GeV * fermi;
19 const double N_PI = 3.14159265359;
20 
21 const double N_INFINITY = 9.0E99;
22 const double N_SMALL = 1.E-10;
23 
24 template <class T>
25 inline void SwapObj(T* a, T* b) {
26  T tmp = *a;
27  *a = *b;
28  *b = tmp;
29 }
30 
31 template <class T>
32 inline void Swap(T& a, T& b) {
33  T tmp = a;
34  a = b;
35  b = tmp;
36 }
37 
38 template <class T>
39 inline T Min(T a, T b) {
40  return (a < b) ? a : b;
41 }
42 
43 template <class T>
44 inline T Max(T a, T b) {
45  return (a > b) ? a : b;
46 }
47 
48 template <class T>
49 inline T Abs(T a) {
50  return (a > 0) ? a : -a;
51 }
52 
53 template <class T>
54 inline T Sign(T A, T B) {
55  return (B > 0) ? Abs(A) : -Abs(A);
56 }
57 template <class T>
58 inline T min(T a, T b) {
59  return (a < b) ? a : b;
60 }
61 
62 template <class T>
63 inline T max(T a, T b) {
64  return (a > b) ? a : b;
65 }
66 
67 #endif
const double GeV
Definition: MathUtil.h:16
const double hbarc
Definition: MathUtil.h:18
T Sign(T A, T B)
Definition: MathUtil.h:54
void SwapObj(T *a, T *b)
Definition: MathUtil.h:25
T Min(T a, T b)
Definition: MathUtil.h:39
const double N_INFINITY
Definition: MathUtil.h:21
const double fermi
Definition: MathUtil.h:17
T Abs(T a)
Definition: MathUtil.h:49
T min(T a, T b)
Definition: MathUtil.h:58
static const std::string B
T Max(T a, T b)
Definition: MathUtil.h:44
double b
Definition: hdecay.h:118
void Swap(T &a, T &b)
Definition: MathUtil.h:32
double a
Definition: hdecay.h:119
const double N_SMALL
Definition: MathUtil.h:22
tmp
align.sh
Definition: createJobs.py:716
long double T
const double N_PI
Definition: MathUtil.h:19