CMS 3D CMS Logo

RealQuadEquation Struct Reference

A numericaly stable and as fast as can be quadratic equation solver. More...

#include <TrackingTools/GeomPropagators/src/RealQuadEquation.h>

List of all members.

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 ( double  A,
double  B,
double  C 
) [inline]

Definition at line 17 of file RealQuadEquation.h.

References funct::D, first, hasSolution, second, and funct::sqrt().

00017                                                   {
00018     double D = B*B - 4*A*C;
00019     if (D<0) hasSolution = false;
00020     else {
00021       hasSolution = true;
00022       double q = -0.5*(B + (B>0 ? sqrt(D) : -sqrt(D)));
00023       first = q/A;
00024       second = C/q;
00025     }
00026   }


Member Data Documentation

double RealQuadEquation::first

Definition at line 14 of file RealQuadEquation.h.

Referenced by HelixBarrelCylinderCrossing::HelixBarrelCylinderCrossing(), HelixBarrelPlaneCrossingByCircle::pathLength(), and RealQuadEquation().

bool RealQuadEquation::hasSolution

Definition at line 13 of file RealQuadEquation.h.

Referenced by HelixBarrelCylinderCrossing::HelixBarrelCylinderCrossing(), HelixBarrelPlaneCrossingByCircle::pathLength(), and RealQuadEquation().

double RealQuadEquation::second

Definition at line 15 of file RealQuadEquation.h.

Referenced by HelixBarrelCylinderCrossing::HelixBarrelCylinderCrossing(), HelixBarrelPlaneCrossingByCircle::pathLength(), and RealQuadEquation().


The documentation for this struct was generated from the following file:
Generated on Tue Jun 9 18:30:39 2009 for CMSSW by  doxygen 1.5.4