Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
16namespace 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
const FCNBase & Fcn() const
Definition MnFcn.h:47
const MnUserTransformation & fTransform
Definition MnUserFcn.h:38
double operator()(const MnAlgebraicVector &) const override
Definition MnUserFcn.cxx:18
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
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...