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

StrobeDelayAlgorithm.cpp

Go to the documentation of this file.
00001 #include "StrobeDelayAlgorithm.h"
00002 #include "AnalysisAlgorithmMap.h"
00003 #include "SctData/StrobeDelayTestResult.h"
00004 #include "SctData/FitScanResult.h"
00005 #include "SctData/FitObject.h"
00006 #include "SctData/TopHatFitObject.h"
00007 #include "SctData/ModuleDefectList.h"
00008 #include "SctData/ModuleDefect.h"
00009 #include <string>
00010 
00011 using namespace std;
00012 using namespace boost;
00013 using namespace SctData;
00014 using namespace Sct;
00015 
00016 namespace SctAnalysis {
00017     
00018 bool StrobeDelayAlgorithm::inMap = AnalysisAlgorithmMap::instance().setAlgorithm("StrobeDelayTest", auto_ptr<AnalysisAlgorithm>(new StrobeDelayAlgorithm()));
00019 
00020 shared_ptr<AnalysisAlgorithm> StrobeDelayAlgorithm::clone(const TestData& testData, const string& moduleName) const throw(){
00021     return shared_ptr<AnalysisAlgorithm>(new StrobeDelayAlgorithm(testData, moduleName));
00022 }
00023 
00024 void StrobeDelayAlgorithm::canAddFitScanResult(const string& name) throw(Sct::LogicError, Sct::IoError) {
00025     //Create and initialize
00026     shared_ptr<StrobeDelayTestResult> result (new StrobeDelayTestResult()) ;
00027     setTestResult( result );
00028     initializeTestResult();
00029     
00030     addFit(name);
00031     optimize(*result, *getTestResult()->getFit(0));
00032     finish();
00033 }
00034 
00035 void StrobeDelayAlgorithm::optimize(StrobeDelayTestResult& result, const FitScanResult& fitted) throw(LogicError) {
00036     
00037     bool pass = true;
00038     result.setNOptima(nChipModule);
00039     for (short unsigned int ichip=0; ichip<nChipModule; ++ichip ) {
00040         FitObject& fit = fitted.getChipFit(ichip);
00041         try {
00042             dynamic_cast<TopHatFitObject&> (fit);
00043         } catch(std::exception& e) {
00044             throw InvariantViolatedError("StrobeDelayAlgorithm::optimize ERROR not a TopHat function", __FILE__, __LINE__);
00045         }
00046         double rise=fit.getParameter(1), fall=fit.getParameter(3);
00047         result.setOptimum(ichip, rise + result.getFraction()*(fall-rise));
00048     if (rise < 0 || rise > ModuleDefect::SD_LO.getParameter()) {
00049         result.getDefects().addDefect(ModuleDefect::SD_LO, Chip(ichip));
00050         pass = false;
00051     } 
00052     if (fall > ModuleDefect::SD_HI.getParameter()) {
00053         result.getDefects().addDefect(ModuleDefect::SD_HI, Chip(ichip));
00054         pass = false;
00055     }
00056     }
00057     result.setPassed(pass);
00058 }
00059 
00060 
00061 }

Generated on Mon Dec 15 19:36:18 2003 for SCT DAQ/DCS Software by doxygen1.3-rc3