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

SctFitter::Fitter Class Reference

Class definition of the SCT fitting service. More...

#include <Fitter.h>

Inheritance diagram for SctFitter::Fitter:

IPCObject FitterI_T_FitterInterface noncopyable

Public Member Functions

void go (unsigned nWorker) throw (IsException)
 The command to start the workers.

const char * getStatus () const throw ()
 Get the status information.

virtual char * ipcFitterStatus (FitterIStatus *status) throw ()
 As for getStatus, but available over IPC.

void setFitOptions (const string opt) throw (LogicError)
 set the fit option over IPC.

virtual void ipcSetFitOptions (FitterIStatus *status, char *opt) throw ()
 as for setFitOptions, but over IPC.

virtual void ipcSetFitStrategy (FitterIStatus *status, char *strategy) throw ()
 set the fit option over IPC.

virtual char * ipcGetFitStrategy (FitterIStatus *status) throw ()
 Finds the FitStrategy name.

void ipcFitAll (FitterIStatus *status) throw ()
void ipcFit (FitterIStatus *status, char *name) throw ()
 Fit a named RawScanResult from IS.

virtual char * ipcGetFitOptions (FitterIStatus *status) throw ()
 Finds the FitStrategy options.

long getNFitsDone () const throw ()
 returns the number of fits done so far;

long ipcNFitsDone (FitterIStatus *status) throw ()
 returns the number of fits done so far over ipc;

long getNFitErrors () const throw ()
 returns the number of fit errors so far;

long ipcNFitErrors (FitterIStatus *status) throw ()
 returns the number of fit errors so far over ipc;

const char * lastScan () const throw ()
 Get the name of the last scan which was fitted;.

char * ipcLastScan (FitterIStatus *status) throw ()
 Get the name of the last scan which was fitted over ipc;.

void ipcUseAnalyticAlgorithm (FitterIStatus *_status, ilu_Boolean use)
 Determine whether to use the analytic fit algorithm.

bool isUsingAnalyticAlgorithm () const
 Return true if we're using analytic fit algorithms.

ilu_Boolean ipcIsUsingAnalyticAlgorithm (FitterIStatus *_status)
 Return true if we're using analytic fit algorithms.

void setFitStrategy (string name) throw (LogicError)
 Set the stragegy from a name the the FitStrategy map.

FitStrategygetFitStrategy () const throw (LogicError)
 get the strategy. Throws an error if none is defined.

void incrementFitErrors () throw ()
 Increments the number of fit errors by 1.

void incrementFitsDone () throw ()
 Increments the number of fits done by 1.

void scanDone (double time) throw ()
 Called by the workers to add to the total amount of scan time.

void addIOTime (double time) throw ()
 Called to add to IO time.

double getAverageTimePerScan () const throw ()
 Algorithm may be complex! Check actual code.


Static Public Member Functions

Fitter & instance ()
 Gets a reference to the instance of the Fitter.

Fitter & initialize (const string &fitStrategyName="RootFitStrategy") throw (ConfigurationException)
 Initialize the Fitter instance.

void doFits (ISCallbackInfo *isc) throw (IsException, LogicError)
 The infoReceiver callback function must take a static function as an argument.

IPCServer & getFitterServer () throw ()
 Get the Fitter IPC server.


Data Fields

FitterWorkerGroupworkergroup
 Group of workers which do the actual fitting.


Private Member Functions

 Fitter (const string &fitStrategyName) throw (ConfigurationException)
 singleton

 ~Fitter () throw ()
 private destructor

void setLastScanName (const char *name)
 update record of last scan attempted.


Private Attributes

long nFitsDone
long nFitErrors
long nScans
double scanTimeTaken
double ioTimeTaken
boost::mutex counterMutex
 Used to lock access to all the counters.

string m_scan
string status
 pointer to char containing the status: cached so that we don't have to make lots of char*'s.

FitStrategyfitStrategy
 Pointer to the fit strategy.

std::auto_ptr< ISInfoReceiver > infoReceiver
 An InfoReveiver for RawRODData objects.


Static Private Attributes

Fitter * fitter

Friends

class FitterWorkerGroup
 FitterWorker is allowed to update stuff.


Detailed Description

Class definition of the SCT fitting service.

This service subscribes to an input IS server, receiving new RawScanResult objects. It then fits a function (dependant on the ScanType) to chips, strips, etc. and outputs a FitScanResult object to the output IS server.
Some status information about the Fitter is available via IPC request.

Author:
Alan Barr
Date:
16 December 2002

Definition at line 40 of file Fitter.h.


Constructor & Destructor Documentation

SctFitter::Fitter::Fitter const string &    fitStrategyName throw (ConfigurationException) [private]
 

singleton

Definition at line 45 of file Fitter.cpp.

SctFitter::Fitter::~Fitter   throw () [private]
 

private destructor

Definition at line 57 of file Fitter.cpp.


Member Function Documentation

void SctFitter::Fitter::addIOTime double    time throw ()
 

Called to add to IO time.

Assumes that main thread does IO and is running concurrently with workers.

Definition at line 252 of file Fitter.cpp.

Referenced by doFits().

void SctFitter::Fitter::doFits ISCallbackInfo *    isc throw (IsException, LogicError) [static]
 

The infoReceiver callback function must take a static function as an argument.

This function simply calls doFits on the parameter or `rock', which is set to be `this' (Fitter).
At the moment it catches all errors since I think it should still be in a stable state after most logic errors I can think of. AJB

Definition at line 81 of file Fitter.cpp.

References addIOTime(), SctService::WorkerGroup< T >::push(), Sct::File::read(), Sct::timer(), and workergroup.

double SctFitter::Fitter::getAverageTimePerScan   const throw ()
 

Algorithm may be complex! Check actual code.

Definition at line 258 of file Fitter.cpp.

FitStrategy & SctFitter::Fitter::getFitStrategy   const throw (LogicError)
 

get the strategy. Throws an error if none is defined.

Definition at line 292 of file Fitter.cpp.

Referenced by SctFitter::FitAlgorithm::doFit().

IPCServer & SctFitter::Fitter::getFitterServer   throw () [static]
 

Get the Fitter IPC server.

Definition at line 59 of file Fitter.cpp.

long SctFitter::Fitter::getNFitErrors   const throw ()
 

returns the number of fit errors so far;

Definition at line 268 of file Fitter.cpp.

long SctFitter::Fitter::getNFitsDone   const throw ()
 

returns the number of fits done so far;

Definition at line 264 of file Fitter.cpp.

const char * SctFitter::Fitter::getStatus   const throw ()
 

Get the status information.

Definition at line 217 of file Fitter.cpp.

void SctFitter::Fitter::go unsigned    nWorker throw (IsException)
 

The command to start the workers.

Parameters:
nWorker the number of worker threads.

Definition at line 66 of file Fitter.cpp.

void SctFitter::Fitter::incrementFitErrors   throw ()
 

Increments the number of fit errors by 1.

Definition at line 236 of file Fitter.cpp.

Referenced by SctFitter::FitAlgorithm::doFit().

void SctFitter::Fitter::incrementFitsDone   throw ()
 

Increments the number of fits done by 1.

Definition at line 241 of file Fitter.cpp.

Referenced by SctFitter::FitAlgorithm::doFit().

Fitter & SctFitter::Fitter::initialize const string &    fitStrategyName = "RootFitStrategy" throw (ConfigurationException) [static]
 

Initialize the Fitter instance.

Parameters:
fitStrategyName the name of the FitStrategy to use. Default is RootFitStrategy
Exceptions:
ConfigurationException if the fitStrategyName is not a recognized FitStrategy

Definition at line 36 of file Fitter.cpp.

References setFitStrategy().

Referenced by instance().

Fitter & SctFitter::Fitter::instance   [static]
 

Gets a reference to the instance of the Fitter.

If it hasn't been initialized, it calls initialize() first

Definition at line 30 of file Fitter.cpp.

References fitter, and initialize().

void SctFitter::Fitter::ipcFit FitterIStatus *    status,
char *    name
throw ()
 

Fit a named RawScanResult from IS.

Definition at line 101 of file Fitter.cpp.

References Sct::timer().

void SctFitter::Fitter::ipcFitAll FitterIStatus *    status throw ()
 

Definition at line 117 of file Fitter.cpp.

References Sct::timer().

char * SctFitter::Fitter::ipcFitterStatus FitterIStatus *    status throw () [virtual]
 

As for getStatus, but available over IPC.

Makes a new char[] which ipc then deletes.

Parameters:
the status of the IPC request.

Definition at line 151 of file Fitter.cpp.

char * SctFitter::Fitter::ipcGetFitOptions FitterIStatus *    status throw () [virtual]
 

Finds the FitStrategy options.

Makes a new char[] which ipc then deletes.

Definition at line 138 of file Fitter.cpp.

char * SctFitter::Fitter::ipcGetFitStrategy FitterIStatus *    status throw () [virtual]
 

Finds the FitStrategy name.

Makes a new char[] which ipc then deletes.

Definition at line 191 of file Fitter.cpp.

ilu_Boolean SctFitter::Fitter::ipcIsUsingAnalyticAlgorithm FitterIStatus *    _status
 

Return true if we're using analytic fit algorithms.

Definition at line 186 of file Fitter.cpp.

References isUsingAnalyticAlgorithm().

char * SctFitter::Fitter::ipcLastScan FitterIStatus *    status throw ()
 

Get the name of the last scan which was fitted over ipc;.

Definition at line 285 of file Fitter.cpp.

long SctFitter::Fitter::ipcNFitErrors FitterIStatus *    status throw ()
 

returns the number of fit errors so far over ipc;

Definition at line 277 of file Fitter.cpp.

long SctFitter::Fitter::ipcNFitsDone FitterIStatus *    status throw ()
 

returns the number of fits done so far over ipc;

Definition at line 272 of file Fitter.cpp.

void SctFitter::Fitter::ipcSetFitOptions FitterIStatus *    status,
char *    opt
throw () [virtual]
 

as for setFitOptions, but over IPC.

Definition at line 164 of file Fitter.cpp.

void SctFitter::Fitter::ipcSetFitStrategy FitterIStatus *    status,
char *    strategy
throw () [virtual]
 

set the fit option over IPC.

(asynchronous).

Parameters:
the status of the IPC request : failure if name not found in map.
tries to find the stragegy with this name

Definition at line 204 of file Fitter.cpp.

void SctFitter::Fitter::ipcUseAnalyticAlgorithm FitterIStatus *    _status,
ilu_Boolean    use
 

Determine whether to use the analytic fit algorithm.

Default is false

Definition at line 174 of file Fitter.cpp.

bool SctFitter::Fitter::isUsingAnalyticAlgorithm   const
 

Return true if we're using analytic fit algorithms.

Definition at line 182 of file Fitter.cpp.

Referenced by ipcIsUsingAnalyticAlgorithm().

const char * SctFitter::Fitter::lastScan   const throw ()
 

Get the name of the last scan which was fitted;.

Definition at line 282 of file Fitter.cpp.

void SctFitter::Fitter::scanDone double    time throw ()
 

Called by the workers to add to the total amount of scan time.

Definition at line 246 of file Fitter.cpp.

void SctFitter::Fitter::setFitOptions const string    opt throw (LogicError)
 

set the fit option over IPC.

(asynchronous). Passes string on to FitStrategy;

Parameters:
the status of the IPC request.
the string to set as the options e.g. "NQR" for ROOT.

Definition at line 160 of file Fitter.cpp.

void SctFitter::Fitter::setFitStrategy string    name throw (LogicError)
 

Set the stragegy from a name the the FitStrategy map.

Exceptions:
LogicError if that name is not in the map.

Definition at line 298 of file Fitter.cpp.

Referenced by initialize().

void SctFitter::Fitter::setLastScanName const char *    name [inline, private]
 

update record of last scan attempted.

Definition at line 229 of file Fitter.h.


Friends And Related Function Documentation

friend class FitterWorkerGroup [friend]
 

FitterWorker is allowed to update stuff.

Definition at line 234 of file Fitter.h.


Field Documentation

boost::mutex SctFitter::Fitter::counterMutex [private]
 

Used to lock access to all the counters.

Definition at line 209 of file Fitter.h.

FitStrategy* SctFitter::Fitter::fitStrategy [private]
 

Pointer to the fit strategy.

Definition at line 222 of file Fitter.h.

Fitter * SctFitter::Fitter::fitter [static, private]
 

Definition at line 28 of file Fitter.cpp.

Referenced by instance().

std::auto_ptr<ISInfoReceiver> SctFitter::Fitter::infoReceiver [private]
 

An InfoReveiver for RawRODData objects.

Definition at line 226 of file Fitter.h.

double SctFitter::Fitter::ioTimeTaken [private]
 

Definition at line 207 of file Fitter.h.

string SctFitter::Fitter::m_scan [private]
 

Definition at line 214 of file Fitter.h.

long SctFitter::Fitter::nFitErrors [private]
 

Definition at line 204 of file Fitter.h.

long SctFitter::Fitter::nFitsDone [private]
 

Definition at line 203 of file Fitter.h.

long SctFitter::Fitter::nScans [private]
 

Definition at line 205 of file Fitter.h.

double SctFitter::Fitter::scanTimeTaken [private]
 

Definition at line 206 of file Fitter.h.

string SctFitter::Fitter::status [mutable, private]
 

pointer to char containing the status: cached so that we don't have to make lots of char*'s.

Definition at line 218 of file Fitter.h.

FitterWorkerGroup* SctFitter::Fitter::workergroup
 

Group of workers which do the actual fitting.

Definition at line 165 of file Fitter.h.

Referenced by doFits().


The documentation for this class was generated from the following files:
Generated on Mon Dec 15 19:38:03 2003 for SCT DAQ/DCS Software by doxygen1.3-rc3