00001 #ifndef __BCPARAMETER__H 00002 #define __BCPARAMETER__H 00003 00004 /*! 00005 * \class BCParameter 00006 * \brief A class representing a parameter of a model. 00007 * \author Daniel Kollar 00008 * \author Kevin Kröninger 00009 * \version 1.0 00010 * \date 08.2008 00011 * \detail This class represents a parameter of a model. It contains 00012 * information about the name and the range of the parameter. 00013 */ 00014 00015 /* 00016 * Copyright (C) 2008-2010, Daniel Kollar and Kevin Kroeninger. 00017 * All rights reserved. 00018 * 00019 * For the licensing terms see doc/COPYING. 00020 */ 00021 00022 // --------------------------------------------------------- 00023 00024 #include <string> 00025 #include <vector> 00026 00027 // --------------------------------------------------------- 00028 00029 class BCParameter 00030 { 00031 00032 public: 00033 00034 /** \name Constructors and destructors */ 00035 /* @{ */ 00036 00037 /** 00038 * The default constructor. */ 00039 BCParameter(); 00040 00041 /** 00042 * A constructor. 00043 * @param name The name of the parameter. 00044 * @param lowerlimit The lower limit of the parameter values. 00045 * @param upperlimit The upper limit of the parameter values. */ 00046 BCParameter(const char* name, double lowerlimit, double upperlimit); 00047 00048 /** 00049 * The default copy constructor. */ 00050 BCParameter(const BCParameter & parameter); 00051 00052 /** 00053 * The default destructor. */ 00054 ~BCParameter(); 00055 00056 /* @} */ 00057 00058 /** \name Assignment operators */ 00059 /* @{ */ 00060 00061 /** 00062 * The defaut assignment operator. */ 00063 BCParameter & operator = (const BCParameter & parameter); 00064 00065 /* @} */ 00066 00067 /** \name Member functions (get) */ 00068 /* @{ */ 00069 00070 /** 00071 * @return The name of the parameter. */ 00072 std::string GetName() 00073 { return fName; }; 00074 00075 /** 00076 * Returns the index of the parameter within the parameter 00077 * container of a BCModel. 00078 * @return The index of the parameter in the model. */ 00079 int GetIndex() 00080 { return fIndex; }; 00081 00082 /** 00083 * @return The lower limit of the parameter values. */ 00084 double GetLowerLimit() 00085 { return fLowerLimit; }; 00086 00087 /** 00088 * @return The upper limit of the parameter values. */ 00089 double GetUpperLimit() 00090 { return fUpperLimit; }; 00091 00092 /** 00093 * Returns the range width of the parameter values. It is 00094 * always a positive value. 00095 * @return The range width of the parameter values. */ 00096 double GetRangeWidth() 00097 { return (fUpperLimit>fLowerLimit)?fUpperLimit-fLowerLimit:fLowerLimit-fUpperLimit; }; 00098 00099 /* @} */ 00100 00101 /** \name Member functions (set) */ 00102 /* @{ */ 00103 00104 /** 00105 * @param name The name of the parameter. */ 00106 void SetName(const char * name) 00107 { fName = name; }; 00108 00109 /** 00110 * Set the index of the parameter within the parameter 00111 * container of a BCModel. 00112 * @param index The index of the parameter. */ 00113 void SetIndex(int index) 00114 { fIndex = index; }; 00115 00116 /** 00117 * Set the lower limit of the parameter values. 00118 * @param limit The lower limit of the parameter values. */ 00119 void SetLowerLimit(double limit = 0) 00120 { fLowerLimit = limit; }; 00121 00122 /** 00123 * Set the upper limit of the parameter values. 00124 * @param limit The upper limit of the parameter values. */ 00125 void SetUpperLimit(double limit = 1) 00126 { fUpperLimit = limit; }; 00127 00128 /** 00129 * Set the limits of the parameter values. 00130 * @param lowerlimit The lower limit of the parameter values. 00131 * @param upperlimit The upper limit of the parameter values. */ 00132 void SetLimits(double lowerlimit = 0, double upperlimit = 1) 00133 { fLowerLimit = lowerlimit; fUpperLimit = upperlimit; }; 00134 00135 /** 00136 * Set parameter to be nuisance. 00137 * @param nuisance 1 - nuisance, 0 - not nuisance */ 00138 void SetNuisance(int nuisance = 1) 00139 { fNuisance = nuisance; }; 00140 00141 /* @} */ 00142 00143 /** \name Member functions (miscellaneous methods) */ 00144 /* @{ */ 00145 00146 /** 00147 * Returns 1 if parameter is a nuisance parameter or 0 if not. 00148 * @return 1 - is nuisance paramete, 0 - is not nuisance parameter */ 00149 double IsNuisance() 00150 { return fNuisance; }; 00151 00152 /** 00153 * Returns true if the value is at a parameter limit. 00154 * @return flag States if value is at parameter limit. */ 00155 bool IsAtLimit(double value); 00156 00157 /** 00158 * Prints a parameter summary on the screen. */ 00159 void PrintSummary(); 00160 00161 /* @} */ 00162 00163 private: 00164 00165 /* 00166 * Copies this BCParameter into another one */ 00167 void Copy(BCParameter & parameter) const; 00168 00169 /** 00170 * The name of the parameter. */ 00171 std::string fName; 00172 00173 /** 00174 * The index of the parameter within the BCParameterSet of a BCModel. */ 00175 int fIndex; 00176 00177 /** 00178 * The lower limit of the parameter value. */ 00179 double fLowerLimit; 00180 00181 /** 00182 * The upper limit of the parameter value. */ 00183 double fUpperLimit; 00184 00185 /** 00186 * Flag to specify whether to integrate over this parameter or not. */ 00187 int fNuisance; 00188 00189 }; 00190 00191 // --------------------------------------------------------- 00192 00193 /* 00194 * \typedef 00195 * \brief A vector of pointer to BCParameter.*/ 00196 typedef std::vector<BCParameter*> BCParameterSet; 00197 00198 // --------------------------------------------------------- 00199 00200 #endif