Stdlib + Utilities

PythiaStdlib only exists as a header file, collecting some simple declarations and inline utilities. Using them may save some time. If you have an #include "Pythia.h" in the beginning of your main program you automatically have access to them.

PythiaStdlib collects all the include and using statements that are required by most other classes to access the C++ Stdlib containers and methods, such as string, vector, map, some mathematical functions, and input/output streams and formats. It defines M_PI if this is not already done. Further, a complex data type is defined by a typedef std::complex<double>.

There are also a few inlined functions. On the mathematics side these include pow2(x), pow3(x), pow4(x) and pow5(x) for small integer powers, and sqrtpos(x) where a max(0., x) ensures that one does not take the square root of a negative number.

On the string manipulation side tolower(string) converts a whole string to lowercase characters (extending on the tolower function for a single character). The boolString(string) method takes a string as input and converts it to a bool, so that there are several alternative ways to say yes ("true", "1", "on", "yes", "ok", also in uppercase).

Some methods ease the task of reading XML input. Assume you have an line that somewhere contains an attribute="value". Then attributeValue(string line, string attribute) will return a string corresponding to the value field, or an empty string if the attribute is not found. The boolAttributeValue, intAttributeValue and doubleAttributeValue methods convert the value field into the corresponding type, with value false or 0 if the attribute is not found.