CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 <math.h>
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 
25 template <class T> inline void SwapObj(T* a, T* b)
26 {
27  T tmp= *a;
28  *a = *b;
29  *b = tmp;
30  }
31 
32  template <class T> inline void Swap(T& a, T& b)
33 {
34  T tmp = a;
35  a = b;
36  b = tmp;
37  }
38 
39  template <class T> inline T Min(T a, T b)
40 {
41  return (a < b) ? a : b;
42  }
43 
44  template <class T> inline T Max(T a, T b)
45 {
46  return (a > b) ? a : b;
47  }
48 
49  template <class T> inline T Abs(T a)
50 {
51  return (a > 0) ? a : -a;
52  }
53 
54  template <class T> inline T Sign(T A, T B)
55 {
56  return (B > 0) ? Abs(A) : -Abs(A);
57  }
58  template <class T> inline T min(T a, T b)
59 {
60  return (a < b)?a:b;
61  }
62 
63  template <class T> inline T max(T a, T b)
64 {
65  return (a > b)?a:b;
66  }
67 
68 #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
T Max(T a, T b)
Definition: MathUtil.h:44
double b
Definition: hdecay.h:120
void Swap(T &a, T &b)
Definition: MathUtil.h:32
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
double a
Definition: hdecay.h:121
const double N_SMALL
Definition: MathUtil.h:22
long double T
const double N_PI
Definition: MathUtil.h:19