12 #ifndef ROOCFUNCTION3BINDING 13 #define ROOCFUNCTION3BINDING 52 template<
class VO,
class VI1,
class VI2,
class VI3>
57 void add(
const char*
name, VO (*ptr)(VI1,VI2,VI3),
const char* arg1name=
"x",
const char* arg2name=
"y",
const char* arg3name=
"z") {
60 _namemap[ptr] =
name ;
61 _argnamemap[ptr].push_back(arg1name) ;
62 _argnamemap[ptr].push_back(arg2name) ;
63 _argnamemap[ptr].push_back(arg3name) ;
69 return _namemap[ptr].c_str() ;
74 return _ptrmap[
name] ;
80 if (iarg<_argnamemap[ptr].size()) {
81 return (_argnamemap[ptr])[iarg].c_str() ;
94 std::map<std::string,VO (*)(VI1,VI2,VI3)>
_ptrmap ;
95 std::map<VO (*)(VI1,VI2,VI3),std::string>
_namemap ;
96 std::map<VO (*)(VI1,VI2,VI3),std::vector<std::string> >
_argnamemap ;
101 template<
class VO,
class VI1,
class VI2,
class VI3>
111 return (*_ptr)(
x,
y,
z) ;
118 const char* result = fmap().lookupName(_ptr) ;
119 if (result && strlen(result)) {
127 temp._funcptr = _ptr;
128 return Form(
"(%p)",temp._ptr) ;
133 return fmap().lookupArgName(_ptr,iarg) ;
153 typedef VO (*func_t)(VI1,VI2,VI3) ;
162 template<
class VO,
class VI1,
class VI2,
class VI3>
167 template<
class VO,
class VI1,
class VI2,
class VI3>
179 typedef ::RooCFunction3Ref<VO,VI1,VI2,VI3> thisClass;
189 tmpName.Streamer(R__b) ;
191 if (tmpName==
"UNKNOWN" && R__v>0) {
193 coutW(
ObjectHandling) <<
"WARNING: Objected embeds function pointer to unknown function, object will not be functional" << std::endl ;
194 _ptr = dummyFunction ;
199 _ptr = fmap().lookupPtr(tmpName.
Data()) ;
203 <<
" but no such function is registered, object will not be functional" << std::endl ;
216 TString tmpName = fmap().lookupName(_ptr) ;
217 if (tmpName.
Length()==0) {
223 temp._funcptr = _ptr;
225 <<
" written object will not be functional when read back" << std::endl ;
230 tmpName.Streamer(R__b) ;
239 template<
class VO,
class VI1,
class VI2,
class VI3>
252 os <<
"[ function=" << func.name() <<
" " ;
253 for (
Int_t i=0 ; i<numProxies() ; i++) {
282 template<
class VO,
class VI1,
class VI2,
class VI3>
287 x(func.argName(0),func.argName(0),this,_x),
288 y(func.argName(1),func.argName(1),this,_y),
289 z(func.argName(2),func.argName(2),this,_z)
298 template<
class VO,
class VI1,
class VI2,
class VI3>
310 template<
class VO,
class VI1,
class VI2,
class VI3>
323 os <<
"[ function=" <<
func.name() <<
" " ;
353 template<
class VO,
class VI1,
class VI2,
class VI3>
358 x(
func.argName(0),
func.argName(0),this,_x),
359 y(
func.argName(1),
func.argName(1),this,_y),
360 z(
func.argName(2),
func.argName(2),this,_z)
369 template<
class VO,
class VI1,
class VI2,
class VI3>
VO(*)(VI1, VI2, VI3) lookupPtr(const char *name)
virtual ~RooCFunction3PdfBinding()
static VO dummyFunction(VI1, VI2, VI3)
RooCFunction3Ref(VO(*ptr)(VI1, VI2, VI3)=0)
const char * argName(Int_t iarg)
virtual const char * name() const
Double_t(* CFUNCD3UDU)(UInt_t, Double_t, UInt_t)
RooCFunction3Ref< VO, VI1, VI2, VI3 > func
RooAbsPdf * bindPdf(const char *name, CFUNCD1D func, RooAbsReal &x)
std::map< VO(*)(VI1, VI2, VI3), std::string > _namemap
Double_t(* CFUNCD3DII)(Double_t, Int_t, Int_t)
Buffer base class used for serializing objects.
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
RooCFunction3Ref< VO, VI1, VI2, VI3 > func
void printArgs(std::ostream &os) const
Print object arguments, ie its proxies.
const char * lookupName(VO(*ptr)(VI1, VI2, VI3))
const char * name() const
virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt=kFALSE)=0
virtual TObject * clone(const char *newname) const
std::map< std::string, VO(*)(VI1, VI2, VI3)> _ptrmap
RooAbsReal * bindFunction(const char *name, CFUNCD1D func, RooAbsReal &x)
const char * lookupArgName(VO(*ptr)(VI1, VI2, VI3), UInt_t iarg)
#define ClassDef(name, id)
static RooCFunction3Map< VO, VI1, VI2, VI3 > * _fmap
Pointer to embedded function.
std::map< VO(*)(VI1, VI2, VI3), std::vector< std::string > > _argnamemap
func_t _ptr
Pointer to embedded function.
RooCFunction3PdfBinding()
void printArgs(std::ostream &os) const
Print object arguments, ie its proxies.
Double_t(* CFUNCD3UDD)(UInt_t, Double_t, Double_t)
virtual ~RooCFunction3Binding()
RooAbsProxy is the abstact interface for proxy classes.
Double_t evaluate() const
void add(const char *name, VO(*ptr)(VI1, VI2, VI3), const char *arg1name="x", const char *arg2name="y", const char *arg3name="z")
char * Form(const char *fmt,...)
virtual void SetByteCount(UInt_t cntpos, Bool_t packInVersion=kFALSE)=0
virtual TObject * clone(const char *newname) const
Double_t evaluate() const
VO operator()(VI1 x, VI2 y, VI3 z) const
static RooCFunction3Map< VO, VI1, VI2, VI3 > & fmap()
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
RooAbsProxy * getProxy(Int_t index) const
Return the nth proxy from the proxy list.
Mother of all ROOT objects.
you should not use this method at all Int_t Int_t z
Int_t numProxies() const
Return the number of registered proxies.
Double_t(* CFUNCD3UUD)(UInt_t, UInt_t, Double_t)
RooCFunction3Binding is a templated implementation of class RooAbsReal that binds generic C(++) funct...
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
Double_t(* CFUNCD3DDD)(Double_t, Double_t, Double_t)
RooRealProxy is the concrete proxy for RooAbsReal objects A RooRealProxy is the general mechanism to ...
virtual void print(std::ostream &os, Bool_t addContents=kFALSE) const
Print proxy name.
Double_t(* CFUNCD3DDB)(Double_t, Double_t, Bool_t)
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
const char * Data() const