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

FitStrategy.cpp

Go to the documentation of this file.
00001 #include "FitStrategy.h"
00002 #include <TH1.h>
00003 #include <TF1.h>
00004 #include <sstream>
00005 
00006 using std::ostringstream;
00007 using namespace Sct;
00008 
00009 namespace SctFitter{
00010     void FitStrategy::setOptions(string opt=string("")) throw() {
00011     options=opt;
00012     } 
00013     
00014     FitStrategy::~FitStrategy(){}
00015 
00016     const string& FitStrategy::getOptions() const throw() {
00017     return options;
00018     }
00019     
00020     FitStrategy::FitStrategy(string opt) throw() {
00021     setOptions(opt);
00022     }
00023 
00024 
00025     FitStrategyFactory& FitStrategyFactory::instance() throw() {
00026     if (!bertha) bertha = new FitStrategyFactory();
00027     return *bertha;
00028     }
00029 
00030     FitStrategy* FitStrategyFactory::getStrategy(string name) throw(LogicError) {
00031     if (strategyMap.find(name) == strategyMap.end()) {
00032         ostringstream s; s<<"Couldn't find FitStrategy `"<<name<<"'";
00033         throw InvalidArgumentError(s.str(), __FILE__, __LINE__);
00034     }
00035     return strategyMap[name];
00036     }
00037 
00038 
00039     bool FitStrategyFactory::addToMap(const string& name, FitStrategy& s) throw(){
00040     if (strategyMap.find(name) != strategyMap.end())
00041         return false;
00042     //cout <<"FitStrategyFactory added "<<name<<endl;
00043     strategyMap[name] = &s;
00044     return true;
00045     }
00046     
00047     FitStrategyFactory* FitStrategyFactory::bertha;
00048 }

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