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