FitAlgorithm.h

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/DefectList.h"
00009 #include <memory>
00010 #include <boost/utility.hpp>
00011 #include <boost/thread.hpp>
00012 
00013 //Forward declarations
00014 class TH1;
00015 namespace SctData {
00016 class FitObject;    
00017 class FitScanResult;
00018 class RawScanResult;
00019 }
00020 
00021 using SctData::FitScanResult;
00022 using SctData::RawScanResult;
00023 using SctData::ModuleElement;
00024 using SctData::DefectList;
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     // not thread safe!    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 
00079     static int findBin(const TH1& h, const float fraction, const bool forward, const bool relative=true) throw(MathsError);
00080 
00081     
00083     
00084 protected:
00085     FitAlgorithm() throw();
00086 
00091     virtual void doFit(const TH1& hist, FitObject& fitObject,
00092                const ModuleElement& element, 
00093                DefectList& defects) const throw (LogicError);
00094     
00096 
00099     virtual auto_ptr<FitObject> getPrototype() const throw() = 0;
00100     
00104     virtual void guessParameters(const TH1& hist, FitObject& fitOb) const throw (LogicError, MathsError) = 0;
00105 
00109     virtual void checkForDefects(const TH1& hist, const ModuleElement& element, 
00110                  DefectList& defects) const throw (LogicError) = 0;
00114     virtual void checkForDefects(const FitObject& fo, const ModuleElement& element, 
00115                  DefectList& d) const =0;
00116 
00118     
00123     virtual void createSummaryHistograms(FitScanResult& fits) const throw() = 0;
00124  protected:
00125   boost::recursive_mutex& getMutex() const {return m_access;} 
00126   bool debug() const; 
00127 private:
00128     mutable boost::recursive_mutex m_access;  
00129     FitterMode mode;            
00130 
00131 };
00132 
00133 }
00134 #endif //#ifndef FITALGORITHM_H

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