20 return par[0] + par[1]*x[0];
34 double par0[8] = { 1, 0.05, 10 , 2, 0.5 , 10 , 7 , 1. };
47 std::cout <<
"Error creating minimizer " << std::endl;
68 for (
unsigned int i = 0; i < chi2Func.
NDim(); ++i) {
70 std::cout <<
"set variable " << i <<
" to value " << x0[i] << std::endl;
72 if ( i == 3 || i == 6 )
84 std::cout <<
"Min values by GeneticMinimizer: " << min->
X()[3] <<
" " << min->
X()[6] << std::endl;
102 for (
int i = 0; i <
ndata; ++i) {
119 std::cout <<
"Time :\t " << t.
RealTime() <<
" " << t.
CpuTime() << std::endl;
124 int main(
int argc,
char **argv)
127 for (
Int_t i=1 ; i<argc ; i++) {
128 std::string arg = argv[i] ;
136 std::cout <<
"Usage: " << argv[0] <<
" [-v] [-vv]\n";
137 std::cout <<
" where:\n";
138 std::cout <<
" -v : verbose mode\n";
139 std::cout <<
" -vv : very verbose mode\n";
140 std::cout << std::endl;
Double_t fitFunction(Double_t *x, Double_t *par)
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
virtual void SetParameters(const Double_t *params)
virtual Double_t GetRandom()
Return a random number following this function shape.
void SetMaxIterations(unsigned int maxiter)
set maximum iterations (one iteration can have many function calls)
virtual bool Minimize()
method to perform the minimization
Double_t RealTime()
Stop the stopwatch (if it is running) and return the realtime (in seconds) passed between the start a...
void Start(Bool_t reset=kTRUE)
Start the stopwatch.
Double_t background(Double_t *x, Double_t *par)
virtual double MinValue() const
return minimum function value
Double_t gaussianPeak(Double_t *x, Double_t *par)
double fitFunc(double *x, double *p)
Double_t CpuTime()
Stop the stopwatch (if it is running) and return the cputime (in seconds) passed between the start an...
static const double x2[5]
void Stop()
Stop the stopwatch.
Class to Wrap a ROOT Function class (like TF1) in a IParamMultiFunction interface of multi-dimensions...
Documentation for the abstract class IBaseFunctionMultiDim.
Chi2FCN class for binnned fits using the least square methods.
int main(int argc, char **argv)
void FillData(BinData &dv, const TH1 *hist, TF1 *func=0)
fill the data vector from a TH1.
Class describing the binned data sets : vectors of x coordinates, y values and optionally error on y ...
void SetParameters(const GeneticMinimizerParameters ¶ms)
tomato 1-D histogram with a double per channel (see TH1 documentation)}
int GAMinimize(ROOT::Math::IMultiGenFunction &chi2Func, double &xm1, double &xm2)
Double_t Gaus(Double_t x, Double_t mean=0, Double_t sigma=1, Bool_t norm=kFALSE)
Calculate a gaussian function with mean and sigma.
virtual const double * X() const
return pointer to X values at the minimum
void SetMaxFunctionCalls(unsigned int maxfcn)
set maximum of function calls
static const double x1[5]
void SetTolerance(double tol)
set the tolerance
const double gAbsTolerance
virtual void SetFunction(const ROOT::Math::IMultiGenFunction &func)
set the function to minimize
std::string ToString(const T &val)
Utility function for conversion to strings.
THist< 1, double, THistStatContent, THistStatUncertainty > TH1D
void SetPrintLevel(int level)
set print level
virtual bool SetLimitedVariable(unsigned int, const std::string &, double, double, double, double)
set a new upper/lower limited variable (override if minimizer supports them ) otherwise as default se...
virtual unsigned int NDim() const =0
Retrieve the dimension of the function.