CMS 3D CMS Logo

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
min
T min(T a, T b)
Definition: MathUtil.h:58
Sign
T Sign(T A, T B)
Definition: MathUtil.h:54
max
T max(T a, T b)
Definition: MathUtil.h:63
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
fermi
const double fermi
Definition: MathUtil.h:17
Abs
T Abs(T a)
Definition: MathUtil.h:49
b
double b
Definition: hdecay.h:118
a
double a
Definition: hdecay.h:119
N_PI
const double N_PI
Definition: MathUtil.h:19
GeV
const double GeV
Definition: MathUtil.h:16
A
hbarc
const double hbarc
Definition: MathUtil.h:18
Max
T Max(T a, T b)
Definition: MathUtil.h:44
TtFullHadDaughter::B
static const std::string B
Definition: TtFullHadronicEvent.h:9
T
long double T
Definition: Basic3DVectorLD.h:48
N_SMALL
const double N_SMALL
Definition: MathUtil.h:22
SwapObj
void SwapObj(T *a, T *b)
Definition: MathUtil.h:25
N_INFINITY
const double N_INFINITY
Definition: MathUtil.h:21
Min
T Min(T a, T b)
Definition: MathUtil.h:39
Swap
void Swap(T &a, T &b)
Definition: MathUtil.h:32