7 #ifndef Pythia8_MathTools_H 8 #define Pythia8_MathTools_H 11 #include "Pythia8/Basics.h" 12 #include "Pythia8/PythiaStdlib.h" 29 double xLo,
double xHi,
double tol=1e-6);
32 bool brent(
double& solutionOut,
function<
double(
double)> f,
33 double target,
double xLo,
double xHi,
double tol=1e-6,
int maxIter = 10000);
36 double gramDet(
double s01tilde,
double s12tilde,
double s02tilde,
37 double m0,
double m1,
double m2);
38 double gramDet(Vec4 p0, Vec4 p1, Vec4 p2);
41 double Li2 (
const double,
const double kmax = 100.0,
const double xerr = 1e-9);
53 double kallenFunction(
const double x,
const double y,
const double z);
56 vector<double>
linSpace(
int nPts,
double xMin,
double xMax);
57 vector<double>
logSpace(
int nPts,
double xMin,
double xMax);
73 : leftSave(leftIn), rightSave(rightIn), ysSave(ysIn) { }
76 const vector<double>&
data()
const {
return ysSave; }
79 double left()
const {
return leftSave; }
80 double right()
const {
return rightSave; }
81 double dx()
const {
return (rightSave - leftSave) / (ysSave.size() - 1); }
82 double xi(
int i)
const {
return leftSave + i * dx(); }
85 double at(
double x)
const;
86 double operator()(
double x)
const {
return at(x); }
90 Hist plot(
string title,
double xMin,
double xMax)
const;
98 double leftSave, rightSave;
99 vector<double> ysSave;
118 : leftSave(leftIn), rightSave(rightIn), ysSave(ysIn) {
119 if (ysIn.size() <= 1)
120 rxSave = numeric_limits<double>::quiet_NaN();
122 rxSave = pow(rightSave / leftSave, 1. / (ysSave.size() - 1));
126 const vector<double>&
data()
const {
return ysSave; }
129 double left()
const {
return leftSave; }
130 double right()
const {
return rightSave; }
131 double rx()
const {
return rxSave; }
134 double at(
double x)
const;
135 double operator()(
double x)
const {
return at(x); }
138 Hist plot(
string title,
int nBins,
double xMin,
double xMax)
const;
143 double leftSave, rightSave, rxSave;
144 vector<double> ysSave;
192 double solve(vector <vector<double> >& distMatrix, vector<int>& assignment);
198 void optimal(vector<int>& assignment,
double& cost,
199 vector<double>& distMatrix,
int nOfRows,
int nOfColumns);
201 void vect(vector<int>& assignment, vector<bool>& starMatrix,
int nOfRows,
204 void calcCost(vector<int>& assignment,
double& cost,
205 vector<double>& distMatrix,
int nOfRows);
207 void step2a(vector<int>& assignment, vector<double>& distMatrix,
208 vector<bool>& starMatrix, vector<bool>& newStarMatrix,
209 vector<bool>& primeMatrix, vector<bool>& coveredColumns,
210 vector<bool>& coveredRows,
int nOfRows,
int nOfColumns,
int minDim);
212 void step2b(vector<int>& assignment, vector<double>& distMatrix,
213 vector<bool>& starMatrix, vector<bool>& newStarMatrix,
214 vector<bool>& primeMatrix, vector<bool>& coveredColumns,
215 vector<bool>& coveredRows,
int nOfRows,
int nOfColumns,
int minDim);
217 void step3(vector<int>& assignment, vector<double>& distMatrix,
218 vector<bool>& starMatrix, vector<bool>& newStarMatrix,
219 vector<bool>& primeMatrix, vector<bool>& coveredColumns,
220 vector<bool>& coveredRows,
int nOfRows,
int nOfColumns,
int minDim);
222 void step4(vector<int>& assignment, vector<double>& distMatrix,
223 vector<bool>& starMatrix, vector<bool>& newStarMatrix,
224 vector<bool>& primeMatrix, vector<bool>& coveredColumns,
225 vector<bool>& coveredRows,
int nOfRows,
int nOfColumns,
int minDim,
228 void step5(vector<int>& assignment, vector<double>& distMatrix,
229 vector<bool>& starMatrix, vector<bool>& newStarMatrix,
230 vector<bool>& primeMatrix, vector<bool>& coveredColumns,
231 vector<bool>& coveredRows,
int nOfRows,
int nOfColumns,
int minDim);
double at(double x) const
Get interpolated value at the specified point.
Definition: MathTools.cc:463
double kallenFunction(const double x, const double y, const double z)
Kallen function.
Definition: MathTools.cc:426
double gammaReal(double x)
The Gamma function for real argument.
Definition: MathTools.cc:22
double besselK0(double x)
Definition: MathTools.cc:104
Definition: MathTools.h:109
double left() const
x-values are linearly spaced on the interpolation region.
Definition: MathTools.h:79
int binomial(const int, int)
Binomial coefficient.
Definition: MathTools.cc:390
Definition: MathTools.h:187
double lambertW(const double x)
Lambert W function.
Definition: MathTools.cc:409
LogInterpolator(double leftIn, double rightIn, vector< double > ysIn)
Constructor.
Definition: MathTools.h:117
double left() const
x-values are logarithmically spaced on the interpolation region.
Definition: MathTools.h:129
const vector< double > & data() const
Function to get y-values of interpolation data.
Definition: MathTools.h:126
Hist plot(string title) const
Plot the data points of this LinearInterpolator in a histogram.
Definition: MathTools.cc:490
bool brent(double &solutionOut, function< double(double)> f, double target, double xLo, double xHi, double tol=1e-6, int maxIter=10000)
Solve f(x) = target for x in the specified range.
Definition: MathTools.cc:249
double besselK1(double x)
Definition: MathTools.cc:132
double besselI0(double x)
Modified Bessel functions of the first and second kinds.
Definition: MathTools.cc:44
LinearInterpolator(double leftIn, double rightIn, vector< double > ysIn)
Constructor.
Definition: MathTools.h:72
double sample(Rndm &rndm) const
Sample a random number distributed as given by this LinearInterpolator.
Definition: MathTools.cc:513
double m2(const Vec4 &v1)
The squared invariant mass of one or more four-vectors.
Definition: Basics.cc:605
double Li2(const double, const double kmax=100.0, const double xerr=1e-9)
Dilogarithm.
Definition: MathTools.cc:344
vector< double > linSpace(int nPts, double xMin, double xMax)
Generate linearly or logarithmically spaced points.
Definition: MathTools.cc:434
vector< double > logSpace(int nPts, double xMin, double xMax)
Generate logarithmically spaced points.
Definition: MathTools.cc:446
double factorial(const int)
Standard factorial.
Definition: MathTools.cc:380
double gramDet(double s01tilde, double s12tilde, double s02tilde, double m0, double m1, double m2)
Gram determinant, invariants used in the argument = 2*pi*pj.
Definition: MathTools.cc:328
Header for classes to set beam momentum and interaction vertex spread.
Definition: Analysis.h:20
const vector< double > & data() const
Function to get y-values of interpolation data.
Definition: MathTools.h:76
double besselI1(double x)
Definition: MathTools.cc:74
Definition: MathTools.h:65
bool integrateGauss(double &resultOut, function< double(double)> f, double xLo, double xHi, double tol=1e-6)
Integrate f(x) dx over the specified range.
Definition: MathTools.cc:163