Logo ROOT  
Reference Guide
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"
15#include "Minuit2/MnFcn.h"
16
17namespace ROOT {
18
19 namespace Minuit2 {
20
21
22FunctionMinimum 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
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 sqrt(double)
class holding the full result of the minimization; both internal and external (MnUserParameterState) ...
interface class for gradient calculators
const MnAlgebraicSymMatrix & InvHessian() const
Definition: MinimumError.h:60
const MnAlgebraicVector & Vec() const
MinimumSeed contains the starting values for the minimization produced by the SeedGenerator.
Definition: MinimumSeed.h:31
const MinimumError & Error() const
Definition: MinimumSeed.h:48
const MnUserTransformation & Trafo() const
Definition: MinimumSeed.h:50
const MinimumParameters & Parameters() const
Definition: MinimumSeed.h:47
const MinimumState & State() const
Definition: MinimumSeed.h:46
MinimumState keeps the information (position, Gradient, 2nd deriv, etc) after one minimization step (...
Definition: MinimumState.h:29
Wrapper class to FCNBase interface used internally by Minuit.
Definition: MnFcn.h:33
double Up() const
Definition: MnFcn.cxx:35
const FCNBase & Fcn() const
Definition: MnFcn.h:51
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...
const MnUserParameters & Parameters() const
API class for defining three levels of strategies: low (0), medium (1), high (>=2); acts on: Migrad (...
Definition: MnStrategy.h:27
class which holds the external user and/or internal Minuit representation of the parameters and error...
const MnUserParameters & Parameters() const
double Value(unsigned int) const
double Ext2int(unsigned int, double) const
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
Double_t x[n]
Definition: legend1.C:17
const Int_t n
Definition: legend1.C:16
VSD Structures.
Definition: StringConv.hxx:21