lhapdf is hosted by Hepforge, IPPP Durham
LHAPDF 6.5.4
Loading...
Searching...
No Matches
Internal utility functions

Classes

struct  LHAPDF::bad_lexical_cast
 When lexical_cast goes bad. More...
 

Functions

 LHAPDF::bad_lexical_cast::bad_lexical_cast (const std::string &what)
 Constructor.
 

String handling utility functions

template<typename T , typename U >
LHAPDF::lexical_cast (const U &in)
 Convert between types via stringstream.
 
template<typename T >
std::string LHAPDF::to_str (const T &val)
 Make a string representation of val.
 
template<typename T >
std::string LHAPDF::to_str (const std::vector< T > &vec)
 Make a string representation of a vector vec.
 
std::string LHAPDF::to_str_zeropad (int val, size_t nchars=4)
 Format an integer val as a zero-padded string of length nchars.
 
std::string LHAPDF::join (const std::vector< std::string > &svec, const std::string &sep)
 Concatenate strings with separator strings between each element.
 
std::vector< std::string > LHAPDF::split (const std::string &s, const std::string &sep)
 Split a string by a given separator.
 
bool LHAPDF::contains (const std::string &s, const std::string &sub)
 Does a string s contain the sub substring?
 
bool LHAPDF::startswith (const std::string &s, const std::string &sub)
 Does a string s start with the sub substring?
 
bool LHAPDF::endswith (const std::string &s, const std::string &sub)
 Does a string s end with the sub substring?
 
size_t LHAPDF::countchar (const std::string &s, const char c)
 How many times does a string s contain the character c?
 
std::string LHAPDF::trim (const std::string &s)
 Strip leading and trailing spaces (not in-place)
 
std::string LHAPDF::to_lower (const std::string &s)
 Convert a string to lower-case (not in-place)
 
std::string LHAPDF::to_upper (const std::string &s)
 Convert a string to upper-case (not in-place)
 

Filesystem utils

bool LHAPDF::path_exists (const std::string &p, int mode=0)
 Check if a path p (either file or dir) exists.
 
bool LHAPDF::file_exists (const std::string &p, int mode=0)
 Check if a file p exists.
 
bool LHAPDF::dir_exists (const std::string &p, int mode=0)
 Check if a dir p exists.
 
std::string LHAPDF::operator/ (const std::string &a, const std::string &b)
 Operator for joining strings a and b with filesystem separators.
 
std::string LHAPDF::basename (const std::string &p)
 Get the basename (i.e. terminal file name) from a path p.
 
std::string LHAPDF::dirname (const std::string &p)
 Get the dirname (i.e. path to the penultimate directory) from a path p.
 
std::string LHAPDF::file_stem (const std::string &f)
 Get the stem (i.e. part without a file extension) from a filename f.
 
std::string LHAPDF::file_extn (const std::string &f)
 Get the file extension from a filename f.
 

Math functions

Todo
Add an abspath(p) function
template<typename N >
LHAPDF::sqr (const N &x)
 Convenience function for squaring (of any type)
 
template<typename N >
int LHAPDF::sgn (N val)
 Get the sign of a number.
 
int LHAPDF::in_range (double x, double low, double high)
 Check if a number is in a range (closed-open)
 
int LHAPDF::in_closed_range (double x, double low, double high)
 Check if a number is in a range (closed-closed)
 
int LHAPDF::in_open_range (double x, double low, double high)
 Check if a number is in a range (open-open)
 
double LHAPDF::norm_quantile (double p)
 Quantiles of the standard normal probability distribution function.
 
double LHAPDF::chisquared_quantile (double p, double ndf)
 Quantiles of the chi-squared probability distribution function.
 

Container utils

template<typename T >
bool LHAPDF::contains (const std::vector< T > &container, const T &item)
 Does the vector<T> container contain item?
 
template<typename K , typename T >
bool LHAPDF::has_key (const std::map< K, T > &container, const K &key)
 Does the map<K,T> container have a key K key?
 

Detailed Description

Function Documentation

◆ norm_quantile()

double LHAPDF::norm_quantile ( double p)

Quantiles of the standard normal probability distribution function.

Todo
Add iszero() & equals(,) functions?