ROOT   Reference Guide
Searching...
No Matches
CombinedMinimumBuilder.cxx
Go to the documentation of this file.
1// @(#)root/minuit2:$Id$
2// Authors: M. Winkler, F. James, L. Moneta, A. Zsenei 2003-2005
3
4/**********************************************************************
5 * *
6 * Copyright (c) 2005 LCG ROOT Math team, CERN/PH-SFT *
7 * *
8 **********************************************************************/
9
12#include "Minuit2/MnStrategy.h"
13#include "Minuit2/MnPrint.h"
14
15namespace ROOT {
16
17namespace Minuit2 {
18
20 const MnStrategy &strategy, unsigned int maxfcn, double edmval) const
21{
22 // find minimum using combined method
23 // (Migrad then if fails try Simplex and then Migrad again)
24
25 MnPrint print("CombinedMinimumBuilder");
26
27 FunctionMinimum min = fVMMinimizer.Builder().Minimum(fcn, gc, seed, strategy, maxfcn, edmval);
28
29 if (!min.IsValid()) {
30 print.Warn("Migrad method fails, will try with simplex method first");
31
32 MnStrategy str(2);
33 FunctionMinimum min1 = fSimplexMinimizer.Builder().Minimum(fcn, gc, seed, str, maxfcn, edmval);
34 if (!min1.IsValid()) {
35 print.Warn("Both Migrad and Simplex methods failed");
36
37 return min1;
38 }
39 MinimumSeed seed1 = fVMMinimizer.SeedGenerator()(fcn, gc, min1.UserState(), str);
40
41 FunctionMinimum min2 = fVMMinimizer.Builder().Minimum(fcn, gc, seed1, str, maxfcn, edmval);
42 if (!min2.IsValid()) {
43
44 print.Warn("Both migrad and method failed also at 2nd attempt; return simplex Minimum");
45 return min1;
46 }
47
48 return min2;
49 }
50
51 return min;
52}
53
54} // namespace Minuit2
55
56} // namespace ROOT
virtual FunctionMinimum Minimum(const MnFcn &, const GradientCalculator &, const MinimumSeed &, const MnStrategy &, unsigned int, double) const
class holding the full result of the minimization; both internal and external (MnUserParameterState) ...
const MnUserParameterState & UserState() const