]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TUHKMgen/UHKM/MathUtil.h
updated macros for making PPR plots
[u/mrichter/AliRoot.git] / TUHKMgen / UHKM / MathUtil.h
1 #ifndef NAMathUtil_h
2 #define NAMathUtil_h 1
3
4 #include <iostream>
5 #include <math.h>
6 #include <Rtypes.h>
7 //
8 //##############################################################################
9 //
10 //            Nikolai Amelin (C) JINR/Dubna 1999
11 //
12 //##############################################################################
13 //
14
15 const Double_t GeV   = 1.;
16 const Double_t fermi = 1.;
17 const Double_t hbarc = 0.197*GeV*fermi;
18 const Double_t N_PI  = 3.14159265359;
19
20 const Double_t N_INFINITY = 9.0E99;
21 const Double_t N_SMALL = 1.E-10;
22    
23
24 template <class T> inline void SwapObj(T* a, T* b)
25 {
26    T tmp= *a;
27    *a = *b;
28    *b = tmp;
29 }
30
31 template <class T> inline void Swap(T& a, T& b)
32 {
33    T tmp = a;
34    a = b;
35    b = tmp;
36 }
37
38 template <class T> inline T Min(T a, T b)
39 {
40    return (a < b) ? a : b;
41 }
42
43 template <class T> inline T Max(T a, T b)
44 {
45    return (a > b) ? a : b;
46 }
47
48 template <class T> inline T Abs(T a)
49 {
50    return (a > 0) ? a : -a;
51 }
52
53 template <class T> inline T Sign(T A, T B)
54 {
55    return (B > 0) ? Abs(A) : -Abs(A);
56 }
57 template <class T> inline T min(T a, T b) 
58   {
59   return (a < b)?a:b;
60   }
61
62 template <class T> inline T max(T a, T b) 
63   {
64   return (a > b)?a:b;
65   }
66 /*
67 inline Double_t Rand(void)
68 {
69    return ((Double_t)(rand() + 1))/(Double_t)(RAND_MAX + 2);//Visual C++
70 //   return ((Double_t)(-rand() + 1))/(Double_t)(RAND_MAX + 2);// Linux
71 }
72
73
74 inline Double_t sqr(Double_t Value) { return Value*Value;}
75 */
76 #endif