BOSS 6.6.4.p01
BESIII Offline Software System
Loading...
Searching...
No Matches
DifNumber.h File Reference
#include <math.h>
#include <assert.h>
#include "CLHEP/Matrix/Vector.h"
#include "CLHEP/Matrix/SymMatrix.h"
#include "CLHEP/Matrix/Matrix.h"
#include "MdcRecoUtil/Code.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

Definition at line 27 of file DifNumber.h.

Function Documentation

◆ solveQuad()

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

Definition at line 90 of file DifNumber.cxx.

96{
97 DifNumber descr=b*b-4.0*a*c;
98 if(descr<0.0) { // solution not real
99 code.setFail(1341);
100 return DifNumber(0.0);
101 }
102 if(a.number()==0.0){
103 if(b.number()==0.0) {
104 code.setFail(1342);
105 return DifNumber(0.0);
106 }
107 code.setSuccess(40);
108 return -c/b+a*c/pow(b,3);
109 }
110 code.setSuccess(40);
111 descr=sqrt(descr);
112 DifNumber s=-b;
113
114 if(pref==+1) { // positive solution
115 s+=descr;
116 }else if(pref==-1){ // negative solution
117 s-=descr;
118 }else if(pref==0) { // smallest solution
119 if(s>0.0) {s-=descr;}else {s+=descr;}
120 }else { // illegal prefrence
121 code.setFail(1343);
122 return DifNumber(0.0);
123 }
124 s/=2.0*a;
125 return s;
126}
XmlRpcServer s
Definition: HelloServer.cpp:11
void setFail(int i)
Definition: Code.h:55
void setSuccess(int i)
Definition: Code.h:57
double number() const
Definition: DifNumber.h:87