herwig
is hosted by
Hepforge
,
IPPP Durham
Herwig
7.3.0
Utilities
Maths.h
1
// -*- C++ -*-
2
//
3
// Maths.h is a part of Herwig - A multi-purpose Monte Carlo event generator
4
// Copyright (C) 2002-2019 The Herwig Collaboration
5
//
6
// Herwig is licenced under version 3 of the GPL, see COPYING for details.
7
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
8
//
9
#ifndef HERWIG_Math_H
10
#define HERWIG_Math_H
11
12
#include <cmath>
13
#include <vector>
14
#include "ThePEG/Config/Complex.h"
15
#include "ThePEG/Utilities/Maths.h"
16
#include "
ThePEG/Config/TemplateTools.h
"
17
18
namespace
Herwig
{
19
using
ThePEG::Complex
;
20
using
std::complex;
21
24
namespace
Math {
25
29
Complex
Li2(
Complex
);
30
34
long
double
ReLi2
(
long
double
);
35
39
inline
double
angleZeroTo2Pi
(
double
angle) {
40
double
ret = fmod(angle, 2 * M_PI);
41
if
(ret < 0) ret += 2 * M_PI;
42
return
ret;
43
}
44
48
inline
double
angleMinusPiToPi
(
double
angle) {
49
double
ret =
angleZeroTo2Pi
(angle);
50
if
(ret > M_PI) ret -= 2 * M_PI;
51
return
ret;
52
}
53
58
template
<
typename
T>
59
inline
T
median
(std::vector<T> v) {
60
if
(
v
.empty())
return
T();
61
sort (
v
.begin(),
v
.end() );
62
const
size_t
N =
v
.size();
63
return
(N % 2) ?
v
.at((N+1)/2 - 1) :
v
.at(N/2 - 1);
64
}
65
66
}
67
68
}
69
70
#endif
/* HERWIG_Math_H */
TemplateTools.h
Herwig::Math::angleZeroTo2Pi
double angleZeroTo2Pi(double angle)
Fold angles into the range (0,2 Pi)
Definition:
Maths.h:39
Herwig::Math::ReLi2
long double ReLi2(long double)
The real part of the dilog function taken from FORTRAN Herwig.
Herwig::Math::angleMinusPiToPi
double angleMinusPiToPi(double angle)
Fold angles into the range (-Pi,Pi)
Definition:
Maths.h:48
Herwig::Math::median
T median(std::vector< T > v)
Calculates the (lower) median of a vector of T objects.
Definition:
Maths.h:59
Herwig
-*- C++ -*-
Definition:
BasicConsistency.h:17
SpinorType::v
@ v
ThePEG::Complex
std::complex< double > Complex
Generated on Thu Jun 20 2024 17:50:53 for Herwig by
1.9.6