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

FitObject.h

Go to the documentation of this file.
00001 #ifndef FITOBJECT_H
00002 #define FITOBJECT_H
00003 
00004 #include "Sct/Streamable.h"
00005 #include <vector>
00006 #include <string>
00007 #include <iostream>
00008 #include <memory>
00009 #include <TF1.h>
00010 #include "Sct/Exception.h"
00011 #include "Sct/LogicErrors.h"
00012 
00013 using namespace std;
00014 using Sct::LogicError;
00015 
00016 namespace SctData{
00017 
00038 class FitObject : public virtual Sct::Streamable {
00039  public:
00040 
00045     virtual auto_ptr<FitObject> clone() const throw() = 0;
00046     
00053     virtual auto_ptr<TF1> makeRootTF1() const throw(LogicError);
00054 
00059     FitObject& operator=(const TF1&) throw(LogicError);
00060 
00062 
00063     void print() const throw(LogicError) ;
00064 
00065     //Serializable override
00066     //virtual string getClassName() const throw() ;
00067 
00069     inline int getNDim() const throw(){ return m_varMax.size();}
00070 
00072     inline int getNPar() const throw() { return m_parameter.size();}
00073 
00075     char* getParName(const int ipar) const throw(LogicError) ;
00076 
00081     int getParIndex(const string& name) const throw(LogicError) ;
00082 
00084 
00085 
00086     double getParameter(const int ipar) const throw(LogicError);
00089     double getParameter(const string& name) const throw(LogicError) ;
00091 
00095     double getParError(const int ipar) const throw(LogicError);
00096 
00100     double getParError(const string& name) const throw(LogicError);
00101 
00103     double getChiSquared() const throw() {return m_chiSquared;}
00104 
00106     int getNDF() const throw() { return m_nDF;}
00107 
00109     double getVarMax(const int ivar) const throw(LogicError);
00110 
00112     double getVarMin(const int ivar) const throw(LogicError);
00113 
00115     void setVarMax(const int ivar, const double value) throw(LogicError) ;
00116 
00118     void setVarMin(const int ivar, const double value) throw(LogicError) ;
00119 
00121     char* getFormula() const throw() {
00122     return const_cast <char*> ( m_formula.c_str() ) ;
00123     }
00124 
00127     void fixParameter(int ipar, bool fix) ;
00128     
00131     bool isFixed(int ipar) const;
00132     
00134     void setParameter(const int ipar, const double value) throw (LogicError) ;
00135 
00137     void setParError(const int ipar, const double value) throw (LogicError) ;
00138 
00140 
00141     void setParName(const int ipar, const char* name) throw (LogicError) ;
00142 
00144     virtual ~FitObject() throw() {;}
00145 
00147     void reset() throw() ;
00148 protected:
00149     //Most data objects protected. Accessible through setXxx and getXxx functions.
00150     vector <double> m_parameter;     
00151     vector <double> m_parError;      
00152     vector <string> m_parName;       
00153     vector <bool> m_parFixed;        
00154     vector <double> m_varMax;        
00155     vector <double> m_varMin;        
00156     double m_chiSquared;             
00157     int m_nDF;                       
00158     string m_formula ;               
00159 
00160 
00162     FitObject() throw() ;
00163 
00165     FitObject(const TF1&) throw(LogicError) ;
00171     void setNDim(unsigned int n) throw() ;
00172 
00174     void setNPar(unsigned int npar) throw() ;
00175 
00177     void setChiSquared(const double c) throw() { m_chiSquared=c; }
00178 
00180     void setNDF(const int d) throw() { m_nDF=d; }
00181 
00183     void setFormula(char const* f) throw() { m_formula = f ;}
00184 
00190     virtual auto_ptr<TF1> makeBasicRootTF1() const throw(LogicError) =0;
00195     virtual void init() throw(LogicError) =0;
00196 
00197     friend class FitObjectIOHelper;
00198 }; // end declaration of FitObject
00199 
00200 //Inlines
00201 inline double FitObject::getParameter(const string& name) const throw(LogicError) {
00202     return getParameter(getParIndex(name));
00203 }
00204 
00205 inline double FitObject::getParError(const string& name) const throw(LogicError) {
00206     return getParError(getParIndex(name));
00207 }
00208 
00209 ostream& operator << (ostream&, const SctData::FitObject& ) throw (LogicError) ;
00210 
00211 } 
00212 
00213 
00214 #endif // #ifndef FITOBJECT_H

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