1 #ifndef HiggsAnalysis_CombinedLimit_SequentialMinimizer_h
2 #define HiggsAnalysis_CombinedLimit_SequentialMinimizer_h
8 #include <Math/Minimizer.h>
18 double cleanEval(
unsigned int i,
double xi)
const {
double x0 =
x[
i];
x[
i] = xi;
double y =
eval();
x[
i] = x0;
return y; }
20 const ROOT::Math::IMultiGenFunction *
func;
22 mutable std::vector<double>
x;
114 virtual void Clear() ;
117 virtual void SetFunction(
const ROOT::Math::IMultiGenFunction & func) ;
120 virtual bool SetVariable(
unsigned int ivar,
const std::string &
name,
double val,
double step) ;
138 virtual const double *
X()
const {
return &
func_->x[0]; }
158 virtual const double *
Errors()
const {
return 0; }
160 virtual double CovMatrix(
unsigned int i,
unsigned int j)
const {
return 0; }
171 bool improve(
int smallsteps=5);
174 std::auto_ptr<MinimizerContext>
func_;
OneDimMinimizer(const MinimizerContext &ctx, unsigned int idx)
bool minimize(int steps=1, double ytol=0, double xtol=0)
virtual bool SetLimitedVariable(unsigned int ivar, const std::string &name, double val, double step, double lower, double upper)
set upper/lower limited variable (override if minimizer supports them )
void seek()
search for a triplet of points bracketing the maximum. return false in case of errors ...
bool minimize(int smallsteps=5)
void assign(int to, int from)
virtual bool Minimize()
method to perform the minimization
virtual void SetFunction(const ROOT::Math::IMultiGenFunction &func)
set the function to minimize
const ROOT::Math::IMultiGenFunction * func
virtual unsigned int NFree() const
virtual const double * MinGradient() const
return pointer to gradient values at the minimum
void init(const MinimizerContext &ctx, unsigned int idx, double xmin, double xmax, double xstep, const std::string &name)
virtual bool SetVariable(unsigned int ivar, const std::string &name, double val, double step)
set free variable
void initDefault(const MinimizerContext &ctx, unsigned int idx)
MinimizerContext(const ROOT::Math::IMultiGenFunction *function)
void initUnbound(const MinimizerContext &ctx, unsigned int idx, double xstep, const std::string &name)
OneDimMinimizer(const MinimizerContext &ctx, unsigned int idx, double xmin, double xmax, double xstep, const std::string &name)
std::vector< Worker > workers_
ImproveRet improve(int steps=1, double ytol=0, double xtol=0, bool force=true)
virtual unsigned int NDim() const
virtual bool ProvidesError() const
minimizer provides error and error matrix
virtual bool SetFixedVariable(unsigned int ivar, const std::string &name, double val)
set fixed variable (override if minimizer supports them )
double cleanEval(unsigned int i, double xi) const
bool improve(int smallsteps=5)
virtual void Clear()
reset for consecutive minimizations - implement if needed
const char * cname() const
double setAndEval(unsigned int i, double xi) const
std::auto_ptr< MinimizerContext > func_
static std::string from(" from ")
bool doloop(int steps, double ytol, double xtol)
bool parabolaStep()
do the parabola fit
SequentialMinimizer(const char *name=0)
Basic struct to call a function.
void goldenBisection()
do the golden bisection
std::auto_ptr< ROOT::Math::Minimizer > fullMinimizer_
const std::string & name() const
virtual double Edm() const
return expected distance reached from the minimum
double & x()
evaluate function at x
virtual const double * X() const
return pointer to X values at the minimum
std::vector< int > subspaceIndices_
double parabolaFit()
do the parabola fit
const MinimizerContext * f_
virtual const double * Errors() const
return errors at the minimum
virtual double CovMatrix(unsigned int i, unsigned int j) const
virtual unsigned int NCalls() const
number of function calls to reach the minimum
virtual double MinValue() const
return minimum function value