BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
DifNumber.h File Reference
#include "CLHEP/Matrix/Matrix.h"
#include "CLHEP/Matrix/SymMatrix.h"
#include "CLHEP/Matrix/Vector.h"
#include "MdcRecoUtil/Code.h"
#include <assert.h>
#include <math.h>
#include <iosfwd>
#include "MdcRecoUtil/DifNumber.icc"

Go to the source code of this file.

Classes

class  DifNumber

Macros

#define MATRIX_BOUND_CHECK

Functions

DifNumber solveQuad (const DifNumber &a, const DifNumber &b, const DifNumber &c, int pref, Code &code)

Macro Definition Documentation

◆ MATRIX_BOUND_CHECK

#define MATRIX_BOUND_CHECK

Function Documentation

◆ solveQuad()

DifNumber solveQuad ( const DifNumber & a,
const DifNumber & b,
const DifNumber & c,
int pref,
Code & code )

Definition at line 91 of file DifNumber.cxx.

96{
97 DifNumber descr = b * b - 4.0 * a * c;
98 if ( descr < 0.0 )
99 { // solution not real
100 code.setFail( 1341 );
101 return DifNumber( 0.0 );
102 }
103 if ( a.number() == 0.0 )
104 {
105 if ( b.number() == 0.0 )
106 {
107 code.setFail( 1342 );
108 return DifNumber( 0.0 );
109 }
110 code.setSuccess( 40 );
111 return -c / b + a * c / pow( b, 3 );
112 }
113 code.setSuccess( 40 );
114 descr = sqrt( descr );
115 DifNumber s = -b;
116
117 if ( pref == +1 )
118 { // positive solution
119 s += descr;
120 }
121 else if ( pref == -1 )
122 { // negative solution
123 s -= descr;
124 }
125 else if ( pref == 0 )
126 { // smallest solution
127 if ( s > 0.0 ) { s -= descr; }
128 else { s += descr; }
129 }
130 else
131 { // illegal prefrence
132 code.setFail( 1343 );
133 return DifNumber( 0.0 );
134 }
135 s /= 2.0 * a;
136 return s;
137}
XmlRpcServer s