ATLAS Offline Software
Loading...
Searching...
No Matches
TrkDetDescr/TrkSurfaces/TrkSurfaces/RealQuadraticEquation.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
6// RealQuadraticEquation.h, (c) ATLAS Detector software
8
9#ifndef TRKEXUTILS_REALQUADRATICEQUATION_H
10#define TRKEXUTILS_REALQUADRATICEQUATION_H
11
12#include <cmath>
13#include <utility>
14
15namespace Trk {
18
20{
21 none = 0,
22 one = 1,
23 two = 2
24};
25
50
52{
53
54 double first;
55 double second;
57
58 RealQuadraticEquation(double alpha, double beta, double gamma)
59 : first(0.)
60 , second(0.)
61 {
62 double discriminant = beta * beta - 4 * alpha * gamma;
63 if (discriminant < 0)
65 else {
66 solutions = (discriminant == 0) ? one : two;
67 double q = -0.5 * (beta + (beta > 0 ? sqrt(discriminant) : -sqrt(discriminant)));
68 first = q / alpha;
69 second = gamma / q;
70 }
71 }
72};
73
74} // end of namespace
75
76#endif // TRKEXUTILS_REALQUADRATICEQUATION_H
Ensure that the ATLAS eigen extensions are properly loaded.