CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
RealQuadEquation Struct Reference

#include <RealQuadEquation.h>

Public Member Functions

 RealQuadEquation (double A, double B, double C)
 

Public Attributes

double first
 
bool hasSolution
 
double second
 

Detailed Description

A numericaly stable and as fast as can be quadratic equation solver. The equation has the form A*x^2 + B*x + C = 0

Definition at line 11 of file RealQuadEquation.h.

Constructor & Destructor Documentation

◆ RealQuadEquation()

RealQuadEquation::RealQuadEquation ( double  A,
double  B,
double  C 
)
inline

Definition at line 16 of file RealQuadEquation.h.

16  {
17  double D = B * B - 4 * A * C;
18  if (D < 0)
19  hasSolution = false;
20  else {
21  hasSolution = true;
22  auto q = -0.5 * (B + std::copysign(std::sqrt(D), B));
23  first = q / A;
24  second = C / q;
25  }
26  }

References MaterialEffects_cfi::A, TtFullHadDaughter::B, gen::C, first, submitPVResolutionJobs::q, edm::second(), and mathSSE::sqrt().

Member Data Documentation

◆ first

double RealQuadEquation::first

◆ hasSolution

bool RealQuadEquation::hasSolution

◆ second

double RealQuadEquation::second
RealQuadEquation::hasSolution
bool hasSolution
Definition: RealQuadEquation.h:14
RealQuadEquation::second
double second
Definition: RealQuadEquation.h:13
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
A
submitPVResolutionJobs.q
q
Definition: submitPVResolutionJobs.py:84
TtFullHadDaughter::B
static const std::string B
Definition: TtFullHadronicEvent.h:9
MaterialEffects_cfi.A
A
Definition: MaterialEffects_cfi.py:11
funct::D
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:141
gen::C
C
Definition: PomwigHadronizer.cc:78
RealQuadEquation::first
double first
Definition: RealQuadEquation.h:12