From eeafd6e502bc60da664de3cf0eb9251f349df228 Mon Sep 17 00:00:00 2001 From: astrojhgu Date: Thu, 17 Dec 2009 13:35:02 +0000 Subject: git-svn-id: file:///home/svn/opt_utilities@102 ed2142bd-67ad-457f-ba7c-d818d4011675 --- test/makefile | 4 +++- test/test_fitter.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 test/test_fitter.cpp diff --git a/test/makefile b/test/makefile index 94d223d..761475c 100644 --- a/test/makefile +++ b/test/makefile @@ -1,4 +1,4 @@ -targets=test_optimizer many_dims +targets=test_optimizer many_dims test_fitter all:$(targets) @@ -8,6 +8,8 @@ test_optimizer:test_optimizer.cpp many_dims:many_dims.cpp $(CXX) $< -o $@ -I .. -O3 -g +test_fitter:test_fitter.cpp + $(CXX) $< -o $@ -I .. -O3 -g clean: rm -f $(targets) *.o *~ diff --git a/test/test_fitter.cpp b/test/test_fitter.cpp new file mode 100644 index 0000000..5e5b139 --- /dev/null +++ b/test/test_fitter.cpp @@ -0,0 +1,39 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; +using namespace opt_utilities; + + +int main(int argc,char* argv[]) +{ + if(argc!=2) + { + cerr<<"Usage:"<"<,double,std::string> f; + f.set_model(nbeta1d()); + f.set_opt_method(powell_method >()); + f.set_statistic(chisq,double,std::string>()); + dl_x_xe_y_ye dl; + ifstream ifs(argv[1]); + dl.load_from(ifs); + f.load_data(dl.get_data_set()); + f.set_param_modifier(freeze,string>("bkg")); + f.set_param_value("bkg",0); + f.fit(); + for(int i=0;i