Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//#include <getopt.h>
//#include <fstream>
//#include <string>
#include <math.h>
#include <stdio.h>
#include "Minuit2/MnUserParameters.h"
#include "PwaUtils/PwaFcnBaseNew.hh"
#include "PwaUtils/AbsLhNew.hh"
// #include "PwaUtils/FitParamsBaseNew.hh"
#include "ErrLogger/ErrLogger.hh"
using namespace ROOT::Minuit2;
PwaFcnBaseNew::PwaFcnBaseNew(boost::shared_ptr<AbsLhNew> absLh, boost::shared_ptr<FitParamsBaseNew> fitParamsBase) :
_absLhPtr(absLh)
, _fitParamsBasePtr(fitParamsBase)
, _fcnCounter(0)
{
if (0==_absLhPtr) { Alert << "AbsLh* _absLhPtr pointer is 0 !!!!" << endmsg; exit(1); }
_absLhPtr->getDefaultParams(_defaultFitValParms, _defaultFitErrParms);
}
PwaFcnBaseNew::~PwaFcnBaseNew()
{
}
double PwaFcnBaseNew::operator()(const std::vector<double>& par) const
{
_fcnCounter++;
fitParamsNew theFitParmValTmp=_defaultFitValParms;
// fitParamsNew theFitParmValTmp;
// fitParamsNew theFitParmValTmp1;
// _absLhPtr->getDefaultParams(theFitParmValTmp, theFitParmValTmp1);
_fitParamsBasePtr->getFitParamVal(par, theFitParmValTmp);
double result=_absLhPtr->calcLogLh(theFitParmValTmp);
DebugMsg << "logLh= " << result <<endmsg;
if ( _fcnCounter%50 == 0) {
_fitParamsBasePtr->printParams(theFitParmValTmp);
}
if ( _fcnCounter%200 == 0) {
std::ofstream theStream ( "currentResult.dat");
_fitParamsBasePtr->dumpParams(theStream, theFitParmValTmp, theFitParmValTmp);
}
return result;
}
double PwaFcnBaseNew::Up() const
{
return .5;
}