13#ifndef ROOCFUNCTION2BINDING
14#define ROOCFUNCTION2BINDING
50template<
class VO,
class VI1,
class VI2>
55 void add(
const char*
name, VO (*ptr)(VI1,VI2),
const char* arg1name=
"x",
const char* arg2name=
"y") {
91 std::map<std::string,VO (*)(VI1,VI2)>
_ptrmap ;
92 std::map<VO (*)(VI1,VI2),std::string>
_namemap ;
93 std::map<VO (*)(VI1,VI2),std::vector<std::string> >
_argnamemap ;
99template<
class VO,
class VI1,
class VI2>
116 const char* result =
fmap().lookupName(
_ptr) ;
117 if (result && strlen(result)) {
125 temp._funcptr =
_ptr;
126 return Form(
"(%p)",temp._ptr) ;
131 return fmap().lookupArgName(
_ptr,iarg) ;
159template<
class VO,
class VI1,
class VI2>
163template<
class VO,
class VI1,
class VI2>
175 typedef ::RooCFunction2Ref<VO,VI1,VI2> thisClass;
185 tmpName.Streamer(R__b) ;
187 if (tmpName==
"UNKNOWN" && R__v>0) {
189 coutW(ObjectHandling) <<
"WARNING: Objected embeds function pointer to unknown function, object will not be functional" << std::endl ;
190 _ptr = dummyFunction ;
195 _ptr = fmap().lookupPtr(tmpName.
Data()) ;
198 coutW(ObjectHandling) <<
"ERROR: Objected embeds pointer to function named " << tmpName
199 <<
" but no such function is registered, object will not be functional" << std::endl ;
212 TString tmpName = fmap().lookupName(_ptr) ;
213 if (tmpName.
Length()==0) {
214 coutW(ObjectHandling) <<
"WARNING: Cannot persist unknown function pointer " <<
Form(
"0x%lx", (
ULong_t)_ptr)
215 <<
" written object will not be functional when read back" << std::endl ;
220 tmpName.Streamer(R__b) ;
229template<
class VO,
class VI1,
class VI2>
242 os <<
"[ function=" <<
func.name() <<
" " ;
269template<
class VO,
class VI1,
class VI2>
274 x(func.argName(0),func.argName(0),this,_x),
275 y(func.argName(1),func.argName(1),this,_y)
284template<
class VO,
class VI1,
class VI2>
297template<
class VO,
class VI1,
class VI2>
310 os <<
"[ function=" <<
func.name() <<
" " ;
337template<
class VO,
class VI1,
class VI2>
342 x(func.argName(0),func.argName(0),this,_x),
343 y(func.argName(1),func.argName(1),this,_y)
352template<
class VO,
class VI1,
class VI2>
#define ClassDef(name, id)
char * Form(const char *fmt,...)
Int_t numProxies() const
Return the number of registered proxies.
RooAbsProxy * getProxy(Int_t index) const
Return the nth proxy from the proxy list.
RooAbsProxy is the abstact interface for proxy classes.
virtual void print(std::ostream &os, Bool_t addContents=kFALSE) const
Print proxy name.
virtual const char * name() const
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
RooCFunction2Binding is a templated implementation of class RooAbsReal that binds generic C(++) funct...
void printArgs(std::ostream &os) const
Print object arguments, ie its proxies.
RooCFunction2Ref< VO, VI1, VI2 > func
Double_t evaluate() const
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
virtual ~RooCFunction2Binding()
virtual TObject * clone(const char *newname) const
std::map< VO(*)(VI1, VI2), std::vector< std::string > > _argnamemap
std::map< std::string, VO(*)(VI1, VI2)> _ptrmap
std::map< VO(*)(VI1, VI2), std::string > _namemap
void add(const char *name, VO(*ptr)(VI1, VI2), const char *arg1name="x", const char *arg2name="y")
VO(*)(VI1, VI2) lookupPtr(const char *name)
const char * lookupArgName(VO(*ptr)(VI1, VI2), UInt_t iarg)
const char * lookupName(VO(*ptr)(VI1, VI2))
virtual TObject * clone(const char *newname) const
void printArgs(std::ostream &os) const
Print object arguments, ie its proxies.
virtual ~RooCFunction2PdfBinding()
RooCFunction2PdfBinding()
RooCFunction2Ref< VO, VI1, VI2 > func
Double_t evaluate() const
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
const char * argName(Int_t iarg)
VO operator()(VI1 x, VI2 y) const
static RooCFunction2Map< VO, VI1, VI2 > & fmap()
static VO dummyFunction(VI1, VI2)
RooCFunction2Ref(VO(*ptr)(VI1, VI2)=0)
const char * name() const
static RooCFunction2Map< VO, VI1, VI2 > * _fmap
Pointer to embedded function.
Buffer base class used for serializing objects.
virtual void SetByteCount(UInt_t cntpos, Bool_t packInVersion=kFALSE)=0
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt=kFALSE)=0
Mother of all ROOT objects.
const char * Data() const
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Double_t(* CFUNCD2UD)(UInt_t, Double_t)
Double_t(* CFUNCD2DI)(Double_t, Int_t)
RooAbsPdf * bindPdf(const char *name, CFUNCD1D func, RooAbsReal &x)
Double_t(* CFUNCD2II)(Int_t, Int_t)
Double_t(* CFUNCD2DD)(Double_t, Double_t)
RooAbsReal * bindFunction(const char *name, CFUNCD1D func, RooAbsReal &x)
Double_t(* CFUNCD2ID)(Int_t, Double_t)