46 double functionValue,
double lowerValue,
47 double upperValue,
double precision ) {
52 double xLower = 0.0, xUpper = 0.0;
55 double f1 = theFunc->
value( lowerValue ) - functionValue;
56 double f2 = theFunc->
value( upperValue ) - functionValue;
60 report(
WARNING,
"EvtGen" ) <<
"EvtBtoXsgammaRootFinder: No root in specified range !"
66 if ( fabs(
f1 ) < precision )
71 if ( fabs( f2 ) < precision )
89 double rootGuess = 0.5 * ( lowerValue + upperValue );
90 double dxold = fabs( upperValue - lowerValue );
93 double f = theFunc->
value( rootGuess ) - functionValue;
99 dx = 0.5 * ( xUpper - xLower );
100 rootGuess = xLower + dx;
103 if ( fabs( xLower - rootGuess ) < precision )
109 f = theFunc->
value( rootGuess ) - functionValue;
111 if (
f < 0.0 ) { xLower = rootGuess; }
112 else { xUpper = rootGuess; }
115 report(
WARNING,
"EvtGen" ) <<
"EvtBtoXsgammaRootFinder: Maximum number of iterations "
116 <<
"in EvtBtoXsgammaRootFinder::foundRoot exceeded!"
117 <<
" Returning false." << endl;
123 double integ2Precision,
int maxLoop1,
int maxLoop2,
double integLower,
double integUpper,
124 double lowerValue,
double upperValue,
double precision ) {
137 theFunc1->
setCoeff( 1, 0, lowerValue );
138 theFunc2->
setCoeff( 1, 0, lowerValue );
140 double f1 = func1Integ->
evaluate( integLower, integUpper ) -
141 theFunc2->
getCoeff( 1, 2 ) * func2Integ->
evaluate( integLower, integUpper );
142 theFunc1->
setCoeff( 1, 0, upperValue );
143 theFunc2->
setCoeff( 1, 0, upperValue );
144 double f2 = func1Integ->
evaluate( integLower, integUpper ) -
145 theFunc2->
getCoeff( 1, 2 ) * func2Integ->
evaluate( integLower, integUpper );
147 double xLower = 0.0, xUpper = 0.0;
152 report(
WARNING,
"EvtGen" ) <<
"EvtBtoXsgammaRootFinder: No root in specified range !"
158 if ( fabs(
f1 ) < precision )
163 if ( fabs( f2 ) < precision )
181 double rootGuess = 0.5 * ( lowerValue + upperValue );
182 double dxold = fabs( upperValue - lowerValue );
185 theFunc1->
setCoeff( 1, 0, rootGuess );
186 theFunc2->
setCoeff( 1, 0, rootGuess );
187 double f = func1Integ->
evaluate( integLower, integUpper ) -
188 theFunc2->
getCoeff( 1, 2 ) * func2Integ->
evaluate( integLower, integUpper );
194 dx = 0.5 * ( xUpper - xLower );
195 rootGuess = xLower + dx;
198 if ( fabs( xLower - rootGuess ) < precision )
204 theFunc1->
setCoeff( 1, 0, rootGuess );
205 theFunc2->
setCoeff( 1, 0, rootGuess );
206 f = func1Integ->
evaluate( integLower, integUpper ) -
207 theFunc2->
getCoeff( 1, 2 ) * func2Integ->
evaluate( integLower, integUpper );
209 if (
f < 0.0 ) { xLower = rootGuess; }
210 else { xUpper = rootGuess; }
213 report(
WARNING,
"EvtGen" ) <<
"EvtBtoXsgammaRootFinder: Maximum number of iterations "
214 <<
"in EvtBtoXsgammaRootFinder::foundRoot exceeded!"
215 <<
" Returning false." << endl;
double GetGaussIntegFcnRoot(EvtItgAbsFunction *theFunc1, EvtItgAbsFunction *theFunc2, double integ1Precision, double integ2Precision, int maxLoop1, int maxLoop2, double integLower, double integUpper, double lowerValue, double upperValue, double precision)