CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch1/src/TrackingTools/GeomPropagators/src/RealQuadEquation.h

Go to the documentation of this file.
00001 #ifndef RealQuadEquation_H
00002 #define RealQuadEquation_H
00003 
00004 #include <utility>
00005 #include <cmath>
00006 #include "FWCore/Utilities/interface/Visibility.h"
00007 
00012 struct dso_internal RealQuadEquation {
00013 
00014   bool hasSolution;
00015   double first;
00016   double second;
00017 
00018   RealQuadEquation( double A, double B, double C) {
00019     double D = B*B - 4*A*C;
00020     if (D<0) hasSolution = false;
00021     else {
00022       hasSolution = true;
00023       double q = -0.5*(B + (B>0 ? sqrt(D) : -sqrt(D)));
00024       first = q/A;
00025       second = C/q;
00026     }
00027   }
00028 
00029 };
00030 
00031 #endif