00001 #ifndef NPTGAINALGORITHM_H
00002 #define NPTGAINALGORITHM_H
00003
00004 #include "AnalysisAlgorithm.h"
00005 #include "Sct/Exception.h"
00006 #include "Sct/SctParameters.h"
00007 #include <boost/scoped_ptr.hpp>
00008 #include "SctData/ModuleElement.h"
00009 #include <memory>
00010
00011 class TGraph;
00012
00013 namespace SctData {
00014 class NPtGainTestResult;
00015 class NPtGainTestResultData;
00016 class TestResult;
00017 class FitScanResult;
00018 class FitObject;
00019 class DefectList;
00020 class ResponseCurve;
00021 }
00022
00023 using std::auto_ptr;
00024 using boost::scoped_ptr;
00025 using SctData::NPtGainTestResult;
00026 using SctData::NPtGainTestResultData;
00027 using SctData::FitScanResult;
00028 using SctData::FitObject;
00029 using SctData::ModuleElement;
00030 using SctData::DefectList;
00031 using SctData::ResponseCurve;
00032 using namespace Sct;
00033
00034 namespace SctAnalysis {
00035
00039 class NPtGainAlgorithm : public AnalysisAlgorithm {
00040 public:
00044 NPtGainAlgorithm(const TestData& testData, const string& moduleName, const AnalysisAlgorithm& alg) throw() : AnalysisAlgorithm(testData, moduleName, alg) {}
00048 virtual ~NPtGainAlgorithm() throw() {}
00054 static boost::shared_ptr<ResponseCurve> getResponseCurve(unsigned int nPts=4) throw(LogicError);
00060 static void setResponseCurve( auto_ptr<ResponseCurve> rc) throw();
00061
00062 virtual void analyze();
00063 virtual void loadData();
00064 virtual bool canAnalyze() const;
00065 virtual shared_ptr<SctData::TestResult> createTestResult() const;
00066 virtual boost::shared_ptr<AnalysisAlgorithm> clone(const TestData& testData, const string& moduleName) const throw();
00067 private:
00068 NPtGainAlgorithm() {}
00069
00071 static boost::shared_ptr<ResponseCurve> s_responseCurve;
00072 static bool inMap;
00073 typedef FitObject& (FitScanResult::*getFitFunction) (unsigned int) const;
00075 void setupGraph(unsigned int id, const ModuleElement& element, getFitFunction fitFunc, NPtGainTestResult& test, NPtGainTestResultData& testData, bool trimPoints = false) throw(LogicError);
00076
00078 void doFit(unsigned int id, getFitFunction fitFunc, NPtGainTestResult& test, NPtGainTestResultData& testData) throw(LogicError) ;
00079
00083 void mergeDefects(NPtGainTestResult& test, const ModuleElement& element, unsigned int lastPoint);
00084
00088 void doSlopes(NPtGainTestResult& test);
00092 void doSlopes(shared_ptr<TGraph> graph, vector<float>& result);
00093
00098 static void doDefect(const ModuleElement& e, DefectList& defects,
00099 const NPtGainTestResultData& data,
00100 const NPtGainTestResultData& comparisonData) throw(LogicError);
00101
00102 unsigned int nOnePointTrimmed;
00103 unsigned int nTwoPointTrimmed;
00104 };
00105
00106 }
00107
00108 #endif //#ifndef NPTGAINALGORITHM_H