ROOT  6.06/09
Reference Guide
Quad1FMain.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 "Quad1F.h"
12 #include "Minuit2/MnPrint.h"
14 #include "Minuit2/MnMigrad.h"
15 #include "Minuit2/MnMinos.h"
16 
17 using namespace ROOT::Minuit2;
18 
19 int main() {
20 
21  {
22  //test constructor
23  {
24  Quad1F fcn;
25  MnUserParameters upar;
26  upar.Add("x", 1., 0.1);
27  MnMigrad migrad(fcn, upar);
28  FunctionMinimum min = migrad();
29  std::cout<<"min= "<<min<<std::endl;
30  }
31  {
32  // using VariableMetricMinimizer, analytical derivatives
33  Quad1F fcn;
34  std::vector<double> par(1, 1.);
35  std::vector<double> err(1, 0.1);
37  FunctionMinimum min = mini.Minimize(fcn, par, err);
38  std::cout<<"min= "<<min<<std::endl;
39  }
40  {
41  // test Minos for one Parameter
42  Quad1F fcn;
43  std::vector<double> par(1, 1.);
44  std::vector<double> err(1, 0.1);
46  FunctionMinimum min = mini.Minimize(fcn, par, err);
47  MnMinos Minos(fcn, min);
48  std::pair<double,double> e0 = Minos(0);
49  std::cout<<"par0: "<<min.UserState().Value(unsigned(0))<<" "<<e0.first<<" "<<e0.second<<std::endl;
50  fcn.SetErrorDef(4.);
51  MnMinos minos2(fcn, min);
52  std::pair<double,double> e02 = minos2(0);
53  std::cout<<"par0: "<<min.UserState().Value(unsigned(0))<<" "<<e02.first<<" "<<e02.second<<std::endl;
54  }
55 
56  }
57 
58  return 0;
59 }
double par[1]
Definition: unuranDistr.cxx:38
API class for minimization using Variable Metric technology ("MIGRAD"); allows for user interaction: ...
Definition: MnMigrad.h:31
static Vc_ALWAYS_INLINE int_v min(const int_v &x, const int_v &y)
Definition: vector.h:433
int main()
Definition: Quad1FMain.cxx:19
RooCmdArg Minos(Bool_t flag=kTRUE)
const MnUserParameterState & UserState() const
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 Minos Error analysis (asymmetric errors); minimization has to be done before and Minimu...
Definition: MnMinos.h:34
virtual FunctionMinimum Minimize(const FCNBase &, const std::vector< double > &, const std::vector< double > &, unsigned int stra=1, unsigned int maxfcn=0, double toler=0.1) const
Instantiates the SeedGenerator and MinimumBuilder for Variable Metric Minimization method...
API class for the user interaction with the parameters; serves as input to the minimizer as well as o...
void SetErrorDef(double up)
add interface to set dynamically a new error definition Re-implement this function if needed...
Definition: Quad1F.h:39