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