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

Fitter.h

00001 #ifndef FITTER_H
00002 #define FITTER_H
00003 
00004 #include <is/isinfo.h>
00005 #include <ipc/object.h>
00006 #include <ipc/server.h>
00007 
00008 #include <string>
00009 #include <memory>
00010 
00011 #include <boost/thread.hpp>
00012 
00013 #include "FitterI.hh"
00014 #include "Sct/Exception.h"
00015 #include "Sct/ConfigurationException.h"
00016 #include "Sct/LogicErrors.h"
00017 #include "Sct/IoExceptions.h"
00018 
00019 class TH1;
00020 class TF1;
00021 
00022 using namespace Sct;
00023 
00027 namespace SctFitter {
00028     class FitStrategy;
00029     class FitterWorkerGroup;
00030 
00040 class Fitter: public IPCObject, public virtual FitterI_T_FitterInterface, private boost::noncopyable{
00041 private:
00043     Fitter(const string& fitStrategyName) throw(ConfigurationException);
00045     ~Fitter() throw();
00046     static Fitter* fitter;
00047     
00048 public:
00053     static Fitter& instance();
00054     
00060     static Fitter& initialize(const string& fitStrategyName = "RootFitStrategy") throw(ConfigurationException);
00061     
00065     void go(unsigned nWorker) throw(IsException);
00069     const char* status() const throw();
00074     virtual char* status(FitterIStatus* status) throw();
00082     void setFitOptions(const string opt) throw(LogicError) ;
00084     virtual void setFitOptions(FitterIStatus* status, char* opt) throw() ;
00091     virtual void setFitStrategy(FitterIStatus* status, char* strategy) throw() ;
00095     virtual char* getFitStrategy(FitterIStatus* status) throw() ;
00096     // Fit all RawScanResults currently in IS.
00097     void fitAll(FitterIStatus* status) throw();
00099     void fit(FitterIStatus* status, char* name) throw();
00103     virtual char* getFitOptions(FitterIStatus* status) throw() ;
00111     static void doFits(ISCallbackInfo * isc) throw(IsException, LogicError);
00112     
00114     long busy(FitterIStatus* status);
00115 
00117     long queueLength(FitterIStatus* status);
00118 
00122     long nFitsDone() const throw();
00126     long nFitsDone(FitterIStatus* status) throw();
00130     long nFitErrors() const throw();
00131 
00135     long nFitErrors(FitterIStatus* status) throw();
00139     const char* lastScan() const throw();
00143     char* lastScan(FitterIStatus* status) throw();
00144     
00148     void useAnalyticAlgorithm (FitterIStatus *_status, ilu_Boolean use);
00149         
00153     bool isUsingAnalyticAlgorithm() const;
00154     
00158     ilu_Boolean isUsingAnalyticAlgorithm(FitterIStatus *_status);
00159 
00160     
00165     void setFitStrategy(string name) throw(LogicError) ;
00166 
00168     FitStrategy& getFitStrategy() const throw(LogicError) ;
00169 
00171     FitterWorkerGroup* workergroup;
00172     
00176     void incrementFitErrors() throw();
00177     
00181     void incrementFitsDone() throw();
00182     
00186     void scanDone(double time) throw();
00187     
00192     void addIOTime(double time) throw();
00193     
00197     double getAverageTimePerScan() const throw();
00198     
00202     static IPCServer& getFitterServer() throw();
00203     
00204 private:      
00205 
00206     /*
00207      * counters:      
00208      */
00209     long m_nFitsDone;
00210     long m_nFitErrors;
00211     long m_nScans;
00212     double m_scanTimeTaken;
00213     double m_ioTimeTaken;
00215     mutable boost::recursive_mutex counterMutex;
00216     
00217     /*
00218      * name of the last scan attempted.
00219      */
00220     string m_scan;
00224     mutable string m_status;
00228     FitStrategy* m_fitStrategy;
00232     std::auto_ptr<ISInfoReceiver> m_infoReceiver;
00233 
00235     void setLastScanName(const char* name){
00236     m_scan = name;
00237     }
00238     
00240     friend class FitterWorkerGroup;
00241 
00242 }
00243 ; // end of definition of class Fitter;
00244 }// end of namespace SctFitter
00245 #endif // #ifndef FITTER_H

Generated on Thu Jul 15 09:50:46 2004 for SCT DAQ/DCS Software - C++ by doxygen 1.3.5