CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
ProfileLikelihood::MinimizerSentry Class Reference

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

#include <ProfileLikelihood.h>

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, and gather_cfg::cout.

82  :
83  minimizerTypeBackup(ROOT::Math::MinimizerOptions::DefaultMinimizerType()),
84  minimizerAlgoBackup(ROOT::Math::MinimizerOptions::DefaultMinimizerAlgo()),
85  minimizerTollBackup(ROOT::Math::MinimizerOptions::DefaultTolerance())
86 {
87  ROOT::Math::MinimizerOptions::SetDefaultTolerance(tolerance);
88  if (minimizerAlgo.find(",") != std::string::npos) {
89  size_t idx = minimizerAlgo.find(",");
90  std::string type = minimizerAlgo.substr(0,idx), algo = minimizerAlgo.substr(idx+1);
91  if (verbose > 1) std::cout << "Set default minimizer to " << type << ", algorithm " << algo << std::endl;
92  ROOT::Math::MinimizerOptions::SetDefaultMinimizer(type.c_str(), algo.c_str());
93  } else {
94  if (verbose > 1) std::cout << "Set default minimizer to " << minimizerAlgo << std::endl;
95  ROOT::Math::MinimizerOptions::SetDefaultMinimizer(minimizerAlgo.c_str());
96  }
97 }
type
Definition: HCALResponse.h:22
tuple cout
Definition: gather_cfg.py:121
LimitAlgo * algo
Definition: Combine.cc:60
ProfileLikelihood::MinimizerSentry::~MinimizerSentry ( )

Definition at line 99 of file ProfileLikelihood.cc.

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

Member Data Documentation

std::string ProfileLikelihood::MinimizerSentry::minimizerAlgoBackup
private

Definition at line 31 of file ProfileLikelihood.h.

double ProfileLikelihood::MinimizerSentry::minimizerTollBackup
private

Definition at line 32 of file ProfileLikelihood.h.

std::string ProfileLikelihood::MinimizerSentry::minimizerTypeBackup
private

Definition at line 31 of file ProfileLikelihood.h.