diff --git a/ConfigParser/ParserBase.cc b/ConfigParser/ParserBase.cc index 4394326ae741bbf538c79ac294f4c43de24b04f5..a256ff36f1d9633bbc44102f734024430eec7a2b 100644 --- a/ConfigParser/ParserBase.cc +++ b/ConfigParser/ParserBase.cc @@ -101,6 +101,7 @@ ParserBase::ParserBase(int argc,char **argv) ,_stepSizeParamsDump(200) ,_useAbsPhaseDiff(false) ,_useMultipoleGeneral(false) + ,_scalingMachinePrecision(1.) { string globalCofigFilePath="/ConfigParser/global.cfg"; _configFile=getenv("TOP_DIR")+globalCofigFilePath; @@ -215,6 +216,7 @@ ParserBase::ParserBase(int argc,char **argv) ("stepSizeParamsDump",po::value<unsigned int>(&_stepSizeParamsDump),"step size for parameter print out in dump file") ("useAbsPhaseDiff",po::value<bool>(&_useAbsPhaseDiff), "use absolut value of the phse difference in FVectorCompare mode") ("useMultipoleGeneral",po::value<bool>(&_useMultipoleGeneral), "use moltipoles for the general case") + ("scalingMachinePrecision",po::value<double>(&_scalingMachinePrecision), "scaling factor of machine precision for numerical calculations") ; } @@ -337,7 +339,8 @@ bool ParserBase::parseCommandLine(int argc, char **argv) << "stepSizeParamsPrint: " << _stepSizeParamsPrint << "\n\n" << "stepSizeParamsDump: " << _stepSizeParamsDump << "\n\n" << "useAbsPhaseDiff: " << _useAbsPhaseDiff <<"\n\n" - << "useMultipoleGeneral: " << _useMultipoleGeneral << "\n\n" + << "useMultipoleGeneral: " << _useMultipoleGeneral << "\n\n" + << "scalingMachinePrecision: " << _scalingMachinePrecision << "\n\n" << endmsg; diff --git a/ConfigParser/ParserBase.hh b/ConfigParser/ParserBase.hh index 5b0fdf1005feb3b8094dd7374cd90c61b8338203..55db26a78a23ca5c352b516e49b4991bb365fda6 100644 --- a/ConfigParser/ParserBase.hh +++ b/ConfigParser/ParserBase.hh @@ -140,7 +140,9 @@ public: const unsigned int stepSizeParamsPrint() const {return _stepSizeParamsPrint;} const unsigned int stepSizeParamsDump() const {return _stepSizeParamsDump;} const bool useAbsPhaseDiff() const {return _useAbsPhaseDiff;} - const bool useMultipoleGeneral() const {return _useMultipoleGeneral;} + const bool useMultipoleGeneral() const {return _useMultipoleGeneral;} + const double scalingMachinePrecision() const {return _scalingMachinePrecision;} + protected: virtual bool parseCommandLine(int argc,char **argv); @@ -239,4 +241,5 @@ protected: unsigned int _stepSizeParamsDump; bool _useAbsPhaseDiff; bool _useMultipoleGeneral; + double _scalingMachinePrecision; }; diff --git a/MinFunctions/PwaFcnServer.cc b/MinFunctions/PwaFcnServer.cc index 8c02c25d488592325ec1338953546be8233d1475..c072e249e535f6edcfcc459e97ffbecbe1781910 100644 --- a/MinFunctions/PwaFcnServer.cc +++ b/MinFunctions/PwaFcnServer.cc @@ -44,7 +44,7 @@ template<typename T> PwaFcnServer<T>::PwaFcnServer(std::shared_ptr<NetworkServer> netServer) : AbsFcn<T>() , _networkServerPtr(netServer) - , _numStepSize(std::sqrt(std::numeric_limits<double>::epsilon()*150.)) + , _numStepSize(std::sqrt(std::numeric_limits<double>::epsilon()*GlobalEnv::instance()->parser()->scalingMachinePrecision())) { this->_defaultPawianParms = GlobalEnv::instance()->defaultPawianParams(); this->_currentPawianParms = GlobalEnv::instance()->startPawianParams(); @@ -135,14 +135,14 @@ std::vector<double> PwaFcnServer<T>::Gradient(const std::vector<double>& par) co ParamDepHandler::instance()->ApplyDependencies(this->_currentPawianParms); double currentLH=collectLH(); resultVec.at(i)=(LHBase-currentLH)/dx; - // InfoMsg << "resultVecLow.at(" << i << ")= " << resultVec.at(i) << endmsg; + //InfoMsg << "resultVecLow.at(" << i << ")= " << resultVec.at(i) << endmsg; } else{ this->_currentPawianParms->SetValue(i, currentVal+epsilon); ParamDepHandler::instance()->ApplyDependencies(this->_currentPawianParms); double currentLH=collectLH(); resultVec.at(i)=(currentLH-LHBase)/dx; - // InfoMsg << "resultVecHigh.at(" << i << ")= " << resultVec.at(i) << endmsg; + //InfoMsg << "resultVecHigh.at(" << i << ")= " << resultVec.at(i) << endmsg; } this->_currentPawianParms->SetValue(i, currentVal); }