Logo ROOT   6.10/09
Reference Guide
Quad12FMain.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 "Quad12F.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  Quad12F 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  upar.Add("x1", 1., 0.1);
44  upar.Add("y1", 1., 0.1);
45  upar.Add("z1", 1., 0.1);
46  upar.Add("w1", 1., 0.1);
47 
48  MnMigrad migrad(fcn, upar);
49  FunctionMinimum min = migrad();
50  std::cout<<"minimum: "<<min<<std::endl;
51  }
52 // stop = stopwatch.lap().ticks();
53 // std::cout<<"stop-start: "<<stop - start<<std::endl;
54 /*
55 
56  {
57  //test constructor
58  std::vector<double> par(8);
59  std::vector<double> err(8);
60  for(int i = 0; i < 8; i++) {
61  par[i] = 1.;
62  err[i] = 0.1;
63  }
64  MnMigrad migrad(fcn, par, err);
65  FunctionMinimum min = migrad();
66  std::cout<<"minimum: "<<min<<std::endl;
67  }
68 
69  {
70  //test edm Value
71  std::vector<double> par(8);
72  std::vector<double> err(8);
73  for(int i = 0; i < 8; i++) {
74  par[i] = 1.;
75  err[i] = 0.1;
76  }
77  MnMigrad migrad(fcn, par, err);
78  double edm = 1.e-1;
79  FunctionMinimum min = migrad(20, edm);
80  std::cout<<"minimum: "<<min<<std::endl;
81  }
82 
83  {
84  //test # of iterations
85  std::vector<double> par(4);
86  std::vector<double> err(4);
87  for(int i = 0; i < 4; i++) {
88  par[i] = 1.;
89  err[i] = 0.1;
90  }
91  MnMigrad migrad(fcn, par, err);
92  int niter = 2;
93  FunctionMinimum min = migrad(niter, 1.e-5);
94  std::cout<<"minimum: "<<min<<std::endl;
95  }
96 */
97 
98  return 0;
99 }
int main()
Definition: Quad12FMain.cxx:21
API class for minimization using Variable Metric technology ("MIGRAD"); allows for user interaction: ...
Definition: MnMigrad.h:31
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...