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

NMaskAlgorithm.cpp

Go to the documentation of this file.
00001 #include "NMaskAlgorithm.h"
00002 #include "AnalysisAlgorithmMap.h"
00003 #include "SctData/NMaskTestResult.h"
00004 #include "SctData/RawScanResult.h"
00005 #include "SctData/ModuleDefect.h"
00006 #include "SctData/ModuleElement.h"
00007 #include <TH1.h>
00008 #include <TH2.h>
00009 
00010 using namespace std;
00011 using namespace boost;
00012 using namespace SctData;
00013 using namespace Sct;
00014 
00015 namespace SctAnalysis {
00016 
00017 bool NMaskAlgorithm::inMap = AnalysisAlgorithmMap::instance().setAlgorithm("NMaskTest", auto_ptr<AnalysisAlgorithm>(new NMaskAlgorithm()));
00018 
00019 shared_ptr<AnalysisAlgorithm> NMaskAlgorithm::clone(const TestData& testData, const string& moduleName) const throw() {
00020     return shared_ptr<AnalysisAlgorithm>(new NMaskAlgorithm(testData, moduleName));
00021 }
00022 
00023 void NMaskAlgorithm::canAddRawScanResult(const string& name) throw(Sct::LogicError, Sct::IoError) {
00024 
00025     shared_ptr<NMaskTestResult> result =  dynamic_pointer_cast<NMaskTestResult> ( getTestResult() );
00026 
00027     if (result.get()==0) {
00028         result = shared_ptr<NMaskTestResult> (new NMaskTestResult());
00029         setTestResult( result );
00030         initializeTestResult();
00031     }
00032 
00033     addRaw(name);
00034 
00035     if ( !result->hasAllRaws() )
00036         return;
00037 
00038     shared_ptr<const RawScanResult> raw = result->getRaw(0);
00039     TH2D& link0 = raw->getScanData(0);
00040     TH2D& link1 = raw->getScanData(1);
00041     int nTriggers = (int)result->getTestPointAt(0);
00042     
00043     for (unsigned int channel = 0; channel<Sct::nChannelModule; ++channel) {
00044     for (unsigned int bin = 0; bin<link0.GetNbinsY(); ++bin) {
00045         int content = (int) channel < Sct::nChannelLink ? link0.GetBinContent(channel+1, bin+1) : link1.GetBinContent(channel+1-nChannelLink, bin+1);
00046         if (channel%nChannelChip < bin) {
00047         if (content != 0) {
00048             result->getDefects().addDefect(ModuleDefect::OVER, Channel(channel));
00049             break;
00050         }
00051         } else {
00052         if (content != nTriggers) {
00053             result->getDefects().addDefect(ModuleDefect::UNDER, Channel(channel));
00054             break;
00055         }
00056         }
00057     }
00058     }
00059     if (result->getDefects().defectAffectingElement(Module()))
00060     result->setPassed(false);
00061     else 
00062     result->setPassed(true);
00063         
00064     finish();
00065 }
00066 } // end of namespace SctAnalysis

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