/** \file gauss1d.hpp \brief Gauss model \author Junhua Gu */ #ifndef GAUSS_MODEL_BKG_H_ #define GAUSS_MODEL_BKG_H_ #define OPT_HEADER #include #include #include namespace opt_utilities { template class gauss1d_bkg :public model,optvec,optvec,std::string> { private: gauss1d_bkg* do_clone()const { return new gauss1d_bkg(*this); } const char* do_get_type_name()const { return "1d gaussian with bkg"; } public: gauss1d_bkg() { this->push_param_info(param_info >("N",1)); this->push_param_info(param_info >("x0",0)); this->push_param_info(param_info >("sigma",1)); this->push_param_info(param_info >("bkg",0)); } public: optvec do_eval(const optvec& x,const optvec& param) { T N=get_element(param,0); T x0=get_element(param,1); T sigma=get_element(param,2); T bkg=get_element(param,3); optvec y=(x-x0)/sigma; return N*exp(-y*y/2.)+bkg; } private: std::string do_get_information()const { #ifdef WITH_OPT_DOC #include #endif return ""; } }; } #endif //EOF