ATLAS Offline Software
TrkExtrapolation/TrkExUtils/TrkExUtils/RealQuadraticEquation.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 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 
53 struct RealQuadraticEquation
54 {
55 
56  double first;
57  double second;
59 
60  RealQuadraticEquation(double alpha, double beta, double gamma)
61  : first{}
62  , second{}
63  {
64  double discriminant = beta * beta - 4 * alpha * gamma;
65  if (discriminant < 0)
66  solutions = none;
67  else {
68  solutions = (discriminant == 0) ? one : two;
69  double q =
70  -0.5 * (beta + (beta > 0 ? sqrt(discriminant) : -sqrt(discriminant)));
71  first = q / alpha;
72  second = gamma / q;
73  }
74  }
75 };
76 
77 } // end of namespace
78 
79 #endif // TRKEXUTILS_REALQUADRATICEQUATION_H
80 
Trk::RealQuadraticEquation::second
double second
Definition: TrkDetDescr/TrkSurfaces/TrkSurfaces/RealQuadraticEquation.h:55
Trk::RealQuadraticEquation::RealQuadraticEquation
RealQuadraticEquation(double alpha, double beta, double gamma)
Definition: TrkExtrapolation/TrkExUtils/TrkExUtils/RealQuadraticEquation.h:60
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
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