00001 #include "TopHatFitObject.h"
00002 #include "TF1.h"
00003 #include "Sct/LogicErrors.h"
00004
00005 using namespace Sct;
00006
00007 namespace SctData {
00008
00009 TopHatFitObject::TopHatFitObject() throw() {
00010 this->init();
00011 this->reset();
00012 }
00013
00014 TopHatFitObject::TopHatFitObject(const TF1& f) throw(LogicError) {
00015 this->init();
00016 this->reset();
00017 *this=f;
00018 }
00019
00020 auto_ptr<FitObject> TopHatFitObject::clone() const throw() {
00021 return auto_ptr<FitObject>(new TopHatFitObject(*this));
00022 }
00023
00024 TopHatFitObject& TopHatFitObject::operator=(const TF1& f) throw(LogicError) {
00025 this->FitObject::operator=(f);
00026 return *this;
00027 }
00028
00029 void TopHatFitObject::init() throw() {
00030 this->setFormula("tophat");
00031 this->setNDim(1);
00032 this->setNPar(5);
00033 try {
00034 this->setParName(0,"Prefact");
00035 this->setParName(1,"MidRise");
00036 this->setParName(2,"RiseTime");
00037 this->setParName(3,"MidFall");
00038 this->setParName(4,"FallTime");
00039 } catch (LogicError&) {}
00040 }
00041
00042
00043 auto_ptr<TF1> TopHatFitObject::makeBasicRootTF1() const throw(LogicError) {
00044 auto_ptr<TF1> r (new ::TF1("tophat", tophat, this->getVarMin(0), this->getVarMax(0), 5));
00045 if (!r.get())
00046 throw IllegalStateError("TopHatFitObject::makeBasicRootTF1()", __FILE__, __LINE__);
00047 return r;
00048 }
00049
00050 }