#include "Riostream.h"
#include "RooTFnBinding.h"
#include "RooAbsReal.h"
#include "RooAbsCategory.h"
#include "TF3.h"
ClassImp(RooTFnBinding)
RooTFnBinding::RooTFnBinding(const char *name, const char *title, TF1* _func, const RooArgList& _list) :
RooAbsReal(name,title),
list("params","params",this),
func(_func)
{
list.add(_list) ;
}
RooTFnBinding::RooTFnBinding(const RooTFnBinding& other, const char* name) :
RooAbsReal(other,name),
list("params",this,other.list),
func(other.func)
{
}
Double_t RooTFnBinding::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 RooTFnBinding::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 {
RooAbsReal* bindFunction(TF1* func,RooAbsReal& x) {
return new RooTFnBinding(func->GetName(),func->GetTitle(),func,x) ;
}
RooAbsReal* bindFunction(TF2* func,RooAbsReal& x, RooAbsReal& y) {
return new RooTFnBinding(func->GetName(),func->GetTitle(),func,RooArgList(x,y)) ;
}
RooAbsReal* bindFunction(TF3* func,RooAbsReal& x, RooAbsReal& y, RooAbsReal& z) {
return new RooTFnBinding(func->GetName(),func->GetTitle(),func,RooArgList(x,y,z)) ;
}
}
Last change: Mon Aug 25 11:36:59 2008
Last generated: 2008-08-25 11:36
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.