Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ParameterSettings.h
Go to the documentation of this file.
1// @(#)root/mathcore:$Id$
2// Author: L. Moneta Thu Sep 21 16:21:48 2006
3
4/**********************************************************************
5 * *
6 * Copyright (c) 2006 LCG ROOT Math Team, CERN/PH-SFT *
7 * *
8 * *
9 **********************************************************************/
10
11// Header file for class ParameterSettings
12
13#ifndef ROOT_Fit_ParameterSettings
14#define ROOT_Fit_ParameterSettings
15
16#include <string>
17
18namespace ROOT {
19
20 namespace Fit {
21
22
23//___________________________________________________________________________________
24/**
25 Class, describing value, limits and step size of the parameters
26 Provides functionality also to set/retrieve values, step sizes, limits and fix the
27 parameters.
28
29 To be done: add constraints (equality and inequality) as functions of the parameters
30
31 @ingroup FitMain
32*/
34
35public:
36
37 /**
38 Default constructor
39 */
41 fValue(0.), fStepSize(0.1), fFix(false),
43 fName("")
44 {}
45
46
47 ///constructor for unlimited named Parameter
48 ParameterSettings(const std::string & name, double val, double err) :
49 fValue(val), fStepSize(err), fFix(false),
51 fName(name)
52 {}
53
54 ///constructor for double limited Parameter. The given value should be within the given limits [min,max]
55 ParameterSettings(const std::string & name, double val, double err,
56 double min, double max) :
57 fValue(val), fStepSize(err), fFix(false),
59 fName(name)
60 {
61 SetLimits(min,max);
62 }
63
64 ///constructor for fixed Parameter
65 ParameterSettings(const std::string & name, double val) :
66 fValue(val), fStepSize(0), fFix(true),
68 fName(name)
69 {}
70
71
72
73
74 /// set value and name (unlimited parameter)
75 void Set(const std::string & name, double value, double step) {
78 SetStepSize(step);
79 }
80
81 /// set a limited parameter. The given value should be within the given limits [min,max]
82 void Set(const std::string & name, double value, double step, double lower, double upper ) {
85 SetStepSize(step);
86 SetLimits(lower,upper);
87 }
88
89 /// set a fixed parameter
90 void Set(const std::string & name, double value) {
93 Fix();
94 }
95
96
97 /**
98 Destructor (no operations)
99 */
101
102 /// copy constructor and assignment operators (leave them to the compiler)
103
104public:
105
106 /// return parameter value
107 double Value() const { return fValue; }
108 /// return step size
109 double StepSize() const { return fStepSize; }
110 /// return lower limit value
111 double LowerLimit() const {return fLowerLimit;}
112 /// return upper limit value
113 double UpperLimit() const {return fUpperLimit;}
114 /// check if is fixed
115 bool IsFixed() const { return fFix; }
116 /// check if parameter has lower limit
117 bool HasLowerLimit() const {return fHasLowerLimit; }
118 /// check if parameter has upper limit
119 bool HasUpperLimit() const {return fHasUpperLimit; }
120 /// check if is bound
121 bool IsBound() const { return fHasLowerLimit || fHasUpperLimit; }
122 /// check if is double bound (upper AND lower limit)
123 bool IsDoubleBound() const { return fHasLowerLimit && fHasUpperLimit; }
124 /// return name
125 const std::string & Name() const { return fName; }
126
127 /** interaction **/
128
129 /// set name
130 void SetName(const std::string & name ) { fName = name; }
131
132 /// fix the parameter
133 void Fix() {fFix = true;}
134 /// release the parameter
135 void Release() {fFix = false;}
136 /// set the value
137 void SetValue(double val) {fValue = val;}
138 /// set the step size
139 void SetStepSize(double err) {fStepSize = err;}
140 void SetLimits(double low, double up);
141 /// set a single upper limit
142 void SetUpperLimit(double up) {
143 fLowerLimit = 0.;
144 fUpperLimit = up;
145 fHasLowerLimit = false;
146 fHasUpperLimit = true;
147 }
148 /// set a single lower limit
149 void SetLowerLimit(double low) {
150 fLowerLimit = low;
151 fUpperLimit = 0.;
152 fHasLowerLimit = true;
153 fHasUpperLimit = false;
154 }
155
156 /// remove all limit
158 fLowerLimit = 0.;
159 fUpperLimit = 0.;
160 fHasLowerLimit = false;
161 fHasUpperLimit = false;
162 }
163
164
165
166protected:
167
168
169private:
170
171 double fValue; ///< parameter value
172 double fStepSize; ///< parameter step size (used by minimizer)
173 bool fFix; ///< flag to control if parameter is fixed
174 double fLowerLimit; ///< lower parameter limit
175 double fUpperLimit; ///< upper parameter limit
176 bool fHasLowerLimit; ///< flag to control lower parameter limit
177 bool fHasUpperLimit; ///< flag to control upper parameter limit
178
179 std::string fName; ///< parameter name
180
181};
182
183 } // end namespace Fit
184
185} // end namespace ROOT
186
187
188#endif /* ROOT_Fit_ParameterSettings */
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
char name[80]
Definition TGX11.cxx:110
Class, describing value, limits and step size of the parameters Provides functionality also to set/re...
void Release()
release the parameter
bool IsFixed() const
check if is fixed
bool HasUpperLimit() const
check if parameter has upper limit
bool fFix
flag to control if parameter is fixed
ParameterSettings(const std::string &name, double val, double err)
constructor for unlimited named Parameter
ParameterSettings()
Default constructor.
void RemoveLimits()
remove all limit
void SetValue(double val)
set the value
double LowerLimit() const
return lower limit value
void SetName(const std::string &name)
interaction
const std::string & Name() const
return name
bool HasLowerLimit() const
check if parameter has lower limit
double fLowerLimit
lower parameter limit
double fUpperLimit
upper parameter limit
bool fHasUpperLimit
flag to control upper parameter limit
void SetStepSize(double err)
set the step size
void Set(const std::string &name, double value, double step)
set value and name (unlimited parameter)
double fStepSize
parameter step size (used by minimizer)
bool fHasLowerLimit
flag to control lower parameter limit
void SetLimits(double low, double up)
set a double side limit, if low == up the parameter is fixed if low > up the limits are removed The c...
ParameterSettings(const std::string &name, double val)
constructor for fixed Parameter
double Value() const
copy constructor and assignment operators (leave them to the compiler)
void Set(const std::string &name, double value)
set a fixed parameter
void Set(const std::string &name, double value, double step, double lower, double upper)
set a limited parameter. The given value should be within the given limits [min,max]
ParameterSettings(const std::string &name, double val, double err, double min, double max)
constructor for double limited Parameter. The given value should be within the given limits [min,...
~ParameterSettings()
Destructor (no operations)
double StepSize() const
return step size
void SetUpperLimit(double up)
set a single upper limit
std::string fName
parameter name
void Fix()
fix the parameter
double UpperLimit() const
return upper limit value
bool IsDoubleBound() const
check if is double bound (upper AND lower limit)
bool IsBound() const
check if is bound
void SetLowerLimit(double low)
set a single lower limit
TFitResultPtr Fit(FitObject *h1, TF1 *f1, Foption_t &option, const ROOT::Math::MinimizerOptions &moption, const char *goption, ROOT::Fit::DataRange &range)
Definition HFitImpl.cxx:133
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...