BAT  0.9.4
The Bayesian analysis toolkit
 All Classes Namespaces Functions Variables Enumerations
BCParameter.h
1 #ifndef __BCPARAMETER__H
2 #define __BCPARAMETER__H
3 
15 /*
16  * Copyright (C) 2007-2014, the BAT core developer team
17  * All rights reserved.
18  *
19  * For the licensing terms see doc/COPYING.
20  * For documentation see http://mpp.mpg.de/bat
21  */
22 
23 // ---------------------------------------------------------
24 #include <string>
25 
26 // ---------------------------------------------------------
27 
29 {
30 
31  public:
32 
38  BCParameter();
39 
47  BCParameter(const char* name, double lowerlimit, double upperlimit, const char* latexname = "");
48 
54  const std::string & GetName() const
55  { return fName; }
56 
60  const std::string & GetLatexName() const
61  { return (fLatexName.empty()) ? fName : fLatexName; }
62 
65  double GetLowerLimit() const
66  { return fLowerLimit; }
67 
70  double GetUpperLimit() const
71  { return fUpperLimit; }
72 
77  double GetRangeWidth() const
78  { return (fUpperLimit > fLowerLimit) ? fUpperLimit - fLowerLimit : fLowerLimit - fUpperLimit; }
79 
80  bool FillHistograms() const
81  { return fFillHistograms; }
82 
83  bool Fixed() const
84  { return fFixed; }
85 
86  double GetFixedValue() const
87  { return fFixedValue; }
88 
89  unsigned GetNbins() const
90  { return fNbins; }
91 
99  void SetName(const char * name)
100  { fName = name; }
101 
102  void SetLatexName(const char * latex_name)
103  { fLatexName = latex_name; }
104 
108  void SetLowerLimit(double limit = 0)
109  { fLowerLimit = limit; }
110 
114  void SetUpperLimit(double limit = 1)
115  { fUpperLimit = limit; }
116 
121  void SetLimits(double lowerlimit = 0, double upperlimit = 1)
122  { fLowerLimit = lowerlimit; fUpperLimit = upperlimit; }
123 
124  void Fix(double value)
125  {
126  fFixed = true;
127  fFixedValue = value;
128  }
129 
130  void Unfix()
131  { fFixed = false; }
132 
133  void FillHistograms(bool flag)
134  { fFillHistograms = flag; }
135 
136  void SetNbins(unsigned nbins)
137  { fNbins = nbins; }
146  bool IsAtLimit(double value) const;
147 
148  bool IsValid(double value) const
149  { return (fLowerLimit <= value) && (value <= fUpperLimit) ? true : false; }
150 
153  void PrintSummary() const;
154 
157  private:
159  std::string fName;
160 
162  double fLowerLimit;
163 
165  double fUpperLimit;
166 
168  std::string fLatexName;
169 
171  bool fFixed;
172 
174  double fFixedValue;
175 
177  bool fFillHistograms;
178 
180  unsigned fNbins;
181 };
182 #endif
void SetUpperLimit(double limit=1)
Definition: BCParameter.h:114
double GetLowerLimit() const
Definition: BCParameter.h:65
void SetName(const char *name)
Definition: BCParameter.h:99
double GetRangeWidth() const
Definition: BCParameter.h:77
A class representing a parameter of a model.
Definition: BCParameter.h:28
const std::string & GetLatexName() const
Definition: BCParameter.h:60
void SetLimits(double lowerlimit=0, double upperlimit=1)
Definition: BCParameter.h:121
double GetUpperLimit() const
Definition: BCParameter.h:70
void SetLowerLimit(double limit=0)
Definition: BCParameter.h:108
const std::string & GetName() const
Definition: BCParameter.h:54
bool IsAtLimit(double value) const
Definition: BCParameter.cxx:58
void PrintSummary() const
Definition: BCParameter.cxx:48