00001 00017 #ifndef __BASEFITTER_H 00018 #define __BASEFITTER_H 00019 00020 #include<vector> 00021 00022 class BaseFitObject; 00023 class BaseConstraint; 00024 00025 // Class BaseConstraint: 00027 00034 class BaseFitter { 00035 public: 00036 BaseFitter() {}; 00037 virtual ~BaseFitter() {}; 00038 virtual void addFitObject (BaseFitObject* fitobject_) { 00039 fitobjects.push_back(fitobject_); 00040 }; 00041 virtual void addFitObject (BaseFitObject& fitobject_) { 00042 fitobjects.push_back(&fitobject_); 00043 }; 00044 virtual void addConstraint (BaseConstraint* constraint_) { 00045 constraints.push_back(constraint_); 00046 }; 00047 virtual void addConstraint (BaseConstraint& constraint_) { 00048 constraints.push_back(&constraint_); 00049 }; 00050 virtual std::vector<BaseFitObject*>* getFitObjects() {return &fitobjects;}; 00051 virtual std::vector<BaseConstraint*>* getConstraints() {return &constraints;}; 00052 virtual double fit() = 0; 00053 virtual int getError() const = 0; 00054 virtual double getProbability() const = 0; 00055 virtual double getChi2() const = 0; 00056 virtual int getIterations() const = 0; 00057 00058 virtual void reset() { 00059 fitobjects.resize(0); 00060 constraints.resize(0); 00061 } 00062 00063 protected: 00064 virtual bool initialize() = 0; 00065 00066 typedef std::vector <BaseFitObject *> FitObjectContainer; 00067 typedef std::vector <BaseConstraint *> ConstraintContainer; 00068 00069 typedef FitObjectContainer::iterator FitObjectIterator; 00070 00071 FitObjectContainer fitobjects; 00072 ConstraintContainer constraints; 00073 00074 }; 00075 00076 #endif // __BASEFITTER_H