00001 #ifndef FITSTRATEGY_H
00002 #define FITSTRATEGY_H
00003 #include "Sct/LogicErrors.h"
00004 #include "Sct/MathsError.h"
00005 #include <boost/noncopyable.hpp>
00006 #include <map>
00007 #include <string>
00008
00009 using namespace Sct;
00010 class TH1;
00011 class TF1;
00012 class TGraph;
00013 class TGraphErrors;
00014
00015 namespace SctFitter{
00028 class FitStrategy : boost::noncopyable {
00029 public:
00035 virtual void fitTH1(const TH1& hist, TF1& fit) const throw(Sct::LogicError, Sct::MathsError)=0;
00041 virtual void fitTGraph(const TGraph& graph, TF1& fit) const throw(Sct::LogicError, Sct::MathsError)=0;
00047 virtual void fitTGraphErrors(const TGraphErrors& graph, TF1& fit) const throw(Sct::LogicError, Sct::MathsError)=0;
00048
00049
00050 void setOptions(string opt) throw();
00051
00052 const string& getOptions() const throw();
00053
00054 virtual const string& getName() const throw() =0 ;
00055 protected:
00057 FitStrategy(string opt=string("")) throw();
00059 virtual ~FitStrategy();
00060 private:
00062 string options;
00063 };
00064
00068 class FitStrategyFactory{
00069 public:
00071 static FitStrategyFactory& instance() throw();
00072
00074 FitStrategy* getStrategy(string name) throw(LogicError);
00079 bool addToMap(const string& className, FitStrategy& s) throw();
00081 std::map <string, FitStrategy*> strategyMap;
00082 private:
00083 ~FitStrategyFactory() throw() {}
00084 static FitStrategyFactory* bertha;
00085 };
00086
00087 }
00088 #endif // #ifndef FITSTRATEGY_H