1 // @(#)root/minuit2:$Id$ 2 // Authors: M. Winkler, F. James, L. Moneta, A. Zsenei 2003-2005 3 4 /********************************************************************** 5 * * 6 * Copyright (c) 2005 LCG ROOT Math team, CERN/PH-SFT * 7 * * 8 **********************************************************************/ 9 10 #ifndef ROOT_Minuit2_MnStrategy 11 #define ROOT_Minuit2_MnStrategy 12 13 namespace ROOT { 14 15 namespace Minuit2 { 16 17 //_________________________________________________________________________ 18 /** 19 API class for defining three levels of strategies: low (0), medium (1), 20 high (>=2); 21 acts on: Migrad (behavioural), 22 Minos (lowers strategy by 1 for Minos-own minimization), 23 Hesse (iterations), 24 Numerical2PDerivative (iterations) 25 */ 26 27 class MnStrategy { 28 29 public: 30 // default strategy 31 MnStrategy(); 32 33 // user defined strategy (0, 1, >=2) 34 explicit MnStrategy(unsigned int); 35 ~MnStrategy()36 ~MnStrategy() {} 37 Strategy()38 unsigned int Strategy() const { return fStrategy; } 39 GradientNCycles()40 unsigned int GradientNCycles() const { return fGradNCyc; } GradientStepTolerance()41 double GradientStepTolerance() const { return fGradTlrStp; } GradientTolerance()42 double GradientTolerance() const { return fGradTlr; } 43 HessianNCycles()44 unsigned int HessianNCycles() const { return fHessNCyc; } HessianStepTolerance()45 double HessianStepTolerance() const { return fHessTlrStp; } HessianG2Tolerance()46 double HessianG2Tolerance() const { return fHessTlrG2; } HessianGradientNCycles()47 unsigned int HessianGradientNCycles() const { return fHessGradNCyc; } 48 StorageLevel()49 int StorageLevel() const { return fStoreLevel; } 50 IsLow()51 bool IsLow() const { return fStrategy == 0; } IsMedium()52 bool IsMedium() const { return fStrategy == 1; } IsHigh()53 bool IsHigh() const { return fStrategy >= 2; } 54 55 void SetLowStrategy(); 56 void SetMediumStrategy(); 57 void SetHighStrategy(); 58 SetGradientNCycles(unsigned int n)59 void SetGradientNCycles(unsigned int n) { fGradNCyc = n; } SetGradientStepTolerance(double stp)60 void SetGradientStepTolerance(double stp) { fGradTlrStp = stp; } SetGradientTolerance(double toler)61 void SetGradientTolerance(double toler) { fGradTlr = toler; } 62 SetHessianNCycles(unsigned int n)63 void SetHessianNCycles(unsigned int n) { fHessNCyc = n; } SetHessianStepTolerance(double stp)64 void SetHessianStepTolerance(double stp) { fHessTlrStp = stp; } SetHessianG2Tolerance(double toler)65 void SetHessianG2Tolerance(double toler) { fHessTlrG2 = toler; } SetHessianGradientNCycles(unsigned int n)66 void SetHessianGradientNCycles(unsigned int n) { fHessGradNCyc = n; } 67 68 // set storage level of iteration quantities 69 // 0 = store only last iterations 1 = full storage (default) SetStorageLevel(unsigned int level)70 void SetStorageLevel(unsigned int level) { fStoreLevel = level; } 71 72 private: 73 unsigned int fStrategy; 74 75 unsigned int fGradNCyc; 76 double fGradTlrStp; 77 double fGradTlr; 78 unsigned int fHessNCyc; 79 double fHessTlrStp; 80 double fHessTlrG2; 81 unsigned int fHessGradNCyc; 82 int fStoreLevel; 83 }; 84 85 } // namespace Minuit2 86 87 } // namespace ROOT 88 89 #endif // ROOT_Minuit2_MnStrategy 90