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 "Sct/RangedVector.h"
00010 #include "sctConf/ConfUtilities.h"
00011 #include "sctConf/configuration.h"
00012 #include <memory>
00013
00014 class TGraph;
00015
00016 namespace SctData {
00017 class NPtGainTestResult;
00018 class NPtGainTestResultData;
00019 class TestResult;
00020 class FitScanResult;
00021 class FitObject;
00022 class DefectList;
00023 class ResponseCurve;
00024 }
00025
00026 using std::auto_ptr;
00027 using boost::scoped_ptr;
00028 using SctData::NPtGainTestResult;
00029 using SctData::NPtGainTestResultData;
00030 using SctData::FitScanResult;
00031 using SctData::FitObject;
00032 using SctData::ModuleElement;
00033 using SctData::DefectList;
00034 using SctData::ResponseCurve;
00035 using namespace Sct;
00036
00037 namespace SctAnalysis {
00038
00042 class NPtGainAlgorithm : public AnalysisAlgorithm {
00043 public:
00047 NPtGainAlgorithm(shared_ptr<const TestData> testData, const string& moduleName, const AnalysisAlgorithm& alg) throw();
00051 virtual ~NPtGainAlgorithm() throw() {}
00057 static boost::shared_ptr<ResponseCurve> getResponseCurve(unsigned int nPts=4) throw(LogicError);
00063 static void setResponseCurve( auto_ptr<ResponseCurve> rc) throw();
00064
00065 virtual void analyze();
00066 virtual void loadData();
00067 virtual bool canAnalyze() const;
00068 virtual shared_ptr<SctData::TestResult> createTestResult() const;
00069 virtual boost::shared_ptr<AnalysisAlgorithm> clone(shared_ptr<const TestData> testData, const string& moduleName) const throw();
00070 private:
00071 NPtGainAlgorithm() {}
00072
00074 static boost::shared_ptr<ResponseCurve> s_responseCurve;
00075 static bool inMap;
00076 typedef FitObject& (FitScanResult::*getFitFunction) (unsigned int) const;
00078 void setupGraph(unsigned int id, const ModuleElement& element, getFitFunction fitFunc, NPtGainTestResult& test, NPtGainTestResultData& testData, bool trimPoints = false) throw(LogicError);
00079
00081 void doFit(unsigned int id, getFitFunction fitFunc, NPtGainTestResult& test, NPtGainTestResultData& testData) throw(LogicError) ;
00082
00086 void mergeDefects(NPtGainTestResult& test, const ModuleElement& element, unsigned int lastPoint);
00087
00091 void doSlopes(NPtGainTestResult& test);
00095 void doSlopes(shared_ptr<TGraph> graph, Sct::RangedVector<float>& result);
00096
00101 void doDefect(const ModuleElement& e, DefectList& defects,
00102 const NPtGainTestResultData& data,
00103 const NPtGainTestResultData& comparisonData) throw(LogicError);
00104
00105 unsigned int nOnePointTrimmed;
00106 unsigned int nTwoPointTrimmed;
00107 static unsigned s_configurationWarnings;
00108 SctConfiguration::MURType m_mur_type;
00109 SctConfiguration::EndcapType m_endcap_type;
00110 };
00111
00112 }
00113
00114 #endif //#ifndef NPTGAINALGORITHM_H