Logo ROOT  
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 
14 namespace ROOT {
15 
16 namespace Minuit2 {
17 
19 {
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  } else {
38  vpar[ext] = v(i);
39  }
40  }
41  return Fcn()(vpar);
42 }
43 
44 } // namespace Minuit2
45 
46 } // namespace ROOT
n
const Int_t n
Definition: legend1.C:16
ROOT::Minuit2::MnUserTransformation::Int2ext
double Int2ext(unsigned int, double) const
Definition: MnUserTransformation.cxx:99
ROOT::Minuit2::LAVector
Definition: LAVector.h:32
ROOT::Minuit2::MnFcn::fNumCall
int fNumCall
Definition: MnFcn.h:53
ROOT::Minuit2::MnUserTransformation::Parameters
const std::vector< MinuitParameter > & Parameters() const
Definition: MnUserTransformation.h:108
ROOT::Minuit2::MnUserFcn::operator()
virtual double operator()(const MnAlgebraicVector &) const
Definition: MnUserFcn.cxx:18
MnUserTransformation.h
v
@ v
Definition: rootcling_impl.cxx:3664
ROOT::Minuit2::MnFcn::Fcn
const FCNBase & Fcn() const
Definition: MnFcn.h:47
ROOT::Minuit2::MnUserTransformation::InitialParValues
const std::vector< double > & InitialParValues() const
Definition: MnUserTransformation.h:113
MnUserFcn.h
FCNBase.h
ROOT::Minuit2::MnUserTransformation::ExtOfInt
unsigned int ExtOfInt(unsigned int internal) const
Definition: MnUserTransformation.h:102
ROOT
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Definition: EExecutionPolicy.hxx:4
ROOT::Minuit2::MnUserFcn::fTransform
const MnUserTransformation & fTransform
Definition: MnUserFcn.h:38