13 #ifndef ROOCFUNCTION1BINDING 14 #define ROOCFUNCTION1BINDING 39 template<
class VO,
class VI>
44 void add(
const char* name, VO (*ptr)(VI),
const char* arg1name=
"x") {
47 _namemap[ptr] =
name ;
48 _argnamemap[ptr].push_back(arg1name) ;
54 return _namemap[ptr].c_str() ;
59 return _ptrmap[
name] ;
65 if (iarg<_argnamemap[ptr].size()) {
66 return (_argnamemap[ptr])[iarg].c_str() ;
79 std::map<std::string,VO (*)(VI)>
_ptrmap ;
87 template<
class VO,
class VI>
104 const char*
result = fmap().lookupName(_ptr) ;
105 if (result && strlen(result)) {
113 temp._funcptr = _ptr;
114 return Form(
"(%p)",temp._ptr) ;
119 return fmap().lookupArgName(_ptr,iarg) ;
132 typedef VO (*func_t)(VI);
142 template<
class VO,
class VI>
154 typedef ::RooCFunction1Ref<VO,VI> thisClass;
164 tmpName.Streamer(R__b) ;
166 if (tmpName==
"UNKNOWN" && R__v>0) {
168 coutW(
ObjectHandling) <<
"WARNING: Objected embeds function pointer to unknown function, object will not be functional" << std::endl ;
169 _ptr = dummyFunction ;
174 _ptr = fmap().lookupPtr(tmpName.
Data()) ;
178 <<
" but no such function is registered, object will not be functional" << std::endl ;
191 TString tmpName = fmap().lookupName(_ptr) ;
192 if (tmpName.
Length()==0) {
198 temp._funcptr = _ptr;
200 <<
" written object will not be functional when read back" << std::endl ;
205 tmpName.Streamer(R__b) ;
214 template<
class VO,
class VI>
227 os <<
"[ function=" <<
func.name() <<
" " ;
228 for (
Int_t i=0 ; i<numProxies() ; i++) {
254 template<
class VO,
class VI>
258 x(
func.argName(0),
func.argName(0),this,_x)
267 template<
class VO,
class VI>
278 template<
class VO,
class VI>
291 os <<
"[ function=" <<
func.name() <<
" " ;
318 template<
class VO,
class VI>
322 x(
func.argName(0),
func.argName(0),this,_x)
331 template<
class VO,
class VI>
const char * name() const
RooCFunction1Ref< VO, VI > func
virtual TObject * clone(const char *newname) const
virtual const char * name() const
const char * argName(Int_t iarg)
RooAbsPdf * bindPdf(const char *name, CFUNCD1D func, RooAbsReal &x)
const char * lookupArgName(VO(*ptr)(VI), UInt_t iarg)
Buffer base class used for serializing objects.
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
void add(const char *name, VO(*ptr)(VI), const char *arg1name="x")
virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt=kFALSE)=0
RooAbsReal * bindFunction(const char *name, CFUNCD1D func, RooAbsReal &x)
Double_t(* CFUNCD1I)(Int_t)
std::map< VO(*)(VI), std::string > _namemap
virtual TObject * clone(const char *newname) const
#define ClassDef(name, id)
virtual ~RooCFunction1Binding()
void printArgs(std::ostream &os) const
Print object arguments, ie its proxies.
void printArgs(std::ostream &os) const
Print object arguments, ie its proxies.
Double_t evaluate() const
Double_t(* CFUNCD1D)(Double_t)
RooCFunction1Ref< VO, VI > func
char * Form(const char *fmt,...)
std::map< VO(*)(VI), std::vector< std::string > > _argnamemap
virtual void SetByteCount(UInt_t cntpos, Bool_t packInVersion=kFALSE)=0
std::map< std::string, VO(*)(VI)> _ptrmap
VO operator()(VI x) const
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
double func(double *x, double *p)
static RooCFunction1Map< VO, VI > * _fmap
Pointer to embedded function.
virtual ~RooCFunction1PdfBinding()
Double_t evaluate() const
VO(*)(VI) lookupPtr(const char *name)
RooAbsProxy * getProxy(Int_t index) const
Return the nth proxy from the proxy list.
Mother of all ROOT objects.
Int_t numProxies() const
Return the number of registered proxies.
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
static VO dummyFunction(VI)
RooCFunction1Ref(VO(*ptr)(VI)=0)
const char * lookupName(VO(*ptr)(VI))
virtual void print(std::ostream &os, Bool_t addContents=kFALSE) const
Print proxy name.
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
RooCFunction1PdfBinding()
const char * Data() const