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

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 
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                DefectList& 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                  DefectList& defects) const throw (LogicError) = 0;
00113     virtual void checkForDefects(const FitObject& fo, const ModuleElement& element, 
00114                  DefectList& d) const =0;
00115 
00117     
00122     virtual void createSummaryHistograms(FitScanResult& fits) const throw() = 0;
00123  protected:
00124   boost::recursive_mutex& getMutex() const {return m_access;} 
00125 private:
00126     mutable boost::recursive_mutex m_access;  
00127     FitterMode mode;            
00128 };
00129 
00130 }
00131 #endif //#ifndef FITALGORITHM_H

Generated on Thu Jul 15 09:50:45 2004 for SCT DAQ/DCS Software - C++ by doxygen 1.3.5