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
42
43 ///constructor for unlimited named Parameter
44 ParameterSettings(const std::string & name, double val, double err) :
45 fValue(val), fStepSize(err),
46 fName(name)
47 {}
48
49 ///constructor for double limited Parameter. The given value should be within the given limits [min,max]
50 ParameterSettings(const std::string & name, double val, double err,
51 double min, double max) :
52 fValue(val), fStepSize(err),
53 fName(name)
54 {
55 SetLimits(min,max);
56 }
57
58 ///constructor for fixed Parameter
59 ParameterSettings(const std::string & name, double val) :
60 fValue(val), fStepSize(0), fFix(true),
61 fName(name)
62 {}
63
64
65
66
67 /// set value and name (unlimited parameter)
68 void Set(const std::string & name, double value, double step) {
71 SetStepSize(step);
72 }
73
74 /// set a limited parameter. The given value should be within the given limits [min,max]
75 void Set(const std::string & name, double value, double step, double lower, double upper ) {
78 SetStepSize(step);
79 SetLimits(lower,upper);
80 }
81
82 /// set a fixed parameter
83 void Set(const std::string & name, double value) {
86 Fix();
87 }
88
89 /// return parameter value
90 double Value() const { return fValue; }
91 /// return step size
92 double StepSize() const { return fStepSize; }
93 /// return lower limit value
94 double LowerLimit() const {return fLowerLimit;}
95 /// return upper limit value
96 double UpperLimit() const {return fUpperLimit;}
97 /// check if is fixed
98 bool IsFixed() const { return fFix; }
99 /// check if parameter has lower limit
100 bool HasLowerLimit() const {return fHasLowerLimit; }
101 /// check if parameter has upper limit
102 bool HasUpperLimit() const {return fHasUpperLimit; }
103 /// check if is bound
104 bool IsBound() const { return fHasLowerLimit || fHasUpperLimit; }
105 /// check if is double bound (upper AND lower limit)
106 bool IsDoubleBound() const { return fHasLowerLimit && fHasUpperLimit; }
107 /// return name
108 const std::string & Name() const { return fName; }
109
110 /** interaction **/
111
112 /// set name
113 void SetName(const std::string & name ) { fName = name; }
114
115 /// fix the parameter
116 void Fix() {fFix = true;}
117 /// release the parameter
118 void Release() {fFix = false;}
119 /// set the value
120 void SetValue(double val) {fValue = val;}
121 /// set the step size
122 void SetStepSize(double err) {fStepSize = err;}
123 void SetLimits(double low, double up);
124 /// set a single upper limit
125 void SetUpperLimit(double up) {
126 fLowerLimit = 0.;
127 fUpperLimit = up;
128 fHasLowerLimit = false;
129 fHasUpperLimit = true;
130 }
131 /// set a single lower limit
132 void SetLowerLimit(double low) {
133 fLowerLimit = low;
134 fUpperLimit = 0.;
135 fHasLowerLimit = true;
136 fHasUpperLimit = false;
137 }
138
139 /// remove all limit
141 fLowerLimit = 0.;
142 fUpperLimit = 0.;
143 fHasLowerLimit = false;
144 fHasUpperLimit = false;
145 }
146
147private:
148
149 double fValue = 0.0; ///< parameter value
150 double fStepSize = 0.1; ///< parameter step size (used by minimizer)
151 bool fFix = false; ///< flag to control if parameter is fixed
152 double fLowerLimit = 0.0; ///< lower parameter limit
153 double fUpperLimit = 0.0; ///< upper parameter limit
154 bool fHasLowerLimit = false; ///< flag to control lower parameter limit
155 bool fHasUpperLimit = false; ///< flag to control upper parameter limit
156
157 std::string fName; ///< parameter name
158
159};
160
161 } // end namespace Fit
162
163} // end namespace ROOT
164
165
166#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
return parameter value
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,...
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...