13 #ifndef ROOCFUNCTION1BINDING
14 #define ROOCFUNCTION1BINDING
42 template<
class VO,
class VI>
47 void add(
const char* name, VO (*ptr)(VI),
const char* arg1name=
"x") {
82 std::map<std::string,VO (*)(VI)>
_ptrmap ;
90 template<
class VO,
class VI>
108 if (result && strlen(result)) {
116 temp._funcptr =
_ptr;
117 return Form(
"(%p)",temp._ptr) ;
122 return fmap().lookupArgName(
_ptr,iarg) ;
145 template<
class VO,
class VI>
157 typedef ::RooCFunction1Ref<VO,VI> thisClass;
167 tmpName.Streamer(R__b) ;
169 if (tmpName==
"UNKNOWN" && R__v>0) {
171 coutW(
ObjectHandling) <<
"WARNING: Objected embeds function pointer to unknown function, object will not be functional" << std::endl ;
172 _ptr = dummyFunction ;
177 _ptr = fmap().lookupPtr(tmpName.
Data()) ;
181 <<
" but no such function is registered, object will not be functional" << std::endl ;
194 TString tmpName = fmap().lookupName(_ptr) ;
195 if (tmpName.
Length()==0) {
201 temp._funcptr = _ptr;
203 <<
" written object will not be functional when read back" << std::endl ;
208 tmpName.Streamer(R__b) ;
217 template<
class VO,
class VI>
230 os <<
"[ function=" <<
func.name() <<
" " ;
257 template<
class VO,
class VI>
261 x(
func.argName(0),
func.argName(0),this,_x)
270 template<
class VO,
class VI>
281 template<
class VO,
class VI>
294 os <<
"[ function=" <<
func.name() <<
" " ;
321 template<
class VO,
class VI>
325 x(
func.argName(0),
func.argName(0),this,_x)
334 template<
class VO,
class VI>
virtual TObject * clone(const char *newname) const
virtual void print(std::ostream &os, Bool_t addContents=kFALSE) const
Print proxy name.
RooCFunction1Ref< VO, VI > func
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
RooAbsProxy * getProxy(Int_t index) const
Return the nth proxy from the proxy list.
const char * name() const
virtual TObject * clone(const char *newname) const
static RooCFunction1Map< VO, VI > & fmap()
Double_t(* CFUNCD1D)(Double_t)
RooAbsReal * bindFunction(const char *name, CFUNCD1D func, RooAbsReal &x)
std::map< VO(*)(VI), std::string > _namemap
const char * Data() const
Double_t evaluate() const
#define ClassDef(name, id)
virtual ~RooCFunction1Binding()
VO operator()(VI x) const
Int_t numProxies() const
Return the number of registered proxies.
RooCFunction1Ref< VO, VI > func
RooAbsProxy is the abstact interface for proxy classes.
void printArgs(std::ostream &os) const
Print object arguments, ie its proxies.
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
virtual const char * name() const
std::map< std::string, VO(*)(VI)> _ptrmap
Double_t evaluate() const
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
RooCFunction1Binding is a templated implementation of class RooAbsReal that binds generic C(++) funct...
double func(double *x, double *p)
static RooCFunction1Map< VO, VI > * _fmap
Pointer to embedded function.
virtual ~RooCFunction1PdfBinding()
VO(*)(VI) lookupPtr(const char *name)
Mother of all ROOT objects.
void printArgs(std::ostream &os) const
Print object arguments, ie its proxies.
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
RooRealProxy is the concrete proxy for RooAbsReal objects A RooRealProxy is the general mechanism to ...
static VO dummyFunction(VI)
Double_t(* CFUNCD1I)(Int_t)
RooCFunction1Ref(VO(*ptr)(VI)=0)
const char * lookupName(VO(*ptr)(VI))
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
RooCFunction1PdfBinding()