Logo ROOT   6.08/07
Reference Guide
Quad8FMain.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 
10 #include "Quad8F.h"
12 #include "Minuit2/MnMigrad.h"
14 #include "Minuit2/MnPrint.h"
15 // #include "TimingUtilities/PentiumTimer.h"
16 
17 // StackAllocator gStackAllocator;
18 
19 using namespace ROOT::Minuit2;
20 
21 int main() {
22 
23  Quad8F fcn;
24 
25 // PentiumTimer stopwatch;
26 // stopwatch.start();
27 
28 // long long int start = stopwatch.lap().ticks();
29 // long long int stop = stopwatch.lap().ticks();
30 // std::cout<<"stop-start: "<<stop - start<<std::endl;
31 // start = stopwatch.lap().ticks();
32  {
33  //test constructor
34  MnUserParameters upar;
35  upar.Add("x", 1., 0.1);
36  upar.Add("y", 1., 0.1);
37  upar.Add("z", 1., 0.1);
38  upar.Add("w", 1., 0.1);
39  upar.Add("x0", 1., 0.1);
40  upar.Add("y0", 1., 0.1);
41  upar.Add("z0", 1., 0.1);
42  upar.Add("w0", 1., 0.1);
43 
44  MnMigrad migrad(fcn, upar);
45  FunctionMinimum min = migrad();
46  std::cout<<"minimum: "<<min<<std::endl;
47  }
48 // stop = stopwatch.lap().ticks();
49 // std::cout<<"stop-start: "<<stop - start<<std::endl;
50 /*
51 
52  {
53  //test constructor
54  std::vector<double> par(8);
55  std::vector<double> err(8);
56  for(int i = 0; i < 8; i++) {
57  par[i] = 1.;
58  err[i] = 0.1;
59  }
60  MnMigrad migrad(fcn, par, err);
61  FunctionMinimum min = migrad();
62  std::cout<<"minimum: "<<min<<std::endl;
63  }
64 
65  {
66  //test edm Value
67  std::vector<double> par(8);
68  std::vector<double> err(8);
69  for(int i = 0; i < 8; i++) {
70  par[i] = 1.;
71  err[i] = 0.1;
72  }
73  MnMigrad migrad(fcn, par, err);
74  double edm = 1.e-1;
75  FunctionMinimum min = migrad(20, edm);
76  std::cout<<"minimum: "<<min<<std::endl;
77  }
78 
79  {
80  //test # of iterations
81  std::vector<double> par(4);
82  std::vector<double> err(4);
83  for(int i = 0; i < 4; i++) {
84  par[i] = 1.;
85  err[i] = 0.1;
86  }
87  MnMigrad migrad(fcn, par, err);
88  int niter = 2;
89  FunctionMinimum min = migrad(niter, 1.e-5);
90  std::cout<<"minimum: "<<min<<std::endl;
91  }
92 */
93 
94  return 0;
95 }
API class for minimization using Variable Metric technology ("MIGRAD"); allows for user interaction: ...
Definition: MnMigrad.h:31
int main()
Definition: Quad8FMain.cxx:21
bool Add(const std::string &, double, double)
Add free Parameter Name, Value, Error.
class holding the full result of the minimization; both internal and external (MnUserParameterState) ...
API class for the user interaction with the parameters; serves as input to the minimizer as well as o...