34 ClassImp(RooFunctorBinding);
35 ClassImp(RooFunctorPdfBinding);
38 RooFunctorBinding::RooFunctorBinding(
const char *name,
const char *title,
const ROOT::Math::IBaseFunctionMultiDim& ftor,
const RooArgList& v) :
39 RooAbsReal(name,title),
41 vars(
"vars",
"vars",this)
44 if (ftor.NDim()!=UInt_t(v.getSize())) {
45 coutE(InputArguments) <<
"RooFunctorBinding::ctor(" << GetName() <<
") ERROR number of provided variables (" << v.getSize()
46 <<
") does not match dimensionality of function (" << ftor.NDim() <<
")" << endl ;
47 throw string(
"RooFunctor::ctor ERROR") ;
49 x =
new Double_t[func->NDim()] ;
54 RooFunctorBinding::RooFunctorBinding(
const RooFunctorBinding& other,
const char* name) :
55 RooAbsReal(other,name),
57 vars(
"vars",this,other.vars)
60 x =
new Double_t[func->NDim()] ;
64 void RooFunctorBinding::printArgs(ostream& os)
const {
66 os <<
"[ function=" << func <<
" " ;
67 for (Int_t i=0 ; i<numProxies() ; i++) {
68 RooAbsProxy* p = getProxy(i) ;
69 if (!TString(p->name()).BeginsWith(
"!")) {
78 Double_t RooFunctorBinding::evaluate()
const {
80 for (
int i=0 ; i<vars.getSize() ; i++) {
81 x[i] = ((RooAbsReal*)vars.at(i))->getVal() ;
87 RooFunctorPdfBinding::RooFunctorPdfBinding(
const char *name,
const char *title,
const ROOT::Math::IBaseFunctionMultiDim& ftor,
const RooArgList& v) :
88 RooAbsPdf(name,title),
90 vars(
"vars",
"vars",this)
93 if (ftor.NDim()!=UInt_t(v.getSize())) {
94 coutE(InputArguments) <<
"RooFunctorPdfBinding::ctor(" << GetName() <<
") ERROR number of provided variables (" << v.getSize()
95 <<
") does not match dimensionality of function (" << ftor.NDim() <<
")" << endl ;
96 throw string(
"RooFunctor::ctor ERROR") ;
98 x =
new Double_t[func->NDim()] ;
103 RooFunctorPdfBinding::RooFunctorPdfBinding(
const RooFunctorPdfBinding& other,
const char* name) :
104 RooAbsPdf(other,name),
106 vars(
"vars",this,other.vars)
109 x =
new Double_t[func->NDim()] ;
113 void RooFunctorPdfBinding::printArgs(ostream& os)
const {
115 os <<
"[ function=" << func <<
" " ;
116 for (Int_t i=0 ; i<numProxies() ; i++) {
117 RooAbsProxy* p = getProxy(i) ;
118 if (!TString(p->name()).BeginsWith(
"!")) {
127 Double_t RooFunctorPdfBinding::evaluate()
const {
129 for (
int i=0 ; i<vars.getSize() ; i++) {
130 x[i] = ((RooAbsReal*)vars.at(i))->getVal() ;
137 RooAbsReal* bindFunction(
const char* name,
const ROOT::Math::IBaseFunctionMultiDim& ftor,
const RooArgList& vars) {
138 return new RooFunctorBinding(name,name,ftor,vars) ;
141 RooAbsPdf* bindPdf(
const char* name,
const ROOT::Math::IBaseFunctionMultiDim& ftor,
const RooArgList& vars) {
142 return new RooFunctorPdfBinding(name,name,ftor,vars) ;