39#define EVTITGROOTFINDER_MAXIT 100
40#define EVTITGROOTFINDER_RELATIVEPRECISION 1.0e-16
54 double xLower = 0.0, xUpper = 0.0;
57 double f1 = theFunc->
value(lowerValue) - functionValue;
58 double f2 = theFunc->
value(upperValue) - functionValue;
61 report(
WARNING,
"EvtGen") <<
"EvtBtoXsgammaRootFinder: No root in specified range !"<<endl;
66 if (fabs(
f1) < precision) {
70 if (fabs(f2) < precision) {
84 double rootGuess = 0.5*(lowerValue + upperValue);
85 double dxold = fabs(upperValue - lowerValue);
88 double f = theFunc->
value(rootGuess) - functionValue;
93 dx = 0.5*(xUpper-xLower);
94 rootGuess = xLower+dx;
97 if (fabs(xLower - rootGuess) < precision) {
102 f = theFunc->
value(rootGuess) - functionValue;
112 report(
WARNING,
"EvtGen") <<
"EvtBtoXsgammaRootFinder: Maximum number of iterations "
113 <<
"in EvtBtoXsgammaRootFinder::foundRoot exceeded!"
114 <<
" Returning false."<<endl;
120EvtBtoXsgammaRootFinder::GetGaussIntegFcnRoot(
EvtItgAbsFunction *theFunc1,
EvtItgAbsFunction *theFunc2,
double integ1Precision,
double integ2Precision,
int maxLoop1,
int maxLoop2,
double integLower,
double integUpper,
double lowerValue,
double upperValue,
double precision) {
135 double f1 = func1Integ->
evaluate(integLower,integUpper) - theFunc2->
getCoeff(1,2)*func2Integ->
evaluate(integLower,integUpper);
138 double f2 = func1Integ->
evaluate(integLower,integUpper) - theFunc2->
getCoeff(1,2)*func2Integ->
evaluate(integLower,integUpper);
140 double xLower = 0.0, xUpper = 0.0;
144 report(
WARNING,
"EvtGen") <<
"EvtBtoXsgammaRootFinder: No root in specified range !"<<endl;
149 if (fabs(
f1) < precision) {
153 if (fabs(f2) < precision) {
167 double rootGuess = 0.5*(lowerValue + upperValue);
168 double dxold = fabs(upperValue - lowerValue);
173 double f = func1Integ->
evaluate(integLower,integUpper) - theFunc2->
getCoeff(1,2)*func2Integ->
evaluate(integLower,integUpper);
178 dx = 0.5*(xUpper-xLower);
179 rootGuess = xLower+dx;
182 if (fabs(xLower - rootGuess) < precision) {
199 report(
WARNING,
"EvtGen") <<
"EvtBtoXsgammaRootFinder: Maximum number of iterations "
200 <<
"in EvtBtoXsgammaRootFinder::foundRoot exceeded!"
201 <<
" Returning false."<<endl;
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")
#define EVTITGROOTFINDER_MAXIT
ostream & report(Severity severity, const char *facility)
double GetGaussIntegFcnRoot(EvtItgAbsFunction *theFunc1, EvtItgAbsFunction *theFunc2, double integ1Precision, double integ2Precision, int maxLoop1, int maxLoop2, double integLower, double integUpper, double lowerValue, double upperValue, double precision)
virtual ~EvtBtoXsgammaRootFinder()
double GetRootSingleFunc(const EvtItgAbsFunction *theFunc, double functionValue, double lowerValue, double upperValue, double precision)
EvtBtoXsgammaRootFinder()
virtual double getCoeff(int, int)=0
virtual void setCoeff(int, int, double)=0
virtual double value(double x) const
double evaluate(double lower, double upper) const