#include "Riostream.h"
#include "RooTFnPdfBinding.h"
#include "RooAbsReal.h"
#include "RooAbsCategory.h"
#include "TF3.h"
ClassImp(RooTFnPdfBinding)
RooTFnPdfBinding::RooTFnPdfBinding(const char *name, const char *title, TF1* _func, const RooArgList& _list) :
RooAbsPdf(name,title),
list("params","params",this),
func(_func)
{
list.add(_list) ;
}
RooTFnPdfBinding::RooTFnPdfBinding(const RooTFnPdfBinding& other, const char* name) :
RooAbsPdf(other,name),
list("params",this,other.list),
func(other.func)
{
}
Double_t RooTFnPdfBinding::evaluate() const
{
Double_t x = list.at(0) ? ((RooAbsReal*)list.at(0))->getVal() : 0 ;
Double_t y = list.at(1) ? ((RooAbsReal*)list.at(1))->getVal() : 0 ;
Double_t z = list.at(2) ? ((RooAbsReal*)list.at(2))->getVal() : 0 ;
return func->Eval(x,y,z) ;
}
void RooTFnPdfBinding::printArgs(ostream& os) const
{
os << "[ TFn={" << func->GetName() << "=" << func->GetTitle() << "} " ;
for (Int_t i=0 ; i<numProxies() ; i++) {
RooAbsProxy* p = getProxy(i) ;
if (!TString(p->name()).BeginsWith("!")) {
p->print(os) ;
os << " " ;
}
}
os << "]" ;
}
namespace RooFit {
RooAbsPdf* bindPdf(TF1* func,RooAbsReal& x) {
return new RooTFnPdfBinding(func->GetName(),func->GetName(),func,x) ;
}
RooAbsPdf* bindPdf(TF2* func,RooAbsReal& x, RooAbsReal& y) {
return new RooTFnPdfBinding(func->GetName(),func->GetName(),func,RooArgList(x,y)) ;
}
RooAbsPdf* bindPdf(TF3* func,RooAbsReal& x, RooAbsReal& y, RooAbsReal& z) {
return new RooTFnPdfBinding(func->GetName(),func->GetName(),func,RooArgList(x,y,z)) ;
}
}
Last change: Mon Aug 25 11:37:01 2008
Last generated: 2008-08-25 11:37
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.