00001 // @(#)root/mathcore:$Id: DistSamplerOptions.h 37419 2010-12-08 21:19:45Z moneta $ 00002 // Author: L. Moneta Fri Aug 15 2008 00003 00004 /********************************************************************** 00005 * * 00006 * Copyright (c) 2008 LCG ROOT Math Team, CERN/PH-SFT * 00007 * * 00008 * * 00009 **********************************************************************/ 00010 00011 #ifndef ROOT_Math_DistSamplerOptions 00012 #define ROOT_Math_DistSamplerOptions 00013 00014 #include <string> 00015 00016 #include <iostream> 00017 00018 namespace ROOT { 00019 00020 00021 namespace Math { 00022 00023 00024 class IOptions; 00025 00026 //_______________________________________________________________________________ 00027 /** 00028 DistSampler options class 00029 00030 @ingroup NumAlgo 00031 */ 00032 class DistSamplerOptions { 00033 00034 public: 00035 00036 // static methods for setting and retrieving the default options 00037 00038 static void SetDefaultSampler(const char * type); 00039 static void SetDefaultAlgorithm1D(const char * algo ); 00040 static void SetDefaultAlgorithmND(const char * algo ); 00041 static void SetDefaultPrintLevel(int level); 00042 00043 static const std::string & DefaultSampler(); 00044 static const std::string & DefaultAlgorithm1D(); 00045 static const std::string & DefaultAlgorithmND(); 00046 static int DefaultPrintLevel(); 00047 00048 /// retrieve extra options - if not existing create a IOptions 00049 static ROOT::Math::IOptions & Default(const char * name); 00050 00051 // find extra options - return 0 if not existing 00052 static ROOT::Math::IOptions * FindDefault(const char * name); 00053 00054 /// print all the default options for the name given 00055 static void PrintDefault(const char * name = 0, std::ostream & os = std::cout); 00056 00057 public: 00058 00059 // constructor using the default options 00060 // pass optionally a pointer to the additional options 00061 // otherwise look if they exist for this default minimizer 00062 // and in that case they are copied in the constructed instance 00063 // constructor takes dimension since a different default algorithm 00064 // is used if the dimension is 1 or greater than 1 00065 DistSamplerOptions(int dim = 0); 00066 00067 // destructor 00068 ~DistSamplerOptions(); 00069 00070 // copy constructor 00071 DistSamplerOptions(const DistSamplerOptions & opt); 00072 00073 /// assignment operators 00074 DistSamplerOptions & operator=(const DistSamplerOptions & opt); 00075 00076 /** non-static methods for retrivieng options */ 00077 00078 /// set print level 00079 int PrintLevel() const { return fLevel; } 00080 00081 /// return extra options (NULL pointer if they are not present) 00082 IOptions * ExtraOptions() const { return fExtraOptions; } 00083 00084 /// type of minimizer 00085 const std::string & Sampler() const { return fSamplerType; } 00086 00087 /// type of algorithm 00088 const std::string & Algorithm() const { return fAlgoType; } 00089 00090 /// print all the options 00091 void Print(std::ostream & os = std::cout) const; 00092 00093 /** non-static methods for setting options */ 00094 00095 /// set print level 00096 void SetPrintLevel(int level) { fLevel = level; } 00097 00098 /// set minimizer type 00099 void SetSampler(const char * type) { fSamplerType = type; } 00100 00101 /// set minimizer algorithm 00102 void SetAlgorithm(const char *type) { fAlgoType = type; } 00103 00104 /// set extra options (in this case pointer is cloned) 00105 void SetExtraOptions(const IOptions & opt); 00106 00107 00108 private: 00109 00110 int fLevel; // debug print level 00111 std::string fSamplerType; // DistSampler type (Unuran, Foam, etc...)xs 00112 std::string fAlgoType; // DistSampler algorithmic specification (for Unuran only) 00113 00114 // extra options 00115 ROOT::Math::IOptions * fExtraOptions; // extra options 00116 00117 }; 00118 00119 } // end namespace Math 00120 00121 } // end namespace ROOT 00122 00123 #endif