19 namespace TrackFindingCDC {
23 template<
class ANumber>
24 inline auto square(ANumber t) ->
decltype(t* t) {
return t * t;}
33 inline double hypot2(
double x,
double y) {
return sqrt(x * x + y * y); }
36 inline double hypot3(
double x,
double y,
double z) {
return sqrt(x * x + y * y + z * z); }
46 inline std::pair<double, double> solveQuadraticABC(
const double a,
const double b,
const double c)
58 const double discriminant = b * b - 4 * a * c;
59 const double root =
sqrt(discriminant);
60 const double bigSum = (b > 0) ? -b - root : -b + root;
62 const double bigSolution = bigSum / 2 / a;
63 const double smallSolution = 2 * c / bigSum;
65 return {bigSolution, smallSolution};
double sqrt(double a)
sqrt for double
Abstract base class for different kinds of events.