MathUtils.hh File Reference

#include "Rivet/Math/MathHeader.hh"

Include dependency graph for MathUtils.hh:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


Namespaces

namespace  Rivet

Number comparisons etc.

enum  RangeBoundary { OPEN = 0, SOFT = 0, CLOSED = 1, HARD = 1 }
bool isZero (double val, double tolerance=1E-8)
bool isZero (long val, double UNUSED(tolerance)=1E-8)
int sign (double val)
 Find the sign of a number.
int sign (int val)
 Find the sign of a number.
int sign (long val)
 Find the sign of a number.
bool fuzzyEquals (double a, double b, double tolerance=1E-5)
bool fuzzyEquals (long a, long b, double UNUSED(tolerance)=1E-5)
template<typename NUM>
bool inRange (NUM value, NUM low, NUM high, RangeBoundary lowbound=CLOSED, RangeBoundary highbound=OPEN)
bool inRange (int value, int low, int high, RangeBoundary lowbound=CLOSED, RangeBoundary highbound=CLOSED)
template<typename Num>
Num sqr (Num a)
 Named number-type squaring operation.

Functions

Statistics functions
double mean (const vector< int > &sample)
 Calculate the mean of a sample.
double covariance (const vector< int > &sample1, const vector< int > &sample2)
 Calculate the covariance (variance) between two samples.
double correlation (const vector< int > &sample1, const vector< int > &sample2)
 Calculate the correlation strength between two samples.
Angle range mappings
double _mapAngleM2PITo2Pi (double angle)
double mapAngleMPiToPi (double angle)
 Map an angle into the range (-PI, PI].
double mapAngle0To2Pi (double angle)
 Map an angle into the range [0, 2PI).
double mapAngle0ToPi (double angle)
 Map an angle into the range [0, PI].
Phase space measure helpers
double deltaPhi (double phi1, double phi2)
double deltaR (double y1, double phi1, double y2, double phi2)
double rapidity (double E, double pz)
 Calculate a rapidity value from the supplied energy E and longitudinal momentum .