1 | // PythiaStdlib.h is a part of the PYTHIA event generator. |
---|
2 | // Copyright (C) 2012 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 | |
---|
17 | // Stdlib header files for strings and containers. |
---|
18 | #include <string> |
---|
19 | #include <vector> |
---|
20 | #include <map> |
---|
21 | #include <deque> |
---|
22 | #include <set> |
---|
23 | |
---|
24 | // Stdlib header file for input and output. |
---|
25 | #include <iostream> |
---|
26 | #include <iomanip> |
---|
27 | #include <fstream> |
---|
28 | #include <sstream> |
---|
29 | |
---|
30 | // Define pi if not yet done. |
---|
31 | #ifndef M_PI |
---|
32 | #define M_PI 3.1415926535897932385 |
---|
33 | #endif |
---|
34 | |
---|
35 | // By this declaration you do not need to use std:: qualifier everywhere. |
---|
36 | using namespace std; |
---|
37 | |
---|
38 | // Alternatively you can specify exactly which std:: methods will be used. |
---|
39 | /* |
---|
40 | namespace Pythia8 { |
---|
41 | // Generic utilities and mathematical functions. |
---|
42 | using std::swap; |
---|
43 | using std::max; |
---|
44 | using std::min; |
---|
45 | using std::abs; |
---|
46 | // Strings and containers. |
---|
47 | using std::string; |
---|
48 | using std::vector; |
---|
49 | using std::map; |
---|
50 | using std::deque; |
---|
51 | // Input/output streams. |
---|
52 | using std::cin; |
---|
53 | using std::cout; |
---|
54 | using std::cerr; |
---|
55 | using std::istream; |
---|
56 | using std::ostream; |
---|
57 | using std::ifstream; |
---|
58 | using std::ofstream; |
---|
59 | using std::istringstream; |
---|
60 | using std::ostringstream; |
---|
61 | // Input/output formatting. |
---|
62 | using std::endl; |
---|
63 | using std::fixed; |
---|
64 | using std::scientific; |
---|
65 | using std::left; |
---|
66 | using std::right; |
---|
67 | using std::setw; |
---|
68 | using std::setprecision; |
---|
69 | } // end namespace Pythia8 |
---|
70 | */ |
---|
71 | |
---|
72 | namespace Pythia8 { |
---|
73 | |
---|
74 | // Powers of small integers - for balance speed/code clarity. |
---|
75 | inline double pow2(const double& x) {return x*x;} |
---|
76 | inline double pow3(const double& x) {return x*x*x;} |
---|
77 | inline double pow4(const double& x) {return x*x*x*x;} |
---|
78 | inline double pow5(const double& x) {return x*x*x*x*x;} |
---|
79 | inline double pow6(const double& x) {return x*x*x*x*x*x;} |
---|
80 | |
---|
81 | // Avoid problem with negative square root argument (from roundoff). |
---|
82 | inline double sqrtpos(const double& x) {return sqrt( max( 0., x));} |
---|
83 | |
---|
84 | // The Gamma function for real argument. |
---|
85 | double GammaReal(double x); |
---|
86 | |
---|
87 | } // end namespace Pythia8 |
---|
88 | |
---|
89 | #endif // Pythia8_PythiaStdlib_H |
---|