Logo ROOT   6.18/05
Reference Guide
MnUserFcn.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/MnUserFcn.h"
11#include "Minuit2/FCNBase.h"
13
14namespace ROOT {
15
16 namespace Minuit2 {
17
18
20 // call Fcn function transforming from a MnAlgebraicVector of internal values to a std::vector of external ones
21 fNumCall++;
22
23 // calling fTransform() like here was not thread safe because it was using a cached vector
24 //return Fcn()( fTransform(v) );
25 // make a new thread-safe implementation creating a vector each time
26 // a bit slower few% in stressFit and 10% in Rosenbrock function but it is negligible in big fits
27
28 // get first initial values of parameter (in case some one is fixed)
29 std::vector<double> vpar(fTransform.InitialParValues().begin(), fTransform.InitialParValues().end() );
30
31 const std::vector<MinuitParameter>& parameters = fTransform.Parameters();
32 unsigned int n = v.size();
33 for (unsigned int i = 0; i < n; i++) {
34 int ext = fTransform.ExtOfInt(i);
35 if (parameters[ext].HasLimits()) {
36 vpar[ext] = fTransform.Int2ext(i, v(i));
37 }
38 else {
39 vpar[ext] = v(i);
40 }
41 }
42 return Fcn()(vpar);
43}
44
45 } // namespace Minuit2
46
47} // namespace ROOT
SVector< double, 2 > v
Definition: Dict.h:5
const FCNBase & Fcn() const
Definition: MnFcn.h:51
const MnUserTransformation & fTransform
Definition: MnUserFcn.h:39
virtual double operator()(const MnAlgebraicVector &) const
Definition: MnUserFcn.cxx:19
unsigned int ExtOfInt(unsigned int internal) const
const std::vector< MinuitParameter > & Parameters() const
double Int2ext(unsigned int, double) const
const std::vector< double > & InitialParValues() const
const Int_t n
Definition: legend1.C:16
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21