FitStrategy.h

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 class TGraphAsymmErrors;
00015 
00016 namespace SctFitter{
00029     class FitStrategy : boost::noncopyable {
00030     public:
00036     virtual void fitTH1(const TH1& hist, TF1& fit) const throw(Sct::LogicError, Sct::MathsError)=0;
00042     virtual void fitTGraph(const TGraph& graph, TF1& fit) const throw(Sct::LogicError, Sct::MathsError)=0;
00048     virtual void fitTGraphErrors(const TGraphErrors& graph, TF1& fit) const throw(Sct::LogicError, Sct::MathsError)=0;
00054     virtual void fitTGraphAsymmErrors(const TGraphAsymmErrors& graph, TF1& fit) const throw(Sct::LogicError, Sct::MathsError)=0;
00055 
00056     // set the options string
00057     void setOptions(string opt) throw();
00058     // get the options string
00059     const string& getOptions() const throw();
00060     // concrete strategies must impliment this function i.e. give a name.
00061     virtual const string& getName() const throw() =0 ;
00062     protected:
00064     FitStrategy(string opt=string("")) throw();
00066     virtual ~FitStrategy();
00067     private:
00069     string options;
00070     };
00071 
00075     class FitStrategyFactory{
00076     public:
00078     static FitStrategyFactory& instance() throw();
00079     
00081     FitStrategy* getStrategy(string name) throw(LogicError);
00086     bool addToMap(const string& className, FitStrategy& s) throw();
00090     std::list<std::string> listStrategies() const;
00091     private:
00093     std::map <string, FitStrategy*> strategyMap;
00094     ~FitStrategyFactory() throw() {} 
00095     static FitStrategyFactory* bertha; 
00096     };
00097 
00098 } // end of namespace SctFitter;
00099 #endif // #ifndef FITSTRATEGY_H

Generated on Mon Feb 6 14:01:20 2006 for SCT DAQ/DCS Software - C++ by  doxygen 1.4.6