ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ScanBuilder.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 "Minuit2/ScanBuilder.h"
13 #include "Minuit2/MinimumSeed.h"
14 #include "Minuit2/MinimumState.h"
15 #include "Minuit2/MnFcn.h"
16 
17 namespace ROOT {
18 
19  namespace Minuit2 {
20 
21 
22 FunctionMinimum ScanBuilder::Minimum(const MnFcn& mfcn, const GradientCalculator&, const MinimumSeed& seed, const MnStrategy&, unsigned int, double) const {
23  // find the function minimum performing a parameter scan (using MnParameterScan class)
24  // function gradient is not used
25  MnAlgebraicVector x = seed.Parameters().Vec();
26  MnUserParameterState upst(seed.State(), mfcn.Up(), seed.Trafo());
27  MnParameterScan scan(mfcn.Fcn(), upst.Parameters(), seed.Fval());
28  double amin = scan.Fval();
29  unsigned int n = seed.Trafo().VariableParameters();
30  MnAlgebraicVector dirin(n);
31  for(unsigned int i = 0; i < n; i++) {
32  unsigned int ext = seed.Trafo().ExtOfInt(i);
33  scan(ext);
34  if(scan.Fval() < amin) {
35  amin = scan.Fval();
36  x(i) = seed.Trafo().Ext2int(ext, scan.Parameters().Value(ext));
37  }
38  dirin(i) = sqrt(2.*mfcn.Up()*seed.Error().InvHessian()(i,i));
39  }
40 
41  MinimumParameters mp(x, dirin, amin);
42  MinimumState st(mp, 0., mfcn.NumOfCalls());
43 
44  return FunctionMinimum(seed, std::vector<MinimumState>(1, st), mfcn.Up());
45 }
46 
47  } // namespace Minuit2
48 
49 } // namespace ROOT
double Ext2int(unsigned int, double) const
const MinimumParameters & Parameters() const
Definition: MinimumSeed.h:47
const MinimumError & Error() const
Definition: MinimumSeed.h:48
MinimumSeed contains the starting values for the minimization produced by the SeedGenerator.
Definition: MinimumSeed.h:31
const MinimumState & State() const
Definition: MinimumSeed.h:46
double sqrt(double)
Double_t x[n]
Definition: legend1.C:17
class holding the full result of the minimization; both internal and external (MnUserParameterState) ...
const MnAlgebraicVector & Vec() const
double Fval() const
Definition: MinimumSeed.h:52
Wrapper class to FCNBase interface used internally by Minuit.
Definition: MnFcn.h:33
class which holds the external user and/or internal Minuit representation of the parameters and error...
unsigned int ExtOfInt(unsigned int internal) const
virtual FunctionMinimum Minimum(const MnFcn &, const GradientCalculator &, const MinimumSeed &, const MnStrategy &, unsigned int, double) const
Definition: ScanBuilder.cxx:22
const MnAlgebraicSymMatrix & InvHessian() const
Definition: MinimumError.h:60
double Up() const
Definition: MnFcn.cxx:35
const MnUserTransformation & Trafo() const
Definition: MinimumSeed.h:50
unsigned int NumOfCalls() const
Definition: MnFcn.h:43
Scans the values of FCN as a function of one Parameter and retains the best function and Parameter va...
MinimumState keeps the information (position, Gradient, 2nd deriv, etc) after one minimization step (...
Definition: MinimumState.h:29
API class for defining three levels of strategies: low (0), medium (1), high (>=2); acts on: Migrad (...
Definition: MnStrategy.h:27
const Int_t n
Definition: legend1.C:16
const FCNBase & Fcn() const
Definition: MnFcn.h:51
interface class for gradient calculators