00001 #include "GausFitObject.h" 00002 #include "Sct/LogicErrors.h" 00003 00004 #include <TF1.h> 00005 00006 // Over-ride function... 00007 // Calls base-class equality operator then renames the parameters 00008 00009 using namespace std; 00010 00011 namespace SctData { 00012 00016 vector<string> GausFitObject::createParNames() { 00017 vector<string> parNames(3); 00018 parNames[0] = "Prefact"; 00019 parNames[1] = "Mean"; 00020 parNames[2] = "Sigma"; 00021 return parNames; 00022 } 00023 00024 vector<string> GausFitObject::parNames = createParNames(); 00025 00026 GausFitObject::GausFitObject() : FitObject("gaus", 3, parNames) { 00027 } 00028 00029 GausFitObject::GausFitObject(const TF1& f) : FitObject("gaus", 3, parNames, f){ 00030 } 00031 00032 shared_ptr<FitObject> GausFitObject::clone() const throw() { 00033 return shared_ptr<FitObject> (new GausFitObject(*this)); 00034 } 00035 00036 GausFitObject& GausFitObject::operator= (const TF1& rootfunc) throw(LogicError) { 00037 // if (!strcmp(rootfunc.GetName(), "gaus")) { 00038 // ostringstream os; os <<"GausFitObject::operator=(TF1&) not a gaus TF1: " 00039 // <<rootfunc.GetName(); 00040 // throw InvalidArgument(os.str()); 00041 // } 00042 this->FitObject::operator=(rootfunc); 00043 return (*this); 00044 } 00045 00046 auto_ptr<TF1> GausFitObject::makeBasicRootTF1() const throw(LogicError) { 00047 auto_ptr<TF1> r ( new TF1("mygaus","gaus")); 00048 if (!r.get()) 00049 throw InvariantViolatedError("GausFitObject::makeBasicRootTF1()", __FILE__, __LINE__); 00050 return r; 00051 } 00052 00053 00054 } // end of namespace SctData