Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 // calling fTransform() like here was not thread safe because it was using a cached vector
21 // return Fcn()( fTransform(v) );
22 // make a new thread-safe implementation creating a vector each time
23 // a bit slower few% in stressFit and 10% in Rosenbrock function but it is negligible in big fits
24
25 // get first initial values of parameter (in case some one is fixed)
26 std::vector<double> vpar(fTransform.InitialParValues().begin(), fTransform.InitialParValues().end());
27
28 const std::vector<MinuitParameter> &parameters = fTransform.Parameters();
29 unsigned int n = v.size();
30 for (unsigned int i = 0; i < n; i++) {
31 int ext = fTransform.ExtOfInt(i);
32 if (parameters[ext].HasLimits()) {
33 vpar[ext] = fTransform.Int2ext(i, v(i));
34 } else {
35 vpar[ext] = v(i);
36 }
37 }
38
40}
41
42// Calling the underlying function with the transformed parameters.
43// For internal use in the Minuit2 implementation.
44double MnUserFcn::callWithTransformedParams(std::vector<double> const &vpar) const
45{
46 // call Fcn function transforming from a MnAlgebraicVector of internal values to a std::vector of external ones
47 fNumCall++;
48
49 return Fcn()(vpar);
50}
51
52} // namespace Minuit2
53
54} // namespace ROOT
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
const FCNBase & Fcn() const
Definition MnFcn.h:47
double callWithTransformedParams(std::vector< double > const &vpar) const
Definition MnUserFcn.cxx:44
const MnUserTransformation & fTransform
Definition MnUserFcn.h:44
double operator()(const MnAlgebraicVector &) const override
Definition MnUserFcn.cxx:18
const_iterator begin() const
const_iterator end() 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...