Skip to content
Snippets Groups Projects
Commit cb71c596 authored by Bertram Kopf's avatar Bertram Kopf
Browse files

added mutex for OpenMP

parent 26c18492
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,10 @@
#include <math.h>
#include <stdio.h>
#ifdef _OPENMP
#include <omp.h>
#endif
#include "Minuit2/MnUserParameters.h"
#include "PwaUtils/PwaFcnBaseNew.hh"
......@@ -29,28 +33,44 @@ 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);
#ifdef _OPENMP
#pragma omp critical
{
#endif
DebugMsg << "logLh= " << result <<endmsg;
if ( _fcnCounter%50 == 0) {
_fitParamsBasePtr->printParams(theFitParmValTmp);
_fitParamsBasePtr->getFitParamVal(par, theFitParmValTmp);
#ifdef _OPENMP
}
if ( _fcnCounter%200 == 0) {
std::ofstream theStream ( "currentResult.dat");
_fitParamsBasePtr->dumpParams(theStream, theFitParmValTmp, theFitParmValTmp);
#endif
double result=_absLhPtr->calcLogLh(theFitParmValTmp);
#ifdef _OPENMP
#pragma omp critical
{
#endif
_fcnCounter++;
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);
}
#ifdef _OPENMP
}
#endif
return result;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment