13 #ifndef ROOCFUNCTION2BINDING
14 #define ROOCFUNCTION2BINDING
47 template<
class VO,
class VI1,
class VI2>
52 void add(
const char* name, VO (*ptr)(VI1,VI2),
const char* arg1name=
"x",
const char* arg2name=
"y") {
88 std::map<std::string,VO (*)(VI1,VI2)>
_ptrmap ;
89 std::map<VO (*)(VI1,VI2),std::string>
_namemap ;
90 std::map<VO (*)(VI1,VI2),std::vector<std::string> >
_argnamemap ;
96 template<
class VO,
class VI1,
class VI2>
114 if (result && strlen(result)) {
122 temp._funcptr =
_ptr;
123 return Form(
"(%p)",temp._ptr) ;
128 return fmap().lookupArgName(
_ptr,iarg) ;
157 template<
class VO,
class VI1,
class VI2>
169 typedef ::RooCFunction2Ref<VO,VI1,VI2> thisClass;
179 tmpName.Streamer(R__b) ;
181 if (tmpName==
"UNKNOWN" && R__v>0) {
183 coutW(
ObjectHandling) <<
"WARNING: Objected embeds function pointer to unknown function, object will not be functional" << std::endl ;
184 _ptr = dummyFunction ;
189 _ptr = fmap().lookupPtr(tmpName.
Data()) ;
193 <<
" but no such function is registered, object will not be functional" << std::endl ;
206 TString tmpName = fmap().lookupName(_ptr) ;
207 if (tmpName.
Length()==0) {
209 <<
" written object will not be functional when read back" << std::endl ;
214 tmpName.Streamer(R__b) ;
223 template<
class VO,
class VI1,
class VI2>
236 os <<
"[ function=" <<
func.name() <<
" " ;
263 template<
class VO,
class VI1,
class VI2>
268 x(
func.argName(0),
func.argName(0),this,_x),
269 y(
func.argName(1),
func.argName(1),this,_y)
278 template<
class VO,
class VI1,
class VI2>
291 template<
class VO,
class VI1,
class VI2>
304 os <<
"[ function=" <<
func.name() <<
" " ;
331 template<
class VO,
class VI1,
class VI2>
336 x(
func.argName(0),
func.argName(0),this,_x),
337 y(
func.argName(1),
func.argName(1),this,_y)
346 template<
class VO,
class VI1,
class VI2>
Double_t evaluate() const
virtual void print(std::ostream &os, Bool_t addContents=kFALSE) const
Print proxy name.
RooCFunction2Ref< VO, VI1, VI2 > func
RooAbsPdf * bindPdf(const char *name, CFUNCD1D func, RooAbsReal &x)
virtual ~RooCFunction2PdfBinding()
RooCFunction2Map< double, int, double > * _fmap
const char * lookupArgName(VO(*ptr)(VI1, VI2), UInt_t iarg)
Buffer base class used for serializing objects.
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
RooCFunction2Ref(VO(*ptr)(VI1, VI2)=0)
RooCFunction2Ref< VO, VI1, VI2 > func
virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt=kFALSE)=0
RooAbsProxy * getProxy(Int_t index) const
Return the nth proxy from the proxy list.
RooAbsReal * bindFunction(const char *name, CFUNCD1D func, RooAbsReal &x)
const char * Data() const
void printArgs(std::ostream &os) const
Print object arguments, ie its proxies.
#define ClassDef(name, id)
virtual TObject * clone(const char *newname) const
static RooCFunction2Map< VO, VI1, VI2 > * _fmap
Pointer to embedded function.
const char * argName(Int_t iarg)
Double_t(* CFUNCD2II)(Int_t, Int_t)
void add(const char *name, VO(*ptr)(VI1, VI2), const char *arg1name="x", const char *arg2name="y")
static RooCFunction2Map< VO, VI1, VI2 > & fmap()
Double_t evaluate() const
Double_t(* CFUNCD2UD)(UInt_t, Double_t)
Int_t numProxies() const
Return the number of registered proxies.
virtual ~RooCFunction2Binding()
char * Form(const char *fmt,...)
std::map< VO(*)(VI1, VI2), std::string > _namemap
virtual void SetByteCount(UInt_t cntpos, Bool_t packInVersion=kFALSE)=0
std::map< VO(*)(VI1, VI2), std::vector< std::string > > _argnamemap
const char * name() const
Double_t(* CFUNCD2DD)(Double_t, Double_t)
virtual const char * name() const
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Double_t(* CFUNCD2DI)(Double_t, Int_t)
Double_t(* CFUNCD2ID)(Int_t, Double_t)
double func(double *x, double *p)
RooCFunction2PdfBinding()
Mother of all ROOT objects.
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
void printArgs(std::ostream &os) const
Print object arguments, ie its proxies.
std::map< std::string, VO(*)(VI1, VI2)> _ptrmap
virtual TObject * clone(const char *newname) const
static VO dummyFunction(VI1, VI2)
VO operator()(VI1 x, VI2 y) const
VO(*)(VI1, VI2) lookupPtr(const char *name)
const char * lookupName(VO(*ptr)(VI1, VI2))
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0