49 std::vector<TMVA::Interval*>& ranges,
74 DeclareOptionRef(fErrorLevel = 1,
"ErrorLevel",
"TMinuit: error level: 0.5=logL fit, 1=chi-squared fit" );
75 DeclareOptionRef(fPrintLevel = -1,
"PrintLevel",
"TMinuit: output level: -1=least, 0, +1=all garbage" );
76 DeclareOptionRef(fFitStrategy = 2,
"FitStrategy",
"TMinuit: fit strategy: 2=best" );
77 DeclareOptionRef(fPrintWarnings =
kFALSE,
"PrintWarnings",
"TMinuit: suppress warnings" );
78 DeclareOptionRef(fUseImprove =
kTRUE,
"UseImprove",
"TMinuit: use IMPROVE" );
79 DeclareOptionRef(fUseMinos =
kTRUE,
"UseMinos",
"TMinuit: use MINOS" );
80 DeclareOptionRef(fBatch =
kFALSE,
"SetBatch",
"TMinuit: use batch mode" );
81 DeclareOptionRef(fMaxCalls = 1000,
"MaxCalls",
"TMinuit: approximate maximum number of function calls" );
82 DeclareOptionRef(fTolerance = 0.1,
"Tolerance",
"TMinuit: tolerance to the function value at the minimum" );
93 if (!fBatch)
Log() << kINFO <<
"<MinuitFitter> Init " <<
Endl;
106 args[0] = fPrintLevel;
107 fMinWrap->ExecuteCommand(
"SET PRINTOUT", args, 1 );
109 if (fBatch) fMinWrap->ExecuteCommand(
"SET BAT", args, 0 );
115 args[0] = fErrorLevel;
116 fMinWrap->ExecuteCommand(
"SET ERR", args, 1 );
119 if (!fPrintWarnings) fMinWrap->ExecuteCommand(
"SET NOWARNINGS", args, 0 );
122 args[0] = fFitStrategy;
123 fMinWrap->ExecuteCommand(
"SET STRATEGY", args, 1 );
135 if ( !fBatch )
Log() << kINFO <<
"<MinuitFitter> Fitting, please be patient ... " <<
Endl;
138 if ((
Int_t)pars.size() != GetNpars())
139 Log() << kFATAL <<
"<Run> Mismatch in number of parameters: (a)"
140 << GetNpars() <<
" != " << pars.size() <<
Endl;
144 if (!fBatch) timer =
new Timer();
147 for (
Int_t ipar=0; ipar<fNpars; ipar++) {
148 fMinWrap->SetParameter( ipar,
Form(
"Par%i",ipar ),
149 pars[ipar], fRanges[ipar]->GetWidth()/100.0,
150 fRanges[ipar]->GetMin(), fRanges[ipar]->GetMax() );
151 if (fRanges[ipar]->GetWidth() == 0.0) fMinWrap->FixParameter( ipar );
158 args[1] = fTolerance;
161 fMinWrap->ExecuteCommand(
"MIGrad", args, 2 );
164 if (fUseImprove) fMinWrap->ExecuteCommand(
"IMProve", args, 0 );
169 fMinWrap->ExecuteCommand(
"MINOs", args, 1 );
178 fMinWrap->GetStats( chi2, edm, errdef, nvpar, nparx );
181 if (GetNpars() != nparx) {
182 Log() << kFATAL <<
"<Run> Mismatch in number of parameters: "
183 << GetNpars() <<
" != " << nparx <<
Endl;
187 for (
Int_t ipar=0; ipar<GetNpars(); ipar++) {
188 Double_t errp, errm, errsym, globcor, currVal, currErr;
189 fMinWrap->GetParameter( ipar, currVal, currErr );
190 pars[ipar] = currVal;
191 fMinWrap->GetErrors( ipar, errp, errm, errsym, globcor );
char * Form(const char *fmt,...)
virtual void ParseOptions()
options parser
Base class for TMVA fitters.
Double_t Run()
estimator function interface for fitting
Interface for a fitter 'target'.
void Init()
minuit-specific settings
virtual ~MinuitFitter()
destructor
Double_t EstimatorFunction(std::vector< Double_t > &pars)
performs the fit by calling Run(pars)
MinuitFitter(IFitterTarget &target, const TString &name, std::vector< TMVA::Interval * > &ranges, const TString &theOption)
constructor
void DeclareOptions()
declare SA options
Timing information for training and evaluation of MVA methods.
TString GetElapsedTime(Bool_t Scientific=kTRUE)
returns pretty string with elapsed time
virtual void Clear(Option_t *="")
RooCmdArg Timer(Bool_t flag=kTRUE)
create variable transformations
MsgLogger & Endl(MsgLogger &ml)