Main Page   Modules   Namespace List   Class Hierarchy   Data Structures   File List   Namespace Members   Data Fields   Globals   Related Pages  

NagFitStrategy.h

Go to the documentation of this file.
00001 #ifndef NAGFITSTRATEGY_H
00002 #define NAGFITSTRATEGY_H
00003 #include "../FitStrategy.h"
00004 #include <nag.h>
00005 #include <nage04.h>
00006 #include <vector>
00007 
00008 using namespace Sct;
00009 using namespace std;
00010 
00011 namespace SctFitter{
00025     class NagFitStrategy : public FitStrategy {
00026     public:
00028     NagFitStrategy(string opt=string("")) throw();
00030     ~NagFitStrategy() throw();
00032     virtual void fitTH1(const TH1& hist, TF1& fit) const throw(LogicError, MathsError);
00034     virtual void fitTGraph(const TGraph& graph, TF1& fit) const throw(LogicError, MathsError);
00036     virtual void fitTGraphErrors(const TGraphErrors& graph, TF1& fit) const throw(LogicError, MathsError);
00037     
00039     virtual const string& getName() const throw();
00040     private:
00041     NagFitStrategy( const NagFitStrategy& ); 
00042     const string name; 
00043     static bool inMap; 
00044     
00053         const int getNumberFitPoints(TH1& hist, const TF1& fit, 
00054                         int& iFirstBin) const throw(LogicError);
00063     void getFitPoints(TGraph& graph, const TF1& fit, vector<bool>& active) const throw(LogicError);
00065     class Cache{
00066     public:
00068         Cache(const TH1& hist, const unsigned npoints, 
00069           const unsigned firstpoint, TF1& fit) throw(LogicError, MathsError) ;
00070 
00072         Cache(const TGraph& graph, TF1& fit, const vector<bool>& active) throw(LogicError, MathsError) ;
00073 
00075         Cache(const TGraphErrors& graph, TF1& fit, const vector<bool>& active) throw(LogicError, MathsError) ;
00076 
00078         void convertPars(double inPars[]);
00079                 
00081         void setupPars(TF1& fit); 
00082         
00083         ~Cache() throw();                
00084         vector<double> m_y; 
00085         vector<double> m_x; 
00086         vector<double> m_ey; 
00087         TF1* function;           
00088         double* pars;       
00089         unsigned int nVarPars;  
00090         double* inPars;     
00091         
00092     private:        
00093         int* map;               
00094     };
00095 
00099     void nagFit(Cache* cache, TF1& fit, bool quiet) const throw(MathsError);
00100 
00102     bool ranged() const throw();
00103 
00105     bool quiet() const throw();
00106 
00108     static void chiSquaredFunctionForNag(Integer m, Integer n, double x[], double fvec[],
00109                          Nag_Comm *comm) throw();
00110     };
00111 
00112 } // end of namespace SctFitter;
00113 
00114 
00115 #endif // #ifndef NAGFITSTRATEGY_H

Generated on Mon Dec 15 19:36:07 2003 for SCT DAQ/DCS Software by doxygen1.3-rc3