21 ClassImp(RooTFnBinding);
25 RooTFnBinding::RooTFnBinding(
const char *name,
const char *title, TF1* func,
const RooArgList& list) :
26 RooAbsReal(name,title),
27 _olist(
"obs",
"obs",this),
35 RooTFnBinding::RooTFnBinding(
const char *name,
const char *title, TF1* func,
const RooArgList& obsList,
const RooArgList& paramList) :
36 RooAbsReal(name,title),
37 _olist(
"obs",
"obs",this),
38 _plist(
"params",
"params",this),
42 _plist.add(paramList) ;
47 RooTFnBinding::RooTFnBinding(
const RooTFnBinding& other,
const char* name) :
48 RooAbsReal(other,name),
49 _olist(
"obs",this,other._olist),
50 _plist(
"params",this,other._plist),
57 Double_t RooTFnBinding::evaluate()
const
59 Double_t x = _olist.at(0) ? ((RooAbsReal*)_olist.at(0))->getVal() : 0 ;
60 Double_t y = _olist.at(1) ? ((RooAbsReal*)_olist.at(1))->getVal() : 0 ;
61 Double_t z = _olist.at(2) ? ((RooAbsReal*)_olist.at(2))->getVal() : 0 ;
62 for (Int_t i=0 ; i<_func->GetNpar() ; i++) {
63 _func->SetParameter(i,_plist.at(i)?((RooAbsReal*)_plist.at(i))->getVal() : 0) ;
65 return _func->Eval(x,y,z) ;
70 void RooTFnBinding::printArgs(ostream& os)
const
73 os <<
"[ TFn={" << _func->GetName() <<
"=" << _func->GetTitle() <<
"} " ;
74 for (Int_t i=0 ; i<numProxies() ; i++) {
75 RooAbsProxy* p = getProxy(i) ;
76 if (!TString(p->name()).BeginsWith(
"!")) {
88 RooAbsReal* bindFunction(TF1* func,RooAbsReal& x) {
89 return new RooTFnBinding(func->GetName(),func->GetTitle(),func,x) ;
92 RooAbsReal* bindFunction(TF2* func,RooAbsReal& x, RooAbsReal& y) {
93 return new RooTFnBinding(func->GetName(),func->GetTitle(),func,RooArgList(x,y)) ;
96 RooAbsReal* bindFunction(TF3* func,RooAbsReal& x, RooAbsReal& y, RooAbsReal& z) {
97 return new RooTFnBinding(func->GetName(),func->GetTitle(),func,RooArgList(x,y,z)) ;
100 RooAbsReal* bindFunction(TF1* func,RooAbsReal& x,
const RooArgList& params) {
101 return new RooTFnBinding(func->GetName(),func->GetTitle(),func,x,params) ;
104 RooAbsReal* bindFunction(TF2* func,RooAbsReal& x, RooAbsReal& y,
const RooArgList& params) {
105 return new RooTFnBinding(func->GetName(),func->GetTitle(),func,RooArgList(x,y),params) ;
108 RooAbsReal* bindFunction(TF3* func,RooAbsReal& x, RooAbsReal& y, RooAbsReal& z,
const RooArgList& params) {
109 return new RooTFnBinding(func->GetName(),func->GetTitle(),func,RooArgList(x,y,z),params) ;