ATLAS Offline Software
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 
15 namespace Trk {
20 {
21  none = 0,
22  one = 1,
23  two = 2
24 };
25 
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)
64  solutions = none;
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
Trk::RealQuadraticEquation::second
double second
Definition: TrkDetDescr/TrkSurfaces/TrkSurfaces/RealQuadraticEquation.h:55
Trk::RealQuadraticEquation::RealQuadraticEquation
RealQuadraticEquation(double alpha, double beta, double gamma)
Definition: TrkDetDescr/TrkSurfaces/TrkSurfaces/RealQuadraticEquation.h:58
Trk::none
@ none
Definition: TrkDetDescr/TrkSurfaces/TrkSurfaces/RealQuadraticEquation.h:21
Trk::one
@ one
Definition: TrkDetDescr/TrkSurfaces/TrkSurfaces/RealQuadraticEquation.h:22
Trk::RealQuadraticEquation::solutions
RQESolutionType solutions
Definition: TrkDetDescr/TrkSurfaces/TrkSurfaces/RealQuadraticEquation.h:56
Trk::RQESolutionType
RQESolutionType
Definition: TrkDetDescr/TrkSurfaces/TrkSurfaces/RealQuadraticEquation.h:20
Trk::two
@ two
Definition: TrkDetDescr/TrkSurfaces/TrkSurfaces/RealQuadraticEquation.h:23
TrigVtx::gamma
@ gamma
Definition: TrigParticleTable.h:26
Trk::RealQuadraticEquation
Definition: TrkDetDescr/TrkSurfaces/TrkSurfaces/RealQuadraticEquation.h:52
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
TauJetParameters::discriminant
@ discriminant
Definition: TauJetParameters.h:166
Trk::RealQuadraticEquation::first
double first
Definition: TrkDetDescr/TrkSurfaces/TrkSurfaces/RealQuadraticEquation.h:54
extractSporadic.q
list q
Definition: extractSporadic.py:98
MuonParameters::beta
@ beta
Definition: MuonParamDefs.h:144