RootFitStrategy.cpp

00001 #include "RootFitStrategy.h"
00002 #include <TH1.h>
00003 #include <TF1.h>
00004 #include <TGraphErrors.h>
00005 #include <TGraphAsymmErrors.h>
00006 
00007 using namespace Sct;
00008 namespace SctFitter{
00009     RootFitStrategy::RootFitStrategy(string opt) throw()
00010     : FitStrategy(opt), name("RootFitStrategy") {}
00011     
00012     RootFitStrategy::~RootFitStrategy() throw() {}
00013 
00014     void RootFitStrategy::fitTH1(const TH1& hist, TF1& fit) const throw(LogicError, MathsError) {
00016     TH1& theHist = const_cast<TH1&> (hist);
00017     theHist.Fit(&fit, getOptions().c_str());
00018     }
00019 
00020     void RootFitStrategy::fitTGraph(const TGraph& graph, TF1& fit) const throw(LogicError, MathsError) {
00022     TGraph& theGraph = const_cast<TGraph&> (graph);
00023     theGraph.Fit(&fit, getOptions().c_str());
00024     }
00025 
00026      void RootFitStrategy::fitTGraphErrors(const TGraphErrors& graph, TF1& fit) const throw(LogicError, MathsError) {
00028     TGraphErrors& theGraph = const_cast<TGraphErrors&> (graph);
00029     theGraph.Fit(&fit, getOptions().c_str());
00030     }
00031 
00032      void RootFitStrategy::fitTGraphAsymmErrors(const TGraphAsymmErrors& graph, TF1& fit) const throw(LogicError, MathsError) {
00034     TGraphAsymmErrors& theGraph = const_cast<TGraphAsymmErrors&> (graph);
00035     theGraph.Fit(&fit, getOptions().c_str());
00036     }
00037 
00038     const string& RootFitStrategy::getName() const throw() {
00039     return name;
00040     }
00041     
00042     bool RootFitStrategy::inMap=FitStrategyFactory::instance().addToMap("RootFitStrategy", *new RootFitStrategy("") );
00043     
00044 } // end of namespace SctFitter;

Generated on Mon Feb 6 14:01:26 2006 for SCT DAQ/DCS Software - C++ by  doxygen 1.4.6