19#include "TObjString.h"
29 Int_t
Eval(Int_t npar, Double_t *grad, Double_t &fval, Double_t *pars, Int_t iflag)
override;
39Int_t
TMinuitEx::Eval(Int_t npar, Double_t *grad, Double_t &fval, Double_t *pars, Int_t iflag)
42 fval =
fxFitter->CalculateFitFunction(pars);
75 fMinuit.SetPrintLevel(-1);
77 for (Int_t n = 0; n < Fitter->
NumPars(); n++) {
80 Double_t epsilon = 0, RangeMin = 0, RangeMax = 0;
84 if (!Fitter->
GetParRange(FullName, RangeMin, RangeMax)) {
89 fMinuit.mnparm(n, FullName, Fitter->
GetParValue(FullName), epsilon, RangeMin, RangeMax, ierflg);
92 fMinuit.FixParameter(n);
96 fMinuit.Command(
"MIGRAD 500 1");
98 for (Int_t n = 0; n <=
fxCommands.GetLast(); n++) {
99 TString cmd = ((TObjString *)
fxCommands[n])->GetString();
101 if (cmd.Index(
"result", 6, 0, TString::kIgnoreCase) == 0) {
103 while ((cmd.Length() > 0) && (cmd[0] ==
' '))
107 if (cmd.Length() < 4) {
108 std::cerr <<
"invalid result command syntax" << std::endl;
111 Bool_t getpar = (cmd[0] ==
'1');
112 Bool_t geterr = (cmd[1] ==
'1');
113 Bool_t getmatr = (cmd[2] ==
'1');
114 Bool_t getcontr = (cmd[3] ==
'1');
116 while ((cmd.Length() > 0) && (cmd[0] ==
' '))
135 fMinuit.Command(cmd);
138 for (Int_t n = 0; n < Fitter->
NumPars(); n++) {
139 Double_t value, error;
140 fMinuit.GetParameter(n, value, error);
171 std::cout <<
"List of commands:" << std::endl;
172 for (Int_t n = 0; n <=
fxCommands.GetLast(); n++)
173 std::cout <<
" " <<
fxCommands[n]->GetName() << std::endl;
175 std::cout <<
"List of stored results:" << std::endl;
Result values, taken from Minuit object.
void GetContourPlot(TMinuit *fMinuit)
void CallMNPOUT(TMinuit *fMinuit, Int_t nPars)
void CallMNERRS(TMinuit *fMinuit, Int_t nPars)
void CallMNSTAT(TMinuit *fMinuit)
void CallMNEMAT(TMinuit *fMinuit, Int_t nPars, Bool_t DoTransform=kTRUE)
TObjArray fxResults
List of TGo4FitMinuitResult objects.
void AddResult(TGo4FitMinuitResult *res)
Add result object to results list.
TGo4FitMinuitResult * FindResult(const char *ResName)
Find result object with provided name.
void Print(Option_t *option="") const override
Print information on standard output.
TGo4FitMinuitResult * GetResult(Int_t indx) const
Get TGo4FitMinuitResult object with given index.
TGo4FitMinuit()
Default constructor.
TObjArray fxCommands
List of minuit commands, presented by array of TObjString.
const char * GetCommand(Int_t n) const
Return command with given index.
void RemoveResult(TGo4FitMinuitResult *res)
Remove result from results list and delete it.
void AddCommand(const char *iCommand)
Add Minuit command to command list.
virtual ~TGo4FitMinuit()
Destroys TGo4FitMinuit object.
void DoAction(TGo4FitterAbstract *Fitter) override
Execute all Minuit commands.
void Print(Option_t *option="") const override
Bool_t SetParValue(const char *ParName, Double_t iValue)
Set value of parameter with given name.
Double_t GetParValue(const char *ParName)
Return value of parameter with given name.
const char * GetParFullName(Int_t n)
Return full name of parameter with given index.
Bool_t SetParError(const char *ParName, Double_t iError)
Set error value for parameter with given name.
Bool_t GetParRange(const char *ParName, Double_t &RangeMin, Double_t &RangeMax) override
Return kTRUE, if range condition specified for parameter and range boundaries.
Bool_t GetParEpsilon(const char *ParName, Double_t &Epsilon) override
Return kTRUE, if epsilon value specified for parameter.
Bool_t GetParFixed(const char *ParName) override
Return kTRUE, if parameter should be fixed.
Int_t NumPars() override
Return total number of parameters, which should be fitted.
TGo4FitterAction()
Default constructor.
TMinuitEx(Int_t NumPars, TGo4FitterAbstract *fitter)
TGo4FitterAbstract * fxFitter
Int_t Eval(Int_t npar, Double_t *grad, Double_t &fval, Double_t *pars, Int_t iflag) override