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