CMS 3D CMS Logo

Public Member Functions | Private Attributes

ProfileLikelihood::MinimizerSentry Class Reference

Setup Minimizer configuration on creation, reset the previous one on destruction. More...

#include <ProfileLikelihood.h>

List of all members.

Public Member Functions

 MinimizerSentry (const std::string &algo, double tolerance)
 ~MinimizerSentry ()

Private Attributes

std::string minimizerAlgoBackup
double minimizerTollBackup
std::string minimizerTypeBackup

Detailed Description

Setup Minimizer configuration on creation, reset the previous one on destruction.

Definition at line 26 of file ProfileLikelihood.h.


Constructor & Destructor Documentation

ProfileLikelihood::MinimizerSentry::MinimizerSentry ( const std::string &  algo,
double  tolerance 
)

Definition at line 82 of file ProfileLikelihood.cc.

References algo, gather_cfg::cout, and UserOptions_cff::idx.

                                                                                                  :
    minimizerTypeBackup(ROOT::Math::MinimizerOptions::DefaultMinimizerType()),
    minimizerAlgoBackup(ROOT::Math::MinimizerOptions::DefaultMinimizerAlgo()),
    minimizerTollBackup(ROOT::Math::MinimizerOptions::DefaultTolerance())
{
  ROOT::Math::MinimizerOptions::SetDefaultTolerance(tolerance);
  if (minimizerAlgo.find(",") != std::string::npos) {
      size_t idx = minimizerAlgo.find(",");
      std::string type = minimizerAlgo.substr(0,idx), algo = minimizerAlgo.substr(idx+1);
      if (verbose > 1) std::cout << "Set default minimizer to " << type << ", algorithm " << algo << std::endl;
      ROOT::Math::MinimizerOptions::SetDefaultMinimizer(type.c_str(), algo.c_str());
  } else {
      if (verbose > 1) std::cout << "Set default minimizer to " << minimizerAlgo << std::endl;
      ROOT::Math::MinimizerOptions::SetDefaultMinimizer(minimizerAlgo.c_str());
  }
}
ProfileLikelihood::MinimizerSentry::~MinimizerSentry ( )

Definition at line 99 of file ProfileLikelihood.cc.

{
  ROOT::Math::MinimizerOptions::SetDefaultTolerance(minimizerTollBackup);
  ROOT::Math::MinimizerOptions::SetDefaultMinimizer(minimizerTypeBackup.c_str(),minimizerAlgoBackup.empty() ? 0 : minimizerAlgoBackup.c_str());
}

Member Data Documentation

Definition at line 31 of file ProfileLikelihood.h.

Definition at line 32 of file ProfileLikelihood.h.

Definition at line 31 of file ProfileLikelihood.h.