23 template<
class T>
inline T sqr(
T x){
return x*
x;}
26 template<
class T>
inline T cube(
T x){
return x*x*
x;}
29 template<
class T>
inline T ipow(
T x,
unsigned int n)
32 if (n == 0)
return ret;
33 for(
unsigned int i = 1;
i <=
n; ++
i) ret *= x;
39 inline double pythag(
double x,
double y)
45 inline double pythag(
double x,
double y,
double z)
55 const std::vector<double>& y,
56 double&
m,
double &
c);
70 double LinFit(
const std::vector<double>& x,
71 const std::vector<double>& y,
72 const std::vector<double>&
w,
73 double& m,
double &c);
103 void LinFitTS(
const std::vector<double>& x,
104 const std::vector<double>& y,
105 const std::vector<double>& w,
Filter events based on their run/event numbers.
T cube(T x)
More efficient cube function than pow(x,3)
T sqr(T x)
More efficient square function than pow(x,2)
T ipow(T x, unsigned int n)
More efficient exponentiation function than pow(x,n) for small n.
void LinFitUnweighted(const std::vector< double > &x, const std::vector< double > &y, double &m, double &c)
Simplified version of LinFit.
double pythag(double x, double y)
2D Euclidean distance
double LinFit(const std::vector< double > &x, const std::vector< double > &y, const std::vector< double > &w, double &m, double &c)
Find the best-fit line to a collection of points in 2-D by minimizing the squared vertical distance f...
void LinFitTS(const std::vector< double > &x, const std::vector< double > &y, const std::vector< double > &wt, double &m, double &b, int wmode)
Best fit line to points using Theil-Sens median method.