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

SctAnalysis::AnalysisAlgorithm Class Reference

An abstract base class for all the analysis algorithms. More...

#include <AnalysisAlgorithm.h>

Inheritance diagram for SctAnalysis::AnalysisAlgorithm:

Inheritance graph
[legend]
Collaboration diagram for SctAnalysis::AnalysisAlgorithm:

Collaboration graph
[legend]

Public Member Functions

virtual ~AnalysisAlgorithm () throw ()
 Destructor.

const TestDatagetTestData () const throw ()
 get a pointer to the cached TestData;

const std::string getModuleName () const throw ()
 Get the name of the module which this algorithm is working on.

virtual boost::shared_ptr<
AnalysisAlgorithm
clone (const TestData &testData, const string &moduleName) const=0 throw ()
 Must be overridden by sub-classes.

void addFitScanResult (shared_ptr< Sct::IOName > name)
 Add a named FitScanResult.

void addRawScanResult (shared_ptr< Sct::IOName > name)
 Add a named RawScanResult.

void checkTestResultExists ()
 Used by other methods to ensure that a TestResult has been made.

bool isDone () const throw ()
 Method indicates when a particular analysis is finished.

void finish ()
 Publishes the TestResult, and sets `done'.

boost::shared_ptr< SctData::TestResultgetTestResult () const
 Access to the TestResult if required.

boost::recursive_mutex & getMutex () const
 Access the mutex.

virtual bool canAnalyze () const=0
 Should check to see if the analysis can be performed.

virtual void analyze ()=0
 Does the analysis.

virtual void loadData ()=0
 Called to indicate the algorithm should try and load as much data as it can - perhaps by calling loadAllFits or loadAllRaws().

Status and timing methods
Note:
These methods are external rather than internal so the calling method can include its overheads etc


void addFailure ()
 Adds a pass for this test.

void addPass ()
 Adds a failure for this test.

void addIOTime (double ioTime)
 Adds some time spent doing I/O.

void addAnalysisTime (double time)
 Adds to the analysis time, and increments the number of analyses successfully done.

void addOverheadTime (double time)
 Adds to the overhead time.

string getStatus () const
 Returns a string giving the status of this algorithm including some info how long things are taking.


Protected Member Functions

 AnalysisAlgorithm (const TestData &testData, const string &moduleName, const AnalysisAlgorithm &prototype) throw ()
 Default constructor, to be used in creation of map.

virtual shared_ptr< SctData::TestResultcreateTestResult () const=0
 Called if the TestResult needs to be created.

void loadAllFits ()
 Loads all the fits it can.

void loadAllRaws ()
 Loads all the raws it can.

bool hasAllRaws () const
 Returns true if all the RawScanResult objects are available in IS.

bool hasAllFits () const
 Returns true if all the FitScanResult objects are available in IS.

shared_ptr< SctData::RawScanResultgetRaw (unsigned int index) const
 Returns a shared pointer to the RawScanResult at index.

shared_ptr< SctData::FitScanResultgetFit (unsigned int index) const
 Returns a shared pointer to the RawScanResult at index.

void mergeDefects ()
 Merges all the defects from the FitScanResults into the TestResult.


Private Member Functions

void initializeTestResult ()
 Useful function that initializes TestResult from Test and module name.


Private Attributes

const string m_modulename
 name of the module being worked on.

shared_ptr< SctData::TestResultm_result
 pointer to the result. it is up to the Concrete class to make one!

const TestDatam_test
 pointer to the testdata.

vector< ScanData > scanData
bool m_done
 true if finish() has been called.

boost::recursive_mutex m_access
 access to the algorithm can be locked for thread-safeness.

boost::recursive_mutex m_status_access
 access to the status information

const AnalysisAlgorithmprototype
 A reference to the prototype.

double ioTime
 The total time spent doing I/O.

double analysisTime
 The total time spent doing analysis.

double overheadTime
 The time spent just getting stuff, checking it etc.

unsigned int nCalls
 The number of times this alg has been accessed.

unsigned int nAnalyses
 The number of analyses performed.

unsigned int nPassed
 The number of tests which passed.

unsigned int nFailed
 The number of analyses which failed.


Detailed Description

An abstract base class for all the analysis algorithms.

Author:
Matthew Palmer
Date:
11 June 2003

Definition at line 33 of file AnalysisAlgorithm.h.


Constructor & Destructor Documentation

SctAnalysis::AnalysisAlgorithm::~AnalysisAlgorithm  )  throw () [virtual]
 

Destructor.

Definition at line 39 of file AnalysisAlgorithm.cpp.

SctAnalysis::AnalysisAlgorithm::AnalysisAlgorithm const TestData testData,
const string &  moduleName,
const AnalysisAlgorithm prototype
throw () [protected]
 

Default constructor, to be used in creation of map.

Definition at line 34 of file AnalysisAlgorithm.cpp.


Member Function Documentation

void SctAnalysis::AnalysisAlgorithm::addAnalysisTime double  time  )  [inline]
 

Adds to the analysis time, and increments the number of analyses successfully done.

Note:
Nothrow

Definition at line 259 of file AnalysisAlgorithm.h.

References analysisTime, m_status_access, nAnalyses, and prototype.

void SctAnalysis::AnalysisAlgorithm::addFailure  )  [inline]
 

Adds a pass for this test.

Definition at line 249 of file AnalysisAlgorithm.h.

References m_status_access, nFailed, and prototype.

Referenced by finish().

void SctAnalysis::AnalysisAlgorithm::addFitScanResult shared_ptr< Sct::IOName >  name  ) 
 

Add a named FitScanResult.

Parameters:
name the IS name of the FitScanResult.
Exceptions:
LogicError if name does not belong in this algorithm

Definition at line 67 of file AnalysisAlgorithm.cpp.

References SctData::UniqueID::getScanNumber(), getTestData(), and TestData::startScanNumber.

Here is the call graph for this function:

void SctAnalysis::AnalysisAlgorithm::addIOTime double  ioTime  )  [inline]
 

Adds some time spent doing I/O.

The number of IO operations is assumed to be the same as the number of analyses

Note:
Nothrow

Definition at line 254 of file AnalysisAlgorithm.h.

References ioTime, m_status_access, and prototype.

void SctAnalysis::AnalysisAlgorithm::addOverheadTime double  time  )  [inline]
 

Adds to the overhead time.

It is assumed there is 1 overhead time per Fit or Raw ScanResult

Note:
Nothrow

Definition at line 265 of file AnalysisAlgorithm.h.

References m_status_access, nCalls, overheadTime, and prototype.

void SctAnalysis::AnalysisAlgorithm::addPass  )  [inline]
 

Adds a failure for this test.

Definition at line 244 of file AnalysisAlgorithm.h.

References m_status_access, nPassed, and prototype.

Referenced by finish().

void SctAnalysis::AnalysisAlgorithm::addRawScanResult shared_ptr< Sct::IOName >  name  ) 
 

Add a named RawScanResult.

Parameters:
name the IS name of the RawScanResult.
Note:
nothrow

Definition at line 74 of file AnalysisAlgorithm.cpp.

References SctData::UniqueID::getScanNumber(), getTestData(), and TestData::startScanNumber.

Here is the call graph for this function:

virtual void SctAnalysis::AnalysisAlgorithm::analyze  )  [pure virtual]
 

Does the analysis.

Should only be called after canAnalyze() returns true. Should not be called is isDone() returns true. It should also do any final initialization of the TestResult which requires data to be present

Exceptions:
any Exception

Implemented in SctAnalysis::FullBypassAlgorithm, SctAnalysis::NMaskAlgorithm, SctAnalysis::NPtGainAlgorithm, SctAnalysis::PipelineAlgorithm, SctAnalysis::RxDelayAlgorithm, SctAnalysis::RxThresholdAlgorithm, SctAnalysis::StrobeDelayAlgorithm, SctAnalysis::TimeWalkAlgorithm, and SctAnalysis::TrimRangeAlgorithm.

virtual bool SctAnalysis::AnalysisAlgorithm::canAnalyze  )  const [pure virtual]
 

Should check to see if the analysis can be performed.

Probably wants to call hasAllRaws() or hasAllFits().

Exceptions:
no exceotions.

Implemented in SctAnalysis::FullBypassAlgorithm, SctAnalysis::NMaskAlgorithm, SctAnalysis::NPtGainAlgorithm, SctAnalysis::PipelineAlgorithm, SctAnalysis::RxDelayAlgorithm, SctAnalysis::RxThresholdAlgorithm, SctAnalysis::StrobeDelayAlgorithm, SctAnalysis::TimeWalkAlgorithm, and SctAnalysis::TrimRangeAlgorithm.

void SctAnalysis::AnalysisAlgorithm::checkTestResultExists  ) 
 

Used by other methods to ensure that a TestResult has been made.

Call createTestResult if it doesn't then initializes it.

Exceptions:
nothing 

Definition at line 45 of file AnalysisAlgorithm.cpp.

References createTestResult(), initializeTestResult(), and m_result.

Referenced by finish().

Here is the call graph for this function:

virtual boost::shared_ptr<AnalysisAlgorithm> SctAnalysis::AnalysisAlgorithm::clone const TestData testData,
const string &  moduleName
const throw () [pure virtual]
 

Must be overridden by sub-classes.

Returns a shared pointer to a concrete AnalysisAlgorithm of the correct type. Primarily used by the map to get an AnalysisAlgorithm of the correct type.

Implemented in SctAnalysis::FullBypassAlgorithm, SctAnalysis::NMaskAlgorithm, SctAnalysis::NPtGainAlgorithm, SctAnalysis::PipelineAlgorithm, SctAnalysis::RxDelayAlgorithm, SctAnalysis::RxThresholdAlgorithm, SctAnalysis::StrobeDelayAlgorithm, SctAnalysis::TimeWalkAlgorithm, and SctAnalysis::TrimRangeAlgorithm.

virtual shared_ptr<SctData::TestResult> SctAnalysis::AnalysisAlgorithm::createTestResult  )  const [protected, pure virtual]
 

Called if the TestResult needs to be created.

Exceptions:
nothing. 

Implemented in SctAnalysis::FullBypassAlgorithm, SctAnalysis::NMaskAlgorithm, SctAnalysis::NPtGainAlgorithm, SctAnalysis::PipelineAlgorithm, SctAnalysis::RxDelayAlgorithm, SctAnalysis::RxThresholdAlgorithm, SctAnalysis::StrobeDelayAlgorithm, SctAnalysis::TimeWalkAlgorithm, and SctAnalysis::TrimRangeAlgorithm.

Referenced by checkTestResultExists().

void SctAnalysis::AnalysisAlgorithm::finish  ) 
 

Publishes the TestResult, and sets `done'.

Exceptions:
IOException if there is some IO problem

Definition at line 130 of file AnalysisAlgorithm.cpp.

References addFailure(), addPass(), checkTestResultExists(), TestSummaryIS::dataString, SctData::TestSummary::SummaryManager::instance(), m_done, and m_result.

Here is the call graph for this function:

shared_ptr< FitScanResult > SctAnalysis::AnalysisAlgorithm::getFit unsigned int  index  )  const [protected]
 

Returns a shared pointer to the RawScanResult at index.

Guarenteed not to run a null pointer

Exceptions:
InvalidStateError if the raw is not available

Definition at line 115 of file AnalysisAlgorithm.cpp.

Referenced by SctAnalysis::TrimRangeAlgorithm::analyze(), SctAnalysis::TimeWalkAlgorithm::analyze(), SctAnalysis::StrobeDelayAlgorithm::analyze(), SctAnalysis::NPtGainAlgorithm::analyze(), and SctAnalysis::NPtGainAlgorithm::mergeDefects().

const std::string SctAnalysis::AnalysisAlgorithm::getModuleName  )  const throw () [inline]
 

Get the name of the module which this algorithm is working on.

Definition at line 47 of file AnalysisAlgorithm.h.

References m_modulename.

boost::recursive_mutex& SctAnalysis::AnalysisAlgorithm::getMutex  )  const [inline]
 

Access the mutex.

Definition at line 91 of file AnalysisAlgorithm.h.

References m_access.

shared_ptr< RawScanResult > SctAnalysis::AnalysisAlgorithm::getRaw unsigned int  index  )  const [protected]
 

Returns a shared pointer to the RawScanResult at index.

Guarenteed not to run a null pointer

Exceptions:
InvalidStateError if the raw is not available

Definition at line 110 of file AnalysisAlgorithm.cpp.

Referenced by SctAnalysis::RxThresholdAlgorithm::analyze(), SctAnalysis::RxDelayAlgorithm::analyze(), SctAnalysis::PipelineAlgorithm::analyze(), SctAnalysis::NMaskAlgorithm::analyze(), and SctAnalysis::FullBypassAlgorithm::analyze().

string SctAnalysis::AnalysisAlgorithm::getStatus  )  const
 

Returns a string giving the status of this algorithm including some info how long things are taking.

Definition at line 171 of file AnalysisAlgorithm.cpp.

References analysisTime, ioTime, m_status_access, nAnalyses, nCalls, nFailed, nPassed, overheadTime, and prototype.

const TestData& SctAnalysis::AnalysisAlgorithm::getTestData  )  const throw () [inline]
 

get a pointer to the cached TestData;

Definition at line 42 of file AnalysisAlgorithm.h.

References m_test.

Referenced by addFitScanResult(), and addRawScanResult().

boost::shared_ptr<SctData::TestResult> SctAnalysis::AnalysisAlgorithm::getTestResult  )  const [inline]
 

Access to the TestResult if required.

Definition at line 86 of file AnalysisAlgorithm.h.

References m_result.

Referenced by SctAnalysis::TrimRangeAlgorithm::analyze(), SctAnalysis::TimeWalkAlgorithm::analyze(), SctAnalysis::StrobeDelayAlgorithm::analyze(), SctAnalysis::RxThresholdAlgorithm::analyze(), SctAnalysis::RxDelayAlgorithm::analyze(), SctAnalysis::PipelineAlgorithm::analyze(), SctAnalysis::NPtGainAlgorithm::analyze(), SctAnalysis::NMaskAlgorithm::analyze(), and SctAnalysis::FullBypassAlgorithm::analyze().

bool SctAnalysis::AnalysisAlgorithm::hasAllFits  )  const [protected]
 

Returns true if all the FitScanResult objects are available in IS.

Exceptions:
nothing 

Definition at line 88 of file AnalysisAlgorithm.cpp.

Referenced by SctAnalysis::TrimRangeAlgorithm::canAnalyze(), SctAnalysis::TimeWalkAlgorithm::canAnalyze(), SctAnalysis::StrobeDelayAlgorithm::canAnalyze(), and SctAnalysis::NPtGainAlgorithm::canAnalyze().

bool SctAnalysis::AnalysisAlgorithm::hasAllRaws  )  const [protected]
 

Returns true if all the RawScanResult objects are available in IS.

Note:
nothrow

Definition at line 81 of file AnalysisAlgorithm.cpp.

Referenced by SctAnalysis::RxThresholdAlgorithm::canAnalyze(), SctAnalysis::RxDelayAlgorithm::canAnalyze(), SctAnalysis::NMaskAlgorithm::canAnalyze(), and SctAnalysis::FullBypassAlgorithm::canAnalyze().

void SctAnalysis::AnalysisAlgorithm::initializeTestResult  )  [private]
 

Useful function that initializes TestResult from Test and module name.

Sets up stuff that can be done here. Anything else must be done by the algorithm in analyze.

Note:
TestResult must have been created first!

Definition at line 54 of file AnalysisAlgorithm.cpp.

References m_modulename, m_result, m_test, TestData::runNumber, TestData::startScanNumber, TestData::startTime, TestData::testPoints, TestData::testPoints_size, and TestData::testVariable.

Referenced by checkTestResultExists().

bool SctAnalysis::AnalysisAlgorithm::isDone  )  const throw () [inline]
 

Method indicates when a particular analysis is finished.

Definition at line 75 of file AnalysisAlgorithm.h.

References m_done.

void SctAnalysis::AnalysisAlgorithm::loadAllFits  )  [protected]
 

Loads all the fits it can.

Exceptions:
Sct::IoException if there is an IO problem

Definition at line 103 of file AnalysisAlgorithm.cpp.

Referenced by SctAnalysis::TrimRangeAlgorithm::loadData(), SctAnalysis::TimeWalkAlgorithm::loadData(), SctAnalysis::StrobeDelayAlgorithm::loadData(), and SctAnalysis::NPtGainAlgorithm::loadData().

void SctAnalysis::AnalysisAlgorithm::loadAllRaws  )  [protected]
 

Loads all the raws it can.

Exceptions:
Sct::IoException if there is an IO problem

Definition at line 95 of file AnalysisAlgorithm.cpp.

Referenced by SctAnalysis::RxThresholdAlgorithm::loadData(), SctAnalysis::RxDelayAlgorithm::loadData(), SctAnalysis::PipelineAlgorithm::loadData(), SctAnalysis::NMaskAlgorithm::loadData(), and SctAnalysis::FullBypassAlgorithm::loadData().

virtual void SctAnalysis::AnalysisAlgorithm::loadData  )  [pure virtual]
 

Called to indicate the algorithm should try and load as much data as it can - perhaps by calling loadAllFits or loadAllRaws().

This is guarenteed to be called shortly before analyze().

Implemented in SctAnalysis::FullBypassAlgorithm, SctAnalysis::NMaskAlgorithm, SctAnalysis::NPtGainAlgorithm, SctAnalysis::PipelineAlgorithm, SctAnalysis::RxDelayAlgorithm, SctAnalysis::RxThresholdAlgorithm, SctAnalysis::StrobeDelayAlgorithm, SctAnalysis::TimeWalkAlgorithm, and SctAnalysis::TrimRangeAlgorithm.

void SctAnalysis::AnalysisAlgorithm::mergeDefects  )  [protected]
 

Merges all the defects from the FitScanResults into the TestResult.

Utility method for algorithms. Ignores FitScanResults that don't exist. Does nothing if the TestResult doesn't exist.

Definition at line 120 of file AnalysisAlgorithm.cpp.

References m_result.


Field Documentation

double SctAnalysis::AnalysisAlgorithm::analysisTime [mutable, private]
 

The total time spent doing analysis.

Definition at line 236 of file AnalysisAlgorithm.h.

Referenced by addAnalysisTime(), and getStatus().

double SctAnalysis::AnalysisAlgorithm::ioTime [mutable, private]
 

The total time spent doing I/O.

Definition at line 235 of file AnalysisAlgorithm.h.

Referenced by addIOTime(), and getStatus().

boost::recursive_mutex SctAnalysis::AnalysisAlgorithm::m_access [mutable, private]
 

access to the algorithm can be locked for thread-safeness.

Definition at line 230 of file AnalysisAlgorithm.h.

Referenced by getMutex().

bool SctAnalysis::AnalysisAlgorithm::m_done [private]
 

true if finish() has been called.

Definition at line 229 of file AnalysisAlgorithm.h.

Referenced by finish(), and isDone().

const string SctAnalysis::AnalysisAlgorithm::m_modulename [private]
 

name of the module being worked on.

Definition at line 225 of file AnalysisAlgorithm.h.

Referenced by getModuleName(), and initializeTestResult().

shared_ptr<SctData::TestResult> SctAnalysis::AnalysisAlgorithm::m_result [private]
 

pointer to the result. it is up to the Concrete class to make one!

Definition at line 226 of file AnalysisAlgorithm.h.

Referenced by checkTestResultExists(), finish(), getTestResult(), initializeTestResult(), and mergeDefects().

boost::recursive_mutex SctAnalysis::AnalysisAlgorithm::m_status_access [mutable, private]
 

access to the status information

Definition at line 233 of file AnalysisAlgorithm.h.

Referenced by addAnalysisTime(), addFailure(), addIOTime(), addOverheadTime(), addPass(), and getStatus().

const TestData& SctAnalysis::AnalysisAlgorithm::m_test [private]
 

pointer to the testdata.

Definition at line 227 of file AnalysisAlgorithm.h.

Referenced by getTestData(), and initializeTestResult().

unsigned int SctAnalysis::AnalysisAlgorithm::nAnalyses [mutable, private]
 

The number of analyses performed.

Definition at line 239 of file AnalysisAlgorithm.h.

Referenced by addAnalysisTime(), and getStatus().

unsigned int SctAnalysis::AnalysisAlgorithm::nCalls [mutable, private]
 

The number of times this alg has been accessed.

Definition at line 238 of file AnalysisAlgorithm.h.

Referenced by addOverheadTime(), and getStatus().

unsigned int SctAnalysis::AnalysisAlgorithm::nFailed [mutable, private]
 

The number of analyses which failed.

Definition at line 241 of file AnalysisAlgorithm.h.

Referenced by addFailure(), and getStatus().

unsigned int SctAnalysis::AnalysisAlgorithm::nPassed [mutable, private]
 

The number of tests which passed.

Definition at line 240 of file AnalysisAlgorithm.h.

Referenced by addPass(), and getStatus().

double SctAnalysis::AnalysisAlgorithm::overheadTime [mutable, private]
 

The time spent just getting stuff, checking it etc.

Definition at line 237 of file AnalysisAlgorithm.h.

Referenced by addOverheadTime(), and getStatus().

const AnalysisAlgorithm& SctAnalysis::AnalysisAlgorithm::prototype [private]
 

A reference to the prototype.

Definition at line 234 of file AnalysisAlgorithm.h.

Referenced by addAnalysisTime(), addFailure(), addIOTime(), addOverheadTime(), addPass(), and getStatus().


The documentation for this class was generated from the following files:
Generated on Thu Jul 15 09:51:43 2004 for SCT DAQ/DCS Software - C++ by doxygen 1.3.5