Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
DistSamplerOptions.h
Go to the documentation of this file.
1// @(#)root/mathcore:$Id$
2// Author: L. Moneta Fri Aug 15 2008
3
4/**********************************************************************
5 * *
6 * Copyright (c) 2008 LCG ROOT Math Team, CERN/PH-SFT *
7 * *
8 * *
9 **********************************************************************/
10
11#ifndef ROOT_Math_DistSamplerOptions
12#define ROOT_Math_DistSamplerOptions
13
14#include <string>
15
16#include <iostream>
17#include "Math/IOptions.h"
18
19namespace ROOT {
20
21
22namespace Math {
23
24
25//_______________________________________________________________________________
26/**
27 DistSampler options class
28
29 @ingroup NumAlgo
30*/
32
33public:
34
35 // static methods for setting and retrieving the default options
36
37 static void SetDefaultSampler(const char * type);
38 static void SetDefaultAlgorithm1D(const char * algo );
39 static void SetDefaultAlgorithmND(const char * algo );
40 static void SetDefaultPrintLevel(int level);
41
42 static const std::string & DefaultSampler();
43 static const std::string & DefaultAlgorithm1D();
44 static const std::string & DefaultAlgorithmND();
45 static int DefaultPrintLevel();
46
47 /// retrieve extra options - if not existing create a IOptions
48 static ROOT::Math::IOptions & Default(const char * name);
49
50 // find extra options - return 0 if not existing
51 static ROOT::Math::IOptions * FindDefault(const char * name);
52
53 /// print all the default options for the name given
54 static void PrintDefault(const char * name, std::ostream & os = std::cout);
55
56public:
57
58 // constructor using the default options
59 // pass optionally a pointer to the additional options
60 // otherwise look if they exist for this default minimizer
61 // and in that case they are copied in the constructed instance
62 // constructor takes dimension since a different default algorithm
63 // is used if the dimension is 1 or greater than 1
64 DistSamplerOptions(int dim = 0);
65
66 // destructor
68
69 // copy constructor
71
72 /// assignment operators
74
75 /** non-static methods for retrivieng options */
76
77 /// set print level
78 int PrintLevel() const { return fLevel; }
79
80 /// return extra options (NULL pointer if they are not present)
81 IOptions * ExtraOptions() const { return fExtraOptions; }
82
83 /// type of minimizer
84 const std::string & Sampler() const { return fSamplerType; }
85
86 /// type of algorithm (method)
87 const std::string & Algorithm() const { return fAlgoType; }
88
89 /// print all the options
90 void Print(std::ostream & os = std::cout) const;
91
92 /** non-static methods for setting options */
93
94 /// set print level
95 void SetPrintLevel(int level) { fLevel = level; }
96
97 /// set minimizer type
98 void SetSampler(const char * type) { fSamplerType = type; }
99
100 /// set minimizer algorithm
101 void SetAlgorithm(const char *type) { fAlgoType = type; }
102
103 /// set extra options (in this case pointer is cloned)
104 void SetExtraOptions(const IOptions & opt);
105
106 /// set a specific algorithm option
107 template <class T>
108 void SetAlgoOption(const char * name, T value) {
110 fExtraOptions->SetValue(name, value);
111 }
112
113protected:
114
115 void CreateExtraOptions();
116
117private:
118
119 int fLevel; // debug print level
120 std::string fSamplerType; // DistSampler type (Unuran, Foam, etc...)xs
121 std::string fAlgoType; // DistSampler algorithmic specification (for Unuran only)
122
123 // extra options
125
126};
127
128 } // end namespace Math
129
130} // end namespace ROOT
131
132#endif
char name[80]
Definition TGX11.cxx:110
int type
Definition TGX11.cxx:121
DistSampler options class.
DistSamplerOptions & operator=(const DistSamplerOptions &opt)
assignment operators
int PrintLevel() const
non-static methods for retrivieng options
static void SetDefaultSampler(const char *type)
void SetExtraOptions(const IOptions &opt)
set extra options (in this case pointer is cloned)
void SetAlgorithm(const char *type)
set minimizer algorithm
const std::string & Algorithm() const
type of algorithm (method)
static void SetDefaultPrintLevel(int level)
static void PrintDefault(const char *name, std::ostream &os=std::cout)
print all the default options for the name given
void SetSampler(const char *type)
set minimizer type
ROOT::Math::IOptions * fExtraOptions
static const std::string & DefaultSampler()
const std::string & Sampler() const
type of minimizer
static void SetDefaultAlgorithmND(const char *algo)
IOptions * ExtraOptions() const
return extra options (NULL pointer if they are not present)
static const std::string & DefaultAlgorithmND()
static const std::string & DefaultAlgorithm1D()
static void SetDefaultAlgorithm1D(const char *algo)
static ROOT::Math::IOptions & Default(const char *name)
retrieve extra options - if not existing create a IOptions
static ROOT::Math::IOptions * FindDefault(const char *name)
void SetAlgoOption(const char *name, T value)
set a specific algorithm option
void SetPrintLevel(int level)
non-static methods for setting options
void Print(std::ostream &os=std::cout) const
print all the options
Generic interface for defining configuration options of a numerical algorithm.
Definition IOptions.h:31
void SetValue(const char *name, double val)
generic methods for retrivieng options
Definition IOptions.h:45
Namespace for new Math classes and functions.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...