Model.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 HEPfit Collaboration
3  * All rights reserved.
4  *
5  * For the licensing terms see doc/COPYING.
6  */
7 
8 #ifndef MODEL_H
9 #define MODEL_H
10 
11 #include <map>
12 #include <boost/ref.hpp>
13 
24 class Model {
25 public:
26 
31  {
32  ModelInitialized = false;
33  flagSUSYmodel = false;
34  };
35 
39  virtual ~Model()
40  {
41  };
42 
47  void setModelName(const std::string name)
48  {
49  this->name = name;
50  }
51 
56  std::string ModelName() const
57  {
58  return name;
59  }
60 
67  virtual bool Init(const std::map<std::string, double>& DPars) = 0;
68 
77  virtual bool PreUpdate() = 0;
78 
86  virtual bool Update(const std::map<std::string, double>& DPars) = 0;
87 
96  virtual bool PostUpdate() = 0;
97 
105  virtual bool CheckParameters(const std::map<std::string, double>& DPars) = 0;
106 
113  virtual bool setFlag(const std::string name, const bool value) = 0;
114 
121  virtual bool setFlagStr(const std::string name, const std::string value) = 0;
122 
127  virtual bool CheckFlags() const = 0;
128 
133  bool IsModelInitialized() const
134  {
135  return ModelInitialized;
136  }
137 
143  {
144  this->ModelInitialized = ModelInitialized;
145  }
146 
151  bool IsUpdateError() const
152  {
153  return UpdateError;
154  }
155 
161  {
162  this->UpdateError = UpdateError;
163  }
164 
165  const double& getModelParam(std::string name) const
166  {
167  return ModelParamMap.at(name);
168  }
169 
170  bool isModelParam(std::string name) const
171  {
172  return (ModelParamMap.find(name) != ModelParamMap.end());
173  }
174 
175  void setModelSUSY(){
176  flagSUSYmodel = true;
177  }
178 
179  bool isModelSUSY() const{
180  return flagSUSYmodel;
181  }
182 
183  void setModelTHDM(){
184  flagTHDMmodel = true;
185  }
186 
187  bool isModelTHDM() const{
188  return flagTHDMmodel;
189  }
190 protected:
191 
192  bool UpdateError;
193 
199  virtual void setParameter(const std::string name, const double& value) = 0;
200  std::map< std::string, boost::reference_wrapper<const double> > ModelParamMap;
201 
202 private:
203  std::string name;
207 
208 };
209 
210 #endif /* MODEL_H */
211 
virtual bool Update(const std::map< std::string, double > &DPars)=0
The update method for the model.
bool isModelSUSY() const
Definition: Model.h:179
virtual bool PostUpdate()=0
The post-update method for the model.
A class for the template of models.
Definition: Model.h:24
virtual bool CheckFlags() const =0
A method to check the sanity of the set of model flags.
virtual bool setFlagStr(const std::string name, const std::string value)=0
A method to set a flag of the model.
virtual bool Init(const std::map< std::string, double > &DPars)=0
A method to initialize the model parameters.
virtual bool CheckParameters(const std::map< std::string, double > &DPars)=0
A method to check if all the mandatory parameters for the model have been provided in model initializ...
bool UpdateError
A boolean set to false if update is successful.
Definition: Model.h:192
virtual ~Model()
The default destructor.
Definition: Model.h:39
std::string name
The name of the model.
Definition: Model.h:203
virtual bool PreUpdate()=0
The pre-update method for the model.
void setModelInitialized(bool ModelInitialized)
A set method to fix the failure or success of the initialization of the model.
Definition: Model.h:142
void setModelTHDM()
Definition: Model.h:183
bool isModelParam(std::string name) const
Definition: Model.h:170
bool IsModelInitialized() const
A method to check if the model is initialized.
Definition: Model.h:133
virtual bool setFlag(const std::string name, const bool value)=0
A method to set a flag of the model.
bool ModelInitialized
A boolean set to true if the model is successfully initialized.
Definition: Model.h:204
bool IsUpdateError() const
A method to check if there was any error in the model update process.
Definition: Model.h:151
bool flagTHDMmodel
A flag identifying the model as a THDM model.
Definition: Model.h:206
void setModelName(const std::string name)
A method to set the name of the model.
Definition: Model.h:47
void setUpdateError(bool UpdateError)
A set method to fix the update status as success or failure.
Definition: Model.h:160
void setModelSUSY()
Definition: Model.h:175
bool isModelTHDM() const
Definition: Model.h:187
Model()
The default constructor.
Definition: Model.h:30
bool flagSUSYmodel
A flag identifying the model as a SUSY model.
Definition: Model.h:205
std::string ModelName() const
A method to fetch the name of the model.
Definition: Model.h:56
std::map< std::string, boost::reference_wrapper< const double > > ModelParamMap
Definition: Model.h:200
const double & getModelParam(std::string name) const
Definition: Model.h:165
virtual void setParameter(const std::string name, const double &value)=0
A method to set the value of a parameter of the model.