From 61ccc92efe31b5cb72d8face87f9ce4eab120e62 Mon Sep 17 00:00:00 2001 From: astrojhgu Date: Fri, 2 Mar 2012 10:05:27 +0000 Subject: git-svn-id: file:///home/svn/opt_utilities@227 ed2142bd-67ad-457f-ba7c-d818d4011675 --- vmodels/gauss1d_bkg.hpp | 64 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 vmodels/gauss1d_bkg.hpp diff --git a/vmodels/gauss1d_bkg.hpp b/vmodels/gauss1d_bkg.hpp new file mode 100644 index 0000000..71175b5 --- /dev/null +++ b/vmodels/gauss1d_bkg.hpp @@ -0,0 +1,64 @@ +/** + \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 -- cgit v1.2.2