00001 #ifndef FITALGORITHM_H
00002 #define FITALGORITHM_H
00003
00004 #include "FitterMode.h"
00005 #include "Sct/Exception.h"
00006 #include "Sct/MathsError.h"
00007 #include "SctData/ModuleElement.h"
00008 #include "SctData/ModuleDefectList.h"
00009 #include <memory>
00010 #include <boost/utility.hpp>
00011
00012
00013 class TH1;
00014 namespace SctData {
00015 class FitObject;
00016 class FitScanResult;
00017 class RawScanResult;
00018 class ModuleDefect;
00019 }
00020
00021 using SctData::FitScanResult;
00022 using SctData::RawScanResult;
00023 using SctData::ModuleElement;
00024 using SctData::ModuleDefectList;
00025 using SctData::FitObject;
00026 using Sct::LogicError;
00027 using Sct::MathsError;
00028 using std::auto_ptr;
00029
00030 namespace SctFitter {
00031
00041 class FitAlgorithm : boost::noncopyable {
00042 public:
00043 virtual ~FitAlgorithm() throw() {}
00044
00051 virtual auto_ptr<FitScanResult> doFit(const RawScanResult& raw) const throw(Sct::LogicError);
00052
00053 const FitterMode& getMode() const throw();
00054 FitterMode& getMode() throw();
00055 void setMode(const FitterMode& mode) throw();
00056
00059
00068 static float findLevel(const TH1& h, const float fraction, const bool forward) throw(MathsError);
00069
00078 static int findBin(const TH1& h, const float fraction, const bool forward) throw(MathsError);
00079
00080
00082
00083 protected:
00084 FitAlgorithm() throw();
00085
00090 virtual void doFit(const TH1& hist, FitObject& fitObject,
00091 const ModuleElement& element,
00092 ModuleDefectList& defects) const throw (LogicError);
00093
00095
00098 virtual auto_ptr<FitObject> getPrototype() const throw() = 0;
00099
00103 virtual void guessParameters(const TH1& hist, FitObject& fitOb) const throw (LogicError, MathsError) = 0;
00104
00108 virtual void checkForDefects(const TH1& hist, const ModuleElement& element,
00109 ModuleDefectList& defects) const throw (LogicError) = 0;
00111
00116 virtual void createSummaryHistograms(FitScanResult& fits) const throw() = 0;
00117
00118
00119 private:
00120 FitterMode mode;
00121 };
00122
00123 }
00124
00125 #endif //#ifndef FITALGORITHM_H