Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
MnFcn.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/MnFcn.h"
12
13namespace ROOT {
14
15namespace Minuit2 {
16
18{
19 // evaluate FCN converting from from MnAlgebraicVector to std::vector
20 fNumCall++;
21 return fFCN(std::vector<double>{v.Data(), v.Data() + v.size()});
22}
23
24// Calling the underlying function with the transformed parameters.
25// For internal use in the Minuit2 implementation.
26double MnFcn::CallWithTransformedParams(std::vector<double> const &vpar) const
27{
28 // call Fcn function transforming from a MnAlgebraicVector of internal values to a std::vector of external ones
29 fNumCall++;
30
31 return Fcn()(vpar);
32}
33
34MnFcnCaller::MnFcnCaller(const MnFcn &mfcn) : fMfcn{mfcn}, fDoInt2ext{static_cast<bool>(mfcn.Trafo())}
35{
36 if (!fDoInt2ext)
37 return;
38
40
41 // get first initial values of parameter (in case some one is fixed)
42 fVpar.assign(transform.InitialParValues().begin(), transform.InitialParValues().end());
43}
44
46{
47 if (!fDoInt2ext)
49
51
52 bool firstCall = fLastInput.size() != v.size();
53
54 fLastInput.resize(v.size());
55
56 for (unsigned int i = 0; i < v.size(); i++) {
57 if (firstCall || fLastInput[i] != v(i)) {
58 fVpar[transform.ExtOfInt(i)] = transform.Int2ext(i, v(i));
59 fLastInput[i] = v(i);
60 }
61 }
62
64}
65
66} // namespace Minuit2
67
68} // namespace ROOT
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
std::vector< double > fVpar
Definition MnFcn.h:81
std::vector< double > fLastInput
Definition MnFcn.h:80
double operator()(const MnAlgebraicVector &v)
Definition MnFcn.cxx:45
MnFcnCaller(const MnFcn &mfcn)
Definition MnFcn.cxx:34
MnFcn const & fMfcn
Definition MnFcn.h:78
Wrapper class to FCNBase interface used internally by Minuit.
Definition MnFcn.h:34
const FCNBase & fFCN
Definition MnFcn.h:65
double CallWithoutDoingTrafo(const MnAlgebraicVector &) const
Definition MnFcn.cxx:17
const FCNBase & Fcn() const
Definition MnFcn.h:55
double CallWithTransformedParams(std::vector< double > const &vpar) const
Definition MnFcn.cxx:26
const MnUserTransformation * Trafo() const
Definition MnFcn.h:59
class dealing with the transformation between user specified parameters (external) and internal param...
const_iterator begin() const
const_iterator end() const
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...