Line data Source code
1 : // PythiaStdlib.h is a part of the PYTHIA event generator.
2 : // Copyright (C) 2015 Torbjorn Sjostrand.
3 : // PYTHIA is licenced under the GNU GPL version 2, see COPYING for details.
4 : // Please respect the MCnet Guidelines, see GUIDELINES for details.
5 :
6 : // Header file for functionality pulled in from Stdlib,
7 : // plus a few useful utilities (small powers; positive square root,
8 : // Gamma function).
9 :
10 : #ifndef Pythia8_PythiaStdlib_H
11 : #define Pythia8_PythiaStdlib_H
12 :
13 : // Stdlib header files for mathematics.
14 : #include <cmath>
15 : #include <cstdlib>
16 : #include <algorithm>
17 :
18 : // Stdlib header files for strings and containers.
19 : #include <string>
20 : #include <vector>
21 : #include <map>
22 : #include <deque>
23 : #include <set>
24 : #include <list>
25 :
26 : // Stdlib header file for dynamic library loading.
27 : #ifndef __CINT__
28 : #define dlsym __
29 : #ifndef __const
30 : #define __const const
31 : #endif
32 : #include <dlfcn.h>
33 : #undef dlsym
34 : #endif
35 :
36 : // Redefine dlsym to suppress compiler warnings.
37 : extern "C" void *(*dlsym(void *handle, const char *symbol))();
38 :
39 : // Stdlib header file for input and output.
40 : #include <iostream>
41 : #include <iomanip>
42 : #include <fstream>
43 : #include <sstream>
44 :
45 : // Define pi if not yet done.
46 : #ifndef M_PI
47 : #define M_PI 3.1415926535897932385
48 : #endif
49 :
50 : // By this declaration you do not need to use std:: qualifier everywhere.
51 : //using namespace std;
52 :
53 : // Alternatively you can specify exactly which std:: methods will be used.
54 : // Now made default so std does not spill outside namespace Pythia8.
55 : namespace Pythia8 {
56 :
57 : // Generic utilities and mathematical functions.
58 : using std::swap;
59 : using std::max;
60 : using std::min;
61 : using std::abs;
62 : using std::sort;
63 :
64 : // Strings and containers.
65 : using std::pair;
66 : using std::make_pair;
67 : using std::string;
68 : using std::vector;
69 : using std::map;
70 : using std::multimap;
71 : using std::deque;
72 : using std::set;
73 :
74 : // Input/output streams.
75 : using std::cin;
76 : using std::cout;
77 : using std::cerr;
78 : using std::istream;
79 : using std::ostream;
80 : using std::fstream;
81 : using std::ifstream;
82 : using std::ofstream;
83 : using std::stringstream;
84 : using std::istringstream;
85 : using std::ostringstream;
86 : using std::ios;
87 :
88 : // Input/output formatting.
89 : using std::endl;
90 : using std::fixed;
91 : using std::scientific;
92 : using std::left;
93 : using std::right;
94 : using std::setw;
95 : using std::setprecision;
96 :
97 : } // end namespace Pythia8
98 :
99 : namespace Pythia8 {
100 :
101 : // Powers of small integers - for balance speed/code clarity.
102 0 : inline double pow2(const double& x) {return x*x;}
103 0 : inline double pow3(const double& x) {return x*x*x;}
104 0 : inline double pow4(const double& x) {return x*x*x*x;}
105 0 : inline double pow5(const double& x) {return x*x*x*x*x;}
106 0 : inline double pow6(const double& x) {return x*x*x*x*x*x;}
107 :
108 : // Avoid problem with negative square root argument (from roundoff).
109 0 : inline double sqrtpos(const double& x) {return sqrt( max( 0., x));}
110 :
111 : // The Gamma function for real argument.
112 : double GammaReal(double x);
113 :
114 : } // end namespace Pythia8
115 :
116 : #endif // Pythia8_PythiaStdlib_H
|